diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a9b0d2a..43ec64c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ CHANGELOG for FlatCAM beta ================================================= +9.08.2021 + +- wip in porting to PyQt6: fixed OptionalInput and OptionalHideInput GUI elements + 6.08.2021 - more changes due of porting to PyQt6 diff --git a/appEditors/AppTextEditor.py b/appEditors/AppTextEditor.py index ff314c0c..f847d677 100644 --- a/appEditors/AppTextEditor.py +++ b/appEditors/AppTextEditor.py @@ -6,7 +6,7 @@ # ########################################################## from appGUI.GUIElements import FCFileSaveDialog, FCEntry, FCTextAreaExtended, FCTextAreaLineNumber, FCButton, \ - FCGridLayout + FCGridLayout, FCCheckBox from PyQt6 import QtPrintSupport, QtWidgets, QtCore, QtGui from reportlab.platypus import SimpleDocTemplate, Paragraph @@ -106,7 +106,7 @@ class AppTextEditor(QtWidgets.QWidget): control_lay.addWidget(self.entryReplace) # Select All - self.sel_all_cb = QtWidgets.QCheckBox(_('All')) + self.sel_all_cb = FCCheckBox(_('All')) self.sel_all_cb.setToolTip(_("When checked it will replace all instances in the 'Find' box\n" "with the text in the 'Replace' box..")) control_lay.addWidget(self.sel_all_cb) diff --git a/appGUI/GUIElements.py b/appGUI/GUIElements.py index b9acdd38..95f5bf9a 100644 --- a/appGUI/GUIElements.py +++ b/appGUI/GUIElements.py @@ -69,7 +69,7 @@ class RadioSet(QtWidgets.QWidget): layout.setContentsMargins(0, 0, 0, 0) - if stretch is False: + if stretch is False or stretch is None: pass else: layout.addStretch() @@ -3430,8 +3430,7 @@ class OptionalInputSection: self.cb.stateChanged.connect(self.on_cb_change) def on_cb_change(self): - - if self.cb.checkState(): + if self.cb.checkState() is Qt.CheckState.Checked: for widget in self.optinputs: if self.logic is True: widget.setEnabled(True) @@ -3473,7 +3472,7 @@ class OptionalHideInputSection: def on_cb_change(self): - if self.cb.checkState(): + if self.cb.checkState() is Qt.CheckState.Checked: for widget in self.optinputs: if self.logic is True: widget.show() @@ -3737,12 +3736,12 @@ class FCTable(QtWidgets.QTableWidget): table_item = QtWidgets.QTableWidgetItem(col_data) else: old_item = self.cellWidget(row_index, column_index) - if isinstance(old_item, QtWidgets.QComboBox): + if isinstance(old_item, (QtWidgets.QComboBox, FCComboBox, FCComboBox2)): table_item = FCComboBox() items = [old_item.itemText(i) for i in range(old_item.count())] table_item.addItems(items) table_item.setCurrentIndex(old_item.currentIndex()) - elif isinstance(old_item, QtWidgets.QCheckBox): + elif isinstance(old_item, (QtWidgets.QCheckBox, FCCheckBox)): table_item = FCCheckBox() table_item.setChecked(old_item.isChecked()) table_item.setText(old_item.text()) @@ -3897,11 +3896,11 @@ class DialogBoxRadio(QtWidgets.QDialog): self.setWindowIcon(icon) self.setWindowTitle(str(title)) - grid0 = QtWidgets.QGridLayout(self) + grid0 = FCGridLayout(parent=self, h_spacing=5, v_spacing=5) grid0.setColumnStretch(0, 0) grid0.setColumnStretch(1, 1) - self.ref_label = QtWidgets.QLabel('%s:' % _("Reference")) + self.ref_label = FCLabel('%s:' % _("Reference")) self.ref_label.setToolTip( _("The reference can be:\n" "- Absolute -> the reference point is point (0,0)\n" diff --git a/appGUI/preferences/cncjob/CNCJobGenPrefGroupUI.py b/appGUI/preferences/cncjob/CNCJobGenPrefGroupUI.py index b4cb882b..ea908c83 100644 --- a/appGUI/preferences/cncjob/CNCJobGenPrefGroupUI.py +++ b/appGUI/preferences/cncjob/CNCJobGenPrefGroupUI.py @@ -30,7 +30,6 @@ class CNCJobGenPrefGroupUI(OptionsGroupUI): grid0.setColumnStretch(1, 1) # Plot CB - # self.plot_cb = QtWidgets.QCheckBox('Plot') self.plot_cb = FCCheckBox(_('Plot Object')) self.plot_cb.setToolTip(_("Plot (show) this object.")) grid0.addWidget(self.plot_cb, 0, 0, 1, 2) diff --git a/appPlugins/ToolOptimal.py b/appPlugins/ToolOptimal.py index 2fdbc0ca..c6791697 100644 --- a/appPlugins/ToolOptimal.py +++ b/appPlugins/ToolOptimal.py @@ -142,7 +142,7 @@ class ToolOptimal(AppTool): self.ui.locations_textb.clear() # new cursor - select all document cursor = self.ui.locations_textb.textCursor() - cursor.select(QtGui.QTextCursor.Document) + cursor.select(QtGui.QTextCursor.SelectionType.Document) # clear previous selection highlight tmp = cursor.blockFormat() @@ -316,7 +316,7 @@ class ToolOptimal(AppTool): def on_textbox_clicked(self): # new cursor - select all document cursor = self.ui.locations_textb.textCursor() - cursor.select(QtGui.QTextCursor.Document) + cursor.select(QtGui.QTextCursor.SelectionType.Document) # clear previous selection highlight tmp = cursor.blockFormat() @@ -325,11 +325,11 @@ class ToolOptimal(AppTool): # new cursor - select the current line cursor = self.ui.locations_textb.textCursor() - cursor.select(QtGui.QTextCursor.LineUnderCursor) + cursor.select(QtGui.QTextCursor.SelectionType.LineUnderCursor) # highlight the current selected line tmp = cursor.blockFormat() - tmp.setBackground(QtGui.QBrush(QtCore.Qt.yellow)) + tmp.setBackground(QtGui.QBrush(QtCore.Qt.GlobalColor.yellow)) cursor.setBlockFormat(tmp) self.selected_text = cursor.selectedText() @@ -345,7 +345,7 @@ class ToolOptimal(AppTool): def on_distances_textb_clicked(self): # new cursor - select all document cursor = self.ui.distances_textb.textCursor() - cursor.select(QtGui.QTextCursor.Document) + cursor.select(QtGui.QTextCursor.SelectionType.Document) # clear previous selection highlight tmp = cursor.blockFormat() @@ -354,11 +354,11 @@ class ToolOptimal(AppTool): # new cursor - select the current line cursor = self.ui.distances_textb.textCursor() - cursor.select(QtGui.QTextCursor.LineUnderCursor) + cursor.select(QtGui.QTextCursor.SelectionType.LineUnderCursor) # highlight the current selected line tmp = cursor.blockFormat() - tmp.setBackground(QtGui.QBrush(QtCore.Qt.yellow)) + tmp.setBackground(QtGui.QBrush(QtCore.Qt.GlobalColor.yellow)) cursor.setBlockFormat(tmp) distance_text = cursor.selectedText() @@ -376,7 +376,7 @@ class ToolOptimal(AppTool): def on_locations_sec_clicked(self): # new cursor - select all document cursor = self.ui.locations_sec_textb.textCursor() - cursor.select(QtGui.QTextCursor.Document) + cursor.select(QtGui.QTextCursor.SelectionType.Document) # clear previous selection highlight tmp = cursor.blockFormat() @@ -385,11 +385,11 @@ class ToolOptimal(AppTool): # new cursor - select the current line cursor = self.ui.locations_sec_textb.textCursor() - cursor.select(QtGui.QTextCursor.LineUnderCursor) + cursor.select(QtGui.QTextCursor.SelectionType.LineUnderCursor) # highlight the current selected line tmp = cursor.blockFormat() - tmp.setBackground(QtGui.QBrush(QtCore.Qt.yellow)) + tmp.setBackground(QtGui.QBrush(QtCore.Qt.GlobalColor.yellow)) cursor.setBlockFormat(tmp) self.selected_locations_text = cursor.selectedText() diff --git a/appPlugins/ToolPanelize.py b/appPlugins/ToolPanelize.py index e8e2926f..a69288e9 100644 --- a/appPlugins/ToolPanelize.py +++ b/appPlugins/ToolPanelize.py @@ -129,7 +129,6 @@ class Panelize(AppTool): self.clear_ui(self.layout) self.ui = PanelizeUI(layout=self.layout, app=self.app) self.pluginName = self.ui.pluginName - self.connect_signals_at_init() self.reset_fields() @@ -194,6 +193,8 @@ class Panelize(AppTool): self.on_type_obj_index_changed() self.on_type_box_index_changed() + self.connect_signals_at_init() + # Show/Hide Advanced Options app_mode = self.app.defaults["global_app_level"] self.change_level(app_mode) @@ -209,7 +210,8 @@ class Panelize(AppTool): if obj_type != 1: # not Excellon self.ui.panel_type_label.setDisabled(False) self.ui.panel_type_radio.setDisabled(False) - self.ui.on_panel_type(val=self.ui.panel_type_radio.get_value()) + panel_type = self.ui.panel_type_radio.get_value() + self.ui.on_panel_type(val=panel_type) else: self.ui.panel_type_label.setDisabled(True) self.ui.panel_type_radio.setDisabled(True) diff --git a/app_Main.py b/app_Main.py index 0ee9a676..350fea01 100644 --- a/app_Main.py +++ b/app_Main.py @@ -5377,7 +5377,7 @@ class App(QtCore.QObject): self.setWindowIcon(icon) self.setWindowTitle(str(title)) - grid0 = QtWidgets.QGridLayout(self) + grid0 = FCGridLayout(parent=self, h_spacing=5, v_spacing=5) self.ref_radio = RadioSet([ {"label": _("Quadrant 1"), "value": "bl"}, @@ -5648,7 +5648,7 @@ class App(QtCore.QObject): self.setWindowIcon(icon) self.setWindowTitle(str(title)) - grid0 = QtWidgets.QGridLayout(self) + grid0 = FCGridLayout(parent=self, h_spacing=5, v_spacing=5) self.ref_radio = RadioSet([ {"label": _("Bottom Left"), "value": "bl"},