Check for state.kivy together with state.enableGUI (closes #1479)

This commit is contained in:
Dmitri Bogomolov 2019-09-25 18:30:27 +03:00
parent 973f39d5b2
commit 166a2dac41
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13
3 changed files with 23 additions and 8 deletions

View File

@ -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'

View File

@ -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()

View File

@ -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: