def setup_styles(self, force_calibre_style): self.original_font = QFont(QApplication.font()) fi = gprefs['font'] if fi is not None: font = QFont(*(fi[:4])) s = gprefs.get('font_stretch', None) if s is not None: font.setStretch(s) QApplication.setFont(font) depth_ok = True if iswindows: # There are some people that still run 16 bit winxp installs. The # new style does not render well on 16bit machines. try: depth_ok = get_windows_color_depth() >= 32 except: import traceback traceback.print_exc() if force_calibre_style or (depth_ok and gprefs['ui_style'] != 'system'): self.load_calibre_style() else: st = self.style() if st is not None: st = unicode(st.objectName()).lower() if (islinux or isbsd) and st in ('windows', 'motif', 'cde'): from PyQt4.Qt import QStyleFactory styles = set(map(unicode, QStyleFactory.keys())) if os.environ.get('KDE_FULL_SESSION', False): self.load_calibre_style() elif 'Cleanlooks' in styles: self.setStyle('Cleanlooks')
def run(self): # Use default theme; # if you use different Qt4 theme our works looks ugly :) self._application.setStyle(QStyleFactory.create('Plastique')) self._init_screen() self._application.installTranslator(self._translator) # For testing.. # self._window.resize(QSize(800,600)) # Run run run self._application.exec_()
def setup_styles(self, force_calibre_style): self.original_font = QFont(QApplication.font()) fi = gprefs["font"] if fi is not None: font = QFont(*(fi[:4])) s = gprefs.get("font_stretch", None) if s is not None: font.setStretch(s) QApplication.setFont(font) depth_ok = True if iswindows: # There are some people that still run 16 bit winxp installs. The # new style does not render well on 16bit machines. try: depth_ok = get_windows_color_depth() >= 32 except: import traceback traceback.print_exc() if not depth_ok: prints("Color depth is less than 32 bits disabling modern look") if force_calibre_style or (depth_ok and gprefs["ui_style"] != "system"): self.load_calibre_style() else: st = self.style() if st is not None: st = unicode(st.objectName()).lower() if (islinux or isbsd) and st in ("windows", "motif", "cde"): from PyQt4.Qt import QStyleFactory styles = set(map(unicode, QStyleFactory.keys())) if os.environ.get("KDE_FULL_SESSION", False): self.load_calibre_style() elif "Cleanlooks" in styles: self.setStyle("Cleanlooks")