def start_app(): from leap.bitmask.util import STANDALONE os.environ['QT_AUTO_SCREEN_SCALE_FACTOR'] = '1' # Allow the frozen binary in the bundle double as the cli entrypoint # Why have only a user interface when you can have two? if platform.system() == 'Windows': # In windows, there are some args added to the invocation # by PyInstaller, I guess... MIN_ARGS = 3 else: MIN_ARGS = 1 # DEBUG ==================================== if STANDALONE and len(sys.argv) > MIN_ARGS: if sys.argv[1] == 'bitmask_helpers': from leap.bitmask.vpn.helpers import main return main() from leap.bitmask.cli import bitmask_cli return bitmask_cli.main() prev_auth = os.path.join(get_path_prefix(), 'leap', 'authtoken') try: os.remove(prev_auth) except OSError: pass launch_gui()
def start_app(): from leap.bitmask.util import STANDALONE mypid = os.getpid() # Kill a previously-running process for proc in psutil.process_iter(): if proc.name() == PROCNAME and proc.pid != mypid: proc.kill() # Allow the frozen binary in the bundle double as the cli entrypoint # Why have only a user interface when you can have two? if STANDALONE and len(sys.argv) > 1: if sys.argv[1] == 'bitmask_helpers': from leap.bitmask.vpn.helpers import main return main() from leap.bitmask.cli import bitmask_cli return bitmask_cli.main() prev_auth = os.path.join(get_path_prefix(), 'leap', 'authtoken') try: os.remove(prev_auth) except OSError: pass launch_gui()
def start_app(): from leap.bitmask.util import STANDALONE os.environ['QT_AUTO_SCREEN_SCALE_FACTOR'] = '1' # Allow the frozen binary in the bundle double as the cli entrypoint # Why have only a user interface when you can have two? if DEBUG: os.environ.setdefault('QTWEBENGINE_REMOTE_DEBUGGING', '8081') if platform.system() == 'Windows': # In windows, there are some args added to the invocation # by PyInstaller, I guess... MIN_ARGS = 3 else: MIN_ARGS = 1 # DEBUG ==================================== if len(sys.argv) > MIN_ARGS: if STANDALONE: if sys.argv[1] == 'bitmask_helpers': from leap.bitmask.vpn.helpers import main return main() from leap.bitmask.cli import bitmask_cli return bitmask_cli.main() else: if sys.argv[1] == '--help' or sys.argv[1] == 'help': print(usage) sys.exit() reset_authtoken() with_window = '--nowindow' not in sys.argv launch_gui(with_window)
def start_app(): from leap.bitmask.util import STANDALONE # Allow the frozen binary in the bundle double as the cli entrypoint # Why have only a user interface when you can have two? if STANDALONE and len(sys.argv) > 1: from leap.bitmask.cli import bitmask_cli return bitmask_cli.main() launch_gui()