From 272092f877ade0ada63fc1b7b43f7837e73adede Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Sun, 22 Jun 2014 00:54:44 -0400 Subject: [PATCH] can now run onionshare_gui.py without building (fixes #51) --- onionshare_gui/onionshare_gui.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/onionshare_gui/onionshare_gui.py b/onionshare_gui/onionshare_gui.py index 2369d0dc..81ffdbd9 100644 --- a/onionshare_gui/onionshare_gui.py +++ b/onionshare_gui/onionshare_gui.py @@ -1,10 +1,18 @@ -import onionshare, webapp import os, sys, subprocess, inspect - from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4.QtWebKit import * +onionshare_gui_dir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) + +try: + import onionshare +except ImportError: + sys.path.append(os.path.abspath(onionshare_gui_dir+"/..")) + import onionshare + +import webapp + window_icon = None class Application(QApplication): @@ -79,8 +87,7 @@ def main(): return # create the onionshare icon - global window_icon - onionshare_gui_dir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) + global window_icon, onionshare_gui_dir window_icon = QIcon("{0}/onionshare-icon.png".format(onionshare_gui_dir)) # try starting hidden service