diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py
index 40113b5a..7f767b03 100644
--- a/src/bitmessageqt/__init__.py
+++ b/src/bitmessageqt/__init__.py
@@ -4241,6 +4241,15 @@ class BitmessageQtApplication(QtGui.QApplication):
QtCore.QCoreApplication.setOrganizationDomain("bitmessage.org")
QtCore.QCoreApplication.setApplicationName("pybitmessageqt")
+ self.setStyle(
+ config.safeGet('bitmessagesettings', 'windowstyle', 'GTK+'))
+
+ font = config.safeGet('bitmessagesettings', 'font')
+ if font:
+ # family, size, weight = font.split(',')
+ family, size = font.split(',')
+ self.setFont(QtGui.QFont(family, int(size)))
+
self.server = None
self.is_running = False
diff --git a/src/bitmessageqt/settings.py b/src/bitmessageqt/settings.py
index 3d05db25..44cad4c9 100644
--- a/src/bitmessageqt/settings.py
+++ b/src/bitmessageqt/settings.py
@@ -49,6 +49,7 @@ class SettingsDialog(QtGui.QDialog):
self.firstrun = firstrun
self.config = config_obj
self.net_restart_needed = False
+ self.font_setting = None
self.timer = QtCore.QTimer()
if self.config.safeGetBoolean('bitmessagesettings', 'dontconnect'):
@@ -85,6 +86,16 @@ class SettingsDialog(QtGui.QDialog):
def adjust_from_config(self, config):
"""Adjust all widgets state according to config settings"""
# pylint: disable=too-many-branches,too-many-statements
+
+ current_style = config.safeGet(
+ 'bitmessagesettings', 'windowstyle', 'GTK+')
+ for i, sk in enumerate(QtGui.QStyleFactory.keys()):
+ self.comboBoxStyle.addItem(sk)
+ if sk == current_style:
+ self.comboBoxStyle.setCurrentIndex(i)
+
+ self.save_font_setting(QtGui.QApplication.instance().font())
+
if not self.parent.tray.isSystemTrayAvailable():
self.groupBoxTray.setEnabled(False)
self.groupBoxTray.setTitle(_translate(
@@ -322,6 +333,18 @@ class SettingsDialog(QtGui.QDialog):
if status == 'success':
self.parent.namecoin = nc
+ def save_font_setting(self, font):
+ """Save user font setting and set the buttonFont text"""
+ font_setting = (font.family(), font.pointSize())
+ self.buttonFont.setText('{} {}'.format(*font_setting))
+ self.font_setting = '{},{}'.format(*font_setting)
+
+ def choose_font(self):
+ """Show the font selection dialog"""
+ font, valid = QtGui.QFontDialog.getFont()
+ if valid:
+ self.save_font_setting(font)
+
def accept(self):
"""A callback for accepted event of buttonBox (OK button pressed)"""
# pylint: disable=too-many-branches,too-many-statements
@@ -348,6 +371,22 @@ class SettingsDialog(QtGui.QDialog):
self.config.set('bitmessagesettings', 'replybelow', str(
self.checkBoxReplyBelow.isChecked()))
+ window_style = str(self.comboBoxStyle.currentText())
+ if self.config.safeGet(
+ 'bitmessagesettings', 'windowstyle', 'GTK+'
+ ) != window_style or self.config.safeGet(
+ 'bitmessagesettings', 'font'
+ ) != self.font_setting:
+ self.config.set('bitmessagesettings', 'windowstyle', window_style)
+ self.config.set('bitmessagesettings', 'font', self.font_setting)
+ queues.UISignalQueue.put((
+ 'updateStatusBar', (
+ _translate(
+ "MainWindow",
+ "You need to restart the application to apply"
+ " the window style or default font."), 1)
+ ))
+
lang = str(self.languageComboBox.itemData(
self.languageComboBox.currentIndex()).toString())
self.config.set('bitmessagesettings', 'userlocale', lang)
diff --git a/src/bitmessageqt/settings.ui b/src/bitmessageqt/settings.ui
index 1e9a6f09..e7ce1d71 100644
--- a/src/bitmessageqt/settings.ui
+++ b/src/bitmessageqt/settings.ui
@@ -147,6 +147,32 @@
+ -
+
+
+ Custom Style
+
+
+
-
+
+
+
+ 100
+ 0
+
+
+
+
+ -
+
+
+ Font
+
+
+
+
+
+
-
@@ -1202,5 +1228,11 @@
+
+ buttonFont
+ clicked()
+ settingsDialog
+ choose_font
+