From 953ea4e9506c23f7a20506291444f30ee693b1c8 Mon Sep 17 00:00:00 2001 From: Dmitri Bogomolov <4glitch@gmail.com> Date: Tue, 22 May 2018 14:17:47 +0300 Subject: [PATCH] Slightly rewritten bitmessagemain to use depends properly --- src/bitmessagemain.py | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/bitmessagemain.py b/src/bitmessagemain.py index 11726913..6b2ecacd 100755 --- a/src/bitmessagemain.py +++ b/src/bitmessagemain.py @@ -245,6 +245,19 @@ class Main: state.enableGUI = False # run without a UI # is the application already running? If yes then exit. + if state.enableGUI and not state.curses and not depends.check_pyqt(): + sys.exit( + 'PyBitmessage requires PyQt unless you want' + ' to run it as a daemon and interact with it' + ' using the API. You can download PyQt from ' + 'http://www.riverbankcomputing.com/software/pyqt/download' + ' or by searching Google for \'PyQt Download\'.' + ' If you want to run in daemon mode, see ' + 'https://bitmessage.org/wiki/Daemon\n' + 'You can also run PyBitmessage with' + ' the new curses interface by providing' + ' \'-c\' as a commandline argument.' + ) shared.thisapp = singleinstance("", daemon) if daemon and not state.testmode: @@ -381,26 +394,14 @@ class Main: BMConfigParser().remove_option('bitmessagesettings', 'dontconnect') elif daemon is False: if state.curses: - # if depends.check_curses(): + if not depends.check_curses(): + sys.exit() print('Running with curses') import bitmessagecurses bitmessagecurses.runwrapper() - elif depends.check_pyqt(): + else: import bitmessageqt bitmessageqt.run() - else: - sys.exit( - 'PyBitmessage requires PyQt unless you want' - ' to run it as a daemon and interact with it' - ' using the API. You can download PyQt from ' - 'http://www.riverbankcomputing.com/software/pyqt/download' - ' or by searching Google for \'PyQt Download\'.' - ' If you want to run in daemon mode, see ' - 'https://bitmessage.org/wiki/Daemon\n' - 'You can also run PyBitmessage with' - ' the new curses interface by providing' - ' \'-c\' as a commandline argument.' - ) if daemon: if state.testmode: