Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 02-13-2013, 10:48 AM   #1
Dfaure
Enthusiast
Dfaure began at the beginning.
 
Posts: 31
Karma: 10
Join Date: Jan 2013
Device: Kobo Libra 2 & Aura HD, Cybook Muse
Calibre GUI styling

Hi,

Before all, I wish to thank all the Calibre developers for all their high quality work on this priceless piece of code.

Using Calibre and it's viewer regularly at night (ie. in low light conditions), I was wondering if the global GUI couldn't take advantage of (Py)Qt Stylesheets, and therefore enable "easily" to use darker themes?

Dominique
Dfaure is offline   Reply With Quote
Old 02-13-2013, 11:37 AM   #2
Dfaure
Enthusiast
Dfaure began at the beginning.
 
Posts: 31
Karma: 10
Join Date: Jan 2013
Device: Kobo Libra 2 & Aura HD, Cybook Muse
This post (and the related screenshots) would helpfully illustrate my request:

[Release] Qt dark orange stylesheet

Thanks
Dfaure is offline   Reply With Quote
Advert
Old 02-13-2013, 12:39 PM   #3
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
If you wish to create a dark theme for the actual text in the viewer use the viewer preferences to do so. As for GUI styling Qt will use whatever colors you have set at the system level. So switch your system theme to dark and restart calibre, and you should see dark colors.
kovidgoyal is offline   Reply With Quote
Old 02-14-2013, 04:34 AM   #4
Dfaure
Enthusiast
Dfaure began at the beginning.
 
Posts: 31
Karma: 10
Join Date: Jan 2013
Device: Kobo Libra 2 & Aura HD, Cybook Muse
You're right, this is the way I would have followed on a computer driven by a "real" system (no troll here), but I'm stuck on a windows 7 where I can't have any decent system theming without huge modifications in the system binaries themselves.

I was just wondering if Calibre and it's viewer couldn't fetch itself and set a custom Qt stylesheet file lying in the user preferences datas, or even if this could be done from a plugin (whereas being not so familiar with Python and Qt, I could write a plugins for this).

Regards
Dfaure is offline   Reply With Quote
Old 02-14-2013, 07:09 AM   #5
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
calibre will use the system colors you set in windows as well.
kovidgoyal is offline   Reply With Quote
Advert
Old 02-18-2013, 11:10 AM   #6
Dfaure
Enthusiast
Dfaure began at the beginning.
 
Posts: 31
Karma: 10
Join Date: Jan 2013
Device: Kobo Libra 2 & Aura HD, Cybook Muse
Quote:
Originally Posted by kovidgoyal View Post
calibre will use the system colors you set in windows as well.
I already toyed a bit with that, but without any heavy windows gui tweaks (which as at least one other guy I really don't want), I couldn't get a suitable configuration for both Calibre and other windows stuff.

I was just asking to have enabled in Calibre and its viewer the access point provided by Qt to customize the default look'n feel. Nothing more.
Dfaure is offline   Reply With Quote
Old 02-18-2013, 02:23 PM   #7
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Feel free to run calibre from source and add the one line thats needed to load a stylesheet. Instructions are here: http://manual.calibre-ebook.com/develop.html
kovidgoyal is offline   Reply With Quote
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
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Which GUI library is used in latest Calibre? klonuo Calibre 8 03-04-2012 11:26 PM
how to display book's id in Calibre GUI? jokermania Calibre 1 12-22-2011 04:36 AM
starting calibre to do only jobs (no gui) sosimple Calibre 7 05-27-2011 02:56 AM
Calibre GUI is shown Right to Left nimrodz Calibre 2 02-04-2011 01:25 PM
Calibre GUI crash on convert aapezzuto Calibre 1 08-02-2008 06:39 PM


All times are GMT -4. The time now is 06:03 PM.


MobileRead.com is a privately owned, operated and funded community.