Skip to content
This repository has been archived by the owner on Dec 18, 2023. It is now read-only.

Commit

Permalink
style(config): 优化颜色选择代码
Browse files Browse the repository at this point in the history
  • Loading branch information
ambition_echo committed Nov 24, 2022
1 parent e2eaa8a commit d0a92fd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
15 changes: 8 additions & 7 deletions earth_wallpaper/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,14 +226,15 @@ def clear_cache():
def init_color_select(self):
pix = QPixmap(16, 16)
painter = QPainter(pix)
color_list = ['660000', '990000', 'cc0000', 'cc3333', 'ea4c88',
'993399', '663399', '333399', '0066cc', '0099cc',
'66cccc', '77cc33', '669900', '336600', '666600',
'999900', 'cccc33', 'ffff00', 'ffcc33', 'ff9900',
'ff6600', 'cc6633', '996633', '663300', '000000',
'999999', 'cccccc', 'ffffff', '424153']
color_list = ['#660000', '#990000', '#cc0000', '#cc3333', '#ea4c88',
'#993399', '#663399', '#333399', '#0066cc', '#0099cc',
'#66cccc', '#77cc33', '#669900', '#336600', '#666600',
'#999900', '#cccc33', '#ffff00', '#ffcc33', '#ff9900',
'#ff6600', '#cc6633', '#996633', '#663300', '#000000',
'#999999', '#cccccc', '#ffffff', '#424153']
for i in color_list:
painter.fillRect(0, 0, 16, 16, QColor("#" + i))
painter.fillRect(0, 0, 16, 16, QColor(i))
self.color.addItem(QIcon(pix), i)
self.color.addItem("不选择")
painter.end()
self.color.setFont("MonoSpace")
4 changes: 2 additions & 2 deletions earth_wallpaper/interfaces/utils/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ def sorting(self):
return self.settings.value("APP/sorting").lower().replace(" ", "_")

def searchkey(self):
return self.settings.value("APP/searchkey")
return self.settings.value("APP/searchkey").replace(" ", "+")

def color(self):
return self.settings.value("APP/color")
return self.settings.value("APP/color").replace('#', '')

@staticmethod
def desktop_res() -> (int, int):
Expand Down

0 comments on commit d0a92fd

Please sign in to comment.