From 6a244b30c1c0df3d7d99680638eef9ab4ee21900 Mon Sep 17 00:00:00 2001 From: ingvar1995 Date: Mon, 6 Jun 2016 13:29:17 +0300 Subject: [PATCH] tox: URI --- src/main.py | 17 +++++++++++++---- src/mainscreen.py | 4 ++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/main.py b/src/main.py index 4e78235..81341bf 100644 --- a/src/main.py +++ b/src/main.py @@ -20,10 +20,17 @@ from plugin_support import PluginLoader class Toxygen(object): - def __init__(self, path=None): + def __init__(self, path_or_uri=None): super(Toxygen, self).__init__() 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): """ @@ -206,6 +213,9 @@ class Toxygen(object): self.avloop = self.ToxAVIterateThread(self.tox.AV) 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.exec_() self.init.stop = True @@ -335,9 +345,8 @@ class Toxygen(object): if __name__ == '__main__': - # TODO: add tox: URI support if len(sys.argv) == 1: toxygen = Toxygen() - else: # path to profile + else: # path to profile or tox: uri toxygen = Toxygen(sys.argv[1]) toxygen.main() diff --git a/src/mainscreen.py b/src/mainscreen.py index 4608e71..8d652fb 100644 --- a/src/mainscreen.py +++ b/src/mainscreen.py @@ -386,8 +386,8 @@ class MainWindow(QtGui.QMainWindow): self.p_s = PluginsSettings() self.p_s.show() - def add_contact(self): - self.a_c = AddContact() + def add_contact(self, link=''): + self.a_c = AddContact(link) self.a_c.show() def profile_settings(self, *args):