mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-26 06:25:58 -05:00
Display version string automatically in CLI, and in the status bar in GUI (#251)
This commit is contained in:
parent
d987a23c40
commit
e199946a8d
@ -44,5 +44,6 @@
|
||||
"using_ephemeral": "Staring ephemeral Tor hidden service and awaiting publication",
|
||||
"gui_download_progress_complete": "%p%, Time Elapsed: {0:s}",
|
||||
"gui_download_progress_starting": "{0:s}, %p% (Computing ETA)",
|
||||
"gui_download_progress_eta": "{0:s}, ETA: {1:s}, %p%"
|
||||
"gui_download_progress_eta": "{0:s}, ETA: {1:s}, %p%",
|
||||
"version_string": "Onionshare {0:s} | https://onionshare.org/"
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ def get_html_path(filename):
|
||||
"""
|
||||
Returns the path of the html files.
|
||||
"""
|
||||
p = platform.system()
|
||||
p = get_platform()
|
||||
if p == 'Darwin':
|
||||
prefix = os.path.join(osx_resources_dir, 'html')
|
||||
else:
|
||||
@ -66,6 +66,20 @@ def get_html_path(filename):
|
||||
return os.path.join(prefix, filename)
|
||||
|
||||
|
||||
def get_version():
|
||||
"""
|
||||
Returns the version of OnionShare that is running.
|
||||
"""
|
||||
p = get_platform()
|
||||
if p == 'Linux':
|
||||
version_filename = os.path.join(sys.prefix, 'share/onionshare/version')
|
||||
elif p == 'Darwin':
|
||||
version_filename = os.path.join(helpers.osx_resources_dir, 'version')
|
||||
else:
|
||||
version_filename = os.path.join(os.path.dirname(helpers.get_onionshare_dir()), 'version')
|
||||
return open(version_filename).read().strip()
|
||||
|
||||
|
||||
def constant_time_compare(val1, val2):
|
||||
"""
|
||||
Compares two values in constant time.
|
||||
|
@ -97,6 +97,7 @@ def main(cwd=None):
|
||||
onionshare uses.
|
||||
"""
|
||||
strings.load_strings()
|
||||
print strings._('version_string').format(helpers.get_version())
|
||||
|
||||
# onionshare CLI in OSX needs to change current working directory (#132)
|
||||
if helpers.get_platform() == 'Darwin':
|
||||
|
@ -111,6 +111,9 @@ class OnionShareGui(QtGui.QWidget):
|
||||
# status bar
|
||||
self.status_bar = QtGui.QStatusBar()
|
||||
self.status_bar.setSizeGripEnabled(False)
|
||||
version_label = QtGui.QLabel('v{0:s}'.format(helpers.get_version()))
|
||||
version_label.setStyleSheet('color: #666666;')
|
||||
self.status_bar.addPermanentWidget(version_label)
|
||||
|
||||
# main layout
|
||||
self.layout = QtGui.QVBoxLayout()
|
||||
@ -260,6 +263,7 @@ def main():
|
||||
The main() function implements all of the logic that the GUI version of onionshare uses.
|
||||
"""
|
||||
strings.load_strings()
|
||||
print strings._('version_string').format(helpers.get_version())
|
||||
|
||||
# start the Qt app
|
||||
global qtapp
|
||||
|
1
setup.py
1
setup.py
@ -90,6 +90,7 @@ if system == 'Linux':
|
||||
(os.path.join(sys.prefix, 'share/applications'), ['install/onionshare.desktop']),
|
||||
(os.path.join(sys.prefix, 'share/appdata'), ['install/onionshare.appdata.xml']),
|
||||
(os.path.join(sys.prefix, 'share/pixmaps'), ['install/onionshare80.xpm']),
|
||||
(os.path.join(sys.prefix, 'share/onionshare'), ['version']),
|
||||
(os.path.join(sys.prefix, 'share/onionshare/images'), images),
|
||||
(os.path.join(sys.prefix, 'share/onionshare/locale'), locale)
|
||||
]
|
||||
|
Loading…
x
Reference in New Issue
Block a user