예제 #1
0
 def setStyle(item):
     path = os.path.join('Resources/Themes', item.text(), 'style.qss')
     if os.path.isfile(path):
         t = time()
         ThemeManager.loadUserTheme(item.text())
         print(time() - t)
         w.grab().save('Resources/Themes/{}/preview.png'.format(
             item.text()))
예제 #2
0
 def setStyle(item):
     path = os.path.join('Resources/Themes', item.text(), 'style.qss')
     if os.path.isfile(path):
         t = time()
         ThemeManager.loadUserTheme(item.text())
         print(time() - t)
         path = 'Resources/Themes/{}/background.jpg'.format(item.text())
         if os.path.exists(path):
             print(ColorThief(path).get_color())
         w.grab().save('Resources/Themes/{}/preview.png'.format(
             item.text()))
예제 #3
0
 def on_buttonPreviewApply_clicked(self):
     """设置主题
     """
     if self._which == self.Theme:
         ThemeManager.loadUserTheme(
             os.path.basename(os.path.dirname(self._poc)))
         Setting.setValue('picture', None)
         Setting.setValue('colourful', None)
     elif self._which == self.Color:
         ThemeManager.loadColourfulTheme(self._poc)
         if isinstance(self._poc, QColor):
             Setting.setValue('colourful', self._poc)
         else:
             # 渐变需要转成字典数据
             Setting.setValue('colourful', GradientUtils.toJson(self._poc))
         Setting.setValue('picture', None)