- the application now uses only the default values from the app.options dict, the app.defaults dict holds the definitive default values
- fixed some outstanding issues from the PyQt6 port - PEP8 fixes - minor fixes - updated the saving of Preferences to update the self.options too: the `Apply` action will update the self.options but the `Save` action will save the updated preferences to the file on disk
This commit is contained in:
@@ -318,7 +318,7 @@ class ObjectCollection(QtCore.QAbstractItemModel):
|
||||
self.view.setContextMenuPolicy(QtCore.Qt.ContextMenuPolicy.CustomContextMenu)
|
||||
self.view.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.ExtendedSelection)
|
||||
|
||||
if self.app.defaults["global_allow_edit_in_project_tab"] is True:
|
||||
if self.app.options["global_allow_edit_in_project_tab"] is True:
|
||||
self.view.setEditTriggers(QtWidgets.QTreeView.EditTrigger.SelectedClicked) # allow Edit on Tree
|
||||
else:
|
||||
self.view.setEditTriggers(QtWidgets.QTreeView.EditTrigger.NoEditTriggers)
|
||||
@@ -482,8 +482,8 @@ class ObjectCollection(QtCore.QAbstractItemModel):
|
||||
return index.internalPointer().data(index.column())
|
||||
|
||||
if role == Qt.ItemDataRole.ForegroundRole:
|
||||
color = QColor(self.app.defaults['global_proj_item_color'][:-2])
|
||||
color_disabled = QColor(self.app.defaults['global_proj_item_dis_color'][:-2])
|
||||
color = QColor(self.app.options['global_proj_item_color'][:-2])
|
||||
color_disabled = QColor(self.app.options['global_proj_item_dis_color'][:-2])
|
||||
obj = index.internalPointer().obj
|
||||
if obj:
|
||||
return QtGui.QBrush(color) if obj.obj_options["plot"] else QtGui.QBrush(color_disabled)
|
||||
@@ -627,7 +627,7 @@ class ObjectCollection(QtCore.QAbstractItemModel):
|
||||
self.app.object_status_changed.emit(obj, 'append', name)
|
||||
|
||||
# decide if to show or hide the Notebook side of the screen
|
||||
if self.app.defaults["global_project_autohide"] is True:
|
||||
if self.app.options["global_project_autohide"] is True:
|
||||
# always open the notebook on object added to collection
|
||||
self.app.ui.splitter.setSizes([1, 1])
|
||||
|
||||
@@ -742,7 +742,7 @@ class ObjectCollection(QtCore.QAbstractItemModel):
|
||||
self.app.should_we_save = True
|
||||
|
||||
# decide if to show or hide the Notebook side of the screen
|
||||
if self.app.defaults["global_project_autohide"] is True:
|
||||
if self.app.options["global_project_autohide"] is True:
|
||||
# hide the notebook if there are no objects in the collection
|
||||
if not self.get_list():
|
||||
self.app.ui.splitter.setSizes([0, 1])
|
||||
@@ -796,7 +796,7 @@ class ObjectCollection(QtCore.QAbstractItemModel):
|
||||
self.app.should_we_save = True
|
||||
|
||||
# decide if to show or hide the Notebook side of the screen
|
||||
if self.app.defaults["global_project_autohide"] is True:
|
||||
if self.app.options["global_project_autohide"] is True:
|
||||
# hide the notebook if there are no objects in the collection
|
||||
if not self.get_list():
|
||||
self.app.ui.splitter.setSizes([0, 1])
|
||||
@@ -1014,7 +1014,7 @@ class ObjectCollection(QtCore.QAbstractItemModel):
|
||||
# works only for mouse button 1 (left click)
|
||||
if button == Qt.MouseButton.LeftButton:
|
||||
# on Gerber object selection it will redrawn on top of the other Gerber objects
|
||||
if self.app.defaults["gerber_plot_on_select"] is True:
|
||||
if self.app.options["gerber_plot_on_select"] is True:
|
||||
self.app.gerber_redraw()
|
||||
|
||||
def on_item_activated(self, index):
|
||||
|
||||
Reference in New Issue
Block a user