View Single Post
Old 03-01-2013, 10:53 AM   #8
Dfaure
Enthusiast
Dfaure began at the beginning.
 
Posts: 31
Karma: 10
Join Date: Jan 2013
Device: Kobo Libra 2 & Aura HD, Cybook Muse
Here's my code source tweaks made on 0.9.20 enabling a "gui.qss" stylesheet stored in the configuration directory.

I'm posting that here as installing and using Bazaar would be a real overkill for such a small modification.

Basically, I just had to modify gui2\mainwindow.py as below:
Code:
(11)                       pyqtSignal, QObject)
(12) from calibre.utils.config import OptionParser
(13) from calibre.gui2 import error_dialog
(14) from calibre import prints
(15) 
(16) # <DFaure>
(17) import os
(18) from PyQt4.QtCore import (QFile, QString)
(19) from calibre.constants import config_dir
(20) from calibre.gui2 import info_dialog
(21) # </Dfaure>
(22) 
(23) def option_parser(usage='''\
(24) Usage: %prog [options]
(25) 
(26) Launch the Graphical User Interface
and

Code:
(104)         quit_action.setMenuRole(QAction.QuitRole)
(105)         return preferences_action, quit_action
(106) 
(107)     def __init__(self, opts, parent=None, disable_automatic_gc=False):
(108)         QMainWindow.__init__(self, parent)
(109) # <DFaure>
(110)         styleFile = os.path.join(config_dir, 'gui.qss')
(111)         if QFile.exists(styleFile):
(112)             styleSheetStr = open(styleFile, 'r').read()
(113)             self.setStyleSheet(styleSheetStr)
(114) # </DFaure>
(115)         if disable_automatic_gc:
(116)             self._gc = GarbageCollector(self, debug=False)
(117) 
(118)     def unhandled_exception(self, type, value, tb):
(119)         if type == KeyboardInterrupt:
Feel free to handle this feature better than me in the next version.

Regards
Dfaure is offline   Reply With Quote