From 2165ebe419b5ff38e52353366701b6923ef16994 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Tue, 11 Jan 2022 23:21:18 +0200 Subject: [PATCH] - added an initial implementation of a dark theme using the qdarktheme (performance is not great and there are some artifacts); the theme is activated once the gray icons are checked in the Preferences --- CHANGELOG.md | 4 ++++ FlatCAM.py | 3 --- Makefile | 2 +- appGUI/GUIElements.py | 6 +++++- app_Main.py | 8 ++++++++ 5 files changed, 18 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 03fb56aa..de425bab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ CHANGELOG for FlatCAM beta ================================================= +11.01.2022 + +- added an initial implementation of a dark theme using the qdarktheme (performance is not great and there are some artifacts); the theme is activated once the gray icons are checked in the Preferences + 10.01.2022 - added a new feature in Preferences -> Gerber: a Layer Color Manager where the user can set and edit predefined colors for the Gerber objects: loading order matter diff --git a/FlatCAM.py b/FlatCAM.py index 39b4650d..95340601 100644 --- a/FlatCAM.py +++ b/FlatCAM.py @@ -11,7 +11,6 @@ from appGUI import VisPyPatches from multiprocessing import freeze_support # import copyreg # import types -# import qdarktheme MIN_VERSION_MAJOR = 3 MIN_VERSION_MINOR = 6 @@ -155,8 +154,6 @@ if __name__ == '__main__': style = QtWidgets.QStyleFactory.keys()[idx] app.setStyle(style) - # app.setStyleSheet(qdarktheme.load_stylesheet()) - fc = App(qapp=app) # interrupt the Qt loop such that Python events have a chance to be responsive diff --git a/Makefile b/Makefile index 7bda1647..a4b692de 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ ASSEST_PATH = assets/linux INSTALL_PATH = /usr/share/flatcam-beta APPS_PATH = /usr/share/applications -MIN_PY3_MINOR_VERSION := 5 +MIN_PY3_MINOR_VERSION := 6 PY3_MINOR_VERSION := $(shell python3 --version | cut -d'.' -f2) ifneq ($(MIN_PY3_MINOR_VERSION), $(firstword $(sort $(PY3_MINOR_VERSION) $(MIN_PY3_MINOR_VERSION)))) diff --git a/appGUI/GUIElements.py b/appGUI/GUIElements.py index 14beb510..a851347e 100644 --- a/appGUI/GUIElements.py +++ b/appGUI/GUIElements.py @@ -922,7 +922,11 @@ class FCColorEntry(QtWidgets.QFrame): # selected_color = color_dialog.getColor(initial=current_color, # options=QtWidgets.QColorDialog.ColorDialogOption.ShowAlphaChannel) - current_color.setAlpha(int(self._extract_alpha(value), 16)) + try: + current_color.setAlpha(int(self._extract_alpha(value), 16)) + except Exception: + current_color.setAlpha(255) + color_dialog.setCurrentColor(current_color) if color_dialog.exec() == QtWidgets.QDialog.DialogCode.Accepted: diff --git a/app_Main.py b/app_Main.py index 0ed6871b..a0dcc0b5 100644 --- a/app_Main.py +++ b/app_Main.py @@ -39,6 +39,8 @@ from multiprocessing.connection import Listener, Client from multiprocessing import Pool import socket +import qdarktheme + # #################################################################################################################### # ################################### Imports part of FlatCAM ############################################# # #################################################################################################################### @@ -1645,6 +1647,12 @@ class App(QtCore.QObject): "Please reboot the application to update.")) self.defaults.old_defaults_found = False + # ############################################################################################################# + # ######################################### DARK THEME ######################################################## + # ############################################################################################################# + if self.defaults["global_gray_icons"] is True: + self.qapp.setStyleSheet(qdarktheme.load_stylesheet()) + # ######################################### INIT FINISHED ####################################################### # ################################################################################################################# # #################################################################################################################