diff --git a/MANIFEST.in b/MANIFEST.in index ea6193a5..682f4d03 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -5,10 +5,5 @@ include version include onionshare/index.html include onionshare/404.html include onionshare/strings.json -include onionshare_gui/images/logo.png -include onionshare_gui/images/drop_files.png -include onionshare_gui/images/server_stopped.png -include onionshare_gui/images/server_started.png -include onionshare_gui/images/server_working.png include setup/onionshare.desktop include setup/onionshare80.xpm diff --git a/onionshare_gui/images/drop_files.png b/images/drop_files.png similarity index 100% rename from onionshare_gui/images/drop_files.png rename to images/drop_files.png diff --git a/onionshare_gui/images/logo.png b/images/logo.png similarity index 100% rename from onionshare_gui/images/logo.png rename to images/logo.png diff --git a/onionshare_gui/images/server_started.png b/images/server_started.png similarity index 100% rename from onionshare_gui/images/server_started.png rename to images/server_started.png diff --git a/onionshare_gui/images/server_stopped.png b/images/server_stopped.png similarity index 100% rename from onionshare_gui/images/server_stopped.png rename to images/server_stopped.png diff --git a/onionshare_gui/images/server_working.png b/images/server_working.png similarity index 100% rename from onionshare_gui/images/server_working.png rename to images/server_working.png diff --git a/onionshare_gui/common.py b/onionshare_gui/common.py index 2fd9d17b..ef690a7d 100644 --- a/onionshare_gui/common.py +++ b/onionshare_gui/common.py @@ -17,7 +17,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . """ -import os, inspect, platform +import os, sys, inspect, platform def get_onionshare_gui_dir(): if platform.system() == 'Darwin': @@ -27,3 +27,10 @@ def get_onionshare_gui_dir(): return onionshare_gui_dir onionshare_gui_dir = get_onionshare_gui_dir() + +def get_image_path(filename): + if platform.system() == 'Linux': + prefix = os.path.join(sys.prefix, 'share/onionshare/images') + else: + prefix = os.path.join(get_onionshare_gui_dir(), 'images') + return os.path.join(prefix, filename) diff --git a/onionshare_gui/file_selection.py b/onionshare_gui/file_selection.py index 0b839dfc..c18c1960 100644 --- a/onionshare_gui/file_selection.py +++ b/onionshare_gui/file_selection.py @@ -36,7 +36,7 @@ class FileList(QtGui.QListWidget): # drag and drop label self.drop_label = QtGui.QLabel(QtCore.QString(strings._('gui_drag_and_drop')), parent=self) self.drop_label.setAlignment(QtCore.Qt.AlignCenter) - self.drop_label.setStyleSheet('background: url({0}/images/drop_files.png) no-repeat center center; color: #999999;'.format(common.onionshare_gui_dir)) + self.drop_label.setStyleSheet('background: url({0}) no-repeat center center; color: #999999;'.format(common.get_image_path('drop_files.png'))) self.drop_label.hide() self.filenames = [] diff --git a/onionshare_gui/onionshare_gui.py b/onionshare_gui/onionshare_gui.py index 50dae52d..395c4421 100644 --- a/onionshare_gui/onionshare_gui.py +++ b/onionshare_gui/onionshare_gui.py @@ -227,7 +227,7 @@ def main(): # create the onionshare icon global window_icon - window_icon = QtGui.QIcon("{0}/images/logo.png".format(common.onionshare_gui_dir)) + window_icon = QtGui.QIcon(common.get_image_path('logo.png')) # start the onionshare app web.set_stay_open(stay_open) diff --git a/onionshare_gui/server_status.py b/onionshare_gui/server_status.py index e868da30..d82fce0e 100644 --- a/onionshare_gui/server_status.py +++ b/onionshare_gui/server_status.py @@ -43,9 +43,9 @@ class ServerStatus(QtGui.QVBoxLayout): self.file_selection = file_selection # server layout - self.status_image_stopped = QtGui.QImage('{0}/images/server_stopped.png'.format(common.onionshare_gui_dir)) - self.status_image_working = QtGui.QImage('{0}/images/server_working.png'.format(common.onionshare_gui_dir)) - self.status_image_started = QtGui.QImage('{0}/images/server_started.png'.format(common.onionshare_gui_dir)) + self.status_image_stopped = QtGui.QImage(common.get_image_path('server_stopped.png')) + self.status_image_working = QtGui.QImage(common.get_image_path('server_working.png')) + self.status_image_started = QtGui.QImage(common.get_image_path('server_started.png')) self.status_image_label = QtGui.QLabel() self.status_image_label.setFixedWidth(30) self.start_server_button = QtGui.QPushButton(strings._('gui_start_server')) diff --git a/setup.py b/setup.py index 0f612693..2929ead7 100644 --- a/setup.py +++ b/setup.py @@ -34,7 +34,6 @@ def file_list(path): files.append(path+'/'+filename) return files -packages = ['onionshare', 'onionshare_gui'] version = open('version').read().strip() @@ -48,12 +47,19 @@ setup( url='https://github.com/micahflee/onionshare', license="GPL v3", keywords='onion, share, onionshare, tor, anonymous, web server', - packages=packages, + packages=['onionshare', 'onionshare_gui'], include_package_data=True, scripts=['bin/onionshare', 'bin/onionshare-gui'], data_files=[ - ('/usr/share/applications', ['setup/onionshare.desktop']), - ('/usr/share/pixmaps', ['setup/onionshare80.xpm']) + (os.path.join(sys.prefix, 'share/applications'), ['setup/onionshare.desktop']), + (os.path.join(sys.prefix, 'share/pixmaps'), ['setup/onionshare80.xpm']), + (os.path.join(sys.prefix, 'share/onionshare/images'), [ + 'images/logo.png', + 'images/drop_files.png', + 'images/server_stopped.png', + 'images/server_started.png', + 'images/server_working.png' + ]) ] ) diff --git a/setup/onionshare-osx.spec b/setup/onionshare-osx.spec index 00d4eb46..878415ac 100644 --- a/setup/onionshare-osx.spec +++ b/setup/onionshare-osx.spec @@ -8,11 +8,11 @@ a.datas += [ ('onionshare/strings.json', 'onionshare/strings.json', 'DATA'), ('onionshare/index.html', 'onionshare/index.html', 'DATA'), ('onionshare/404.html', 'onionshare/404.html', 'DATA'), - ('onionshare_gui/images/logo.png', 'onionshare_gui/images/logo.png', 'DATA'), - ('onionshare_gui/images/drop_files.png', 'onionshare_gui/images/drop_files.png', 'DATA'), - ('onionshare_gui/images/server_stopped.png', 'onionshare_gui/images/server_stopped.png', 'DATA'), - ('onionshare_gui/images/server_started.png', 'onionshare_gui/images/server_started.png', 'DATA'), - ('onionshare_gui/images/server_working.png', 'onionshare_gui/images/server_working.png', 'DATA'), + ('images/logo.png', 'onionshare_gui/images/logo.png', 'DATA'), + ('images/drop_files.png', 'onionshare_gui/images/drop_files.png', 'DATA'), + ('images/server_stopped.png', 'onionshare_gui/images/server_stopped.png', 'DATA'), + ('images/server_started.png', 'onionshare_gui/images/server_started.png', 'DATA'), + ('images/server_working.png', 'onionshare_gui/images/server_working.png', 'DATA'), ] pyz = PYZ(a.pure) exe = EXE(pyz, diff --git a/setup/onionshare.nsi b/setup/onionshare.nsi index 6ea76344..2c66c20f 100644 --- a/setup/onionshare.nsi +++ b/setup/onionshare.nsi @@ -59,11 +59,11 @@ Section "install" File "${BINPATH}\onionshare_gui\__init__.py" File "${BINPATH}\onionshare_gui\__init__.pyc" SetOutPath "$INSTDIR\onionshare_gui\images" - File "${BINPATH}\onionshare_gui\images\logo.png" - File "${BINPATH}\onionshare_gui\images\drop_files.png" - File "${BINPATH}\onionshare_gui\images\server_stopped.png" - File "${BINPATH}\onionshare_gui\images\server_started.png" - File "${BINPATH}\onionshare_gui\images\server_working.png" + File "${BINPATH}\images\logo.png" + File "${BINPATH}\images\drop_files.png" + File "${BINPATH}\images\server_stopped.png" + File "${BINPATH}\images\server_started.png" + File "${BINPATH}\images\server_working.png" # dependencies SetOutPath $INSTDIR