@@ -49,6 +49,7 @@ def __init__(self, parent=None, firstrun=False):
4949 self .firstrun = firstrun
5050 self .config = config_obj
5151 self .net_restart_needed = False
52+ self .font_setting = None
5253 self .timer = QtCore .QTimer ()
5354
5455 if self .config .safeGetBoolean ('bitmessagesettings' , 'dontconnect' ):
@@ -85,6 +86,16 @@ def __init__(self, parent=None, firstrun=False):
8586 def adjust_from_config (self , config ):
8687 """Adjust all widgets state according to config settings"""
8788 # pylint: disable=too-many-branches,too-many-statements
89+
90+ current_style = config .safeGet (
91+ 'bitmessagesettings' , 'windowstyle' , 'GTK+' )
92+ for i , sk in enumerate (QtGui .QStyleFactory .keys ()):
93+ self .comboBoxStyle .addItem (sk )
94+ if sk == current_style :
95+ self .comboBoxStyle .setCurrentIndex (i )
96+
97+ self .save_font_setting (QtGui .QApplication .instance ().font ())
98+
8899 if not self .parent .tray .isSystemTrayAvailable ():
89100 self .groupBoxTray .setEnabled (False )
90101 self .groupBoxTray .setTitle (_translate (
@@ -322,6 +333,18 @@ def click_pushButtonNamecoinTest(self):
322333 if status == 'success' :
323334 self .parent .namecoin = nc
324335
336+ def save_font_setting (self , font ):
337+ """Save user font setting and set the buttonFont text"""
338+ font_setting = (font .family (), font .pointSize ())
339+ self .buttonFont .setText ('{} {}' .format (* font_setting ))
340+ self .font_setting = '{},{}' .format (* font_setting )
341+
342+ def choose_font (self ):
343+ """Show the font selection dialog"""
344+ font , valid = QtGui .QFontDialog .getFont ()
345+ if valid :
346+ self .save_font_setting (font )
347+
325348 def accept (self ):
326349 """A callback for accepted event of buttonBox (OK button pressed)"""
327350 # pylint: disable=too-many-branches,too-many-statements
@@ -348,6 +371,22 @@ def accept(self):
348371 self .config .set ('bitmessagesettings' , 'replybelow' , str (
349372 self .checkBoxReplyBelow .isChecked ()))
350373
374+ window_style = str (self .comboBoxStyle .currentText ())
375+ if self .config .safeGet (
376+ 'bitmessagesettings' , 'windowstyle' , 'GTK+'
377+ ) != window_style or self .config .safeGet (
378+ 'bitmessagesettings' , 'font'
379+ ) != self .font_setting :
380+ self .config .set ('bitmessagesettings' , 'windowstyle' , window_style )
381+ self .config .set ('bitmessagesettings' , 'font' , self .font_setting )
382+ queues .UISignalQueue .put ((
383+ 'updateStatusBar' , (
384+ _translate (
385+ "MainWindow" ,
386+ "You need to restart the application to apply"
387+ " the window style or default font." ), 1 )
388+ ))
389+
351390 lang = str (self .languageComboBox .itemData (
352391 self .languageComboBox .currentIndex ()).toString ())
353392 self .config .set ('bitmessagesettings' , 'userlocale' , lang )
0 commit comments