diff --git a/Bookmark.py b/Bookmark.py index ddb819b8..84814d17 100644 --- a/Bookmark.py +++ b/Bookmark.py @@ -78,17 +78,21 @@ class BookmarkManager(QtWidgets.QWidget): new_title_lbl = QtWidgets.QLabel('%s' % _("New Bookmark")) new_vlay.addWidget(new_title_lbl) - form0 = QtWidgets.QFormLayout() - new_vlay.addLayout(form0) + grid0 = QtWidgets.QGridLayout() + grid0.setColumnStretch(0, 0) + grid0.setColumnStretch(1, 1) + new_vlay.addLayout(grid0) title_lbl = QtWidgets.QLabel('%s:' % _("Title")) self.title_entry = FCEntry() - form0.addRow(title_lbl, self.title_entry) + grid0.addWidget(title_lbl, 0, 0) + grid0.addWidget(self.title_entry, 0, 1) link_lbl = QtWidgets.QLabel('%s:' % _("Web Link")) self.link_entry = FCEntry() self.link_entry.set_value('http://') - form0.addRow(link_lbl, self.link_entry) + grid0.addWidget(link_lbl, 2, 0) + grid0.addWidget(self.link_entry, 2, 1) # Buttons Layout button_hlay = QtWidgets.QHBoxLayout() diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e36cf4c..111fae22 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ CHANGELOG for FlatCAM beta - fixed the issue with not saving the project on program close if selecting the 'Yes' option. - all the logs done on Exception are now errors (with the exception of few places where the Exception is expected) - added the modifications made by Andre Spahlinger in PR #333 +- replaced all usages of QFormLayout with QGridLayout 30.12.2020 diff --git a/appEditors/AppGeoEditor.py b/appEditors/AppGeoEditor.py index 9cf6d5da..5e1bb3ca 100644 --- a/appEditors/AppGeoEditor.py +++ b/appEditors/AppGeoEditor.py @@ -81,15 +81,19 @@ class BufferSelectionTool(AppTool): self.buffer_tools_box.setContentsMargins(0, 0, 0, 0) self.buffer_tool_frame.setLayout(self.buffer_tools_box) - # Form Layout - form_layout = QtWidgets.QFormLayout() - self.buffer_tools_box.addLayout(form_layout) + # Grid Layout + grid_buffer = QtWidgets.QGridLayout() + grid_buffer.setColumnStretch(0, 0) + grid_buffer.setColumnStretch(1, 1) + self.buffer_tools_box.addLayout(grid_buffer) # Buffer distance self.buffer_distance_entry = FCDoubleSpinner() self.buffer_distance_entry.set_precision(self.decimals) self.buffer_distance_entry.set_range(0.0000, 9910000.0000) - form_layout.addRow('%s:' % _("Buffer distance"), self.buffer_distance_entry) + grid_buffer.addWidget(FCLabel('%s:' % _("Buffer distance")), 0, 0) + grid_buffer.addWidget(self.buffer_distance_entry, 0, 1) + self.buffer_corner_lbl = FCLabel('%s:' % _("Buffer corner")) self.buffer_corner_lbl.setToolTip( _("There are 3 types of corners:\n" @@ -101,11 +105,12 @@ class BufferSelectionTool(AppTool): self.buffer_corner_cb.addItem(_("Round")) self.buffer_corner_cb.addItem(_("Square")) self.buffer_corner_cb.addItem(_("Beveled")) - form_layout.addRow(self.buffer_corner_lbl, self.buffer_corner_cb) + grid_buffer.addWidget(self.buffer_corner_lbl, 2, 0) + grid_buffer.addWidget(self.buffer_corner_cb, 2, 1) # Buttons hlay = QtWidgets.QHBoxLayout() - self.buffer_tools_box.addLayout(hlay) + grid_buffer.addLayout(hlay, 4, 0, 1, 2) self.buffer_int_button = FCButton(_("Buffer Interior")) hlay.addWidget(self.buffer_int_button) @@ -113,12 +118,12 @@ class BufferSelectionTool(AppTool): hlay.addWidget(self.buffer_ext_button) hlay1 = QtWidgets.QHBoxLayout() - self.buffer_tools_box.addLayout(hlay1) + grid_buffer.addLayout(hlay1, 6, 0, 1, 2) self.buffer_button = FCButton(_("Full Buffer")) hlay1.addWidget(self.buffer_button) - self.layout.addStretch() + self.layout.addStretch(1) # Signals self.buffer_button.clicked.connect(self.on_buffer) @@ -249,9 +254,11 @@ class TextInputTool(AppTool): """) self.text_tools_box.addWidget(title_label) - # Form Layout - self.form_layout = QtWidgets.QFormLayout() - self.text_tools_box.addLayout(self.form_layout) + # Grid Layout + self.grid_text = QtWidgets.QGridLayout() + self.grid_text.setColumnStretch(0, 0) + self.grid_text.setColumnStretch(1, 1) + self.text_tools_box.addLayout(self.grid_text) # Font type if sys.platform == "win32": @@ -265,7 +272,8 @@ class TextInputTool(AppTool): self.font_type_cb = QtWidgets.QFontComboBox(self) self.font_type_cb.setCurrentFont(f_current) - self.form_layout.addRow(FCLabel('%s:' % _("Font")), self.font_type_cb) + self.grid_text.addWidget(FCLabel('%s:' % _("Font")), 0, 0) + self.grid_text.addWidget(self.font_type_cb, 0, 1) # Flag variables to show if font is bold, italic, both or none (regular) self.font_bold = False @@ -338,23 +346,23 @@ class TextInputTool(AppTool): self.font_italic_tb.setIcon(QtGui.QIcon(self.app.resource_location + '/italic32.png')) hlay.addWidget(self.font_italic_tb) - self.form_layout.addRow(FCLabel('%s:' % _("Size")), hlay) + self.grid_text.addWidget(FCLabel('%s:' % _("Size")), 2, 0) + self.grid_text.addLayout(hlay, 2, 1) # Text input + self.grid_text.addWidget(FCLabel('%s:' % _("Text")), 4, 0, 1, 2) + self.text_input_entry = FCTextAreaRich() self.text_input_entry.setTabStopWidth(12) self.text_input_entry.setMinimumHeight(200) # self.text_input_entry.setMaximumHeight(150) self.text_input_entry.setCurrentFont(f_current) self.text_input_entry.setFontPointSize(10) - self.form_layout.addRow(FCLabel('%s:' % _("Text")), self.text_input_entry) + self.grid_text.addWidget(self.text_input_entry, 6, 0, 1, 2) # Buttons - hlay1 = QtWidgets.QHBoxLayout() - self.form_layout.addRow("", hlay1) - hlay1.addStretch() self.apply_button = FCButton(_("Apply")) - hlay1.addWidget(self.apply_button) + self.grid_text.addWidget(self.apply_button, 8, 0, 1, 2) # self.layout.addStretch() diff --git a/appEditors/AppGerberEditor.py b/appEditors/AppGerberEditor.py index db6935c5..75cd87e9 100644 --- a/appEditors/AppGerberEditor.py +++ b/appEditors/AppGerberEditor.py @@ -6316,16 +6316,19 @@ class AppGerberEditorUI: ) self.buffer_tools_box.addWidget(buf_title_lbl) - # Form Layout - buf_form_layout = QtWidgets.QFormLayout() - self.buffer_tools_box.addLayout(buf_form_layout) + # Grid Layout + buff_grid = QtWidgets.QGridLayout() + buff_grid.setColumnStretch(0, 0) + buff_grid.setColumnStretch(1, 1) + self.buffer_tools_box.addLayout(buff_grid) # Buffer distance self.buffer_distance_entry = FCDoubleSpinner() self.buffer_distance_entry.set_precision(self.decimals) self.buffer_distance_entry.set_range(-10000.0000, 10000.0000) - buf_form_layout.addRow('%s:' % _("Buffer distance"), self.buffer_distance_entry) + buff_grid.addWidget(FCLabel('%s:' % _("Buffer distance")), 0 ,0 ) + buff_grid.addWidget(self.buffer_distance_entry, 0, 1) # Buffer Corner self.buffer_corner_lbl = FCLabel('%s:' % _("Buffer corner")) @@ -6339,12 +6342,13 @@ class AppGerberEditorUI: self.buffer_corner_cb.addItem(_("Round")) self.buffer_corner_cb.addItem(_("Square")) self.buffer_corner_cb.addItem(_("Beveled")) - buf_form_layout.addRow(self.buffer_corner_lbl, self.buffer_corner_cb) + buff_grid.addWidget(self.buffer_corner_lbl, 2, 0) + buff_grid.addWidget(self.buffer_corner_cb, 2, 1) separator_line = QtWidgets.QFrame() separator_line.setFrameShape(QtWidgets.QFrame.HLine) separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) - buf_form_layout.addRow(separator_line) + buff_grid.addWidget(separator_line, 4, 0, 1, 2) # Buttons hlay_buf = QtWidgets.QHBoxLayout() @@ -6372,9 +6376,11 @@ class AppGerberEditorUI: ) self.scale_tools_box.addWidget(scale_title_lbl) - # Form Layout - scale_form_layout = QtWidgets.QFormLayout() - self.scale_tools_box.addLayout(scale_form_layout) + # Grid Layout + scale_grid = QtWidgets.QGridLayout() + scale_grid.setColumnStretch(0, 0) + scale_grid.setColumnStretch(1, 1) + self.scale_tools_box.addLayout(scale_grid) self.scale_factor_lbl = FCLabel('%s:' % _("Scale factor")) self.scale_factor_lbl.setToolTip( @@ -6385,20 +6391,18 @@ class AppGerberEditorUI: self.scale_factor_entry.set_precision(self.decimals) self.scale_factor_entry.set_range(0.0000, 10000.0000) - scale_form_layout.addRow(self.scale_factor_lbl, self.scale_factor_entry) + scale_grid.addWidget(self.scale_factor_lbl, 0, 0) + scale_grid.addWidget(self.scale_factor_entry, 0, 1) separator_line = QtWidgets.QFrame() separator_line.setFrameShape(QtWidgets.QFrame.HLine) separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) - scale_form_layout.addRow(separator_line) + scale_grid.addWidget(separator_line, 2, 0, 1, 2) # Buttons - hlay_scale = QtWidgets.QHBoxLayout() - self.scale_tools_box.addLayout(hlay_scale) - self.scale_button = FCButton(_("Scale")) - self.scale_button.setIcon(QtGui.QIcon(self.app.resource_location + '/clean32.png')) - hlay_scale.addWidget(self.scale_button) + self.scale_button.setIcon(QtGui.QIcon(self.app.resource_location + '/scale32.png')) + scale_grid.addWidget(self.scale_button, 4, 0, 1, 2) # ############################################################################################################# # ######################################### Mark Area TOOL #################################################### @@ -6424,9 +6428,12 @@ class AppGerberEditorUI: self.ma_tools_box.addWidget(ma_title_lbl) # Form Layout - ma_form_layout = QtWidgets.QFormLayout() - self.ma_tools_box.addLayout(ma_form_layout) + mark_grid = QtWidgets.QGridLayout() + mark_grid.setColumnStretch(0, 0) + mark_grid.setColumnStretch(1, 1) + self.ma_tools_box.addLayout(mark_grid) + # Upper Threshold self.ma_upper_threshold_lbl = FCLabel('%s:' % _("Area UPPER threshold")) self.ma_upper_threshold_lbl.setToolTip( _("The threshold value, all areas less than this are marked.\n" @@ -6436,6 +6443,10 @@ class AppGerberEditorUI: self.ma_upper_threshold_entry.set_precision(self.decimals) self.ma_upper_threshold_entry.set_range(0, 10000) + mark_grid.addWidget(self.ma_upper_threshold_lbl, 0, 0) + mark_grid.addWidget(self.ma_upper_threshold_entry, 0, 1) + + # Lower Threshold self.ma_lower_threshold_lbl = FCLabel('%s:' % _("Area LOWER threshold")) self.ma_lower_threshold_lbl.setToolTip( _("The threshold value, all areas more than this are marked.\n" @@ -6445,12 +6456,12 @@ class AppGerberEditorUI: self.ma_lower_threshold_entry.set_precision(self.decimals) self.ma_lower_threshold_entry.set_range(0, 10000) - ma_form_layout.addRow(self.ma_lower_threshold_lbl, self.ma_lower_threshold_entry) - ma_form_layout.addRow(self.ma_upper_threshold_lbl, self.ma_upper_threshold_entry) + mark_grid.addWidget(self.ma_lower_threshold_lbl, 2, 0) + mark_grid.addWidget(self.ma_lower_threshold_entry, 2, 1) # Buttons hlay_ma = QtWidgets.QHBoxLayout() - self.ma_tools_box.addLayout(hlay_ma) + mark_grid.addLayout(hlay_ma, 4, 0, 1, 2) self.ma_threshold_button = FCButton(_("Mark")) self.ma_threshold_button.setIcon(QtGui.QIcon(self.app.resource_location + '/markarea32.png')) diff --git a/appGUI/GUIElements.py b/appGUI/GUIElements.py index cce7d2d3..a3649784 100644 --- a/appGUI/GUIElements.py +++ b/appGUI/GUIElements.py @@ -3859,7 +3859,9 @@ class DialogBoxRadio(QtWidgets.QDialog): self.setWindowIcon(icon) self.setWindowTitle(str(title)) - self.form = QtWidgets.QFormLayout(self) + grid0 = QtWidgets.QGridLayout(self) + grid0.setColumnStretch(0, 0) + grid0.setColumnStretch(1, 1) self.ref_label = QtWidgets.QLabel('%s:' % _("Reference")) self.ref_label.setToolTip( @@ -3872,12 +3874,13 @@ class DialogBoxRadio(QtWidgets.QDialog): {"label": _("Relative"), "value": "rel"} ], orientation='horizontal', stretch=False) self.ref_radio.set_value(reference) - self.form.addRow(self.ref_label, self.ref_radio) + grid0.addWidget(self.ref_label, 0, 0) + grid0.addWidget(self.ref_radio, 0, 1) - self.form.addRow(QtWidgets.QLabel('')) + grid0.addWidget(QtWidgets.QLabel(''), 2, 0, 1, 2) self.wdg_label = QtWidgets.QLabel('%s' % str(label)) - self.form.addRow(self.wdg_label) + grid0.addWidget(self.wdg_label, 4, 0, 1, 2) self.loc_label = QtWidgets.QLabel('%s:' % _("Location")) self.loc_label.setToolTip( @@ -3890,11 +3893,12 @@ class DialogBoxRadio(QtWidgets.QDialog): self.lineEdit.setText(str(self.location).replace('(', '').replace(')', '')) self.lineEdit.selectAll() self.lineEdit.setFocus() - self.form.addRow(self.loc_label, self.lineEdit) + grid0.addWidget(self.loc_label, 6, 0) + grid0.addWidget(self.lineEdit, 6, 1) self.button_box = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel, orientation=Qt.Horizontal, parent=self) - self.form.addRow(self.button_box) + grid0.addWidget(self.button_box, 8, 0, 1, 2) self.button_box.button(QtWidgets.QDialogButtonBox.Ok).setText(_("Ok")) self.button_box.button(QtWidgets.QDialogButtonBox.Cancel).setText(_("Cancel")) diff --git a/appGUI/ObjectUI.py b/appGUI/ObjectUI.py index 5fd40918..fac1074d 100644 --- a/appGUI/ObjectUI.py +++ b/appGUI/ObjectUI.py @@ -2910,11 +2910,14 @@ class DocumentObjectUI(ObjectUI): h_lay.addStretch() # ############################################################## - # ############ FORM LAYOUT ##################################### + # ############ Grid LAYOUT ##################################### # ############################################################## - self.form_box = QtWidgets.QFormLayout() - self.custom_box.addLayout(self.form_box) + self.grid0 = QtWidgets.QGridLayout() + self.grid0.setColumnStretch(0, 0) + self.grid0.setColumnStretch(1, 1) + self.grid0.setColumnStretch(2, 0) + self.custom_box.addLayout(self.grid0) # Font self.font_type_label = FCLabel('%s:' % _("Font Type")) @@ -2931,27 +2934,27 @@ class DocumentObjectUI(ObjectUI): self.font_type_cb = QtWidgets.QFontComboBox(self) self.font_type_cb.setCurrentFont(f_current) - self.form_box.addRow(self.font_type_label, self.font_type_cb) + self.grid0.addWidget(self.font_type_label, 0, 0) + self.grid0.addWidget(self.font_type_cb, 0, 1) # Font Size self.font_size_label = FCLabel('%s:' % _("Font Size")) + size_hlay = QtWidgets.QHBoxLayout() + self.font_size_cb = FCComboBox() self.font_size_cb.setEditable(True) self.font_size_cb.setMinimumContentsLength(3) - self.font_size_cb.setMaximumWidth(70) + # self.font_size_cb.setMaximumWidth(70) font_sizes = ['6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '18', '20', '22', '24', '26', '28', '32', '36', '40', '44', '48', '54', '60', '66', '72', '80', '88', '96'] - for i in font_sizes: - self.font_size_cb.addItem(i) + self.font_size_cb.addItems(font_sizes) - size_hlay = QtWidgets.QHBoxLayout() size_hlay.addWidget(self.font_size_cb) - size_hlay.addStretch() self.font_bold_tb = QtWidgets.QToolButton() self.font_bold_tb.setCheckable(True) @@ -2967,7 +2970,8 @@ class DocumentObjectUI(ObjectUI): self.font_under_tb.setIcon(QtGui.QIcon(self.resource_loc + '/underline32.png')) size_hlay.addWidget(self.font_under_tb) - self.form_box.addRow(self.font_size_label, size_hlay) + self.grid0.addWidget(self.font_size_label, 2, 0) + self.grid0.addLayout(size_hlay, 2, 1) # Alignment Choices self.alignment_label = FCLabel('%s:' % _("Alignment")) @@ -2994,39 +2998,48 @@ class DocumentObjectUI(ObjectUI): self.al_justify_tb.setIcon(QtGui.QIcon(self.resource_loc + '/align_justify32.png')) al_hlay.addWidget(self.al_justify_tb) - self.form_box.addRow(self.alignment_label, al_hlay) + al_hlay.addStretch() + + self.grid0.addWidget(self.alignment_label, 4, 0) + self.grid0.addLayout(al_hlay, 4, 1) # Font Color self.font_color_label = FCLabel('%s:' % _('Font Color')) self.font_color_label.setToolTip( _("Set the font color for the selected text") ) + + self.grid0_child_1 = QtWidgets.QHBoxLayout() + self.font_color_entry = FCEntry() self.font_color_button = FCButton() self.font_color_button.setFixedSize(15, 15) - self.form_box_child_1 = QtWidgets.QHBoxLayout() - self.form_box_child_1.addWidget(self.font_color_entry) - self.form_box_child_1.addWidget(self.font_color_button) - self.form_box_child_1.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) + self.grid0_child_1.addWidget(self.font_color_entry) + self.grid0_child_1.addWidget(self.font_color_button) + self.grid0_child_1.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) - self.form_box.addRow(self.font_color_label, self.form_box_child_1) + self.grid0.addWidget(self.font_color_label, 6, 0) + self.grid0.addLayout(self.grid0_child_1, 6, 1) # Selection Color self.sel_color_label = FCLabel('%s:' % _('Selection Color')) self.sel_color_label.setToolTip( _("Set the selection color when doing text selection.") ) + + self.grid0_child_2 = QtWidgets.QHBoxLayout() + self.sel_color_entry = FCEntry() self.sel_color_button = FCButton() self.sel_color_button.setFixedSize(15, 15) - self.form_box_child_2 = QtWidgets.QHBoxLayout() - self.form_box_child_2.addWidget(self.sel_color_entry) - self.form_box_child_2.addWidget(self.sel_color_button) - self.form_box_child_2.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) + self.grid0_child_2.addWidget(self.sel_color_entry) + self.grid0_child_2.addWidget(self.sel_color_button) + self.grid0_child_2.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) - self.form_box.addRow(self.sel_color_label, self.form_box_child_2) + self.grid0.addWidget(self.sel_color_label, 8, 0) + self.grid0.addLayout(self.grid0_child_2, 8, 1) # Tab size self.tab_size_label = FCLabel('%s:' % _('Tab Size')) @@ -3036,8 +3049,9 @@ class DocumentObjectUI(ObjectUI): self.tab_size_spinner = FCSpinner(callback=self.confirmation_message_int) self.tab_size_spinner.set_range(0, 1000) - self.form_box.addRow(self.tab_size_label, self.tab_size_spinner) + self.grid0.addWidget(self.tab_size_label, 10, 0) + self.grid0.addWidget(self.tab_size_spinner, 10, 1) - self.custom_box.addStretch() + self.custom_box.addStretch(1) # end of file diff --git a/appGUI/preferences/excellon/ExcellonExpPrefGroupUI.py b/appGUI/preferences/excellon/ExcellonExpPrefGroupUI.py index 38a44159..395738a1 100644 --- a/appGUI/preferences/excellon/ExcellonExpPrefGroupUI.py +++ b/appGUI/preferences/excellon/ExcellonExpPrefGroupUI.py @@ -34,8 +34,10 @@ class ExcellonExpPrefGroupUI(OptionsGroupUI): ) self.layout.addWidget(self.export_options_label) - form = QtWidgets.QFormLayout() - self.layout.addLayout(form) + grid0 = QtWidgets.QGridLayout() + grid0.setColumnStretch(0, 0) + grid0.setColumnStretch(1, 1) + self.layout.addLayout(grid0) # Excellon Units self.excellon_units_label = FCLabel('%s:' % _('Units')) @@ -49,7 +51,8 @@ class ExcellonExpPrefGroupUI(OptionsGroupUI): _("The units used in the Excellon file.") ) - form.addRow(self.excellon_units_label, self.excellon_units_radio) + grid0.addWidget(self.excellon_units_label, 0, 0) + grid0.addWidget(self.excellon_units_radio, 0, 1) # Excellon non-decimal format self.digits_label = FCLabel("%s:" % _("Int/Decimals")) @@ -85,7 +88,8 @@ class ExcellonExpPrefGroupUI(OptionsGroupUI): hlay1.addWidget(self.format_dec_entry, QtCore.Qt.AlignLeft) hlay1.addStretch() - form.addRow(self.digits_label, hlay1) + grid0.addWidget(self.digits_label, 2, 0) + grid0.addLayout(hlay1, 2, 1) # Select the Excellon Format self.format_label = FCLabel("%s:" % _("Format")) @@ -108,7 +112,8 @@ class ExcellonExpPrefGroupUI(OptionsGroupUI): "or TZ = trailing zeros are kept.") ) - form.addRow(self.format_label, self.format_radio) + grid0.addWidget(self.format_label, 4, 0) + grid0.addWidget(self.format_radio, 4, 1) # Excellon Zeros self.zeros_label = FCLabel('%s:' % _('Zeros')) @@ -131,7 +136,8 @@ class ExcellonExpPrefGroupUI(OptionsGroupUI): "and Leading Zeros are removed.") ) - form.addRow(self.zeros_label, self.zeros_radio) + grid0.addWidget(self.zeros_label, 6, 0) + grid0.addWidget(self.zeros_radio, 6, 1) # Slot type self.slot_type_label = FCLabel('%s:' % _('Slot type')) @@ -154,9 +160,12 @@ class ExcellonExpPrefGroupUI(OptionsGroupUI): "using the Drilled slot command (G85).") ) - form.addRow(self.slot_type_label, self.slot_type_radio) + grid0.addWidget(self.slot_type_label, 8, 0) + grid0.addWidget(self.slot_type_radio, 8, 1) - self.layout.addStretch() + self.layout.addStretch(1) + + # Signals self.format_radio.activated_custom.connect(self.optimization_selection) def optimization_selection(self): diff --git a/appGUI/preferences/gerber/GerberExpPrefGroupUI.py b/appGUI/preferences/gerber/GerberExpPrefGroupUI.py index f900ea52..144d3819 100644 --- a/appGUI/preferences/gerber/GerberExpPrefGroupUI.py +++ b/appGUI/preferences/gerber/GerberExpPrefGroupUI.py @@ -35,8 +35,10 @@ class GerberExpPrefGroupUI(OptionsGroupUI): ) self.layout.addWidget(self.export_options_label) - form = QtWidgets.QFormLayout() - self.layout.addLayout(form) + grid0 = QtWidgets.QGridLayout() + grid0.setColumnStretch(0, 0) + grid0.setColumnStretch(1, 1) + self.layout.addLayout(grid0) # Gerber Units self.gerber_units_label = FCLabel('%s:' % _('Units')) @@ -50,7 +52,8 @@ class GerberExpPrefGroupUI(OptionsGroupUI): _("The units used in the Gerber file.") ) - form.addRow(self.gerber_units_label, self.gerber_units_radio) + grid0.addWidget(self.gerber_units_label, 0, 0) + grid0.addWidget(self.gerber_units_radio, 0, 1) # Gerber format self.digits_label = FCLabel("%s:" % _("Int/Decimals")) @@ -90,7 +93,8 @@ class GerberExpPrefGroupUI(OptionsGroupUI): hlay1.addWidget(self.format_dec_entry, QtCore.Qt.AlignLeft) hlay1.addStretch() - form.addRow(self.digits_label, hlay1) + grid0.addWidget(self.digits_label, 2, 0) + grid0.addLayout(hlay1, 2, 1) # Gerber Zeros self.zeros_label = FCLabel('%s:' % _('Zeros')) @@ -113,6 +117,7 @@ class GerberExpPrefGroupUI(OptionsGroupUI): "and Leading Zeros are kept.") ) - form.addRow(self.zeros_label, self.zeros_radio) + grid0.addWidget(self.zeros_label, 4, 0) + grid0.addWidget(self.zeros_radio, 4, 1) self.layout.addStretch() diff --git a/appGUI/preferences/tools/Tools2RulesCheckPrefGroupUI.py b/appGUI/preferences/tools/Tools2RulesCheckPrefGroupUI.py index be5c28b8..31b60a26 100644 --- a/appGUI/preferences/tools/Tools2RulesCheckPrefGroupUI.py +++ b/appGUI/preferences/tools/Tools2RulesCheckPrefGroupUI.py @@ -35,19 +35,21 @@ class Tools2RulesCheckPrefGroupUI(OptionsGroupUI): self.layout.addWidget(self.crlabel) # Form Layout - self.form_layout_1 = QtWidgets.QFormLayout() - self.layout.addLayout(self.form_layout_1) + self.grid0 = QtWidgets.QGridLayout() + self.grid0.setColumnStretch(0, 0) + self.grid0.setColumnStretch(1, 1) + self.layout.addLayout(self.grid0) # Trace size self.trace_size_cb = FCCheckBox('%s:' % _("Trace Size")) self.trace_size_cb.setToolTip( _("This checks if the minimum size for traces is met.") ) - self.form_layout_1.addRow(self.trace_size_cb) + self.grid0.addWidget(self.trace_size_cb, 0, 0, 1, 2) # Trace size value self.trace_size_entry = FCDoubleSpinner() - self.trace_size_entry.set_range(0.00001, 999.99999) + self.trace_size_entry.set_range(0.0000, 10000.0000) self.trace_size_entry.set_precision(self.decimals) self.trace_size_entry.setSingleStep(0.1) @@ -55,7 +57,8 @@ class Tools2RulesCheckPrefGroupUI(OptionsGroupUI): self.trace_size_lbl.setToolTip( _("Minimum acceptable trace size.") ) - self.form_layout_1.addRow(self.trace_size_lbl, self.trace_size_entry) + self.grid0.addWidget(self.trace_size_lbl, 2, 0) + self.grid0.addWidget(self.trace_size_entry, 2, 1) # Copper2copper clearance self.clearance_copper2copper_cb = FCCheckBox('%s:' % _("Copper to Copper clearance")) @@ -63,11 +66,11 @@ class Tools2RulesCheckPrefGroupUI(OptionsGroupUI): _("This checks if the minimum clearance between copper\n" "features is met.") ) - self.form_layout_1.addRow(self.clearance_copper2copper_cb) + self.grid0.addWidget(self.clearance_copper2copper_cb, 4, 0, 1, 2) # Copper2copper clearance value self.clearance_copper2copper_entry = FCDoubleSpinner() - self.clearance_copper2copper_entry.set_range(0.00001, 999.99999) + self.clearance_copper2copper_entry.set_range(0.0000, 10000.0000) self.clearance_copper2copper_entry.set_precision(self.decimals) self.clearance_copper2copper_entry.setSingleStep(0.1) @@ -75,7 +78,8 @@ class Tools2RulesCheckPrefGroupUI(OptionsGroupUI): self.clearance_copper2copper_lbl.setToolTip( _("Minimum acceptable clearance value.") ) - self.form_layout_1.addRow(self.clearance_copper2copper_lbl, self.clearance_copper2copper_entry) + self.grid0.addWidget(self.clearance_copper2copper_lbl, 6, 0) + self.grid0.addWidget(self.clearance_copper2copper_entry, 6, 1) # Copper2outline clearance self.clearance_copper2ol_cb = FCCheckBox('%s:' % _("Copper to Outline clearance")) @@ -83,11 +87,11 @@ class Tools2RulesCheckPrefGroupUI(OptionsGroupUI): _("This checks if the minimum clearance between copper\n" "features and the outline is met.") ) - self.form_layout_1.addRow(self.clearance_copper2ol_cb) + self.grid0.addWidget(self.clearance_copper2ol_cb, 8, 0, 1, 2) # Copper2outline clearance value self.clearance_copper2ol_entry = FCDoubleSpinner() - self.clearance_copper2ol_entry.set_range(0.00001, 999.99999) + self.clearance_copper2ol_entry.set_range(0.0000, 10000.0000) self.clearance_copper2ol_entry.set_precision(self.decimals) self.clearance_copper2ol_entry.setSingleStep(0.1) @@ -95,7 +99,8 @@ class Tools2RulesCheckPrefGroupUI(OptionsGroupUI): self.clearance_copper2ol_lbl.setToolTip( _("Minimum acceptable clearance value.") ) - self.form_layout_1.addRow(self.clearance_copper2ol_lbl, self.clearance_copper2ol_entry) + self.grid0.addWidget(self.clearance_copper2ol_lbl, 10, 0) + self.grid0.addWidget(self.clearance_copper2ol_entry, 10, 1) # Silkscreen2silkscreen clearance self.clearance_silk2silk_cb = FCCheckBox('%s:' % _("Silk to Silk Clearance")) @@ -103,11 +108,11 @@ class Tools2RulesCheckPrefGroupUI(OptionsGroupUI): _("This checks if the minimum clearance between silkscreen\n" "features and silkscreen features is met.") ) - self.form_layout_1.addRow(self.clearance_silk2silk_cb) + self.grid0.addWidget(self.clearance_silk2silk_cb, 12, 0, 1, 2) # Copper2silkscreen clearance value self.clearance_silk2silk_entry = FCDoubleSpinner() - self.clearance_silk2silk_entry.set_range(0.00001, 999.99999) + self.clearance_silk2silk_entry.set_range(0.0000, 10000.0000) self.clearance_silk2silk_entry.set_precision(self.decimals) self.clearance_silk2silk_entry.setSingleStep(0.1) @@ -115,7 +120,8 @@ class Tools2RulesCheckPrefGroupUI(OptionsGroupUI): self.clearance_silk2silk_lbl.setToolTip( _("Minimum acceptable clearance value.") ) - self.form_layout_1.addRow(self.clearance_silk2silk_lbl, self.clearance_silk2silk_entry) + self.grid0.addWidget(self.clearance_silk2silk_lbl, 14, 0) + self.grid0.addWidget(self.clearance_silk2silk_entry, 14, 1) # Silkscreen2soldermask clearance self.clearance_silk2sm_cb = FCCheckBox('%s:' % _("Silk to Solder Mask Clearance")) @@ -123,11 +129,11 @@ class Tools2RulesCheckPrefGroupUI(OptionsGroupUI): _("This checks if the minimum clearance between silkscreen\n" "features and soldermask features is met.") ) - self.form_layout_1.addRow(self.clearance_silk2sm_cb) + self.grid0.addWidget(self.clearance_silk2sm_cb, 16, 0, 1, 2) # Silkscreen2soldermask clearance value self.clearance_silk2sm_entry = FCDoubleSpinner() - self.clearance_silk2sm_entry.set_range(0.00001, 999.99999) + self.clearance_silk2sm_entry.set_range(0.0000, 10000.0000) self.clearance_silk2sm_entry.set_precision(self.decimals) self.clearance_silk2sm_entry.setSingleStep(0.1) @@ -135,7 +141,8 @@ class Tools2RulesCheckPrefGroupUI(OptionsGroupUI): self.clearance_silk2sm_lbl.setToolTip( _("Minimum acceptable clearance value.") ) - self.form_layout_1.addRow(self.clearance_silk2sm_lbl, self.clearance_silk2sm_entry) + self.grid0.addWidget(self.clearance_silk2sm_lbl, 18, 0) + self.grid0.addWidget(self.clearance_silk2sm_entry, 18, 1) # Silk2outline clearance self.clearance_silk2ol_cb = FCCheckBox('%s:' % _("Silk to Outline Clearance")) @@ -143,11 +150,11 @@ class Tools2RulesCheckPrefGroupUI(OptionsGroupUI): _("This checks if the minimum clearance between silk\n" "features and the outline is met.") ) - self.form_layout_1.addRow(self.clearance_silk2ol_cb) + self.grid0.addWidget(self.clearance_silk2ol_cb, 20, 0, 1, 2) # Silk2outline clearance value self.clearance_silk2ol_entry = FCDoubleSpinner() - self.clearance_silk2ol_entry.set_range(0.00001, 999.99999) + self.clearance_silk2ol_entry.set_range(0.0000, 10000.0000) self.clearance_silk2ol_entry.set_precision(self.decimals) self.clearance_silk2ol_entry.setSingleStep(0.1) @@ -155,7 +162,8 @@ class Tools2RulesCheckPrefGroupUI(OptionsGroupUI): self.clearance_silk2ol_lbl.setToolTip( _("Minimum acceptable clearance value.") ) - self.form_layout_1.addRow(self.clearance_silk2ol_lbl, self.clearance_silk2ol_entry) + self.grid0.addWidget(self.clearance_silk2ol_lbl, 22, 0) + self.grid0.addWidget(self.clearance_silk2ol_entry, 22, 1) # Soldermask2soldermask clearance self.clearance_sm2sm_cb = FCCheckBox('%s:' % _("Minimum Solder Mask Sliver")) @@ -163,11 +171,11 @@ class Tools2RulesCheckPrefGroupUI(OptionsGroupUI): _("This checks if the minimum clearance between soldermask\n" "features and soldermask features is met.") ) - self.form_layout_1.addRow(self.clearance_sm2sm_cb) + self.grid0.addWidget(self.clearance_sm2sm_cb, 24, 0, 1, 2) # Soldermask2soldermask clearance value self.clearance_sm2sm_entry = FCDoubleSpinner() - self.clearance_sm2sm_entry.set_range(0.00001, 999.99999) + self.clearance_sm2sm_entry.set_range(0.0000, 10000.0000) self.clearance_sm2sm_entry.set_precision(self.decimals) self.clearance_sm2sm_entry.setSingleStep(0.1) @@ -175,7 +183,8 @@ class Tools2RulesCheckPrefGroupUI(OptionsGroupUI): self.clearance_sm2sm_lbl.setToolTip( _("Minimum acceptable clearance value.") ) - self.form_layout_1.addRow(self.clearance_sm2sm_lbl, self.clearance_sm2sm_entry) + self.grid0.addWidget(self.clearance_sm2sm_lbl, 26, 0) + self.grid0.addWidget(self.clearance_sm2sm_entry, 26, 1) # Ring integrity check self.ring_integrity_cb = FCCheckBox('%s:' % _("Minimum Annular Ring")) @@ -183,11 +192,11 @@ class Tools2RulesCheckPrefGroupUI(OptionsGroupUI): _("This checks if the minimum copper ring left by drilling\n" "a hole into a pad is met.") ) - self.form_layout_1.addRow(self.ring_integrity_cb) + self.grid0.addWidget(self.ring_integrity_cb, 28, 0, 1, 2) # Ring integrity value self.ring_integrity_entry = FCDoubleSpinner() - self.ring_integrity_entry.set_range(0.00001, 999.99999) + self.ring_integrity_entry.set_range(0.0000, 10000.0000) self.ring_integrity_entry.set_precision(self.decimals) self.ring_integrity_entry.setSingleStep(0.1) @@ -195,9 +204,10 @@ class Tools2RulesCheckPrefGroupUI(OptionsGroupUI): self.ring_integrity_lbl.setToolTip( _("Minimum acceptable ring value.") ) - self.form_layout_1.addRow(self.ring_integrity_lbl, self.ring_integrity_entry) + self.grid0.addWidget(self.ring_integrity_lbl, 30, 0) + self.grid0.addWidget(self.ring_integrity_entry, 30, 1) - self.form_layout_1.addRow(FCLabel("")) + self.grid0.addWidget(FCLabel(''), 32, 0, 1, 2) # Hole2Hole clearance self.clearance_d2d_cb = FCCheckBox('%s:' % _("Hole to Hole Clearance")) @@ -205,11 +215,11 @@ class Tools2RulesCheckPrefGroupUI(OptionsGroupUI): _("This checks if the minimum clearance between a drill hole\n" "and another drill hole is met.") ) - self.form_layout_1.addRow(self.clearance_d2d_cb) + self.grid0.addWidget(self.clearance_d2d_cb, 34, 0, 1, 2) # Hole2Hole clearance value self.clearance_d2d_entry = FCDoubleSpinner() - self.clearance_d2d_entry.set_range(0.00001, 999.99999) + self.clearance_d2d_entry.set_range(0.0000, 10000.0000) self.clearance_d2d_entry.set_precision(self.decimals) self.clearance_d2d_entry.setSingleStep(0.1) @@ -217,7 +227,8 @@ class Tools2RulesCheckPrefGroupUI(OptionsGroupUI): self.clearance_d2d_lbl.setToolTip( _("Minimum acceptable drill size.") ) - self.form_layout_1.addRow(self.clearance_d2d_lbl, self.clearance_d2d_entry) + self.grid0.addWidget(self.clearance_d2d_lbl, 36, 0) + self.grid0.addWidget(self.clearance_d2d_entry, 36, 1) # Drill holes size check self.drill_size_cb = FCCheckBox('%s:' % _("Hole Size")) @@ -225,11 +236,11 @@ class Tools2RulesCheckPrefGroupUI(OptionsGroupUI): _("This checks if the drill holes\n" "sizes are above the threshold.") ) - self.form_layout_1.addRow(self.drill_size_cb) + self.grid0.addWidget(self.drill_size_cb, 38, 0, 1, 2) # Drile holes value self.drill_size_entry = FCDoubleSpinner() - self.drill_size_entry.set_range(0.00001, 999.99999) + self.drill_size_entry.set_range(0.0000, 10000.0000) self.drill_size_entry.set_precision(self.decimals) self.drill_size_entry.setSingleStep(0.1) @@ -237,6 +248,7 @@ class Tools2RulesCheckPrefGroupUI(OptionsGroupUI): self.drill_size_lbl.setToolTip( _("Minimum acceptable clearance value.") ) - self.form_layout_1.addRow(self.drill_size_lbl, self.drill_size_entry) + self.grid0.addWidget(self.drill_size_lbl, 40, 0) + self.grid0.addWidget(self.drill_size_entry, 40, 1) - self.layout.addStretch() + self.layout.addStretch(1) diff --git a/appTools/ToolCalculators.py b/appTools/ToolCalculators.py index 35556a3a..92a1b4b4 100644 --- a/appTools/ToolCalculators.py +++ b/appTools/ToolCalculators.py @@ -452,63 +452,70 @@ class CalcUI: grid_units_layout.addWidget(self.mm_entry, 1, 0) grid_units_layout.addWidget(self.inch_entry, 1, 1) - # ############################## - # ## V-shape Tool Calculator ### - # ############################## + # ############################################################################################################# + # ################################ V-shape Tool Calculator #################################################### + # ############################################################################################################# + grid_vshape = QtWidgets.QGridLayout() + grid_vshape.setColumnStretch(0, 0) + grid_vshape.setColumnStretch(1, 1) + self.layout.addLayout(grid_vshape) + self.v_shape_spacer_label = FCLabel(" ") - self.layout.addWidget(self.v_shape_spacer_label) + grid_vshape.addWidget(self.v_shape_spacer_label, 0, 0, 1, 2) # ## Title of the V-shape Tools Calculator v_shape_title_label = FCLabel("%s" % self.v_shapeName) - self.layout.addWidget(v_shape_title_label) - - # ## Form Layout - form_layout = QtWidgets.QFormLayout() - self.layout.addLayout(form_layout) + grid_vshape.addWidget(v_shape_title_label, 2, 0, 1, 2) + # Tip Diameter self.tipDia_label = FCLabel('%s:' % _("Tip Diameter")) + self.tipDia_label.setToolTip( + _("This is the tool tip diameter.\n" + "It is specified by manufacturer.") + ) + self.tipDia_entry = FCDoubleSpinner(callback=self.confirmation_message) self.tipDia_entry.set_precision(self.decimals) self.tipDia_entry.set_range(0.0, 10000.0000) self.tipDia_entry.setSingleStep(0.1) - # self.tipDia_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) - self.tipDia_label.setToolTip( - _("This is the tool tip diameter.\n" - "It is specified by manufacturer.") - ) + grid_vshape.addWidget(self.tipDia_label, 4, 0) + grid_vshape.addWidget(self.tipDia_entry, 4, 1) + + # Tip Angle self.tipAngle_label = FCLabel('%s:' % _("Tip Angle")) + self.tipAngle_label.setToolTip(_("This is the angle of the tip of the tool.\n" + "It is specified by manufacturer.")) + self.tipAngle_entry = FCSpinner(callback=self.confirmation_message_int) self.tipAngle_entry.set_range(0, 180) self.tipAngle_entry.set_step(5) - # self.tipAngle_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) - self.tipAngle_label.setToolTip(_("This is the angle of the tip of the tool.\n" - "It is specified by manufacturer.")) + grid_vshape.addWidget(self.tipAngle_label, 6, 0) + grid_vshape.addWidget(self.tipAngle_entry, 6, 1) + # Cut Z self.cutDepth_label = FCLabel('%s:' % _("Cut Z")) + self.cutDepth_label.setToolTip(_("This is the depth to cut into the material.\n" + "In the CNCJob is the CutZ parameter.")) + self.cutDepth_entry = FCDoubleSpinner(callback=self.confirmation_message) self.cutDepth_entry.set_range(-10000.0000, 10000.0000) self.cutDepth_entry.set_precision(self.decimals) - # self.cutDepth_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) - self.cutDepth_label.setToolTip(_("This is the depth to cut into the material.\n" - "In the CNCJob is the CutZ parameter.")) + grid_vshape.addWidget(self.cutDepth_label, 8, 0) + grid_vshape.addWidget(self.cutDepth_entry, 8, 1) + # Tool Diameter self.effectiveToolDia_label = FCLabel('%s:' % _("Tool Diameter")) - self.effectiveToolDia_entry = FCDoubleSpinner(callback=self.confirmation_message) - self.effectiveToolDia_entry.set_precision(self.decimals) - - # self.effectiveToolDia_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) self.effectiveToolDia_label.setToolTip(_("This is the tool diameter to be entered into\n" "FlatCAM Gerber section.\n" "In the CNCJob section it is called >Tool dia<.")) - # self.effectiveToolDia_entry.setEnabled(False) + self.effectiveToolDia_entry = FCDoubleSpinner(callback=self.confirmation_message) + self.effectiveToolDia_entry.set_precision(self.decimals) - form_layout.addRow(self.tipDia_label, self.tipDia_entry) - form_layout.addRow(self.tipAngle_label, self.tipAngle_entry) - form_layout.addRow(self.cutDepth_label, self.cutDepth_entry) - form_layout.addRow(self.effectiveToolDia_label, self.effectiveToolDia_entry) + grid_vshape.addWidget(self.effectiveToolDia_label, 10, 0) + grid_vshape.addWidget(self.effectiveToolDia_entry, 10, 1) # ## Buttons self.calculate_vshape_button = FCButton(_("Calculate")) @@ -519,13 +526,17 @@ class CalcUI: "depending on which is desired and which is known. ") ) - self.layout.addWidget(self.calculate_vshape_button) + grid_vshape.addWidget(self.calculate_vshape_button, 12, 0, 1, 2) - # #################################### - # ## ElectroPlating Tool Calculator ## - # #################################### + # ############################################################################################################# + # ############################## ElectroPlating Tool Calculator ############################################### + # ############################################################################################################# + grid_electro = QtWidgets.QGridLayout() + grid_electro.setColumnStretch(0, 0) + grid_electro.setColumnStretch(1, 1) + self.layout.addLayout(grid_electro) - self.layout.addWidget(FCLabel("")) + grid_electro.addWidget(FCLabel(""), 0, 0, 1, 2) # ## Title of the ElectroPlating Tools Calculator plate_title_label = FCLabel("%s" % self.eplateName) @@ -533,13 +544,7 @@ class CalcUI: _("This calculator is useful for those who plate the via/pad/drill holes,\n" "using a method like graphite ink or calcium hypophosphite ink or palladium chloride.") ) - self.layout.addWidget(plate_title_label) - - # ## Plate Form Layout - grid2 = QtWidgets.QGridLayout() - grid2.setColumnStretch(0, 0) - grid2.setColumnStretch(1, 1) - self.layout.addLayout(grid2) + grid_electro.addWidget(plate_title_label, 2, 0, 1, 2) # Area Calculation self.area_sel_label = FCLabel('%s:' % _("Area Calculation")) @@ -551,8 +556,8 @@ class CalcUI: {"label": _("Area"), "value": "a"} ], stretch=False) - grid2.addWidget(self.area_sel_label, 0, 0) - grid2.addWidget(self.area_sel_radio, 1, 0, 1, 2) + grid_electro.addWidget(self.area_sel_label, 4, 0) + grid_electro.addWidget(self.area_sel_radio, 6, 0, 1, 2) # BOARD LENGTH self.pcblengthlabel = FCLabel('%s:' % _("Board Length")) @@ -569,8 +574,8 @@ class CalcUI: l_hlay.addWidget(self.pcblength_entry) l_hlay.addWidget(self.length_unit) - grid2.addWidget(self.pcblengthlabel, 2, 0) - grid2.addLayout(l_hlay, 2, 1) + grid_electro.addWidget(self.pcblengthlabel, 8, 0) + grid_electro.addLayout(l_hlay, 8, 1) # BOARD WIDTH self.pcbwidthlabel = FCLabel('%s:' % _("Board Width")) @@ -587,8 +592,8 @@ class CalcUI: w_hlay.addWidget(self.pcbwidth_entry) w_hlay.addWidget(self.width_unit) - grid2.addWidget(self.pcbwidthlabel, 4, 0) - grid2.addLayout(w_hlay, 4, 1) + grid_electro.addWidget(self.pcbwidthlabel, 10, 0) + grid_electro.addLayout(w_hlay, 10, 1) # AREA self.area_label = FCLabel('%s:' % _("Area")) @@ -605,13 +610,13 @@ class CalcUI: a_hlay.addWidget(self.area_entry) a_hlay.addWidget(self.area_unit) - grid2.addWidget(self.area_label, 6, 0) - grid2.addLayout(a_hlay, 6, 1) + grid_electro.addWidget(self.area_label, 12, 0) + grid_electro.addLayout(a_hlay, 12, 1) separator_line = QtWidgets.QFrame() separator_line.setFrameShape(QtWidgets.QFrame.HLine) separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) - grid2.addWidget(separator_line, 7, 0, 1, 2) + grid_electro.addWidget(separator_line, 14, 0, 1, 2) # DENSITY self.cdensity_label = FCLabel('%s:' % _("Current Density")) @@ -630,8 +635,8 @@ class CalcUI: d_hlay.addWidget(self.cdensity_entry) d_hlay.addWidget(density_unit) - grid2.addWidget(self.cdensity_label, 8, 0) - grid2.addLayout(d_hlay, 8, 1) + grid_electro.addWidget(self.cdensity_label, 16, 0) + grid_electro.addLayout(d_hlay, 16, 1) # COPPER GROWTH self.growth_label = FCLabel('%s:' % _("Copper Growth")) @@ -650,8 +655,8 @@ class CalcUI: g_hlay.addWidget(self.growth_entry) g_hlay.addWidget(growth_unit) - grid2.addWidget(self.growth_label, 10, 0) - grid2.addLayout(g_hlay, 10, 1) + grid_electro.addWidget(self.growth_label, 18, 0) + grid_electro.addLayout(g_hlay, 18, 1) # CURRENT self.cvaluelabel = FCLabel('%s:' % _("Current Value")) @@ -671,8 +676,8 @@ class CalcUI: c_hlay.addWidget(self.cvalue_entry) c_hlay.addWidget(current_unit) - grid2.addWidget(self.cvaluelabel, 12, 0) - grid2.addLayout(c_hlay, 12, 1) + grid_electro.addWidget(self.cvaluelabel, 20, 0) + grid_electro.addLayout(c_hlay, 20, 1) # TIME self.timelabel = FCLabel('%s:' % _("Time")) @@ -692,8 +697,8 @@ class CalcUI: t_hlay.addWidget(self.time_entry) t_hlay.addWidget(time_unit) - grid2.addWidget(self.timelabel, 14, 0) - grid2.addLayout(t_hlay, 14, 1) + grid_electro.addWidget(self.timelabel, 22, 0) + grid_electro.addLayout(t_hlay, 22, 1) # ## Buttons self.calculate_plate_button = FCButton(_("Calculate")) @@ -702,9 +707,9 @@ class CalcUI: _("Calculate the current intensity value and the procedure time,\n" "depending on the parameters above") ) - self.layout.addWidget(self.calculate_plate_button) + grid_electro.addWidget(self.calculate_plate_button, 24, 0, 1, 2) - self.layout.addStretch() + self.layout.addStretch(1) # ## Reset Tool self.reset_button = FCButton(_("Reset Tool")) diff --git a/appTools/ToolDistanceMin.py b/appTools/ToolDistanceMin.py index 725a7429..11ad4dce 100644 --- a/appTools/ToolDistanceMin.py +++ b/appTools/ToolDistanceMin.py @@ -7,7 +7,7 @@ from PyQt5 import QtWidgets, QtCore from appTool import AppTool -from appGUI.GUIElements import FCEntry +from appGUI.GUIElements import FCEntry, FCLabel, FCButton from shapely.ops import nearest_points from shapely.geometry import Point, MultiPolygon @@ -239,95 +239,121 @@ class DistMinUI: self.units = self.app.defaults['units'].lower() # ## Title - title_label = QtWidgets.QLabel("%s
" % self.toolName) + title_label = FCLabel("%s
" % self.toolName) self.layout.addWidget(title_label) - # ## Form Layout - form_layout = QtWidgets.QFormLayout() - self.layout.addLayout(form_layout) - - self.units_label = QtWidgets.QLabel('%s:' % _("Units")) + # ## Grid Layout + grid0 = QtWidgets.QGridLayout() + grid0.setColumnStretch(0, 0) + grid0.setColumnStretch(1, 1) + self.layout.addLayout(grid0) + + # Units + self.units_label = FCLabel('%s:' % _("Units")) self.units_label.setToolTip(_("Those are the units in which the distance is measured.")) - self.units_value = QtWidgets.QLabel("%s" % str({'mm': _("METRIC (mm)"), 'in': _("INCH (in)")}[self.units])) + self.units_value = FCLabel("%s" % str({'mm': _("METRIC (mm)"), 'in': _("INCH (in)")}[self.units])) self.units_value.setDisabled(True) - self.start_label = QtWidgets.QLabel("%s:" % _('First object point')) + grid0.addWidget(self.units_label, 0, 0) + grid0.addWidget(self.units_value, 0, 1) + + # Start + self.start_label = FCLabel("%s:" % _('First object point')) self.start_label.setToolTip(_("This is first object point coordinates.\n" "This is the start point for measuring distance.")) - self.stop_label = QtWidgets.QLabel("%s:" % _('Second object point')) - self.stop_label.setToolTip(_("This is second object point coordinates.\n" - "This is the end point for measuring distance.")) - - self.distance_x_label = QtWidgets.QLabel('%s:' % _("Dx")) - self.distance_x_label.setToolTip(_("This is the distance measured over the X axis.")) - - self.distance_y_label = QtWidgets.QLabel('%s:' % _("Dy")) - self.distance_y_label.setToolTip(_("This is the distance measured over the Y axis.")) - - self.angle_label = QtWidgets.QLabel('%s:' % _("Angle")) - self.angle_label.setToolTip(_("This is orientation angle of the measuring line.")) - - self.total_distance_label = QtWidgets.QLabel("%s:" % _('DISTANCE')) - self.total_distance_label.setToolTip(_("This is the point to point Euclidean distance.")) - - self.half_point_label = QtWidgets.QLabel("%s:" % _('Half Point')) - self.half_point_label.setToolTip(_("This is the middle point of the point to point Euclidean distance.")) - self.start_entry = FCEntry() self.start_entry.setReadOnly(True) self.start_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) self.start_entry.setToolTip(_("This is first object point coordinates.\n" "This is the start point for measuring distance.")) + grid0.addWidget(self.start_label, 2, 0) + grid0.addWidget(self.start_entry, 2, 1) + + # Stop + self.stop_label = FCLabel("%s:" % _('Second object point')) + self.stop_label.setToolTip(_("This is second object point coordinates.\n" + "This is the end point for measuring distance.")) + self.stop_entry = FCEntry() self.stop_entry.setReadOnly(True) self.stop_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) self.stop_entry.setToolTip(_("This is second object point coordinates.\n" "This is the end point for measuring distance.")) + grid0.addWidget(self.stop_label, 4, 0) + grid0.addWidget(self.stop_entry, 4, 1) + + # DX + self.distance_x_label = FCLabel('%s:' % _("Dx")) + self.distance_x_label.setToolTip(_("This is the distance measured over the X axis.")) + self.distance_x_entry = FCEntry() self.distance_x_entry.setReadOnly(True) self.distance_x_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) self.distance_x_entry.setToolTip(_("This is the distance measured over the X axis.")) + grid0.addWidget(self.distance_x_label, 6, 0) + grid0.addWidget(self.distance_x_entry, 6, 1) + + # DY + self.distance_y_label = FCLabel('%s:' % _("Dy")) + self.distance_y_label.setToolTip(_("This is the distance measured over the Y axis.")) + self.distance_y_entry = FCEntry() self.distance_y_entry.setReadOnly(True) self.distance_y_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) self.distance_y_entry.setToolTip(_("This is the distance measured over the Y axis.")) + grid0.addWidget(self.distance_y_label, 8, 0) + grid0.addWidget(self.distance_y_entry, 8, 1) + + # Angle + self.angle_label = FCLabel('%s:' % _("Angle")) + self.angle_label.setToolTip(_("This is orientation angle of the measuring line.")) + self.angle_entry = FCEntry() self.angle_entry.setReadOnly(True) self.angle_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) self.angle_entry.setToolTip(_("This is orientation angle of the measuring line.")) + grid0.addWidget(self.angle_label, 10, 0) + grid0.addWidget(self.angle_entry, 10, 1) + + # Total Distance + self.total_distance_label = FCLabel("%s:" % _('DISTANCE')) + self.total_distance_label.setToolTip(_("This is the point to point Euclidean distance.")) + self.total_distance_entry = FCEntry() self.total_distance_entry.setReadOnly(True) self.total_distance_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) self.total_distance_entry.setToolTip(_("This is the point to point Euclidean distance.")) + grid0.addWidget(self.total_distance_label, 12, 0) + grid0.addWidget(self.total_distance_entry, 12, 1) + + # Half Point + self.half_point_label = FCLabel("%s:" % _('Half Point')) + self.half_point_label.setToolTip(_("This is the middle point of the point to point Euclidean distance.")) + self.half_point_entry = FCEntry() self.half_point_entry.setReadOnly(True) self.half_point_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) self.half_point_entry.setToolTip(_("This is the middle point of the point to point Euclidean distance.")) - self.measure_btn = QtWidgets.QPushButton(_("Measure")) - self.layout.addWidget(self.measure_btn) + grid0.addWidget(self.half_point_label, 14, 0) + grid0.addWidget(self.half_point_entry, 14, 1) + + self.measure_btn = FCButton(_("Measure")) + grid0.addWidget(self.measure_btn, 16, 0, 1, 2) - self.jump_hp_btn = QtWidgets.QPushButton(_("Jump to Half Point")) - self.layout.addWidget(self.jump_hp_btn) + self.jump_hp_btn = FCButton(_("Jump to Half Point")) self.jump_hp_btn.setDisabled(True) + + grid0.addWidget(self.jump_hp_btn, 18, 0, 1, 2) - form_layout.addRow(self.units_label, self.units_value) - form_layout.addRow(self.start_label, self.start_entry) - form_layout.addRow(self.stop_label, self.stop_entry) - form_layout.addRow(self.distance_x_label, self.distance_x_entry) - form_layout.addRow(self.distance_y_label, self.distance_y_entry) - form_layout.addRow(self.angle_label, self.angle_entry) - form_layout.addRow(self.total_distance_label, self.total_distance_entry) - form_layout.addRow(self.half_point_label, self.half_point_entry) - - self.layout.addStretch() + self.layout.addStretch(1) # #################################### FINSIHED GUI ########################### # ############################################################################# diff --git a/appTools/ToolImage.py b/appTools/ToolImage.py index ecbfc877..836b02ba 100644 --- a/appTools/ToolImage.py +++ b/appTools/ToolImage.py @@ -8,7 +8,7 @@ from PyQt5 import QtGui, QtWidgets from appTool import AppTool -from appGUI.GUIElements import RadioSet, FCComboBox, FCSpinner +from appGUI.GUIElements import RadioSet, FCComboBox, FCSpinner, FCLabel import os @@ -114,7 +114,7 @@ class ToolImage(AppTool): filename, _f = QtWidgets.QFileDialog.getOpenFileName(caption=_("Import IMAGE"), directory=self.app.get_last_folder(), filter=_filter) except TypeError: - filename, _f = QtWidgets.QFileDialog.getOpenFileName(caption=_("Import IMAGE"), filter=filter) + filename, _f = QtWidgets.QFileDialog.getOpenFileName(caption=_("Import IMAGE"), filter=_filter) filename = str(filename) type_obj = self.ui.tf_type_obj_combo.get_value() @@ -166,6 +166,7 @@ class ToolImage(AppTool): return def obj_init(geo_obj, app_obj): + app_obj.log.debug("ToolIamge.import_image() -> importing image as geometry") geo_obj.import_image(filename, units=units, dpi=dpi, mode=mode, mask=mask) geo_obj.multigeo = False @@ -194,7 +195,7 @@ class ImageUI: self.layout = layout # ## Title - title_label = QtWidgets.QLabel("%s" % self.toolName) + title_label = FCLabel("%s" % self.toolName) title_label.setStyleSheet(""" QLabel { @@ -204,9 +205,11 @@ class ImageUI: """) self.layout.addWidget(title_label) - # Form Layout - ti_form_layout = QtWidgets.QFormLayout() - self.layout.addLayout(ti_form_layout) + # Grid Layout + grid0 = QtWidgets.QGridLayout() + grid0.setColumnStretch(0, 0) + grid0.setColumnStretch(1, 1) + self.layout.addLayout(grid0) # Type of object to create for the image self.tf_type_obj_combo = FCComboBox() @@ -215,45 +218,44 @@ class ImageUI: self.tf_type_obj_combo.setItemIcon(0, QtGui.QIcon(self.app.resource_location + "/flatcam_icon16.png")) self.tf_type_obj_combo.setItemIcon(1, QtGui.QIcon(self.app.resource_location + "/geometry16.png")) - self.tf_type_obj_combo_label = QtWidgets.QLabel('%s:' % _("Object Type")) + self.tf_type_obj_combo_label = FCLabel('%s:' % _("Object Type")) self.tf_type_obj_combo_label.setToolTip( _("Specify the type of object to create from the image.\n" "It can be of type: Gerber or Geometry.") ) - ti_form_layout.addRow(self.tf_type_obj_combo_label, self.tf_type_obj_combo) + grid0.addWidget(self.tf_type_obj_combo_label, 0, 0) + grid0.addWidget(self.tf_type_obj_combo, 0, 1) # DPI value of the imported image self.dpi_entry = FCSpinner(callback=self.confirmation_message_int) self.dpi_entry.set_range(0, 99999) - self.dpi_label = QtWidgets.QLabel('%s:' % _("DPI value")) + self.dpi_label = FCLabel('%s:' % _("DPI value")) self.dpi_label.setToolTip(_("Specify a DPI value for the image.")) - ti_form_layout.addRow(self.dpi_label, self.dpi_entry) + grid0.addWidget(self.dpi_label, 2, 0) + grid0.addWidget(self.dpi_entry, 2, 1) - self.emty_lbl = QtWidgets.QLabel("") - self.layout.addWidget(self.emty_lbl) + grid0.addWidget(FCLabel(''), 4, 0, 1, 2) - self.detail_label = QtWidgets.QLabel("%s:" % _('Level of detail')) - self.layout.addWidget(self.detail_label) - - ti2_form_layout = QtWidgets.QFormLayout() - self.layout.addLayout(ti2_form_layout) + self.detail_label = FCLabel("%s:" % _('Level of detail')) + grid0.addWidget(self.detail_label, 6, 0, 1, 2) # Type of image interpretation self.image_type = RadioSet([{'label': 'B/W', 'value': 'black'}, {'label': 'Color', 'value': 'color'}]) - self.image_type_label = QtWidgets.QLabel("%s:" % _('Image type')) + self.image_type_label = FCLabel("%s:" % _('Image type')) self.image_type_label.setToolTip( _("Choose a method for the image interpretation.\n" "B/W means a black & white image. Color means a colored image.") ) - ti2_form_layout.addRow(self.image_type_label, self.image_type) + grid0.addWidget(self.image_type_label, 8, 0) + grid0.addWidget(self.image_type, 8, 1) # Mask value of the imported image when image monochrome self.mask_bw_entry = FCSpinner(callback=self.confirmation_message_int) self.mask_bw_entry.set_range(0, 255) - self.mask_bw_label = QtWidgets.QLabel("%s B/W:" % _('Mask value')) + self.mask_bw_label = FCLabel("%s B/W:" % _('Mask value')) self.mask_bw_label.setToolTip( _("Mask for monochrome image.\n" "Takes values between [0 ... 255].\n" @@ -262,55 +264,59 @@ class ImageUI: "0 means no detail and 255 means everything \n" "(which is totally black).") ) - ti2_form_layout.addRow(self.mask_bw_label, self.mask_bw_entry) + grid0.addWidget(self.mask_bw_label, 10, 0) + grid0.addWidget(self.mask_bw_entry, 10, 1) # Mask value of the imported image for RED color when image color self.mask_r_entry = FCSpinner(callback=self.confirmation_message_int) self.mask_r_entry.set_range(0, 255) - self.mask_r_label = QtWidgets.QLabel("%s R:" % _('Mask value')) + self.mask_r_label = FCLabel("%s R:" % _('Mask value')) self.mask_r_label.setToolTip( _("Mask for RED color.\n" "Takes values between [0 ... 255].\n" "Decides the level of details to include\n" "in the resulting geometry.") ) - ti2_form_layout.addRow(self.mask_r_label, self.mask_r_entry) + grid0.addWidget(self.mask_r_label, 12, 0) + grid0.addWidget(self.mask_r_entry, 12, 1) # Mask value of the imported image for GREEN color when image color self.mask_g_entry = FCSpinner(callback=self.confirmation_message_int) self.mask_g_entry.set_range(0, 255) - self.mask_g_label = QtWidgets.QLabel("%s G:" % _('Mask value')) + self.mask_g_label = FCLabel("%s G:" % _('Mask value')) self.mask_g_label.setToolTip( _("Mask for GREEN color.\n" "Takes values between [0 ... 255].\n" "Decides the level of details to include\n" "in the resulting geometry.") ) - ti2_form_layout.addRow(self.mask_g_label, self.mask_g_entry) + grid0.addWidget(self.mask_g_label, 14, 0) + grid0.addWidget(self.mask_g_entry, 14, 1) # Mask value of the imported image for BLUE color when image color self.mask_b_entry = FCSpinner(callback=self.confirmation_message_int) self.mask_b_entry.set_range(0, 255) - self.mask_b_label = QtWidgets.QLabel("%s B:" % _('Mask value')) + self.mask_b_label = FCLabel("%s B:" % _('Mask value')) self.mask_b_label.setToolTip( _("Mask for BLUE color.\n" "Takes values between [0 ... 255].\n" "Decides the level of details to include\n" "in the resulting geometry.") ) - ti2_form_layout.addRow(self.mask_b_label, self.mask_b_entry) + grid0.addWidget(self.mask_b_label, 16, 0) + grid0.addWidget(self.mask_b_entry, 16, 1) # Buttons self.import_button = QtWidgets.QPushButton(_("Import image")) self.import_button.setToolTip( _("Open a image of raster type and then import it in FlatCAM.") ) - self.layout.addWidget(self.import_button) + grid0.addWidget(self.import_button, 18, 0, 1, 2) - self.layout.addStretch() + self.layout.addStretch(1) self.on_image_type(val=False) diff --git a/appTools/ToolNCC.py b/appTools/ToolNCC.py index 8b2e0569..fa1037a8 100644 --- a/appTools/ToolNCC.py +++ b/appTools/ToolNCC.py @@ -4120,9 +4120,11 @@ class NccUI: self.level.setCheckable(True) self.title_box.addWidget(self.level) - # ## Form Layout - form_layout = QtWidgets.QFormLayout() - self.tools_box.addLayout(form_layout) + # ## Grid Layout + grid0 = QtWidgets.QGridLayout() + grid0.setColumnStretch(0, 0) + grid0.setColumnStretch(1, 1) + self.tools_box.addLayout(grid0) self.type_obj_combo_label = FCLabel('%s:' % _("Type")) self.type_obj_combo_label.setToolTip( @@ -4136,7 +4138,8 @@ class NccUI: self.type_obj_radio = RadioSet([{'label': _("Geometry"), 'value': 'geometry'}, {'label': _("Gerber"), 'value': 'gerber'}]) - form_layout.addRow(self.type_obj_combo_label, self.type_obj_radio) + grid0.addWidget(self.type_obj_combo_label, 0, 0) + grid0.addWidget(self.type_obj_radio, 0, 1) # ################################################ # ##### The object to be copper cleaned ########## @@ -4150,12 +4153,12 @@ class NccUI: # self.object_label = FCLabel('%s:' % _("Object")) # self.object_label.setToolTip(_("Object to be cleared of excess copper.")) - form_layout.addRow(self.object_combo) + grid0.addWidget(self.object_combo, 2, 0, 1, 2) separator_line = QtWidgets.QFrame() separator_line.setFrameShape(QtWidgets.QFrame.HLine) separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) - self.tools_box.addWidget(separator_line) + grid0.addWidget(separator_line, 4, 0, 1, 2) # ### Tools ## ## self.tools_table_label = FCLabel('%s' % _('Tools Table')) @@ -4163,10 +4166,10 @@ class NccUI: _("Tools pool from which the algorithm\n" "will pick the ones used for copper clearing.") ) - self.tools_box.addWidget(self.tools_table_label) + grid0.addWidget(self.tools_table_label, 6, 0, 1, 2) self.tools_table = FCTable(drag_drop=True) - self.tools_box.addWidget(self.tools_table) + grid0.addWidget(self.tools_table, 8, 0, 1, 2) self.tools_table.setColumnCount(4) # 3rd column is reserved (and hidden) for the tool ID @@ -4207,9 +4210,9 @@ class NccUI: # "- Clear -> the regular non-copper clearing.")) grid1 = QtWidgets.QGridLayout() - self.tools_box.addLayout(grid1) grid1.setColumnStretch(0, 0) grid1.setColumnStretch(1, 1) + self.tools_box.addLayout(grid1) # Tool order self.ncc_order_label = FCLabel('%s:' % _('Tool order')) diff --git a/appTools/ToolOptimal.py b/appTools/ToolOptimal.py index 10bf16a9..8b9d77bc 100644 --- a/appTools/ToolOptimal.py +++ b/appTools/ToolOptimal.py @@ -425,9 +425,11 @@ class OptimalUI: self.layout.addWidget(title_label) self.layout.addWidget(FCLabel("")) - # ## Form Layout - form_lay = QtWidgets.QFormLayout() - self.layout.addLayout(form_lay) + # ## Grid Layout + grid0 = QtWidgets.QGridLayout() + grid0.setColumnStretch(0, 0) + grid0.setColumnStretch(1, 1) + self.layout.addLayout(grid0) # ## Gerber Object to mirror self.gerber_object_combo = FCComboBox() @@ -440,13 +442,13 @@ class OptimalUI: self.gerber_object_label.setToolTip( "Gerber object for which to find the minimum distance between copper features." ) - form_lay.addRow(self.gerber_object_label) - form_lay.addRow(self.gerber_object_combo) + grid0.addWidget(self.gerber_object_label, 0, 0, 1, 2) + grid0.addWidget(self.gerber_object_combo, 2, 0, 1, 2) separator_line = QtWidgets.QFrame() separator_line.setFrameShape(QtWidgets.QFrame.HLine) separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) - form_lay.addRow(separator_line) + grid0.addWidget(separator_line, 4, 0, 1, 2) # Precision = nr of decimals self.precision_label = FCLabel('%s:' % _("Precision")) @@ -455,12 +457,13 @@ class OptimalUI: self.precision_spinner = FCSpinner(callback=self.confirmation_message_int) self.precision_spinner.set_range(2, 10) self.precision_spinner.setWrapping(True) - form_lay.addRow(self.precision_label, self.precision_spinner) + grid0.addWidget(self.precision_label, 6, 0) + grid0.addWidget(self.precision_spinner, 6, 1) # Results Title self.title_res_label = FCLabel('%s:' % _("Minimum distance")) self.title_res_label.setToolTip(_("Display minimum distance between copper features.")) - form_lay.addRow(self.title_res_label) + grid0.addWidget(self.title_res_label, 8, 0, 1, 2) # Result value self.result_label = FCLabel('%s:' % _("Determined")) @@ -474,19 +477,21 @@ class OptimalUI: hlay.addWidget(self.result_entry) hlay.addWidget(self.units_lbl) - form_lay.addRow(self.result_label, hlay) + grid0.addWidget(self.units_lbl, 10, 0) + grid0.addLayout(hlay, 10, 1) # Frequency of minimum encounter self.freq_label = FCLabel('%s:' % _("Occurring")) self.freq_label.setToolTip(_("How many times this minimum is found.")) self.freq_entry = FCEntry() self.freq_entry.setReadOnly(True) - form_lay.addRow(self.freq_label, self.freq_entry) + grid0.addWidget(self.freq_label, 12, 0) + grid0.addWidget(self.freq_entry, 12, 1) # Control if to display the locations of where the minimum was found self.locations_cb = FCCheckBox(_("Minimum points coordinates")) self.locations_cb.setToolTip(_("Coordinates for points where minimum distance was found.")) - form_lay.addRow(self.locations_cb) + grid0.addWidget(self.locations_cb, 14, 0, 1, 2) # Locations where minimum was found self.locations_textb = FCTextArea() @@ -501,7 +506,7 @@ class OptimalUI: """ self.locations_textb.setStyleSheet(stylesheet) - form_lay.addRow(self.locations_textb) + grid0.addWidget(self.locations_textb, 16, 0, 1, 2) # Jump button self.locate_button = FCButton(_("Jump to selected position")) @@ -511,19 +516,19 @@ class OptimalUI: ) self.locate_button.setMinimumWidth(60) self.locate_button.setDisabled(True) - form_lay.addRow(self.locate_button) + grid0.addWidget(self.locate_button, 18, 0, 1, 2) # Other distances in Gerber self.title_second_res_label = FCLabel('%s:' % _("Other distances")) self.title_second_res_label.setToolTip(_("Will display other distances in the Gerber file ordered from\n" "the minimum to the maximum, not including the absolute minimum.")) - form_lay.addRow(self.title_second_res_label) + grid0.addWidget(self.title_second_res_label, 20, 0, 1, 2) # Control if to display the locations of where the minimum was found self.sec_locations_cb = FCCheckBox(_("Other distances points coordinates")) self.sec_locations_cb.setToolTip(_("Other distances and the coordinates for points\n" "where the distance was found.")) - form_lay.addRow(self.sec_locations_cb) + grid0.addWidget(self.sec_locations_cb, 22, 0, 1, 2) # this way I can hide/show the frame self.sec_locations_frame = QtWidgets.QFrame() @@ -606,7 +611,7 @@ class OptimalUI: self.calculate_button.setMinimumWidth(60) self.layout.addWidget(self.calculate_button) - self.layout.addStretch() + self.layout.addStretch(1) # ## Reset Tool self.reset_button = FCButton(_("Reset Tool")) diff --git a/appTools/ToolPanelize.py b/appTools/ToolPanelize.py index 67af0fb8..fac8b58b 100644 --- a/appTools/ToolPanelize.py +++ b/appTools/ToolPanelize.py @@ -1000,6 +1000,11 @@ class PanelizeUI: """) self.layout.addWidget(title_label) + grid0 = QtWidgets.QGridLayout() + grid0.setColumnStretch(0, 0) + grid0.setColumnStretch(1, 1) + self.layout.addLayout(grid0) + self.object_label = FCLabel('%s:' % _("Source Object")) self.object_label.setToolTip( _("Specify the type of object to be panelized\n" @@ -1008,13 +1013,11 @@ class PanelizeUI: "in the Object combobox.") ) - self.layout.addWidget(self.object_label) - - # Form Layout - form_layout_0 = QtWidgets.QFormLayout() - self.layout.addLayout(form_layout_0) + grid0.addWidget(self.object_label, 0, 0, 1, 2) # Type of object to be panelized + self.type_object_label = FCLabel('%s:' % _("Object Type")) + self.type_obj_combo = FCComboBox() self.type_obj_combo.addItems([_("Gerber"), _("Excellon"), _("Geometry")]) @@ -1022,9 +1025,8 @@ class PanelizeUI: self.type_obj_combo.setItemIcon(1, QtGui.QIcon(self.app.resource_location + "/drill16.png")) self.type_obj_combo.setItemIcon(2, QtGui.QIcon(self.app.resource_location + "/geometry16.png")) - self.type_object_label = FCLabel('%s:' % _("Object Type")) - - form_layout_0.addRow(self.type_object_label, self.type_obj_combo) + grid0.addWidget(self.type_object_label, 2, 0) + grid0.addWidget( self.type_obj_combo, 2, 1) # Object to be panelized self.object_combo = FCComboBox() @@ -1036,15 +1038,10 @@ class PanelizeUI: _("Object to be panelized. This means that it will\n" "be duplicated in an array of rows and columns.") ) - form_layout_0.addRow(self.object_combo) - # Form Layout - form_layout = QtWidgets.QFormLayout() - self.layout.addLayout(form_layout) + grid0.addWidget(self.object_combo, 4, 0, 1, 2) # Type of box Panel object - self.reference_radio = RadioSet([{'label': _('Object'), 'value': 'object'}, - {'label': _('Bounding Box'), 'value': 'bbox'}]) self.box_label = FCLabel("%s:" % _("Penelization Reference")) self.box_label.setToolTip( _("Choose the reference for panelization:\n" @@ -1056,8 +1053,11 @@ class PanelizeUI: "to this reference object therefore maintaining the panelized\n" "objects in sync.") ) - form_layout.addRow(self.box_label) - form_layout.addRow(self.reference_radio) + grid0.addWidget(self.box_label, 6, 0, 1, 2) + + self.reference_radio = RadioSet([{'label': _('Object'), 'value': 'object'}, + {'label': _('Bounding Box'), 'value': 'bbox'}]) + grid0.addWidget(self.reference_radio, 8, 0, 1, 2) # Type of Box Object to be used as an envelope for panelization self.type_box_combo = FCComboBox() @@ -1075,7 +1075,8 @@ class PanelizeUI: "The selection here decide the type of objects that will be\n" "in the Box Object combobox.") ) - form_layout.addRow(self.type_box_combo_label, self.type_box_combo) + grid0.addWidget(self.type_box_combo_label, 10, 0) + grid0.addWidget(self.type_box_combo, 10, 1) # Box self.box_combo = FCComboBox() @@ -1087,12 +1088,12 @@ class PanelizeUI: _("The actual object that is used as container for the\n " "selected object that is to be panelized.") ) - form_layout.addRow(self.box_combo) + grid0.addWidget(self.box_combo, 12, 0, 1, 2) separator_line = QtWidgets.QFrame() separator_line.setFrameShape(QtWidgets.QFrame.HLine) separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) - form_layout.addRow(separator_line) + grid0.addWidget(separator_line, 14, 0, 1, 2) panel_data_label = FCLabel("%s:" % _("Panel Data")) panel_data_label.setToolTip( @@ -1103,7 +1104,7 @@ class PanelizeUI: "The spacings will set the distance between any two\n" "elements of the panel array.") ) - form_layout.addRow(panel_data_label) + grid0.addWidget(panel_data_label, 16, 0, 1, 2) # Spacing Columns self.spacing_columns = FCDoubleSpinner(callback=self.confirmation_message) @@ -1115,7 +1116,8 @@ class PanelizeUI: _("Spacing between columns of the desired panel.\n" "In current units.") ) - form_layout.addRow(self.spacing_columns_label, self.spacing_columns) + grid0.addWidget(self.spacing_columns_label, 18, 0) + grid0.addWidget(self.spacing_columns, 18, 1) # Spacing Rows self.spacing_rows = FCDoubleSpinner(callback=self.confirmation_message) @@ -1127,32 +1129,35 @@ class PanelizeUI: _("Spacing between rows of the desired panel.\n" "In current units.") ) - form_layout.addRow(self.spacing_rows_label, self.spacing_rows) + grid0.addWidget(self.spacing_rows_label, 20, 0) + grid0.addWidget(self.spacing_rows, 20, 1) # Columns self.columns = FCSpinner(callback=self.confirmation_message_int) - self.columns.set_range(0, 9999) + self.columns.set_range(0, 10000) self.columns_label = FCLabel('%s:' % _("Columns")) self.columns_label.setToolTip( _("Number of columns of the desired panel") ) - form_layout.addRow(self.columns_label, self.columns) + grid0.addWidget(self.columns_label, 22, 0) + grid0.addWidget(self.columns, 22, 1) # Rows self.rows = FCSpinner(callback=self.confirmation_message_int) - self.rows.set_range(0, 9999) + self.rows.set_range(0, 10000) self.rows_label = FCLabel('%s:' % _("Rows")) self.rows_label.setToolTip( _("Number of rows of the desired panel") ) - form_layout.addRow(self.rows_label, self.rows) + grid0.addWidget(self.rows_label, 24, 0) + grid0.addWidget(self.rows, 24, 1) separator_line = QtWidgets.QFrame() separator_line.setFrameShape(QtWidgets.QFrame.HLine) separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) - form_layout.addRow(separator_line) + grid0.addWidget(separator_line, 26, 0, 1, 2) # Type of resulting Panel object self.panel_type_radio = RadioSet([{'label': _('Gerber'), 'value': 'gerber'}, @@ -1163,8 +1168,8 @@ class PanelizeUI: "- Gerber\n" "- Geometry") ) - form_layout.addRow(self.panel_type_label) - form_layout.addRow(self.panel_type_radio) + grid0.addWidget(self.panel_type_label, 28, 0) + grid0.addWidget(self.panel_type_radio, 28, 1) # Path optimization self.optimization_cb = FCCheckBox('%s' % _("Path Optimization")) @@ -1174,7 +1179,7 @@ class PanelizeUI: "any two overlapping Line elements in the panel\n" "and will remove the overlapping parts, keeping only one of them.") ) - form_layout.addRow(self.optimization_cb) + grid0.addWidget(self.optimization_cb, 30, 0, 1, 2) # Constrains self.constrain_cb = FCCheckBox('%s:' % _("Constrain panel within")) @@ -1185,29 +1190,31 @@ class PanelizeUI: "the final panel will have as many columns and rows as\n" "they fit completely within selected area.") ) - form_layout.addRow(self.constrain_cb) + grid0.addWidget(self.constrain_cb, 32, 0, 1, 2) self.x_width_entry = FCDoubleSpinner(callback=self.confirmation_message) - self.x_width_entry.set_precision(4) - self.x_width_entry.set_range(0, 9999) + self.x_width_entry.set_precision(self.decimals) + self.x_width_entry.set_range(0.0000, 10000.0000) self.x_width_lbl = FCLabel('%s:' % _("Width (DX)")) self.x_width_lbl.setToolTip( _("The width (DX) within which the panel must fit.\n" "In current units.") ) - form_layout.addRow(self.x_width_lbl, self.x_width_entry) + grid0.addWidget(self.x_width_lbl, 34, 0) + grid0.addWidget(self.x_width_entry, 34, 1) self.y_height_entry = FCDoubleSpinner(callback=self.confirmation_message) - self.y_height_entry.set_range(0, 9999) - self.y_height_entry.set_precision(4) + self.y_height_entry.set_range(0, 10000) + self.y_height_entry.set_precision(self.decimals) self.y_height_lbl = FCLabel('%s:' % _("Height (DY)")) self.y_height_lbl.setToolTip( _("The height (DY)within which the panel must fit.\n" "In current units.") ) - form_layout.addRow(self.y_height_lbl, self.y_height_entry) + grid0.addWidget(self.y_height_lbl, 36, 0) + grid0.addWidget(self.y_height_entry, 36, 1) self.constrain_sel = OptionalInputSection( self.constrain_cb, [self.x_width_lbl, self.x_width_entry, self.y_height_lbl, self.y_height_entry]) @@ -1215,7 +1222,7 @@ class PanelizeUI: separator_line = QtWidgets.QFrame() separator_line.setFrameShape(QtWidgets.QFrame.HLine) separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) - form_layout.addRow(separator_line) + grid0.addWidget(separator_line, 38, 0, 1, 2) # Buttons self.panelize_object_button = FCButton(_("Panelize Object")) @@ -1231,9 +1238,9 @@ class PanelizeUI: font-weight: bold; } """) - self.layout.addWidget(self.panelize_object_button) + grid0.addWidget(self.panelize_object_button, 40, 0, 1, 2) - self.layout.addStretch() + self.layout.addStretch(1) # ## Reset Tool self.reset_button = FCButton(_("Reset Tool")) diff --git a/appTools/ToolPcbWizard.py b/appTools/ToolPcbWizard.py index f6e19e96..5d9c2c52 100644 --- a/appTools/ToolPcbWizard.py +++ b/appTools/ToolPcbWizard.py @@ -398,9 +398,11 @@ class WizardUI: self.layout.addWidget(FCLabel("%s:" % _("Load files"))) - # Form Layout - form_layout = QtWidgets.QFormLayout() - self.layout.addLayout(form_layout) + # Grid Layout + grid0 = QtWidgets.QGridLayout() + grid0.setColumnStretch(0, 0) + grid0.setColumnStretch(1, 1) + self.layout.addLayout(grid0) self.excellon_label = FCLabel('%s:' % _("Excellon file")) self.excellon_label.setToolTip( @@ -408,14 +410,16 @@ class WizardUI: "Usually it has a .DRL extension") ) self.excellon_brn = FCButton(_("Open")) - form_layout.addRow(self.excellon_label, self.excellon_brn) + grid0.addWidget(self.excellon_label, 0, 0) + grid0.addWidget(self.excellon_brn, 0, 1) self.inf_label = FCLabel('%s:' % _("INF file")) self.inf_label.setToolTip( _("Load the INF file.") ) self.inf_btn = FCButton(_("Open")) - form_layout.addRow(self.inf_label, self.inf_btn) + grid0.addWidget(self.inf_label, 2, 0) + grid0.addWidget(self.inf_btn, 2, 1) self.tools_table = FCTable() self.layout.addWidget(self.tools_table) @@ -433,9 +437,12 @@ class WizardUI: self.layout.addWidget(FCLabel("")) self.layout.addWidget(FCLabel("%s:" % _("Excellon Format"))) - # Form Layout - form_layout1 = QtWidgets.QFormLayout() - self.layout.addLayout(form_layout1) + + # Grid Layout + grid01 = QtWidgets.QGridLayout() + grid01.setColumnStretch(0, 0) + grid01.setColumnStretch(1, 1) + self.layout.addLayout(grid01) # Integral part of the coordinates self.int_entry = FCSpinner(callback=self.confirmation_message_int) @@ -444,7 +451,8 @@ class WizardUI: self.int_label.setToolTip( _("The number of digits for the integral part of the coordinates.") ) - form_layout1.addRow(self.int_label, self.int_entry) + grid01.addWidget(self.int_label, 0, 0) + grid01.addWidget(self.int_entry, 0, 1) # Fractional part of the coordinates self.frac_entry = FCSpinner(callback=self.confirmation_message_int) @@ -453,7 +461,8 @@ class WizardUI: self.frac_label.setToolTip( _("The number of digits for the fractional part of the coordinates.") ) - form_layout1.addRow(self.frac_label, self.frac_entry) + grid01.addWidget(self.frac_label, 2, 0) + grid01.addWidget(self.frac_entry, 2, 1) # Zeros suppression for coordinates self.zeros_radio = RadioSet([{'label': _('LZ'), 'value': 'LZ'}, @@ -467,7 +476,8 @@ class WizardUI: "- TZ = trailing zeros are kept\n" "- No Suppression = no zero suppression") ) - form_layout1.addRow(self.zeros_label, self.zeros_radio) + grid01.addWidget(self.zeros_label, 4, 0) + grid01.addWidget(self.zeros_radio, 4, 1) # Units type self.units_radio = RadioSet([{'label': _('Inch'), 'value': 'INCH'}, @@ -477,7 +487,8 @@ class WizardUI: _("The type of units that the coordinates and tool\n" "diameters are using. Can be INCH or MM.") ) - form_layout1.addRow(self.units_label, self.units_radio) + grid01.addWidget(self.units_label, 6, 0) + grid01.addWidget(self.units_radio, 6, 1) # Buttons @@ -488,9 +499,9 @@ class WizardUI: "One usually has .DRL extension while\n" "the other has .INF extension.") ) - self.layout.addWidget(self.import_button) + grid01.addWidget(self.import_button, 8, 0, 1, 2) - self.layout.addStretch() + self.layout.addStretch(1) # #################################### FINSIHED GUI ########################### # ############################################################################# diff --git a/appTools/ToolRulesCheck.py b/appTools/ToolRulesCheck.py index b458dbab..ea30ab72 100644 --- a/appTools/ToolRulesCheck.py +++ b/appTools/ToolRulesCheck.py @@ -1384,29 +1384,33 @@ class RulesUI: self.layout.addWidget(self.all_cb) # Form Layout - self.form_layout_1 = QtWidgets.QFormLayout() - self.layout.addLayout(self.form_layout_1) + self.grid_lay1 = QtWidgets.QGridLayout() + self.grid_lay1.setColumnStretch(0, 0) + self.grid_lay1.setColumnStretch(1, 1) + self.layout.addLayout(self.grid_lay1) - self.form_layout_1.addRow(FCLabel("")) + self.grid_lay1.addWidget(FCLabel(""), 0, 0, 1, 2) # Trace size self.trace_size_cb = FCCheckBox('%s:' % _("Trace Size")) self.trace_size_cb.setToolTip( _("This checks if the minimum size for traces is met.") ) - self.form_layout_1.addRow(self.trace_size_cb) + self.grid_lay1.addWidget(self.trace_size_cb, 2, 0, 1, 2) # Trace size value - self.trace_size_entry = FCDoubleSpinner(callback=self.confirmation_message) - self.trace_size_entry.set_range(0.00001, 999.99999) - self.trace_size_entry.set_precision(self.decimals) - self.trace_size_entry.setSingleStep(0.1) - self.trace_size_lbl = FCLabel('%s:' % _("Min value")) self.trace_size_lbl.setToolTip( _("Minimum acceptable trace size.") ) - self.form_layout_1.addRow(self.trace_size_lbl, self.trace_size_entry) + + self.trace_size_entry = FCDoubleSpinner(callback=self.confirmation_message) + self.trace_size_entry.set_range(0.0000, 10000.0000) + self.trace_size_entry.set_precision(self.decimals) + self.trace_size_entry.setSingleStep(0.1) + + self.grid_lay1.addWidget(self.trace_size_lbl, 4, 0) + self.grid_lay1.addWidget(self.trace_size_entry, 4, 1) self.ts = OptionalInputSection(self.trace_size_cb, [self.trace_size_lbl, self.trace_size_entry]) @@ -1416,19 +1420,21 @@ class RulesUI: _("This checks if the minimum clearance between copper\n" "features is met.") ) - self.form_layout_1.addRow(self.clearance_copper2copper_cb) + self.grid_lay1.addWidget(self.clearance_copper2copper_cb, 6, 0, 1, 2) # Copper2copper clearance value - self.clearance_copper2copper_entry = FCDoubleSpinner(callback=self.confirmation_message) - self.clearance_copper2copper_entry.set_range(0.00001, 999.99999) - self.clearance_copper2copper_entry.set_precision(self.decimals) - self.clearance_copper2copper_entry.setSingleStep(0.1) - self.clearance_copper2copper_lbl = FCLabel('%s:' % _("Min value")) self.clearance_copper2copper_lbl.setToolTip( _("Minimum acceptable clearance value.") ) - self.form_layout_1.addRow(self.clearance_copper2copper_lbl, self.clearance_copper2copper_entry) + + self.clearance_copper2copper_entry = FCDoubleSpinner(callback=self.confirmation_message) + self.clearance_copper2copper_entry.set_range(0.0000, 10000.0000) + self.clearance_copper2copper_entry.set_precision(self.decimals) + self.clearance_copper2copper_entry.setSingleStep(0.1) + + self.grid_lay1.addWidget(self.clearance_copper2copper_lbl, 8, 0) + self.grid_lay1.addWidget(self.clearance_copper2copper_entry, 8, 1) self.c2c = OptionalInputSection( self.clearance_copper2copper_cb, [self.clearance_copper2copper_lbl, self.clearance_copper2copper_entry]) @@ -1439,19 +1445,21 @@ class RulesUI: _("This checks if the minimum clearance between copper\n" "features and the outline is met.") ) - self.form_layout_1.addRow(self.clearance_copper2ol_cb) + self.grid_lay1.addWidget(self.clearance_copper2ol_cb, 10, 0, 1, 2) # Copper2outline clearance value - self.clearance_copper2ol_entry = FCDoubleSpinner(callback=self.confirmation_message) - self.clearance_copper2ol_entry.set_range(0.00001, 999.99999) - self.clearance_copper2ol_entry.set_precision(self.decimals) - self.clearance_copper2ol_entry.setSingleStep(0.1) - self.clearance_copper2ol_lbl = FCLabel('%s:' % _("Min value")) self.clearance_copper2ol_lbl.setToolTip( _("Minimum acceptable clearance value.") ) - self.form_layout_1.addRow(self.clearance_copper2ol_lbl, self.clearance_copper2ol_entry) + + self.clearance_copper2ol_entry = FCDoubleSpinner(callback=self.confirmation_message) + self.clearance_copper2ol_entry.set_range(0.0000, 10000.0000) + self.clearance_copper2ol_entry.set_precision(self.decimals) + self.clearance_copper2ol_entry.setSingleStep(0.1) + + self.grid_lay1.addWidget(self.clearance_copper2ol_lbl, 12, 0) + self.grid_lay1.addWidget(self.clearance_copper2ol_entry, 12, 1) self.c2ol = OptionalInputSection( self.clearance_copper2ol_cb, [self.clearance_copper2ol_lbl, self.clearance_copper2ol_entry]) @@ -1462,19 +1470,21 @@ class RulesUI: _("This checks if the minimum clearance between silkscreen\n" "features and silkscreen features is met.") ) - self.form_layout_1.addRow(self.clearance_silk2silk_cb) + self.grid_lay1.addWidget(self.clearance_silk2silk_cb, 14, 0, 1, 2) # Copper2silkscreen clearance value - self.clearance_silk2silk_entry = FCDoubleSpinner(callback=self.confirmation_message) - self.clearance_silk2silk_entry.set_range(0.00001, 999.99999) - self.clearance_silk2silk_entry.set_precision(self.decimals) - self.clearance_silk2silk_entry.setSingleStep(0.1) - self.clearance_silk2silk_lbl = FCLabel('%s:' % _("Min value")) self.clearance_silk2silk_lbl.setToolTip( _("Minimum acceptable clearance value.") ) - self.form_layout_1.addRow(self.clearance_silk2silk_lbl, self.clearance_silk2silk_entry) + + self.clearance_silk2silk_entry = FCDoubleSpinner(callback=self.confirmation_message) + self.clearance_silk2silk_entry.set_range(0.0000, 10000.0000) + self.clearance_silk2silk_entry.set_precision(self.decimals) + self.clearance_silk2silk_entry.setSingleStep(0.1) + + self.grid_lay1.addWidget(self.clearance_silk2silk_lbl, 16, 0) + self.grid_lay1.addWidget(self.clearance_silk2silk_entry, 16, 1) self.s2s = OptionalInputSection( self.clearance_silk2silk_cb, [self.clearance_silk2silk_lbl, self.clearance_silk2silk_entry]) @@ -1485,19 +1495,21 @@ class RulesUI: _("This checks if the minimum clearance between silkscreen\n" "features and soldermask features is met.") ) - self.form_layout_1.addRow(self.clearance_silk2sm_cb) + self.grid_lay1.addWidget(self.clearance_silk2sm_cb, 18, 0, 1, 2) # Silkscreen2soldermask clearance value - self.clearance_silk2sm_entry = FCDoubleSpinner(callback=self.confirmation_message) - self.clearance_silk2sm_entry.set_range(0.00001, 999.99999) - self.clearance_silk2sm_entry.set_precision(self.decimals) - self.clearance_silk2sm_entry.setSingleStep(0.1) - self.clearance_silk2sm_lbl = FCLabel('%s:' % _("Min value")) self.clearance_silk2sm_lbl.setToolTip( _("Minimum acceptable clearance value.") ) - self.form_layout_1.addRow(self.clearance_silk2sm_lbl, self.clearance_silk2sm_entry) + + self.clearance_silk2sm_entry = FCDoubleSpinner(callback=self.confirmation_message) + self.clearance_silk2sm_entry.set_range(0.0000, 10000.0000) + self.clearance_silk2sm_entry.set_precision(self.decimals) + self.clearance_silk2sm_entry.setSingleStep(0.1) + + self.grid_lay1.addWidget(self.clearance_silk2sm_lbl, 20, 0) + self.grid_lay1.addWidget(self.clearance_silk2sm_entry, 20, 1) self.s2sm = OptionalInputSection( self.clearance_silk2sm_cb, [self.clearance_silk2sm_lbl, self.clearance_silk2sm_entry]) @@ -1508,19 +1520,21 @@ class RulesUI: _("This checks if the minimum clearance between silk\n" "features and the outline is met.") ) - self.form_layout_1.addRow(self.clearance_silk2ol_cb) + self.grid_lay1.addWidget(self.clearance_silk2ol_cb, 22, 0, 1, 2) # Silk2outline clearance value - self.clearance_silk2ol_entry = FCDoubleSpinner(callback=self.confirmation_message) - self.clearance_silk2ol_entry.set_range(0.00001, 999.99999) - self.clearance_silk2ol_entry.set_precision(self.decimals) - self.clearance_silk2ol_entry.setSingleStep(0.1) - self.clearance_silk2ol_lbl = FCLabel('%s:' % _("Min value")) self.clearance_silk2ol_lbl.setToolTip( _("Minimum acceptable clearance value.") ) - self.form_layout_1.addRow(self.clearance_silk2ol_lbl, self.clearance_silk2ol_entry) + + self.clearance_silk2ol_entry = FCDoubleSpinner(callback=self.confirmation_message) + self.clearance_silk2ol_entry.set_range(0.0000, 10000.0000) + self.clearance_silk2ol_entry.set_precision(self.decimals) + self.clearance_silk2ol_entry.setSingleStep(0.1) + + self.grid_lay1.addWidget(self.clearance_silk2ol_lbl, 24, 0) + self.grid_lay1.addWidget(self.clearance_silk2ol_entry, 24, 1) self.s2ol = OptionalInputSection( self.clearance_silk2ol_cb, [self.clearance_silk2ol_lbl, self.clearance_silk2ol_entry]) @@ -1531,19 +1545,22 @@ class RulesUI: _("This checks if the minimum clearance between soldermask\n" "features and soldermask features is met.") ) - self.form_layout_1.addRow(self.clearance_sm2sm_cb) + self.grid_lay1.addWidget(self.clearance_sm2sm_cb, 26, 0, 1, 2) # Soldermask2soldermask clearance value - self.clearance_sm2sm_entry = FCDoubleSpinner(callback=self.confirmation_message) - self.clearance_sm2sm_entry.set_range(0.00001, 999.99999) - self.clearance_sm2sm_entry.set_precision(self.decimals) - self.clearance_sm2sm_entry.setSingleStep(0.1) self.clearance_sm2sm_lbl = FCLabel('%s:' % _("Min value")) self.clearance_sm2sm_lbl.setToolTip( _("Minimum acceptable clearance value.") ) - self.form_layout_1.addRow(self.clearance_sm2sm_lbl, self.clearance_sm2sm_entry) + + self.clearance_sm2sm_entry = FCDoubleSpinner(callback=self.confirmation_message) + self.clearance_sm2sm_entry.set_range(0.0000, 10000.0000) + self.clearance_sm2sm_entry.set_precision(self.decimals) + self.clearance_sm2sm_entry.setSingleStep(0.1) + + self.grid_lay1.addWidget(self.clearance_sm2sm_lbl, 28, 0) + self.grid_lay1.addWidget(self.clearance_sm2sm_entry, 28, 1) self.sm2sm = OptionalInputSection( self.clearance_sm2sm_cb, [self.clearance_sm2sm_lbl, self.clearance_sm2sm_entry]) @@ -1554,24 +1571,26 @@ class RulesUI: _("This checks if the minimum copper ring left by drilling\n" "a hole into a pad is met.") ) - self.form_layout_1.addRow(self.ring_integrity_cb) + self.grid_lay1.addWidget(self.ring_integrity_cb, 30, 0, 1, 2) # Ring integrity value - self.ring_integrity_entry = FCDoubleSpinner(callback=self.confirmation_message) - self.ring_integrity_entry.set_range(0.00001, 999.99999) - self.ring_integrity_entry.set_precision(self.decimals) - self.ring_integrity_entry.setSingleStep(0.1) - self.ring_integrity_lbl = FCLabel('%s:' % _("Min value")) self.ring_integrity_lbl.setToolTip( _("Minimum acceptable ring value.") ) - self.form_layout_1.addRow(self.ring_integrity_lbl, self.ring_integrity_entry) + + self.ring_integrity_entry = FCDoubleSpinner(callback=self.confirmation_message) + self.ring_integrity_entry.set_range(0.0000, 10000.0000) + self.ring_integrity_entry.set_precision(self.decimals) + self.ring_integrity_entry.setSingleStep(0.1) + + self.grid_lay1.addWidget(self.ring_integrity_lbl, 32, 0) + self.grid_lay1.addWidget(self.ring_integrity_entry, 32, 1) self.anr = OptionalInputSection( self.ring_integrity_cb, [self.ring_integrity_lbl, self.ring_integrity_entry]) - self.form_layout_1.addRow(FCLabel("")) + self.grid_lay1.addWidget(FCLabel(''), 34, 0, 1, 2) # Hole2Hole clearance self.clearance_d2d_cb = FCCheckBox('%s:' % _("Hole to Hole Clearance")) @@ -1579,19 +1598,21 @@ class RulesUI: _("This checks if the minimum clearance between a drill hole\n" "and another drill hole is met.") ) - self.form_layout_1.addRow(self.clearance_d2d_cb) + self.grid_lay1.addWidget(self.clearance_d2d_cb, 36, 0, 1, 2) # Hole2Hole clearance value - self.clearance_d2d_entry = FCDoubleSpinner(callback=self.confirmation_message) - self.clearance_d2d_entry.set_range(0.00001, 999.99999) - self.clearance_d2d_entry.set_precision(self.decimals) - self.clearance_d2d_entry.setSingleStep(0.1) - self.clearance_d2d_lbl = FCLabel('%s:' % _("Min value")) self.clearance_d2d_lbl.setToolTip( _("Minimum acceptable clearance value.") ) - self.form_layout_1.addRow(self.clearance_d2d_lbl, self.clearance_d2d_entry) + + self.clearance_d2d_entry = FCDoubleSpinner(callback=self.confirmation_message) + self.clearance_d2d_entry.set_range(0.0000, 10000.0000) + self.clearance_d2d_entry.set_precision(self.decimals) + self.clearance_d2d_entry.setSingleStep(0.1) + + self.grid_lay1.addWidget(self.clearance_d2d_lbl, 38, 0) + self.grid_lay1.addWidget(self.clearance_d2d_entry, 38, 1) self.d2d = OptionalInputSection( self.clearance_d2d_cb, [self.clearance_d2d_lbl, self.clearance_d2d_entry]) @@ -1602,28 +1623,26 @@ class RulesUI: _("This checks if the drill holes\n" "sizes are above the threshold.") ) - self.form_layout_1.addRow(self.drill_size_cb) - - # Drile holes value - self.drill_size_entry = FCDoubleSpinner(callback=self.confirmation_message) - self.drill_size_entry.set_range(0.00001, 999.99999) - self.drill_size_entry.set_precision(self.decimals) - self.drill_size_entry.setSingleStep(0.1) + self.grid_lay1.addWidget(self.drill_size_cb, 40, 0, 1, 2) + # Drills holes value self.drill_size_lbl = FCLabel('%s:' % _("Min value")) self.drill_size_lbl.setToolTip( _("Minimum acceptable drill size.") ) - self.form_layout_1.addRow(self.drill_size_lbl, self.drill_size_entry) + + self.drill_size_entry = FCDoubleSpinner(callback=self.confirmation_message) + self.drill_size_entry.set_range(0.0000, 10000.0000) + self.drill_size_entry.set_precision(self.decimals) + self.drill_size_entry.setSingleStep(0.1) + + self.grid_lay1.addWidget(self.drill_size_lbl, 42, 0) + self.grid_lay1.addWidget(self.drill_size_entry, 42, 1) self.ds = OptionalInputSection( self.drill_size_cb, [self.drill_size_lbl, self.drill_size_entry]) # Buttons - hlay_2 = QtWidgets.QHBoxLayout() - self.layout.addLayout(hlay_2) - - # hlay_2.addStretch() self.run_button = FCButton(_("Run Rules Check")) self.run_button.setIcon(QtGui.QIcon(self.app.resource_location + '/rules32.png')) self.run_button.setToolTip( @@ -1637,9 +1656,9 @@ class RulesUI: font-weight: bold; } """) - hlay_2.addWidget(self.run_button) + self.grid_lay1.addWidget(self.run_button, 44, 0, 1, 2) - self.layout.addStretch() + self.layout.addStretch(1) # ## Reset Tool self.reset_button = FCButton(_("Reset Tool")) @@ -1658,8 +1677,8 @@ class RulesUI: # #################################### FINSIHED GUI ########################### # ############################################################################# def on_all_cb_changed(self, state): - cb_items = [self.form_layout_1.itemAt(i).widget() for i in range(self.form_layout_1.count()) - if isinstance(self.form_layout_1.itemAt(i).widget(), FCCheckBox)] + cb_items = [self.grid_lay1.itemAt(i).widget() for i in range(self.grid_lay1.count()) + if isinstance(self.grid_lay1.itemAt(i).widget(), FCCheckBox)] for cb in cb_items: if state: diff --git a/appTools/ToolSolderPaste.py b/appTools/ToolSolderPaste.py index c3955be7..fddc53f0 100644 --- a/appTools/ToolSolderPaste.py +++ b/appTools/ToolSolderPaste.py @@ -1159,26 +1159,28 @@ class SolderUI: self.layout.addWidget(title_label) # ## Form Layout - obj_form_layout = QtWidgets.QFormLayout() + obj_form_layout = QtWidgets.QGridLayout() + obj_form_layout.setColumnStretch(0, 0) + obj_form_layout.setColumnStretch(1, 1) self.layout.addLayout(obj_form_layout) # ## Gerber Object to be used for solderpaste dispensing + self.object_label = QtWidgets.QLabel('%s:' % _("GERBER")) + self.object_label.setToolTip(_("Gerber Solderpaste object.")) + self.obj_combo = FCComboBox(callback=solder_class.on_rmb_combo) self.obj_combo.setModel(self.app.collection) self.obj_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex())) self.obj_combo.is_last = True self.obj_combo.obj_type = "Gerber" - self.object_label = QtWidgets.QLabel('%s:' % _("GERBER")) - self.object_label.setToolTip(_("Gerber Solderpaste object.") - ) - obj_form_layout.addRow(self.object_label) - obj_form_layout.addRow(self.obj_combo) + obj_form_layout.addWidget(self.object_label, 0, 0, 1, 2) + obj_form_layout.addWidget(self.obj_combo, 2, 0, 1, 2) separator_line = QtWidgets.QFrame() separator_line.setFrameShape(QtWidgets.QFrame.HLine) separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) - obj_form_layout.addRow(separator_line) + obj_form_layout.addWidget(separator_line, 4, 0, 1, 2) # ### Tools ## ## self.tools_table_label = QtWidgets.QLabel('%s' % _('Tools Table')) @@ -1186,10 +1188,10 @@ class SolderUI: _("Tools pool from which the algorithm\n" "will pick the ones used for dispensing solder paste.") ) - self.layout.addWidget(self.tools_table_label) + obj_form_layout.addWidget(self.tools_table_label, 6, 0, 1, 2) self.tools_table = FCTable() - self.layout.addWidget(self.tools_table) + obj_form_layout.addWidget(self.tools_table, 8, 0, 1, 2) self.tools_table.setColumnCount(3) self.tools_table.setHorizontalHeaderLabels(['#', _('Diameter'), '']) diff --git a/app_Main.py b/app_Main.py index 63649e8d..0f38fb8a 100644 --- a/app_Main.py +++ b/app_Main.py @@ -5152,7 +5152,7 @@ class App(QtCore.QObject): self.setWindowIcon(icon) self.setWindowTitle(str(title)) - self.form = QtWidgets.QFormLayout(self) + grid0 = QtWidgets.QGridLayout(self) self.ref_radio = RadioSet([ {"label": _("Quadrant 1"), "value": "bl"}, @@ -5162,12 +5162,12 @@ class App(QtCore.QObject): {"label": _("Center"), "value": "c"} ], orientation='vertical', stretch=False) self.ref_radio.set_value(choice) - self.form.addRow(self.ref_radio) + grid0.addWidget(self.ref_radio, 0, 0) self.button_box = QtWidgets.QDialogButtonBox( QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel, Qt.Horizontal, parent=self) - self.form.addRow(self.button_box) + grid0.addWidget(self.button_box, 1, 0) self.button_box.accepted.connect(self.accept) self.button_box.rejected.connect(self.reject) @@ -5416,7 +5416,7 @@ class App(QtCore.QObject): self.setWindowIcon(icon) self.setWindowTitle(str(title)) - self.form = QtWidgets.QFormLayout(self) + grid0 = QtWidgets.QGridLayout(self) self.ref_radio = RadioSet([ {"label": _("Bottom Left"), "value": "bl"}, @@ -5426,12 +5426,12 @@ class App(QtCore.QObject): {"label": _("Center"), "value": "c"} ], orientation='vertical', stretch=False) self.ref_radio.set_value(choice) - self.form.addRow(self.ref_radio) + grid0.addWidget(self.ref_radio, 0, 0) self.button_box = QtWidgets.QDialogButtonBox( QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel, Qt.Horizontal, parent=self) - self.form.addRow(self.button_box) + grid0.addWidget(self.button_box, 1, 0) self.button_box.accepted.connect(self.accept) self.button_box.rejected.connect(self.reject)