Make Windows the default window style on windows, not GTK+
This commit is contained in:
parent
c3c41902cf
commit
de11bc484c
|
@ -62,6 +62,9 @@ except ImportError:
|
||||||
get_plugins = False
|
get_plugins = False
|
||||||
|
|
||||||
|
|
||||||
|
is_windows = sys.platform.startswith('win')
|
||||||
|
|
||||||
|
|
||||||
# TODO: rewrite
|
# TODO: rewrite
|
||||||
def powQueueSize():
|
def powQueueSize():
|
||||||
"""Returns the size of queues.workerQueue including current unfinished work"""
|
"""Returns the size of queues.workerQueue including current unfinished work"""
|
||||||
|
@ -80,7 +83,7 @@ def openKeysFile():
|
||||||
keysfile = os.path.join(state.appdata, 'keys.dat')
|
keysfile = os.path.join(state.appdata, 'keys.dat')
|
||||||
if 'linux' in sys.platform:
|
if 'linux' in sys.platform:
|
||||||
subprocess.call(["xdg-open", keysfile])
|
subprocess.call(["xdg-open", keysfile])
|
||||||
elif sys.platform.startswith('win'):
|
elif is_windows:
|
||||||
os.startfile(keysfile) # pylint: disable=no-member
|
os.startfile(keysfile) # pylint: disable=no-member
|
||||||
|
|
||||||
|
|
||||||
|
@ -868,7 +871,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
"""
|
"""
|
||||||
startonlogon = config.safeGetBoolean(
|
startonlogon = config.safeGetBoolean(
|
||||||
'bitmessagesettings', 'startonlogon')
|
'bitmessagesettings', 'startonlogon')
|
||||||
if sys.platform.startswith('win'): # Auto-startup for Windows
|
if is_windows: # Auto-startup for Windows
|
||||||
RUN_PATH = "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run"
|
RUN_PATH = "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run"
|
||||||
settings = QtCore.QSettings(
|
settings = QtCore.QSettings(
|
||||||
RUN_PATH, QtCore.QSettings.NativeFormat)
|
RUN_PATH, QtCore.QSettings.NativeFormat)
|
||||||
|
@ -4233,6 +4236,14 @@ class BitmessageQtApplication(QtGui.QApplication):
|
||||||
# Unique identifier for this application
|
# Unique identifier for this application
|
||||||
uuid = '6ec0149b-96e1-4be1-93ab-1465fb3ebf7c'
|
uuid = '6ec0149b-96e1-4be1-93ab-1465fb3ebf7c'
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_windowstyle():
|
||||||
|
"""Get window style set in config or default"""
|
||||||
|
return config.safeGet(
|
||||||
|
'bitmessagesettings', 'windowstyle',
|
||||||
|
'Windows' if is_windows else 'GTK+'
|
||||||
|
)
|
||||||
|
|
||||||
def __init__(self, *argv):
|
def __init__(self, *argv):
|
||||||
super(BitmessageQtApplication, self).__init__(*argv)
|
super(BitmessageQtApplication, self).__init__(*argv)
|
||||||
id = BitmessageQtApplication.uuid
|
id = BitmessageQtApplication.uuid
|
||||||
|
@ -4241,8 +4252,7 @@ class BitmessageQtApplication(QtGui.QApplication):
|
||||||
QtCore.QCoreApplication.setOrganizationDomain("bitmessage.org")
|
QtCore.QCoreApplication.setOrganizationDomain("bitmessage.org")
|
||||||
QtCore.QCoreApplication.setApplicationName("pybitmessageqt")
|
QtCore.QCoreApplication.setApplicationName("pybitmessageqt")
|
||||||
|
|
||||||
self.setStyle(
|
self.setStyle(self.get_windowstyle())
|
||||||
config.safeGet('bitmessagesettings', 'windowstyle', 'GTK+'))
|
|
||||||
|
|
||||||
font = config.safeGet('bitmessagesettings', 'font')
|
font = config.safeGet('bitmessagesettings', 'font')
|
||||||
if font:
|
if font:
|
||||||
|
|
|
@ -45,6 +45,7 @@ class SettingsDialog(QtGui.QDialog):
|
||||||
super(SettingsDialog, self).__init__(parent)
|
super(SettingsDialog, self).__init__(parent)
|
||||||
widgets.load('settings.ui', self)
|
widgets.load('settings.ui', self)
|
||||||
|
|
||||||
|
self.app = QtGui.QApplication.instance()
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
self.firstrun = firstrun
|
self.firstrun = firstrun
|
||||||
self.config = config_obj
|
self.config = config_obj
|
||||||
|
@ -87,14 +88,13 @@ class SettingsDialog(QtGui.QDialog):
|
||||||
"""Adjust all widgets state according to config settings"""
|
"""Adjust all widgets state according to config settings"""
|
||||||
# pylint: disable=too-many-branches,too-many-statements
|
# pylint: disable=too-many-branches,too-many-statements
|
||||||
|
|
||||||
current_style = config.safeGet(
|
current_style = self.app.get_windowstyle()
|
||||||
'bitmessagesettings', 'windowstyle', 'GTK+')
|
|
||||||
for i, sk in enumerate(QtGui.QStyleFactory.keys()):
|
for i, sk in enumerate(QtGui.QStyleFactory.keys()):
|
||||||
self.comboBoxStyle.addItem(sk)
|
self.comboBoxStyle.addItem(sk)
|
||||||
if sk == current_style:
|
if sk == current_style:
|
||||||
self.comboBoxStyle.setCurrentIndex(i)
|
self.comboBoxStyle.setCurrentIndex(i)
|
||||||
|
|
||||||
self.save_font_setting(QtGui.QApplication.instance().font())
|
self.save_font_setting(self.app.font())
|
||||||
|
|
||||||
if not self.parent.tray.isSystemTrayAvailable():
|
if not self.parent.tray.isSystemTrayAvailable():
|
||||||
self.groupBoxTray.setEnabled(False)
|
self.groupBoxTray.setEnabled(False)
|
||||||
|
@ -148,7 +148,7 @@ class SettingsDialog(QtGui.QDialog):
|
||||||
"MainWindow",
|
"MainWindow",
|
||||||
"Tray notifications not yet supported on your OS."))
|
"Tray notifications not yet supported on your OS."))
|
||||||
|
|
||||||
if 'win' not in sys.platform and not self.parent.desktop:
|
if not sys.platform.startswith('win') and not self.parent.desktop:
|
||||||
self.checkBoxStartOnLogon.setDisabled(True)
|
self.checkBoxStartOnLogon.setDisabled(True)
|
||||||
self.checkBoxStartOnLogon.setText(_translate(
|
self.checkBoxStartOnLogon.setText(_translate(
|
||||||
"MainWindow", "Start-on-login not yet supported on your OS."))
|
"MainWindow", "Start-on-login not yet supported on your OS."))
|
||||||
|
@ -372,9 +372,7 @@ class SettingsDialog(QtGui.QDialog):
|
||||||
self.checkBoxReplyBelow.isChecked()))
|
self.checkBoxReplyBelow.isChecked()))
|
||||||
|
|
||||||
window_style = str(self.comboBoxStyle.currentText())
|
window_style = str(self.comboBoxStyle.currentText())
|
||||||
if self.config.safeGet(
|
if self.app.get_windowstyle() != window_style or self.config.safeGet(
|
||||||
'bitmessagesettings', 'windowstyle', 'GTK+'
|
|
||||||
) != window_style or self.config.safeGet(
|
|
||||||
'bitmessagesettings', 'font'
|
'bitmessagesettings', 'font'
|
||||||
) != self.font_setting:
|
) != self.font_setting:
|
||||||
self.config.set('bitmessagesettings', 'windowstyle', window_style)
|
self.config.set('bitmessagesettings', 'windowstyle', window_style)
|
||||||
|
|
|
@ -43,7 +43,8 @@ class TestSettings(TestBase):
|
||||||
self.assertIs(style_setting, None)
|
self.assertIs(style_setting, None)
|
||||||
self.assertIs(font_setting, None)
|
self.assertIs(font_setting, None)
|
||||||
style_control = self.dialog.comboBoxStyle
|
style_control = self.dialog.comboBoxStyle
|
||||||
self.assertEqual(style_control.currentText(), 'GTK+')
|
self.assertEqual(
|
||||||
|
style_control.currentText(), self.app.get_windowstyle())
|
||||||
|
|
||||||
def call_font_dialog():
|
def call_font_dialog():
|
||||||
"""A function to get the open font dialog and accept it"""
|
"""A function to get the open font dialog and accept it"""
|
||||||
|
|
Reference in New Issue
Block a user