summaryrefslogtreecommitdiff
path: root/onionshare_gui/__init__.py
diff options
context:
space:
mode:
authorMicah Lee <micah@micahflee.com>2019-05-06 18:06:14 -0700
committerGitHub <noreply@github.com>2019-05-06 18:06:14 -0700
commitbbf6c02da645fcd4fc50db18dd341178ad4fa2e6 (patch)
treec1e2757c56f517e051c9f905f8a7a12e1b8d66ae /onionshare_gui/__init__.py
parenta8201593ec0bfe7596ef530e80aa30e5172ef71d (diff)
parent9e9c29b189cb91ea495a85ed749730395926e07b (diff)
downloadonionshare-bbf6c02da645fcd4fc50db18dd341178ad4fa2e6.tar.gz
onionshare-bbf6c02da645fcd4fc50db18dd341178ad4fa2e6.zip
Merge pull request #980 from micahflee/developv2.1
Version 2.1
Diffstat (limited to 'onionshare_gui/__init__.py')
-rw-r--r--onionshare_gui/__init__.py31
1 files changed, 10 insertions, 21 deletions
diff --git a/onionshare_gui/__init__.py b/onionshare_gui/__init__.py
index 675bb52d..99c52937 100644
--- a/onionshare_gui/__init__.py
+++ b/onionshare_gui/__init__.py
@@ -26,7 +26,6 @@ import signal
from .widgets import Alert
from PyQt5 import QtCore, QtWidgets
-from onionshare import strings
from onionshare.common import Common
from onionshare.onion import Onion
from onionshare.onionshare import OnionShare
@@ -59,16 +58,8 @@ def main():
common = Common()
common.define_css()
- # Load the default settings and strings early, for the sake of being able to parse options.
- # These won't be in the user's chosen locale necessarily, but we need to parse them
- # early in order to even display the option to pass alternate settings (which might
- # contain a preferred locale).
- # If an alternate --config is passed, we'll reload strings later.
- common.load_settings()
- strings.load_strings(common)
-
# Display OnionShare banner
- print(strings._('version_string').format(common.version))
+ print("OnionShare {0:s} | https://onionshare.org/".format(common.version))
# Allow Ctrl-C to smoothly quit the program instead of throwing an exception
# https://stackoverflow.com/questions/42814093/how-to-handle-ctrlc-in-python-app-with-pyqt
@@ -80,10 +71,10 @@ def main():
# Parse arguments
parser = argparse.ArgumentParser(formatter_class=lambda prog: argparse.HelpFormatter(prog,max_help_position=48))
- parser.add_argument('--local-only', action='store_true', dest='local_only', help=strings._("help_local_only"))
- parser.add_argument('--debug', action='store_true', dest='debug', help=strings._("help_debug"))
- parser.add_argument('--filenames', metavar='filenames', nargs='+', help=strings._('help_filename'))
- parser.add_argument('--config', metavar='config', default=False, help=strings._('help_config'))
+ parser.add_argument('--local-only', action='store_true', dest='local_only', help="Don't use Tor (only for development)")
+ parser.add_argument('-v', '--verbose', action='store_true', dest='verbose', help="Log OnionShare errors to stdout, and web errors to disk")
+ parser.add_argument('--filenames', metavar='filenames', nargs='+', help="List of files or folders to share")
+ parser.add_argument('--config', metavar='config', default=False, help="Custom JSON config file location (optional)")
args = parser.parse_args()
filenames = args.filenames
@@ -93,25 +84,23 @@ def main():
config = args.config
if config:
- # Re-load the strings, in case the provided config has changed locale
common.load_settings(config)
- strings.load_strings(common)
local_only = bool(args.local_only)
- debug = bool(args.debug)
+ verbose = bool(args.verbose)
- # Debug mode?
- common.debug = debug
+ # Verbose mode?
+ common.verbose = verbose
# Validation
if filenames:
valid = True
for filename in filenames:
if not os.path.isfile(filename) and not os.path.isdir(filename):
- Alert(common, strings._("not_a_file").format(filename))
+ Alert(common, "{0:s} is not a valid file.".format(filename))
valid = False
if not os.access(filename, os.R_OK):
- Alert(common, strings._("not_a_readable_file").format(filename))
+ Alert(common, "{0:s} is not a readable file.".format(filename))
valid = False
if not valid:
sys.exit()