Skip to content

Commit 6e0ed87

Browse files
committed
qtvcp -stylesheet editor: add the config's preferred search path
Should search in the bare config folder and the preferred config folder/qtvcp/screens/SCREENNAME. I missed adding the second one.
1 parent 77c7740 commit 6e0ed87

1 file changed

Lines changed: 21 additions & 11 deletions

File tree

lib/python/qtvcp/widgets/stylesheeteditor.py

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,18 @@ def load_dialog(self):
9494
# in the users's config directory
9595
def setPath(self):
9696
model = self.styleSheetCombo.model()
97+
98+
# ad an 'As Loaded' entry to follow the preference file's entry
9799
self.loadedItem = QtGui.QStandardItem('As Loaded')
98100
self.loadedItem.setData( 'As Loaded', role = QtCore.Qt.UserRole + 1)
99101
model.appendRow(self.loadedItem)
102+
103+
# add 'None' to cancel all sylesheet changes
100104
item = QtGui.QStandardItem('None')
101105
item.setData( 'None', role = QtCore.Qt.UserRole + 1)
102106
model.appendRow(item)
103-
# check for default qss from qtvcp's default folders
107+
108+
# check for default/builtin styles from qtvcp's default folders
104109
if PATH.IS_SCREEN:
105110
DIR = PATH.SCREENDIR
106111
BNAME = PATH.BASENAME
@@ -117,16 +122,21 @@ def setPath(self):
117122
except Exception as e:
118123
print(e)
119124

120-
# check for qss in the users's config folder
121-
localqss = PATH.CONFIGPATH
122-
try:
123-
fileNames= [f for f in os.listdir(localqss) if f.endswith('.qss')]
124-
for i in(fileNames):
125-
item = QtGui.QStandardItem(i)
126-
item.setData(os.path.join(localqss, i), role = QtCore.Qt.UserRole + 1)
127-
model.appendRow(item)
128-
except Exception as e:
129-
print(e)
125+
# check for qss in the users's bare config folder
126+
localpath = [PATH.CONFIGPATH]
127+
128+
# add optional location in the users's config folder CONFIGFOLDER/qtvcp/screens/SCREENNAME
129+
localpath.append(os.path.join(PATH.CONFIGPATH, 'qtvcp/screens',PATH.BASEPATH))
130+
131+
for localqss in localpath:
132+
try:
133+
fileNames= [f for f in os.listdir(localqss) if f.endswith('.qss')]
134+
for i in(fileNames):
135+
item = QtGui.QStandardItem(i)
136+
item.setData(os.path.join(localqss, i), role = QtCore.Qt.UserRole + 1)
137+
model.appendRow(item)
138+
except Exception as e:
139+
print(e)
130140

131141
def selectionChanged(self,i):
132142
path = self.styleSheetCombo.itemData(i,role = QtCore.Qt.UserRole + 1)

0 commit comments

Comments
 (0)