From 166a2dac41aa1aa5ddcf3a7a692d2cdb0debf55c Mon Sep 17 00:00:00 2001 From: Dmitri Bogomolov <4glitch@gmail.com> Date: Wed, 25 Sep 2019 18:30:27 +0300 Subject: [PATCH] Check for state.kivy together with state.enableGUI (closes #1479) --- src/bitmessagemain.py | 5 ++++- src/singleinstance.py | 5 ++++- src/tr.py | 21 +++++++++++++++------ 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/bitmessagemain.py b/src/bitmessagemain.py index 4ad9311f..c253dc3d 100755 --- a/src/bitmessagemain.py +++ b/src/bitmessagemain.py @@ -252,7 +252,10 @@ class Main: if daemon: state.enableGUI = False # run without a UI - if state.enableGUI and not state.curses and not depends.check_pyqt(): + if ( + state.enableGUI and not state.curses and not state.kivy + and not depends.check_pyqt() + ): sys.exit( 'PyBitmessage requires PyQt unless you want' ' to run it as a daemon and interact with it' diff --git a/src/singleinstance.py b/src/singleinstance.py index c1f18f70..5532491a 100644 --- a/src/singleinstance.py +++ b/src/singleinstance.py @@ -29,7 +29,10 @@ class singleinstance: self.lockfile = os.path.normpath( os.path.join(state.appdata, 'singleton%s.lock' % flavor_id)) - if state.enableGUI and not self.daemon and not state.curses: + if ( + state.enableGUI and not self.daemon and not state.curses + and not state.kivy + ): # Tells the already running (if any) application to get focus. import bitmessageqt bitmessageqt.init() diff --git a/src/tr.py b/src/tr.py index 8b41167f..7ee93849 100644 --- a/src/tr.py +++ b/src/tr.py @@ -1,4 +1,4 @@ -import os +import sys import state @@ -21,13 +21,22 @@ def translateText(context, text, n = None): enableGUI = state.enableGUI except AttributeError: # inside the plugin enableGUI = True - if enableGUI: + if enableGUI and not state.kivy: try: from PyQt4 import QtCore, QtGui - except Exception as err: - print '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' - print 'Error message:', err - os._exit(0) + except ImportError: + 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 n is None: return QtGui.QApplication.translate(context, text) else: