예제 #1
0
 def polish(self, args):
     if isinstance(args, QLabel):
         pal = args.palette()
         args.setPalette(self.panel_palette(pal, self.light_colored(args)))
     elif isinstance(args, QComboBox) or \
             isinstance(args, QToolButton):
         args.setMaximumHeight(24)
     elif isinstance(args, QLineEdit):
         args.setMaximumHeight(24)
     return QProxyStyle.polish(self, args)
예제 #2
0
 def polish(self, args):
     if isinstance(args, QPalette):
         palette = args
         for role, color in self._palette.items():
             qcolor = QColor(color)
             color_group = QPalette.All
             if role.endswith("Disabled"):
                 role = role.split("Disabled")[0]
                 color_group = QPalette.Disabled
             elif role.endswith("Inactive"):
                 role = role.split("Inactive")[0]
                 qcolor.setAlpha(90)
                 color_group = QPalette.Inactive
             color_role = getattr(palette, role)
             palette.setBrush(color_group, color_role, qcolor)
     elif isinstance(args, QApplication):
         # Set style sheet
         filename = os.path.join(resources.PERCENTAGE_QSS, self._qss)
         with open(filename + ".qss") as fileaccess:
             qss = fileaccess.read()
         args.setStyleSheet(qss)
     return QProxyStyle.polish(self, args)
예제 #3
0
 def polish(self, args):
     if isinstance(args, QPalette):
         palette = args
         for role, color in self._palette.items():
             qcolor = QColor(color)
             color_group = QPalette.All
             if role.endswith("Disabled"):
                 role = role.split("Disabled")[0]
                 color_group = QPalette.Disabled
             elif role.endswith("Inactive"):
                 role = role.split("Inactive")[0]
                 qcolor.setAlpha(90)
                 color_group = QPalette.Inactive
             color_role = getattr(palette, role)
             palette.setBrush(color_group, color_role, qcolor)
     elif isinstance(args, QApplication):
         # Set style sheet
         filename = os.path.join(resources.NINJA_QSS, self._qss)
         with open(filename + ".qss") as fileaccess:
             qss = fileaccess.read()
         args.setStyleSheet(qss)
     return QProxyStyle.polish(self, args)