1- VERSION = '008.048 '
1+ VERSION = '008.049 '
22LCNCVER = '2.10'
33DOCSVER = LCNCVER
44
@@ -799,9 +799,6 @@ def inverse_permutation(x_y_z3):
799799#########################################################################################################################
800800
801801 def make_hal_pins (self ):
802- self .colorFgPin = self .h .newpin ('color_fg' , hal .HAL_S32 , hal .HAL_OUT )
803- self .colorBgPin = self .h .newpin ('color_bg' , hal .HAL_S32 , hal .HAL_OUT )
804- self .colorBgAltPin = self .h .newpin ('color_bgalt' , hal .HAL_S32 , hal .HAL_OUT )
805802 self .consChangePin = self .h .newpin ('consumable_changing' , hal .HAL_BIT , hal .HAL_IN )
806803 self .convBlockLoaded = self .h .newpin ('conv_block_loaded' , hal .HAL_BIT , hal .HAL_IN )
807804 self .convTabDisable = self .h .newpin ('conv_disable' , hal .HAL_BIT , hal .HAL_IN )
@@ -6047,40 +6044,32 @@ def set_color_styles(self):
60476044 self .w .gcode_editor .editor .setCaretLineBackgroundColor (QColor (self .backColor ))
60486045
60496046 def standard_stylesheet (self ):
6050- # create stylesheet .qss file from template
6051- styleTemplateFile = os .path .join (self .PATHS .SCREENDIR , self .PATHS .BASEPATH , 'qtplasmac.style' )
6052- with open (styleTemplateFile , 'r' ) as inFile :
6053- with open (self .styleSheetFile , 'w' ) as outFile :
6054- for line in inFile :
6055- if 'foregnd' in line :
6056- outFile .write (line .replace ('foregnd' , self .w .color_foregrnd .styleSheet ().split (':' )[1 ].strip ()))
6057- self .colorFgPin .set (int (self .w .color_foregrnd .styleSheet ().split (':' )[1 ].strip ().lstrip ('#' ), 16 ))
6058- elif 'highlight' in line :
6059- outFile .write (line .replace ('highlight' , self .w .color_foregalt .styleSheet ().split (':' )[1 ].strip ()))
6060- elif 'l-e-d' in line :
6061- outFile .write (line .replace ('l-e-d' , self .w .color_led .styleSheet ().split (':' )[1 ].strip ()))
6062- elif 'backgnd' in line :
6063- outFile .write (line .replace ('backgnd' , self .w .color_backgrnd .styleSheet ().split (':' )[1 ].strip ()))
6064- self .colorBgPin .set (int (self .w .color_backgrnd .styleSheet ().split (':' )[1 ].strip ().lstrip ('#' ), 16 ))
6065- elif 'backalt' in line :
6066- outFile .write (line .replace ('backalt' , self .w .color_backgalt .styleSheet ().split (':' )[1 ].strip ()))
6067- self .colorBgAltPin .set (int (self .w .color_backgalt .styleSheet ().split (':' )[1 ].strip ().lstrip ('#' ), 16 ))
6068- elif 'frames' in line :
6069- outFile .write (line .replace ('frames' , self .w .color_frams .styleSheet ().split (':' )[1 ].strip ()))
6070- elif 'e-stop' in line :
6071- outFile .write (line .replace ('e-stop' , self .w .color_estop .styleSheet ().split (':' )[1 ].strip ()))
6072- elif 'inactive' in line :
6073- outFile .write (line .replace ('inactive' , self .w .color_disabled .styleSheet ().split (':' )[1 ].strip ()))
6074- elif 'prevu' in line :
6075- outFile .write (line .replace ('prevu' , self .w .color_preview .styleSheet ().split (':' )[1 ].strip ()))
6076- else :
6077- outFile .write (line )
6078-
6079- # append custom style if found
6080- if os .path .isfile (os .path .join (self .PATHS .CONFIGPATH , 'qtplasmac_custom.qss' )):
6081- with open (os .path .join (self .PATHS .CONFIGPATH , 'qtplasmac_custom.qss' ), 'r' ) as inFile :
6082- with open (self .styleSheetFile , 'a' ) as outFile :
6083- outFile .write (inFile .read ())
6047+ baseStyleFile = os .path .join (self .PATHS .SCREENDIR , self .PATHS .BASEPATH , 'qtplasmac.style' )
6048+ customStyleFile = os .path .join (self .PATHS .CONFIGPATH , 'qtplasmac_custom.qss' )
6049+ # Read in the base stylesheet file
6050+ with open (baseStyleFile , 'r' ) as inFile :
6051+ lines = inFile .readlines ()
6052+ # Append the base file with changes if custom stylesheet is found
6053+ if os .path .isfile (customStyleFile ):
6054+ with open (customStyleFile , 'r' ) as inFile :
6055+ lines += inFile .readlines ()
6056+ elementColorMap = {
6057+ 'backalt' : self .w .color_backgalt .styleSheet ().split (':' )[1 ].strip (),
6058+ 'backgnd' : self .w .color_backgrnd .styleSheet ().split (':' )[1 ].strip (),
6059+ 'e-stop' : self .w .color_estop .styleSheet ().split (':' )[1 ].strip (),
6060+ 'foregnd' : self .w .color_foregrnd .styleSheet ().split (':' )[1 ].strip (),
6061+ 'frames' : self .w .color_frams .styleSheet ().split (':' )[1 ].strip (),
6062+ 'highlight' : self .w .color_foregalt .styleSheet ().split (':' )[1 ].strip (),
6063+ 'inactive' : self .w .color_disabled .styleSheet ().split (':' )[1 ].strip (),
6064+ 'l-e-d' : self .w .color_led .styleSheet ().split (':' )[1 ].strip (),
6065+ 'prevu' : self .w .color_preview .styleSheet ().split (':' )[1 ].strip ()
6066+ }
6067+ with open (self .styleSheetFile , 'w' ) as outFile :
6068+ for line in lines :
6069+ for element , color in elementColorMap .items ():
6070+ if element in line :
6071+ line = line .replace (element , color )
6072+ outFile .write (line )
60846073
60856074 def custom_stylesheet (self ):
60866075 head = _translate ('HandlerClass' , 'Stylesheet Error' )
@@ -6092,18 +6081,15 @@ def custom_stylesheet(self):
60926081 if line .startswith ('color1' ):
60936082 colors [0 ] += 1
60946083 self .foreColor = QColor (line .split ('=' )[1 ].strip ()).name ()
6095- self .colorFgPin .set (int (QColor (line .split ('=' )[1 ].strip ()).name ().lstrip ('#' ), 16 ))
60966084 elif line .startswith ('color2' ):
60976085 colors [1 ] += 1
60986086 self .backColor = QColor (line .split ('=' )[1 ].strip ()).name ()
6099- self .colorBgPin .set (int (QColor (line .split ('=' )[1 ].strip ()).name ().lstrip ('#' ), 16 ))
61006087 elif line .startswith ('color3' ):
61016088 colors [2 ] += 1
61026089 self .fore1Color = QColor (line .split ('=' )[1 ].strip ()).name ()
61036090 elif line .startswith ('color4' ):
61046091 colors [3 ] += 1
61056092 self .back1Color = QColor (line .split ('=' )[1 ].strip ()).name ()
6106- self .colorBgAltPin .set (int (QColor (line .split ('=' )[1 ].strip ()).name ().lstrip ('#' ), 16 ))
61076093 elif line .startswith ('color5' ):
61086094 colors [4 ] += 1
61096095 self .disabledColor = QColor (line .split ('=' )[1 ].strip ()).name ()
0 commit comments