This commit is contained in:
ingvar1995 2016-06-06 13:29:17 +03:00
parent 17a8d81486
commit 6a244b30c1
2 changed files with 15 additions and 6 deletions

View File

@ -20,10 +20,17 @@ from plugin_support import PluginLoader
class Toxygen(object): class Toxygen(object):
def __init__(self, path=None): def __init__(self, path_or_uri=None):
super(Toxygen, self).__init__() super(Toxygen, self).__init__()
self.tox = self.ms = self.init = self.mainloop = self.avloop = None self.tox = self.ms = self.init = self.mainloop = self.avloop = None
self.path = path if path_or_uri is None:
self.uri = self.path = None
elif path_or_uri.startswith('tox:'):
self.path = None
self.uri = path_or_uri[4:]
else:
self.path = path_or_uri
self.uri = None
def enter_pass(self, data): def enter_pass(self, data):
""" """
@ -206,6 +213,9 @@ class Toxygen(object):
self.avloop = self.ToxAVIterateThread(self.tox.AV) self.avloop = self.ToxAVIterateThread(self.tox.AV)
self.avloop.start() self.avloop.start()
if self.uri is not None:
self.ms.add_contact(self.uri)
app.connect(app, QtCore.SIGNAL("lastWindowClosed()"), app, QtCore.SLOT("quit()")) app.connect(app, QtCore.SIGNAL("lastWindowClosed()"), app, QtCore.SLOT("quit()"))
app.exec_() app.exec_()
self.init.stop = True self.init.stop = True
@ -335,9 +345,8 @@ class Toxygen(object):
if __name__ == '__main__': if __name__ == '__main__':
# TODO: add tox: URI support
if len(sys.argv) == 1: if len(sys.argv) == 1:
toxygen = Toxygen() toxygen = Toxygen()
else: # path to profile else: # path to profile or tox: uri
toxygen = Toxygen(sys.argv[1]) toxygen = Toxygen(sys.argv[1])
toxygen.main() toxygen.main()

View File

@ -386,8 +386,8 @@ class MainWindow(QtGui.QMainWindow):
self.p_s = PluginsSettings() self.p_s = PluginsSettings()
self.p_s.show() self.p_s.show()
def add_contact(self): def add_contact(self, link=''):
self.a_c = AddContact() self.a_c = AddContact(link)
self.a_c.show() self.a_c.show()
def profile_settings(self, *args): def profile_settings(self, *args):