moving image files into /usr/share instead of /usr/lib (fixes #126)

This commit is contained in:
Micah Lee 2014-09-03 17:50:06 -07:00
parent 8d01ad7ec6
commit d00b296c47
13 changed files with 33 additions and 25 deletions

View File

@ -5,10 +5,5 @@ include version
include onionshare/index.html include onionshare/index.html
include onionshare/404.html include onionshare/404.html
include onionshare/strings.json 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/onionshare.desktop
include setup/onionshare80.xpm include setup/onionshare80.xpm

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

Before

Width:  |  Height:  |  Size: 346 B

After

Width:  |  Height:  |  Size: 346 B

View File

Before

Width:  |  Height:  |  Size: 286 B

After

Width:  |  Height:  |  Size: 286 B

View File

Before

Width:  |  Height:  |  Size: 338 B

After

Width:  |  Height:  |  Size: 338 B

View File

@ -17,7 +17,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
""" """
import os, inspect, platform import os, sys, inspect, platform
def get_onionshare_gui_dir(): def get_onionshare_gui_dir():
if platform.system() == 'Darwin': if platform.system() == 'Darwin':
@ -27,3 +27,10 @@ def get_onionshare_gui_dir():
return onionshare_gui_dir return onionshare_gui_dir
onionshare_gui_dir = get_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)

View File

@ -36,7 +36,7 @@ class FileList(QtGui.QListWidget):
# drag and drop label # drag and drop label
self.drop_label = QtGui.QLabel(QtCore.QString(strings._('gui_drag_and_drop')), parent=self) self.drop_label = QtGui.QLabel(QtCore.QString(strings._('gui_drag_and_drop')), parent=self)
self.drop_label.setAlignment(QtCore.Qt.AlignCenter) 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.drop_label.hide()
self.filenames = [] self.filenames = []

View File

@ -227,7 +227,7 @@ def main():
# create the onionshare icon # create the onionshare icon
global window_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 # start the onionshare app
web.set_stay_open(stay_open) web.set_stay_open(stay_open)

View File

@ -43,9 +43,9 @@ class ServerStatus(QtGui.QVBoxLayout):
self.file_selection = file_selection self.file_selection = file_selection
# server layout # server layout
self.status_image_stopped = QtGui.QImage('{0}/images/server_stopped.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('{0}/images/server_working.png'.format(common.onionshare_gui_dir)) self.status_image_working = QtGui.QImage(common.get_image_path('server_working.png'))
self.status_image_started = QtGui.QImage('{0}/images/server_started.png'.format(common.onionshare_gui_dir)) self.status_image_started = QtGui.QImage(common.get_image_path('server_started.png'))
self.status_image_label = QtGui.QLabel() self.status_image_label = QtGui.QLabel()
self.status_image_label.setFixedWidth(30) self.status_image_label.setFixedWidth(30)
self.start_server_button = QtGui.QPushButton(strings._('gui_start_server')) self.start_server_button = QtGui.QPushButton(strings._('gui_start_server'))

View File

@ -34,7 +34,6 @@ def file_list(path):
files.append(path+'/'+filename) files.append(path+'/'+filename)
return files return files
packages = ['onionshare', 'onionshare_gui']
version = open('version').read().strip() version = open('version').read().strip()
@ -48,12 +47,19 @@ setup(
url='https://github.com/micahflee/onionshare', url='https://github.com/micahflee/onionshare',
license="GPL v3", license="GPL v3",
keywords='onion, share, onionshare, tor, anonymous, web server', keywords='onion, share, onionshare, tor, anonymous, web server',
packages=packages, packages=['onionshare', 'onionshare_gui'],
include_package_data=True, include_package_data=True,
scripts=['bin/onionshare', 'bin/onionshare-gui'], scripts=['bin/onionshare', 'bin/onionshare-gui'],
data_files=[ data_files=[
('/usr/share/applications', ['setup/onionshare.desktop']), (os.path.join(sys.prefix, 'share/applications'), ['setup/onionshare.desktop']),
('/usr/share/pixmaps', ['setup/onionshare80.xpm']) (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'
])
] ]
) )

View File

@ -8,11 +8,11 @@ a.datas += [
('onionshare/strings.json', 'onionshare/strings.json', 'DATA'), ('onionshare/strings.json', 'onionshare/strings.json', 'DATA'),
('onionshare/index.html', 'onionshare/index.html', 'DATA'), ('onionshare/index.html', 'onionshare/index.html', 'DATA'),
('onionshare/404.html', 'onionshare/404.html', 'DATA'), ('onionshare/404.html', 'onionshare/404.html', 'DATA'),
('onionshare_gui/images/logo.png', 'onionshare_gui/images/logo.png', 'DATA'), ('images/logo.png', 'onionshare_gui/images/logo.png', 'DATA'),
('onionshare_gui/images/drop_files.png', 'onionshare_gui/images/drop_files.png', 'DATA'), ('images/drop_files.png', 'onionshare_gui/images/drop_files.png', 'DATA'),
('onionshare_gui/images/server_stopped.png', 'onionshare_gui/images/server_stopped.png', 'DATA'), ('images/server_stopped.png', 'onionshare_gui/images/server_stopped.png', 'DATA'),
('onionshare_gui/images/server_started.png', 'onionshare_gui/images/server_started.png', 'DATA'), ('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/server_working.png', 'onionshare_gui/images/server_working.png', 'DATA'),
] ]
pyz = PYZ(a.pure) pyz = PYZ(a.pure)
exe = EXE(pyz, exe = EXE(pyz,

View File

@ -59,11 +59,11 @@ Section "install"
File "${BINPATH}\onionshare_gui\__init__.py" File "${BINPATH}\onionshare_gui\__init__.py"
File "${BINPATH}\onionshare_gui\__init__.pyc" File "${BINPATH}\onionshare_gui\__init__.pyc"
SetOutPath "$INSTDIR\onionshare_gui\images" SetOutPath "$INSTDIR\onionshare_gui\images"
File "${BINPATH}\onionshare_gui\images\logo.png" File "${BINPATH}\images\logo.png"
File "${BINPATH}\onionshare_gui\images\drop_files.png" File "${BINPATH}\images\drop_files.png"
File "${BINPATH}\onionshare_gui\images\server_stopped.png" File "${BINPATH}\images\server_stopped.png"
File "${BINPATH}\onionshare_gui\images\server_started.png" File "${BINPATH}\images\server_started.png"
File "${BINPATH}\onionshare_gui\images\server_working.png" File "${BINPATH}\images\server_working.png"
# dependencies # dependencies
SetOutPath $INSTDIR SetOutPath $INSTDIR