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 60d791a commit e2eaa8a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 58 deletions.
65 changes: 9 additions & 56 deletions earth_wallpaper/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,61 +226,14 @@ def clear_cache():
def init_color_select(self):
pix = QPixmap(16, 16)
painter = QPainter(pix)
painter.fillRect(0, 0, 16, 16, QColor("#660000"))
self.color.addItem(QIcon(pix), "660000")
painter.fillRect(0, 0, 16, 16, QColor("#990000"))
self.color.addItem(QIcon(pix), "990000")
painter.fillRect(0, 0, 16, 16, QColor("#cc0000"))
self.color.addItem(QIcon(pix), "cc0000")
painter.fillRect(0, 0, 16, 16, QColor("#cc3333"))
self.color.addItem(QIcon(pix), "cc3333")
painter.fillRect(0, 0, 16, 16, QColor("#ea4c88"))
self.color.addItem(QIcon(pix), "ea4c88")
painter.fillRect(0, 0, 16, 16, QColor("#993399"))
self.color.addItem(QIcon(pix), "993399")
painter.fillRect(0, 0, 16, 16, QColor("#663399"))
self.color.addItem(QIcon(pix), "663399")
painter.fillRect(0, 0, 16, 16, QColor("#333399"))
self.color.addItem(QIcon(pix), "333399")
painter.fillRect(0, 0, 16, 16, QColor("#0066cc"))
self.color.addItem(QIcon(pix), "0066cc")
painter.fillRect(0, 0, 16, 16, QColor("#0099cc"))
self.color.addItem(QIcon(pix), "0099cc")
painter.fillRect(0, 0, 16, 16, QColor("#66cccc"))
self.color.addItem(QIcon(pix), "66cccc")
painter.fillRect(0, 0, 16, 16, QColor("#77cc33"))
self.color.addItem(QIcon(pix), "77cc33")
painter.fillRect(0, 0, 16, 16, QColor("#669900"))
self.color.addItem(QIcon(pix), "669900")
painter.fillRect(0, 0, 16, 16, QColor("#336600"))
self.color.addItem(QIcon(pix), "336600")
painter.fillRect(0, 0, 16, 16, QColor("#666600"))
self.color.addItem(QIcon(pix), "666600")
painter.fillRect(0, 0, 16, 16, QColor("#cccc33"))
self.color.addItem(QIcon(pix), "cccc33")
painter.fillRect(0, 0, 16, 16, QColor("#ffff00"))
self.color.addItem(QIcon(pix), "ffff00")
painter.fillRect(0, 0, 16, 16, QColor("#ffcc33"))
self.color.addItem(QIcon(pix), "ffcc33")
painter.fillRect(0, 0, 16, 16, QColor("#ff9900"))
self.color.addItem(QIcon(pix), "ff9900")
painter.fillRect(0, 0, 16, 16, QColor("#ff6600"))
self.color.addItem(QIcon(pix), "ff6600")
painter.fillRect(0, 0, 16, 16, QColor("#cc6633"))
self.color.addItem(QIcon(pix), "cc6633")
painter.fillRect(0, 0, 16, 16, QColor("#996633"))
self.color.addItem(QIcon(pix), "996633")
painter.fillRect(0, 0, 16, 16, QColor("#663300"))
self.color.addItem(QIcon(pix), "663300")
painter.fillRect(0, 0, 16, 16, QColor("#000000"))
self.color.addItem(QIcon(pix), "000000")
painter.fillRect(0, 0, 16, 16, QColor("#999999"))
self.color.addItem(QIcon(pix), "999999")
painter.fillRect(0, 0, 16, 16, QColor("#cccccc"))
self.color.addItem(QIcon(pix), "cccccc")
painter.fillRect(0, 0, 16, 16, QColor("#ffffff"))
self.color.addItem(QIcon(pix), "ffffff")
painter.fillRect(0, 0, 16, 16, QColor("#424153"))
self.color.addItem(QIcon(pix), "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))
self.color.addItem(QIcon(pix), i)
self.color.addItem("不选择")
painter.end()
2 changes: 0 additions & 2 deletions earth_wallpaper/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,10 @@ def main():
datefmt='%H:%M:%S')
# 输出到文件
fh = logging.FileHandler(PlatformInfo.log_path())
fh.setLevel(logging.INFO)
fh.setFormatter(formatter)

# 输出到控制台
ch = logging.StreamHandler()
ch.setLevel(logging.INFO)
ch.setFormatter(formatter)

logger.addHandler(ch)
Expand Down

0 comments on commit e2eaa8a

Please sign in to comment.