Skip to content

Commit

Permalink
feat: added dark mode icons
Browse files Browse the repository at this point in the history
  • Loading branch information
ElpadoCan committed Jun 19, 2023
1 parent 2434f89 commit f15fd34
Show file tree
Hide file tree
Showing 136 changed files with 603,455 additions and 268,421 deletions.
24 changes: 20 additions & 4 deletions cellacdc/_test_all_icons.py
Expand Up @@ -4,14 +4,26 @@
from qtpy.QtGui import QIcon
from qtpy.QtCore import Qt, QSize
from qtpy.QtWidgets import (
QApplication, QPushButton, QStyleFactory, QWidget, QGridLayout
QApplication, QPushButton, QStyleFactory, QWidget, QGridLayout,
QCheckBox
)

cellacdc_path = os.path.dirname(os.path.abspath(__file__))
qrc_resources_light_path = os.path.join(cellacdc_path, 'qrc_resources_light.py')
qrc_resources_dark_path = os.path.join(cellacdc_path, 'qrc_resources_dark.py')
qrc_resources_path = os.path.join(cellacdc_path, 'qrc_resources.py')

SCHEME = 'dark'
if SCHEME == 'dark' and os.path.exists(qrc_resources_dark_path):
os.rename(qrc_resources_path, qrc_resources_light_path)
os.rename(qrc_resources_dark_path, qrc_resources_path)
elif SCHEME == 'light' and os.path.exists(qrc_resources_light_path):
os.rename(qrc_resources_path, qrc_resources_dark_path)
os.rename(qrc_resources_light_path, qrc_resources_path)


from cellacdc.load import get_all_svg_icons_aliases
from cellacdc._palettes import getPaletteColorScheme, setToolTipStyleSheet
import qrc_resources

SCHEME = 'dark' # 'light'

svg_aliases = get_all_svg_icons_aliases(sort=True)

Expand Down Expand Up @@ -47,8 +59,12 @@
button = QPushButton(alias)
button.setIcon(icon)
button.setIconSize(QSize(32,32))
button.setCheckable(True)
layout.addWidget(button, i, j)
idx += 1

checkbox = QCheckBox('Test checkbox')
layout.addWidget(checkbox, i, j+1)

win.showMaximized()
app.exec_()
2 changes: 1 addition & 1 deletion cellacdc/load.py
Expand Up @@ -2220,7 +2220,7 @@ def get_all_svg_icons_aliases(sort=True):
with open(resources_filepath, 'r') as resources_file:
resources_txt = resources_file.read()

aliases = re.findall('<file alias="(.+\.svg)">', resources_txt)
aliases = re.findall(r'<file alias="(.+\.svg)">', resources_txt)
if sort:
aliases = natsorted(aliases)
return aliases

0 comments on commit f15fd34

Please sign in to comment.