diff --git a/Bookmark.py b/Bookmark.py index a3b6629d..7826c844 100644 --- a/Bookmark.py +++ b/Bookmark.py @@ -100,7 +100,7 @@ class BookmarkManager(QtWidgets.QWidget): remove_entry_btn = FCButton(_("Remove Entry")) export_list_btn = FCButton(_("Export List")) import_list_btn = FCButton(_("Import List")) - # closebtn = QtWidgets.QPushButton(_("Close")) + # closebtn = FCButton(_("Close")) # button_hlay.addStretch() button_hlay.addWidget(add_entry_btn) diff --git a/CHANGELOG.md b/CHANGELOG.md index e087f0f3..47e22e6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ CHANGELOG for FlatCAM Evo beta ================================================= +10.05.2022 + +- upgraded the Geometry Editor main UI +- upgraded the FCButton widget (and made it used everywhere instead of the QPushButton) so it can have the color and font weight properties settable + 9.05.2022 - fixed an issue in the Paint Plugin where some polygons are discarded in a Geometry object made out of an imported SVG diff --git a/appCommon/Common.py b/appCommon/Common.py index 379a11ec..54c1265f 100644 --- a/appCommon/Common.py +++ b/appCommon/Common.py @@ -509,13 +509,8 @@ class ExclusionAreas(QtCore.QObject): return self.app.inform.emit("[success] %s" % _("Exclusion areas added.")) - self.cnc_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - color: orange; - } - """) + self.cnc_button.bold = True + self.cnc_button.color = 'orange' self.cnc_button.setToolTip( '%s %s' % (_("Generate the CNC Job object."), _("With Exclusion areas.")) ) @@ -646,12 +641,7 @@ class ExclusionAreas(QtCore.QObject): # restore the default StyleSheet self.cnc_button.setStyleSheet("") # update the StyleSheet - self.cnc_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) + self.cnc_button.bold = True self.cnc_button.setToolTip('%s' % _("Generate the CNC Job object.")) def clear_shapes(self): @@ -708,12 +698,7 @@ class ExclusionAreas(QtCore.QObject): # restore the default StyleSheet self.cnc_button.setStyleSheet("") # update the StyleSheet - self.cnc_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) + self.cnc_button.bold = True self.cnc_button.setToolTip('%s' % _("Generate the CNC Job object.")) # there are no more exclusion areas in the storage, all have been selected and deleted diff --git a/appDatabase.py b/appDatabase.py index 0d487586..57bebbcd 100644 --- a/appDatabase.py +++ b/appDatabase.py @@ -1307,19 +1307,12 @@ class ToolsDB2UI: ) self.buttons_box.addWidget(self.save_db_btn) - self.add_tool_from_db = FCButton(_("Transfer the Tool")) + self.add_tool_from_db = FCButton(_("Transfer the Tool"), bold=True, color='green') self.add_tool_from_db.setToolTip( _("Insert a new tool in the Tools Table of the\n" "object/application tool after selecting a tool\n" "in the Tools Database.") ) - self.add_tool_from_db.setStyleSheet(""" - QPushButton - { - font-weight: bold; - color: green; - } - """) self.add_tool_from_db.hide() self.cancel_tool_from_db = FCButton(_("Cancel")) @@ -2663,7 +2656,7 @@ class ToolsDB2(QtWidgets.QWidget): if self.app.ui.plot_tab_area.tabText(idx) == _("Tools Database"): self.app.ui.plot_tab_area.tabBar.setTabTextColor(idx, QtGui.QColor('red')) - self.ui.save_db_btn.setStyleSheet("QPushButton {color: red;}") + self.ui.save_db_btn.color = 'red' self.app.tools_db_changed_flag = True if silent is None: diff --git a/appEditors/AppExcEditor.py b/appEditors/AppExcEditor.py index 2eceff0d..559b987f 100644 --- a/appEditors/AppExcEditor.py +++ b/appEditors/AppExcEditor.py @@ -3393,7 +3393,7 @@ class AppExcEditor(QtCore.QObject): # make sure no rows are selected so the user have to click the correct row, meaning selecting the correct tool self.ui.tools_table_exc.clearSelection() - # Remove anything else in the GUI Selected Tab + # Remove anything else in the GUI Properties Tab self.app.ui.properties_scroll_area.takeWidget() # Put ourselves in the GUI Properties Tab self.app.ui.properties_scroll_area.setWidget(self.ui.exc_edit_widget) @@ -5294,17 +5294,11 @@ class AppExcEditorUI: layout.addStretch(1) # Editor - self.exit_editor_button = FCButton(_('Exit Editor')) + self.exit_editor_button = FCButton(_('Exit Editor'), bold=True) self.exit_editor_button.setIcon(QtGui.QIcon(self.app.resource_location + '/power16.png')) self.exit_editor_button.setToolTip( _("Exit from Editor.") ) - self.exit_editor_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) layout.addWidget(self.exit_editor_button) # ############################################################################################################# diff --git a/appEditors/AppGeoEditor.py b/appEditors/AppGeoEditor.py index 6f393372..29fc212f 100644 --- a/appEditors/AppGeoEditor.py +++ b/appEditors/AppGeoEditor.py @@ -1773,13 +1773,13 @@ class FCSelect(DrawTool): # if selection is done on canvas update the Tree in Properties Tab with the selection try: - self.draw_app.tw.itemPressed.disconnect(self.draw_app.on_tree_geo_click) + self.draw_app.ui.tw.itemPressed.disconnect(self.draw_app.on_tree_geo_click) except (AttributeError, TypeError): pass - self.draw_app.tw.selectionModel().clearSelection() + self.draw_app.ui.tw.selectionModel().clearSelection() for sel_shape in self.draw_app.selected: - iterator = QtWidgets.QTreeWidgetItemIterator(self.draw_app.tw) + iterator = QtWidgets.QTreeWidgetItemIterator(self.draw_app.ui.tw) while iterator.value(): item = iterator.value() try: @@ -1790,9 +1790,9 @@ class FCSelect(DrawTool): iterator += 1 - self.draw_app.tw.itemPressed.connect(self.draw_app.on_tree_geo_click) + self.draw_app.ui.tw.itemPressed.connect(self.draw_app.on_tree_geo_click) - # self.draw_app.tw.itemClicked.emit(self.draw_app.tw.currentItem(), 0) + # self.draw_app.ui.tw.itemClicked.emit(self.draw_app.ui.tw.currentItem(), 0) self.draw_app.update_ui() return "" @@ -3146,209 +3146,16 @@ class AppGeoEditor(QtCore.QObject): self.decimals = app.decimals self.units = self.app.app_units + # ############################################################################################################# + # Geometry Editor UI + # ############################################################################################################# + self.ui = AppGeoEditorUI(app=self.app) + if disabled: + self.ui.geo_frame.setDisabled(True) + # when True the Editor can't do selection due of an ongoing process self.interdict_selection = False - self.geo_edit_widget = QtWidgets.QWidget() - # ## Box for custom widgets - # This gets populated in offspring implementations. - layout = QtWidgets.QVBoxLayout() - self.geo_edit_widget.setLayout(layout) - - # add a frame and inside add a vertical box layout. Inside this vbox layout I add all the Drills widgets - # this way I can hide/show the frame - self.geo_frame = QtWidgets.QFrame() - self.geo_frame.setContentsMargins(0, 0, 0, 0) - layout.addWidget(self.geo_frame) - self.tools_box = QtWidgets.QVBoxLayout() - self.tools_box.setContentsMargins(0, 0, 0, 0) - self.geo_frame.setLayout(self.tools_box) - - if disabled: - self.geo_frame.setDisabled(True) - - # ## Page Title box (spacing between children) - self.title_box = QtWidgets.QHBoxLayout() - self.tools_box.addLayout(self.title_box) - - # ## Page Title icon - pixmap = QtGui.QPixmap(self.app.resource_location + '/app32.png') - self.icon = FCLabel() - self.icon.setPixmap(pixmap) - self.title_box.addWidget(self.icon, stretch=0) - - # ## Title label - self.title_label = FCLabel("%s" % _('Geometry Editor')) - self.title_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignLeft | QtCore.Qt.AlignmentFlag.AlignVCenter) - self.title_box.addWidget(self.title_label, stretch=1) - - # App Level label - self.level = QtWidgets.QToolButton() - self.level.setToolTip( - _( - "Beginner Mode - many parameters are hidden.\n" - "Advanced Mode - full control.\n" - "Permanent change is done in 'Preferences' menu." - ) - ) - # self.level.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) - self.level.setCheckable(True) - self.title_box.addWidget(self.level) - - self.grid_d = GLay(v_spacing=5, h_spacing=3) - self.tools_box.addLayout(self.grid_d) - - # Tool diameter - tooldia_lbl = FCLabel('%s' % _("Tool dia"), bold=True) - tooldia_lbl.setToolTip( - _("Edited tool diameter.") - ) - self.tooldia_entry = FCDoubleSpinner() - self.tooldia_entry.set_precision(self.decimals) - self.tooldia_entry.setSingleStep(10 ** -self.decimals) - self.tooldia_entry.set_range(-10000.0000, 10000.0000) - - self.grid_d.addWidget(tooldia_lbl, 0, 0) - self.grid_d.addWidget(self.tooldia_entry, 0, 1) - # Tree Widget Title - tw_label = FCLabel('%s' % _("Geometry Table"), bold=True) - tw_label.setToolTip( - _("The list of geometry elements inside the edited object.") - ) - self.tools_box.addWidget(tw_label) - - # Tree Widget - self.tw = FCTree(columns=3, header_hidden=False, protected_column=[0, 1], extended_sel=True) - self.tw.setHeaderLabels(["ID", _("Type"), _("Name")]) - self.tw.setIndentation(0) - self.tw.setContextMenuPolicy(QtCore.Qt.ContextMenuPolicy.CustomContextMenu) - self.tw.header().setStretchLastSection(True) - self.tw.header().setSectionResizeMode(QtWidgets.QHeaderView.ResizeMode.ResizeToContents) - self.tools_box.addWidget(self.tw) - - self.geo_font = QtGui.QFont() - self.geo_font.setBold(True) - self.geo_parent = self.tw.invisibleRootItem() - - # ############################################################################################################# - # ############################################ Advanced Editor ################################################ - # ############################################################################################################# - self.adv_frame = QtWidgets.QFrame() - self.adv_frame.setContentsMargins(0, 0, 0, 0) - self.tools_box.addWidget(self.adv_frame) - - grid0 = GLay(v_spacing=5, h_spacing=3) - grid0.setContentsMargins(0, 0, 0, 0) - self.adv_frame.setLayout(grid0) - - # Zoom Selection - self.geo_zoom = FCCheckBox(_("Zoom on selection")) - grid0.addWidget(self.geo_zoom, 0, 0, 1, 3) - - separator_line = QtWidgets.QFrame() - separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) - separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) - grid0.addWidget(separator_line, 2, 0, 1, 3) - - # Parameters Title - param_title = FCLabel('%s' % _("Parameters"), bold=True) - param_title.setToolTip( - _("Geometry parameters.") - ) - grid0.addWidget(param_title, 4, 0, 1, 3) - - # Is Valid - is_valid_lbl = FCLabel('%s' % _("Is Valid"), bold=True) - self.is_valid_entry = FCLabel('None') - - grid0.addWidget(is_valid_lbl, 10, 0) - grid0.addWidget(self.is_valid_entry, 10, 1, 1, 2) - - # Is Empty - is_empty_lbl = FCLabel('%s' % _("Is Empty"), bold=True) - self.is_empty_entry = FCLabel('None') - - grid0.addWidget(is_empty_lbl, 12, 0) - grid0.addWidget(self.is_empty_entry, 12, 1, 1, 2) - - # Is Ring - is_ring_lbl = FCLabel('%s' % _("Is Ring"), bold=True) - self.is_ring_entry = FCLabel('None') - - grid0.addWidget(is_ring_lbl, 14, 0) - grid0.addWidget(self.is_ring_entry, 14, 1, 1, 2) - - # Is CCW - is_ccw_lbl = FCLabel('%s' % _("Is CCW"), bold=True) - self.is_ccw_entry = FCLabel('None') - self.change_orientation_btn = FCButton(_("Change")) - self.change_orientation_btn.setIcon(QtGui.QIcon(self.app.resource_location + '/orientation32.png')) - self.change_orientation_btn.setToolTip( - _("Change the orientation of the geometric element.\n" - "Works for LinearRing and Polygons.") - ) - grid0.addWidget(is_ccw_lbl, 16, 0) - grid0.addWidget(self.is_ccw_entry, 16, 1) - grid0.addWidget(self.change_orientation_btn, 16, 2) - - # Is Simple - is_simple_lbl = FCLabel('%s' % _("Is Simple"), bold=True) - self.is_simple_entry = FCLabel('None') - - grid0.addWidget(is_simple_lbl, 18, 0) - grid0.addWidget(self.is_simple_entry, 18, 1, 1, 2) - - # Length - len_lbl = FCLabel('%s' % _("Projection"), bold=True) - len_lbl.setToolTip( - _("The length of the geometry element.") - ) - self.geo_len_entry = FCEntry(decimals=self.decimals) - self.geo_len_entry.setReadOnly(True) - - grid0.addWidget(len_lbl, 20, 0) - grid0.addWidget(self.geo_len_entry, 20, 1, 1, 2) - - # Coordinates - coords_lbl = FCLabel('%s' % _("Coordinates"), bold=True) - coords_lbl.setToolTip( - _("The coordinates of the selected geometry element.") - ) - grid0.addWidget(coords_lbl, 22, 0, 1, 3) - - self.geo_coords_entry = FCTextEdit() - self.geo_coords_entry.setPlaceholderText( - _("The coordinates of the selected geometry element.") - ) - grid0.addWidget(self.geo_coords_entry, 24, 0, 1, 3) - - # Vertex Points Number - vertex_lbl = FCLabel('%s' % _("Vertex Points"), bold=True) - vertex_lbl.setToolTip( - _("The number of vertex points in the selected geometry element.") - ) - self.geo_vertex_entry = FCEntry(decimals=self.decimals) - self.geo_vertex_entry.setReadOnly(True) - - grid0.addWidget(vertex_lbl, 26, 0) - grid0.addWidget(self.geo_vertex_entry, 26, 1, 1, 2) - - layout.addStretch() - - # Editor - self.exit_editor_button = FCButton(_('Exit Editor')) - self.exit_editor_button.setIcon(QtGui.QIcon(self.app.resource_location + '/power16.png')) - self.exit_editor_button.setToolTip( - _("Exit from Editor.") - ) - self.exit_editor_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) - layout.addWidget(self.exit_editor_button) - # ## Toolbar events and properties self.tools = {} @@ -3439,7 +3246,6 @@ class AppGeoEditor(QtCore.QObject): # ####################### GEOMETRY Editor Signals ############################################################# # ############################################################################################################# self.build_ui_sig.connect(self.build_ui) - self.level.toggled.connect(self.on_level_changed) self.app.ui.grid_gap_x_entry.textChanged.connect(self.on_gridx_val_changed) self.app.ui.grid_gap_y_entry.textChanged.connect(self.on_gridy_val_changed) @@ -3451,7 +3257,6 @@ class AppGeoEditor(QtCore.QObject): self.app.ui.corner_snap_btn.triggered.connect(lambda: self.toolbar_tool_toggle("corner_snap")) self.app.pool_recreated.connect(self.pool_recreated) - self.exit_editor_button.clicked.connect(lambda: self.app.editor2object()) # connect the toolbar signals self.connect_geo_toolbar_signals() @@ -3490,9 +3295,9 @@ class AppGeoEditor(QtCore.QObject): self.transform_complete.connect(self.on_transform_complete) - self.change_orientation_btn.clicked.connect(self.on_change_orientation) + self.ui.change_orientation_btn.clicked.connect(self.on_change_orientation) - self.tw.customContextMenuRequested.connect(self.on_menu_request) + self.ui.tw.customContextMenuRequested.connect(self.on_menu_request) self.clear_tree_sig.connect(self.on_clear_tree) @@ -3595,25 +3400,27 @@ class AppGeoEditor(QtCore.QObject): self.units = self.app.app_units.upper() self.decimals = self.app.decimals + self.ui.geo_coords_entry.setText('') + self.ui.is_ccw_entry.set_value('None') + self.ui.is_ring_entry.set_value('None') + self.ui.is_simple_entry.set_value('None') + self.ui.is_empty_entry.set_value('None') + self.ui.is_valid_entry.set_value('None') + self.ui.geo_vertex_entry.set_value(0.0) + self.ui.geo_zoom.set_value(False) + + self.ui.param_button.setChecked(self.app.options['geometry_editor_parameters']) + # Remove anything else in the GUI Selected Tab self.app.ui.properties_scroll_area.takeWidget() # Put ourselves in the appGUI Properties Tab - self.app.ui.properties_scroll_area.setWidget(self.geo_edit_widget) + self.app.ui.properties_scroll_area.setWidget(self.ui.geo_edit_widget) # Switch notebook to Properties page self.app.ui.notebook.setCurrentWidget(self.app.ui.properties_tab) - self.geo_coords_entry.setText('') - self.is_ccw_entry.set_value('None') - self.is_ring_entry.set_value('None') - self.is_simple_entry.set_value('None') - self.is_empty_entry.set_value('None') - self.is_valid_entry.set_value('None') - self.geo_vertex_entry.set_value(0.0) - self.geo_zoom.set_value(False) - # Show/Hide Advanced Options app_mode = self.app.options["global_app_level"] - self.change_level(app_mode) + self.ui.change_level(app_mode) def build_ui(self): """ @@ -3622,14 +3429,14 @@ class AppGeoEditor(QtCore.QObject): :return: """ - iterator = QtWidgets.QTreeWidgetItemIterator(self.geo_parent) + iterator = QtWidgets.QTreeWidgetItemIterator(self.ui.geo_parent) to_delete = [] while iterator.value(): item = iterator.value() to_delete.append(item) iterator += 1 for it in to_delete: - self.geo_parent.removeChild(it) + self.ui.geo_parent.removeChild(it) for elem in self.storage.get_objects(): geo_type = type(elem.geo) @@ -3641,20 +3448,20 @@ class AppGeoEditor(QtCore.QObject): else: el_type = elem.data['type'] - self.tw.addParentEditable( - self.geo_parent, + self.ui.tw.addParentEditable( + self.ui.geo_parent, [ str(id(elem)), '%s' % el_type, _("Geo Elem") ], - font=self.geo_font, + font=self.ui.geo_font, font_items=2, # color=QtGui.QColor("#FF0000"), editable=True ) - self.tw.resize_sig.emit() + self.ui.tw.resize_sig.emit() def on_geo_elem_selected(self): pass @@ -3664,7 +3471,7 @@ class AppGeoEditor(QtCore.QObject): last_obj_shape = None last_id = None - selected_tree_items = self.tw.selectedItems() + selected_tree_items = self.ui.tw.selectedItems() for sel in selected_tree_items: for obj_shape in self.storage.get_objects(): try: @@ -3678,14 +3485,14 @@ class AppGeoEditor(QtCore.QObject): if last_obj_shape: last_sel_geo = last_obj_shape.geo - self.is_valid_entry.set_value(last_sel_geo.is_valid) - self.is_empty_entry.set_value(last_sel_geo.is_empty) + self.ui.is_valid_entry.set_value(last_sel_geo.is_valid) + self.ui.is_empty_entry.set_value(last_sel_geo.is_empty) if last_sel_geo.geom_type == 'MultiLineString': length = last_sel_geo.length - self.is_simple_entry.set_value(last_sel_geo.is_simple) - self.is_ring_entry.set_value(last_sel_geo.is_ring) - self.is_ccw_entry.set_value('None') + self.ui.is_simple_entry.set_value(last_sel_geo.is_simple) + self.ui.is_ring_entry.set_value(last_sel_geo.is_ring) + self.ui.is_ccw_entry.set_value('None') coords = '' vertex_nr = 0 @@ -3696,9 +3503,9 @@ class AppGeoEditor(QtCore.QObject): coords += str(line_coords) + '\n' elif last_sel_geo.geom_type == 'MultiPolygon': length = 0.0 - self.is_simple_entry.set_value('None') - self.is_ring_entry.set_value('None') - self.is_ccw_entry.set_value('None') + self.ui.is_simple_entry.set_value('None') + self.ui.is_ring_entry.set_value('None') + self.ui.is_ccw_entry.set_value('None') coords = '' vertex_nr = 0 @@ -3712,24 +3519,24 @@ class AppGeoEditor(QtCore.QObject): length = last_sel_geo.length coords = list(last_sel_geo.coords) vertex_nr = len(coords) - self.is_simple_entry.set_value(last_sel_geo.is_simple) - self.is_ring_entry.set_value(last_sel_geo.is_ring) + self.ui.is_simple_entry.set_value(last_sel_geo.is_simple) + self.ui.is_ring_entry.set_value(last_sel_geo.is_ring) if last_sel_geo.geom_type == 'LinearRing': - self.is_ccw_entry.set_value(last_sel_geo.is_ccw) + self.ui.is_ccw_entry.set_value(last_sel_geo.is_ccw) elif last_sel_geo.geom_type == 'Polygon': length = last_sel_geo.exterior.length coords = list(last_sel_geo.exterior.coords) vertex_nr = len(coords) - self.is_simple_entry.set_value(last_sel_geo.is_simple) - self.is_ring_entry.set_value(last_sel_geo.is_ring) + self.ui.is_simple_entry.set_value(last_sel_geo.is_simple) + self.ui.is_ring_entry.set_value(last_sel_geo.is_ring) if last_sel_geo.exterior.geom_type == 'LinearRing': - self.is_ccw_entry.set_value(last_sel_geo.exterior.is_ccw) + self.ui.is_ccw_entry.set_value(last_sel_geo.exterior.is_ccw) else: length = 0.0 coords = 'None' vertex_nr = 0 - if self.geo_zoom.get_value(): + if self.ui.geo_zoom.get_value(): xmin, ymin, xmax, ymax = last_sel_geo.bounds if xmin == xmax and ymin != ymax: xmin = ymin @@ -3770,9 +3577,9 @@ class AppGeoEditor(QtCore.QObject): ymax += 0.05 * height self.app.plotcanvas.adjust_axes(xmin, ymin, xmax, ymax) - self.geo_len_entry.set_value(length, decimals=self.decimals) - self.geo_coords_entry.setText(str(coords)) - self.geo_vertex_entry.set_value(vertex_nr) + self.ui.geo_len_entry.set_value(length, decimals=self.decimals) + self.ui.geo_coords_entry.setText(str(coords)) + self.ui.geo_vertex_entry.set_value(vertex_nr) self.app.inform.emit('%s: %s' % (_("Last selected shape ID"), str(last_id))) @@ -3783,52 +3590,10 @@ class AppGeoEditor(QtCore.QObject): except Exception as e: self.app.log.error("APpGeoEditor.on_tree_selection_change() -> %s" % str(e)) - def change_level(self, level): - """ - - :param level: application level: either 'b' or 'a' - :type level: str - :return: - """ - - if level == 'a': - self.level.setChecked(True) - else: - self.level.setChecked(False) - self.on_level_changed(self.level.isChecked()) - - def on_level_changed(self, checked): - if not checked: - self.level.setText('%s' % _('Beginner')) - self.level.setStyleSheet(""" - QToolButton - { - color: green; - } - """) - - self.adv_frame.hide() - - # Context Menu section - # self.tw.removeContextMenu() - else: - self.level.setText('%s' % _('Advanced')) - self.level.setStyleSheet(""" - QToolButton - { - color: red; - } - """) - - self.adv_frame.show() - - # Context Menu section - # self.tw.setupContextMenu() - def on_change_orientation(self): self.app.log.debug("AppGeoEditor.on_change_orientation()") - selected_tree_items = self.tw.selectedItems() + selected_tree_items = self.ui.tw.selectedItems() processed_shapes = [] new_shapes = [] @@ -3876,11 +3641,11 @@ class AppGeoEditor(QtCore.QObject): _("Change")) orientation_change.triggered.connect(self.on_change_orientation) - if not self.tw.selectedItems(): + if not self.ui.tw.selectedItems(): delete_action.setDisabled(True) orientation_change.setDisabled(True) - menu.exec(self.tw.viewport().mapToGlobal(pos)) + menu.exec(self.ui.tw.viewport().mapToGlobal(pos)) def activate(self): # adjust the status of the menu entries related to the editor @@ -3934,11 +3699,11 @@ class AppGeoEditor(QtCore.QObject): self.item_selected.connect(self.on_geo_elem_selected) # ## appGUI Events - self.tw.itemPressed.connect(self.on_tree_geo_click) - # self.tw.keyPressed.connect(self.app.ui.keyPressEvent) - # self.tw.customContextMenuRequested.connect(self.on_menu_request) + self.ui.tw.itemPressed.connect(self.on_tree_geo_click) + # self.ui.tw.keyPressed.connect(self.app.ui.keyPressEvent) + # self.ui.tw.customContextMenuRequested.connect(self.on_menu_request) - self.geo_frame.show() + self.ui.geo_frame.show() self.app.log.debug("Finished activating the Geometry Editor...") @@ -4003,9 +3768,9 @@ class AppGeoEditor(QtCore.QObject): try: # ## appGUI Events - self.tw.itemPressed.disconnect(self.on_tree_geo_click) - # self.tw.keyPressed.connect(self.app.ui.keyPressEvent) - # self.tw.customContextMenuRequested.connect(self.on_menu_request) + self.ui.tw.itemPressed.disconnect(self.on_tree_geo_click) + # self.ui.tw.keyPressed.connect(self.app.ui.keyPressEvent) + # self.ui.tw.customContextMenuRequested.connect(self.on_menu_request) except (AttributeError, TypeError): pass @@ -4028,7 +3793,7 @@ class AppGeoEditor(QtCore.QObject): self.app.log.error("AppGeoEditor.deactivate() --> %s" % str(err)) # hide the UI - self.geo_frame.hide() + self.ui.geo_frame.hide() self.app.log.debug("Finished deactivating the Geometry Editor...") @@ -4218,9 +3983,9 @@ class AppGeoEditor(QtCore.QObject): pass def on_clear_tree(self): - self.tw.clearSelection() - self.tw.clear() - self.geo_parent = self.tw.invisibleRootItem() + self.ui.tw.clearSelection() + self.ui.tw.clear() + self.ui.geo_parent = self.ui.tw.invisibleRootItem() def add_shape(self, shape, build_ui=True): """ @@ -4636,13 +4401,13 @@ class AppGeoEditor(QtCore.QObject): # ######### if selection is done on canvas update the Tree in Selected Tab with the selection ############### # ############################################################################################################# try: - self.tw.itemPressed.disconnect(self.on_tree_geo_click) + self.ui.tw.itemPressed.disconnect(self.on_tree_geo_click) except (AttributeError, TypeError): pass - self.tw.selectionModel().clearSelection() + self.ui.tw.selectionModel().clearSelection() for sel_shape in self.selected: - iterator = QtWidgets.QTreeWidgetItemIterator(self.tw) + iterator = QtWidgets.QTreeWidgetItemIterator(self.ui.tw) while iterator.value(): item = iterator.value() try: @@ -4668,9 +4433,9 @@ class AppGeoEditor(QtCore.QObject): vertex_nr += len(sha_geo_solid_coords) - self.geo_vertex_entry.set_value(vertex_nr) + self.ui.geo_vertex_entry.set_value(vertex_nr) - self.tw.itemPressed.connect(self.on_tree_geo_click) + self.ui.tw.itemPressed.connect(self.on_tree_geo_click) self.plot_all() @@ -5098,10 +4863,10 @@ class AppGeoEditor(QtCore.QObject): str(fcgeometry.tools[self.multigeo_tool]['tooldia']) ) ) - self.tooldia_entry.set_value( + self.ui.tooldia_entry.set_value( float(fcgeometry.tools[self.multigeo_tool]['data']['tools_mill_tooldia'])) else: - self.tooldia_entry.set_value(float(fcgeometry.obj_options['tools_mill_tooldia'])) + self.ui.tooldia_entry.set_value(float(fcgeometry.obj_options['tools_mill_tooldia'])) self.app.worker_task.emit({'fcn': task_job, 'params': [self]}) @@ -5119,7 +4884,7 @@ class AppGeoEditor(QtCore.QObject): with editor_obj.app.proc_container.new(_("Working...")): if editor_obj.multigeo_tool: edited_dia = float(fcgeometry.tools[self.multigeo_tool]['tooldia']) - new_dia = self.tooldia_entry.get_value() + new_dia = self.ui.tooldia_entry.get_value() if new_dia != edited_dia: fcgeometry.tools[self.multigeo_tool]['tooldia'] = new_dia @@ -5138,7 +4903,7 @@ class AppGeoEditor(QtCore.QObject): editor_obj.multigeo_tool = None else: edited_dia = float(fcgeometry.obj_options['tools_mill_tooldia']) - new_dia = self.tooldia_entry.get_value() + new_dia = self.ui.tooldia_entry.get_value() if new_dia != edited_dia: fcgeometry.obj_options['tools_mill_tooldia'] = new_dia @@ -5450,6 +5215,287 @@ class AppGeoEditor(QtCore.QObject): return self.flat_geo +class AppGeoEditorUI: + def __init__(self, app): + self.app = app + self.decimals = self.app.decimals + self.units = self.app.app_units.upper() + + self.geo_edit_widget = QtWidgets.QWidget() + # ## Box for custom widgets + # This gets populated in offspring implementations. + layout = QtWidgets.QVBoxLayout() + self.geo_edit_widget.setLayout(layout) + + # add a frame and inside add a vertical box layout. Inside this vbox layout I add all the Drills widgets + # this way I can hide/show the frame + self.geo_frame = QtWidgets.QFrame() + self.geo_frame.setContentsMargins(0, 0, 0, 0) + layout.addWidget(self.geo_frame) + self.tools_box = QtWidgets.QVBoxLayout() + self.tools_box.setContentsMargins(0, 0, 0, 0) + self.geo_frame.setLayout(self.tools_box) + + # ## Page Title box (spacing between children) + self.title_box = QtWidgets.QHBoxLayout() + self.tools_box.addLayout(self.title_box) + + # ## Page Title icon + pixmap = QtGui.QPixmap(self.app.resource_location + '/app32.png') + self.icon = FCLabel() + self.icon.setPixmap(pixmap) + self.title_box.addWidget(self.icon, stretch=0) + + # ## Title label + self.title_label = FCLabel("%s" % _('Geometry Editor')) + self.title_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignLeft | QtCore.Qt.AlignmentFlag.AlignVCenter) + self.title_box.addWidget(self.title_label, stretch=1) + + # App Level label + self.level = QtWidgets.QToolButton() + self.level.setToolTip( + _( + "Beginner Mode - many parameters are hidden.\n" + "Advanced Mode - full control.\n" + "Permanent change is done in 'Preferences' menu." + ) + ) + # self.level.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) + self.level.setCheckable(True) + self.title_box.addWidget(self.level) + + dia_grid = GLay(v_spacing=5, h_spacing=3) + self.tools_box.addLayout(dia_grid) + + # Tool diameter + tooldia_lbl = FCLabel('%s:' % _("Tool dia"), bold=True) + tooldia_lbl.setToolTip( + _("Edited tool diameter.") + ) + self.tooldia_entry = FCDoubleSpinner() + self.tooldia_entry.set_precision(self.decimals) + self.tooldia_entry.setSingleStep(10 ** -self.decimals) + self.tooldia_entry.set_range(-10000.0000, 10000.0000) + + dia_grid.addWidget(tooldia_lbl, 0, 0) + dia_grid.addWidget(self.tooldia_entry, 0, 1) + + # ############################################################################################################# + # Tree Widget Frame + # ############################################################################################################# + # Tree Widget Title + tw_label = FCLabel('%s' % _("Geometry Table"), bold=True, color='green') + tw_label.setToolTip( + _("The list of geometry elements inside the edited object.") + ) + self.tools_box.addWidget(tw_label) + + tw_frame = FCFrame() + self.tools_box.addWidget(tw_frame) + + # Grid Layout + tw_grid = GLay(v_spacing=5, h_spacing=3) + tw_frame.setLayout(tw_grid) + + # Tree Widget + self.tw = FCTree(columns=3, header_hidden=False, protected_column=[0, 1], extended_sel=True) + self.tw.setHeaderLabels(["ID", _("Type"), _("Name")]) + self.tw.setIndentation(0) + self.tw.setContextMenuPolicy(QtCore.Qt.ContextMenuPolicy.CustomContextMenu) + self.tw.header().setStretchLastSection(True) + self.tw.header().setSectionResizeMode(QtWidgets.QHeaderView.ResizeMode.ResizeToContents) + tw_grid.addWidget(self.tw, 0, 0, 1, 2) + + self.geo_font = QtGui.QFont() + self.geo_font.setBold(True) + self.geo_parent = self.tw.invisibleRootItem() + + # ############################################################################################################# + # ############################################ Advanced Editor ################################################ + # ############################################################################################################# + self.adv_frame = QtWidgets.QFrame() + self.adv_frame.setContentsMargins(0, 0, 0, 0) + self.tools_box.addWidget(self.adv_frame) + + grid0 = GLay(v_spacing=5, h_spacing=3) + grid0.setContentsMargins(0, 0, 0, 0) + self.adv_frame.setLayout(grid0) + + # Zoom Selection + self.geo_zoom = FCCheckBox(_("Zoom on selection")) + grid0.addWidget(self.geo_zoom, 0, 0, 1, 2) + + # Parameters Title + self.param_button = FCButton('%s' % _("Parameters"), checkable=True, color='blue', bold=True, + click_callback=self.on_param_click) + self.param_button.setToolTip( + _("Geometry parameters.") + ) + grid0.addWidget(self.param_button, 2, 0, 1, 2) + + # ############################################################################################################# + # ############################################ Parameter Frame ################################################ + # ############################################################################################################# + self.par_frame = FCFrame() + grid0.addWidget(self.par_frame, 6, 0, 1, 2) + + par_grid = GLay(v_spacing=5, h_spacing=3) + self.par_frame.setLayout(par_grid) + + # Is Valid + is_valid_lbl = FCLabel('%s' % _("Is Valid"), bold=True) + self.is_valid_entry = FCLabel('None') + + par_grid.addWidget(is_valid_lbl, 0, 0) + par_grid.addWidget(self.is_valid_entry, 0, 1, 1, 2) + + # Is Empty + is_empty_lbl = FCLabel('%s' % _("Is Empty"), bold=True) + self.is_empty_entry = FCLabel('None') + + par_grid.addWidget(is_empty_lbl, 2, 0) + par_grid.addWidget(self.is_empty_entry, 2, 1, 1, 2) + + # Is Ring + is_ring_lbl = FCLabel('%s' % _("Is Ring"), bold=True) + self.is_ring_entry = FCLabel('None') + + par_grid.addWidget(is_ring_lbl, 4, 0) + par_grid.addWidget(self.is_ring_entry, 4, 1, 1, 2) + + # Is CCW + is_ccw_lbl = FCLabel('%s' % _("Is CCW"), bold=True) + self.is_ccw_entry = FCLabel('None') + self.change_orientation_btn = FCButton(_("Change")) + self.change_orientation_btn.setIcon(QtGui.QIcon(self.app.resource_location + '/orientation32.png')) + self.change_orientation_btn.setToolTip( + _("Change the orientation of the geometric element.\n" + "Works for LinearRing and Polygons.") + ) + par_grid.addWidget(is_ccw_lbl, 6, 0) + par_grid.addWidget(self.is_ccw_entry, 6, 1) + par_grid.addWidget(self.change_orientation_btn, 6, 2) + + # Is Simple + is_simple_lbl = FCLabel('%s' % _("Is Simple"), bold=True) + self.is_simple_entry = FCLabel('None') + + par_grid.addWidget(is_simple_lbl, 8, 0) + par_grid.addWidget(self.is_simple_entry, 8, 1, 1, 2) + + # Length + len_lbl = FCLabel('%s' % _("Length"), bold=True) + len_lbl.setToolTip( + _("The length of the geometry element.") + ) + self.geo_len_entry = FCEntry(decimals=self.decimals) + self.geo_len_entry.setReadOnly(True) + + par_grid.addWidget(len_lbl, 10, 0) + par_grid.addWidget(self.geo_len_entry, 10, 1, 1, 2) + + # ############################################################################################################# + # Coordinates Frame + # ############################################################################################################# + # Coordinates + coords_lbl = FCLabel('%s' % _("Coordinates"), bold=True, color='red') + coords_lbl.setToolTip( + _("The coordinates of the selected geometry element.") + ) + self.tools_box.addWidget(coords_lbl) + + c_frame = FCFrame() + self.tools_box.addWidget(c_frame) + + # Grid Layout + coords_grid = GLay(v_spacing=5, h_spacing=3) + c_frame.setLayout(coords_grid) + + self.geo_coords_entry = FCTextEdit() + self.geo_coords_entry.setPlaceholderText( + _("The coordinates of the selected geometry element.") + ) + coords_grid.addWidget(self.geo_coords_entry, 0, 0, 1, 2) + + # Grid Layout + v_grid = GLay(v_spacing=5, h_spacing=3) + self.tools_box.addLayout(v_grid) + + # Vertex Points Number + vertex_lbl = FCLabel('%s' % _("Vertex Points"), bold=True) + vertex_lbl.setToolTip( + _("The number of vertex points in the selected geometry element.") + ) + self.geo_vertex_entry = FCEntry(decimals=self.decimals) + self.geo_vertex_entry.setReadOnly(True) + + v_grid.addWidget(vertex_lbl, 0, 0) + v_grid.addWidget(self.geo_vertex_entry, 0, 1) + + GLay.set_common_column_size([grid0, v_grid, tw_grid, coords_grid, dia_grid, par_grid], 0) + + layout.addStretch(1) + + # Editor + self.exit_editor_button = FCButton(_('Exit Editor'), bold=True) + self.exit_editor_button.setIcon(QtGui.QIcon(self.app.resource_location + '/power16.png')) + self.exit_editor_button.setToolTip( + _("Exit from Editor.") + ) + layout.addWidget(self.exit_editor_button) + + # Signals + self.level.toggled.connect(self.on_level_changed) + self.exit_editor_button.clicked.connect(lambda: self.app.editor2object()) + + def on_param_click(self): + if self.param_button.get_value(): + self.par_frame.show() + else: + self.par_frame.hide() + + def change_level(self, level): + """ + + :param level: application level: either 'b' or 'a' + :type level: str + :return: + """ + if level == 'a': + self.level.setChecked(True) + else: + self.level.setChecked(False) + self.on_level_changed(self.level.isChecked()) + + def on_level_changed(self, checked): + if not checked: + self.level.setText('%s' % _('Beginner')) + self.level.setStyleSheet(""" + QToolButton + { + color: green; + } + """) + + self.adv_frame.hide() + + # Context Menu section + # self.tw.removeContextMenu() + else: + self.level.setText('%s' % _('Advanced')) + self.level.setStyleSheet(""" + QToolButton + { + color: red; + } + """) + + self.adv_frame.show() + + # Context Menu section + # self.tw.setupContextMenu() + + def distance(pt1, pt2): return np.sqrt((pt1[0] - pt2[0]) ** 2 + (pt1[1] - pt2[1]) ** 2) diff --git a/appEditors/AppGerberEditor.py b/appEditors/AppGerberEditor.py index 776ee8a6..2e41cdc8 100644 --- a/appEditors/AppGerberEditor.py +++ b/appEditors/AppGerberEditor.py @@ -6435,17 +6435,11 @@ class AppGerberEditorUI: self.shape_grid.addWidget(self.geo_tol_entry, 16, 1, 1, 2) # Simplification button - self.simplification_btn = FCButton(_("Simplify")) + self.simplification_btn = FCButton(_("Simplify"), bold=True) self.simplification_btn.setIcon(QtGui.QIcon(self.app.resource_location + '/simplify32.png')) self.simplification_btn.setToolTip( _("Simplify a geometry element by reducing its vertex points number.") ) - self.simplification_btn.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.shape_grid.addWidget(self.simplification_btn, 18, 0, 1, 3) @@ -6772,17 +6766,11 @@ class AppGerberEditorUI: layout.addStretch() # Editor - self.exit_editor_button = FCButton(_('Exit Editor')) + self.exit_editor_button = FCButton(_('Exit Editor'), bold=True) self.exit_editor_button.setIcon(QtGui.QIcon(self.app.resource_location + '/power16.png')) self.exit_editor_button.setToolTip( _("Exit from Editor.") ) - self.exit_editor_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) layout.addWidget(self.exit_editor_button) @@ -6807,14 +6795,7 @@ class TransformEditorTool(AppTool): self.decimals = self.app.decimals # ## Title - title_label = FCLabel("%s" % self.pluginName) - title_label.setStyleSheet(""" - QLabel - { - font-size: 16px; - font-weight: bold; - } - """) + title_label = FCLabel("%s" % self.pluginName, size=16, bold=True) self.layout.addWidget(title_label) self.layout.addWidget(FCLabel('')) diff --git a/appEditors/AppTextEditor.py b/appEditors/AppTextEditor.py index 00e91a77..d2bc7667 100644 --- a/appEditors/AppTextEditor.py +++ b/appEditors/AppTextEditor.py @@ -194,7 +194,7 @@ class AppTextEditor(QtWidgets.QWidget): # self.ui.buttonPrint.setEnabled(enable) # self.ui.buttonPreview.setEnabled(enable) - self.buttonSave.setStyleSheet("QPushButton {color: red;}") + self.buttonSave.setStyleSheet("QToolButton {color: red;}") self.buttonSave.setIcon(QtGui.QIcon(self.app.resource_location + '/save_as_red.png')) def load_text(self, text, move_to_start=False, move_to_end=False, clear_text=True, as_html=False): diff --git a/appEditors/appGCodeEditor.py b/appEditors/appGCodeEditor.py index d1728191..bd5c651f 100644 --- a/appEditors/appGCodeEditor.py +++ b/appEditors/appGCodeEditor.py @@ -642,8 +642,8 @@ class AppGCodeEditor(QtCore.QObject): # self.ui.buttonPrint.setEnabled(enable) # self.ui.buttonPreview.setEnabled(enable) - self.buttonSave.setStyleSheet("QPushButton {color: red;}") - self.buttonSave.setIcon(QtGui.QIcon(self.app.resource_location + '/save_as_red.png')) + self.ui.buttonSave.setStyleSheet("QPushButton {color: red;}") + self.ui.buttonSave.setIcon(QtGui.QIcon(self.app.resource_location + '/save_as_red.png')) def insert_code_snippet_1(self): """ @@ -886,17 +886,11 @@ class AppGCodeEditorUI: layout.addStretch(1) # Editor - self.exit_editor_button = FCButton(_('Exit Editor')) + self.exit_editor_button = FCButton(_('Exit Editor'), bold=True) self.exit_editor_button.setIcon(QtGui.QIcon(self.app.resource_location + '/power16.png')) self.exit_editor_button.setToolTip( _("Exit from Editor.") ) - self.exit_editor_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) layout.addWidget(self.exit_editor_button) # ############################ FINSIHED GUI ################################################################## # ############################################################################################################# diff --git a/appEditors/exc_plugins/ExcCopyPlugin.py b/appEditors/exc_plugins/ExcCopyPlugin.py index bb36af50..6ef646be 100644 --- a/appEditors/exc_plugins/ExcCopyPlugin.py +++ b/appEditors/exc_plugins/ExcCopyPlugin.py @@ -126,14 +126,7 @@ class ExcCopyEditorUI: self.app = self.copy_class.app # Title - title_label = FCLabel("%s" % ('Editor ' + self.pluginName)) - title_label.setStyleSheet(""" - QLabel - { - font-size: 16px; - font-weight: bold; - } - """) + title_label = FCLabel("%s" % ('Editor ' + self.pluginName), size=16, bold=True) self.layout.addWidget(title_label) # this way I can hide/show the frame diff --git a/appEditors/exc_plugins/ExcDrillArrayPlugin.py b/appEditors/exc_plugins/ExcDrillArrayPlugin.py index 70453b4e..93c24316 100644 --- a/appEditors/exc_plugins/ExcDrillArrayPlugin.py +++ b/appEditors/exc_plugins/ExcDrillArrayPlugin.py @@ -98,14 +98,7 @@ class ExcDrillArrayEditorUI: self.app = self.darray_class.app # Title - title_label = FCLabel("%s" % ('Editor ' + self.pluginName)) - title_label.setStyleSheet(""" - QLabel - { - font-size: 16px; - font-weight: bold; - } - """) + title_label = FCLabel("%s" % ('Editor ' + self.pluginName), size=16, bold=True) self.layout.addWidget(title_label) # this way I can hide/show the frame diff --git a/appEditors/exc_plugins/ExcDrillPlugin.py b/appEditors/exc_plugins/ExcDrillPlugin.py index 1f83dedb..387ff3f3 100644 --- a/appEditors/exc_plugins/ExcDrillPlugin.py +++ b/appEditors/exc_plugins/ExcDrillPlugin.py @@ -105,14 +105,7 @@ class ExcDrillEditorUI: self.layout = layout # Title - title_label = FCLabel("%s" % ('Editor ' + self.pluginName)) - title_label.setStyleSheet(""" - QLabel - { - font-size: 16px; - font-weight: bold; - } - """) + title_label = FCLabel("%s" % ('Editor ' + self.pluginName), size=16, bold=True) self.layout.addWidget(title_label) # this way I can hide/show the frame diff --git a/appEditors/exc_plugins/ExcResizePlugin.py b/appEditors/exc_plugins/ExcResizePlugin.py index 4fee1991..bdea50fb 100644 --- a/appEditors/exc_plugins/ExcResizePlugin.py +++ b/appEditors/exc_plugins/ExcResizePlugin.py @@ -97,14 +97,7 @@ class ExcResizeEditorUI: self.layout = layout # Title - title_label = FCLabel("%s" % ('Editor ' + self.pluginName)) - title_label.setStyleSheet(""" - QLabel - { - font-size: 16px; - font-weight: bold; - } - """) + title_label = FCLabel("%s" % ('Editor ' + self.pluginName), size=16, bold=True) self.layout.addWidget(title_label) # this way I can hide/show the frame diff --git a/appEditors/exc_plugins/ExcSlotArrayPlugin.py b/appEditors/exc_plugins/ExcSlotArrayPlugin.py index 6772bd4c..57950e61 100644 --- a/appEditors/exc_plugins/ExcSlotArrayPlugin.py +++ b/appEditors/exc_plugins/ExcSlotArrayPlugin.py @@ -95,14 +95,7 @@ class ExcSlotArrayEditorUI: self.app = self.ed_class.app # Title - title_label = FCLabel("%s" % ('Editor ' + self.pluginName)) - title_label.setStyleSheet(""" - QLabel - { - font-size: 16px; - font-weight: bold; - } - """) + title_label = FCLabel("%s" % ('Editor ' + self.pluginName), size=16, bold=True) self.layout.addWidget(title_label) # this way I can hide/show the frame diff --git a/appEditors/exc_plugins/ExcSlotPlugin.py b/appEditors/exc_plugins/ExcSlotPlugin.py index 55d11ef7..22a85634 100644 --- a/appEditors/exc_plugins/ExcSlotPlugin.py +++ b/appEditors/exc_plugins/ExcSlotPlugin.py @@ -105,14 +105,7 @@ class ExcSlotEditorUI: self.layout = layout # Title - title_label = FCLabel("%s" % ('Editor ' + self.pluginName)) - title_label.setStyleSheet(""" - QLabel - { - font-size: 16px; - font-weight: bold; - } - """) + title_label = FCLabel("%s" % ('Editor ' + self.pluginName), size=16, bold=True) self.layout.addWidget(title_label) # this way I can hide/show the frame diff --git a/appEditors/geo_plugins/GeoBufferPlugin.py b/appEditors/geo_plugins/GeoBufferPlugin.py index e37c2e69..9af28c53 100644 --- a/appEditors/geo_plugins/GeoBufferPlugin.py +++ b/appEditors/geo_plugins/GeoBufferPlugin.py @@ -350,14 +350,7 @@ class BufferEditorUI: self.layout = layout # Title - title_label = FCLabel("%s" % ('Editor ' + self.pluginName)) - title_label.setStyleSheet(""" - QLabel - { - font-size: 16px; - font-weight: bold; - } - """) + title_label = FCLabel("%s" % ('Editor ' + self.pluginName), size=16, bold=True) self.layout.addWidget(title_label) # this way I can hide/show the frame diff --git a/appEditors/geo_plugins/GeoCirclePlugin.py b/appEditors/geo_plugins/GeoCirclePlugin.py index 60cf6976..c0ab2070 100644 --- a/appEditors/geo_plugins/GeoCirclePlugin.py +++ b/appEditors/geo_plugins/GeoCirclePlugin.py @@ -164,14 +164,7 @@ class CircleEditorUI: self.layout = layout # Title - title_label = FCLabel("%s" % ('Editor ' + self.pluginName)) - title_label.setStyleSheet(""" - QLabel - { - font-size: 16px; - font-weight: bold; - } - """) + title_label = FCLabel("%s" % ('Editor ' + self.pluginName), size=16, bold=True) self.layout.addWidget(title_label) # this way I can hide/show the frame diff --git a/appEditors/geo_plugins/GeoCopyPlugin.py b/appEditors/geo_plugins/GeoCopyPlugin.py index f4445117..97bd1db7 100644 --- a/appEditors/geo_plugins/GeoCopyPlugin.py +++ b/appEditors/geo_plugins/GeoCopyPlugin.py @@ -124,14 +124,7 @@ class CopyEditorUI: self.app = self.copy_class.app # Title - title_label = FCLabel("%s" % ('Editor ' + self.pluginName)) - title_label.setStyleSheet(""" - QLabel - { - font-size: 16px; - font-weight: bold; - } - """) + title_label = FCLabel("%s" % ('Editor ' + self.pluginName), size=16, bold=True) self.layout.addWidget(title_label) # this way I can hide/show the frame diff --git a/appEditors/geo_plugins/GeoPaintPlugin.py b/appEditors/geo_plugins/GeoPaintPlugin.py index 5e23178b..2cf0aeee 100644 --- a/appEditors/geo_plugins/GeoPaintPlugin.py +++ b/appEditors/geo_plugins/GeoPaintPlugin.py @@ -225,14 +225,7 @@ class PaintEditorUI: self.layout = layout # Title - title_label = FCLabel("%s" % self.pluginName) - title_label.setStyleSheet(""" - QLabel - { - font-size: 16px; - font-weight: bold; - } - """) + title_label = FCLabel("%s" % self.pluginName, size=16, bold=True) self.layout.addWidget(title_label) grid = GLay(v_spacing=5, h_spacing=3) diff --git a/appEditors/geo_plugins/GeoPathPlugin.py b/appEditors/geo_plugins/GeoPathPlugin.py index d1809f0a..6dc5cd6c 100644 --- a/appEditors/geo_plugins/GeoPathPlugin.py +++ b/appEditors/geo_plugins/GeoPathPlugin.py @@ -105,14 +105,7 @@ class PathEditorUI: self.layout = layout # Title - title_label = FCLabel("%s" % ('Editor ' + self.pluginName)) - title_label.setStyleSheet(""" - QLabel - { - font-size: 16px; - font-weight: bold; - } - """) + title_label = FCLabel("%s" % ('Editor ' + self.pluginName), size=16, bold=True) self.layout.addWidget(title_label) # this way I can hide/show the frame diff --git a/appEditors/geo_plugins/GeoRectanglePlugin.py b/appEditors/geo_plugins/GeoRectanglePlugin.py index a7e1ae04..7a2a7eff 100644 --- a/appEditors/geo_plugins/GeoRectanglePlugin.py +++ b/appEditors/geo_plugins/GeoRectanglePlugin.py @@ -197,14 +197,7 @@ class RectangleEditorUI: self.layout = layout # Title - title_label = FCLabel("%s" % ('Editor ' + self.pluginName)) - title_label.setStyleSheet(""" - QLabel - { - font-size: 16px; - font-weight: bold; - } - """) + title_label = FCLabel("%s" % ('Editor ' + self.pluginName), size=16, bold=True) self.layout.addWidget(title_label) # this way I can hide/show the frame diff --git a/appEditors/geo_plugins/GeoSimplificationPlugin.py b/appEditors/geo_plugins/GeoSimplificationPlugin.py index cc89b1e1..9e774843 100644 --- a/appEditors/geo_plugins/GeoSimplificationPlugin.py +++ b/appEditors/geo_plugins/GeoSimplificationPlugin.py @@ -71,7 +71,7 @@ class SimplificationTool(AppTool): self.ui.geo_tol_entry.set_value(0.01 if self.draw_app.units == 'MM' else 0.0004) selected_shapes_geos = [] - selected_tree_items = self.draw_app.tw.selectedItems() + selected_tree_items = self.draw_app.ui.tw.selectedItems() for sel in selected_tree_items: for obj_shape in self.draw_app.storage.get_objects(): try: @@ -173,14 +173,7 @@ class SimplificationEditorUI: self.layout = layout # Title - title_label = FCLabel("%s" % ('Editor ' + self.pluginName)) - title_label.setStyleSheet(""" - QLabel - { - font-size: 16px; - font-weight: bold; - } - """) + title_label = FCLabel("%s" % ('Editor ' + self.pluginName), size=16, bold=True) self.layout.addWidget(title_label) # this way I can hide/show the frame @@ -255,17 +248,11 @@ class SimplificationEditorUI: par_grid.addWidget(self.geo_tol_entry, 0, 1) # Simplification button - self.simplification_btn = FCButton(_("Simplify")) + self.simplification_btn = FCButton(_("Simplify"), bold=True) self.simplification_btn.setIcon(QtGui.QIcon(self.app.resource_location + '/simplify32.png')) self.simplification_btn.setToolTip( _("Simplify a geometry element by reducing its vertex points number.") ) - self.simplification_btn.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.layout.addWidget(self.simplification_btn) diff --git a/appEditors/geo_plugins/GeoTextPlugin.py b/appEditors/geo_plugins/GeoTextPlugin.py index 4914e90d..79334e06 100644 --- a/appEditors/geo_plugins/GeoTextPlugin.py +++ b/appEditors/geo_plugins/GeoTextPlugin.py @@ -209,14 +209,7 @@ class TextEditorUI: self.text_tool_frame.setLayout(self.text_tools_box) # Title - title_label = FCLabel("%s" % self.pluginName) - title_label.setStyleSheet(""" - QLabel - { - font-size: 16px; - font-weight: bold; - } - """) + title_label = FCLabel("%s" % self.pluginName, size=16, bold=True) self.text_tools_box.addWidget(title_label) # Grid Layout diff --git a/appEditors/geo_plugins/GeoTransformationPlugin.py b/appEditors/geo_plugins/GeoTransformationPlugin.py index 7a609183..e428039a 100644 --- a/appEditors/geo_plugins/GeoTransformationPlugin.py +++ b/appEditors/geo_plugins/GeoTransformationPlugin.py @@ -609,14 +609,7 @@ class TransformationEditorUI: self.layout = layout # ## Title - title_label = FCLabel("%s" % self.pluginName) - title_label.setStyleSheet(""" - QLabel - { - font-size: 16px; - font-weight: bold; - } - """) + title_label = FCLabel("%s" % self.pluginName, size=16, bold=True) self.layout.addWidget(title_label) self.layout.addWidget(FCLabel('')) diff --git a/appGUI/GUIElements.py b/appGUI/GUIElements.py index aa2e5de6..93847ae2 100644 --- a/appGUI/GUIElements.py +++ b/appGUI/GUIElements.py @@ -978,7 +978,7 @@ class FCColorEntry(QtWidgets.QFrame): validator = QtGui.QRegularExpressionValidator(regex, self.entry) self.entry.setValidator(validator) - self.button = QtWidgets.QPushButton() + self.button = FCButton() self.button.setFixedSize(15, 15) self.button.setStyleSheet("border-color: dimgray;") @@ -3002,27 +3002,63 @@ class FCInputDialogSpinnerButton(QtWidgets.QDialog): class FCButton(QtWidgets.QPushButton): - def __init__(self, text=None, checkable=None, click_callback=None, parent=None): + def __init__(self, text=None, checkable=None, click_callback=None, bold=False, color=None, parent=None): super(FCButton, self).__init__(text, parent) + + self._bold = False + self._color = None + + self.bold = True if bold else False + + if color: + self.color = self.patching_text_color(color) + if checkable is not None: self.setCheckable(checkable) if click_callback is not None: self.clicked.connect(click_callback) + @property + def bold(self): + return self._bold + + @bold.setter + def bold(self, bold): + self._bold = bold + font = QtGui.QFont() + font.setBold(True) if bold else font.setBold(False) + self.setFont(font) + + @property + def color(self): + return self._color + + @color.setter + def color(self, color): + self._color = color + self.setStyleSheet(""" + QPushButton + {{ + color: {color}; + }} + """.format(color=color)) + def get_value(self): return self.isChecked() def set_value(self, val): self.setText(str(val)) + def patching_text_color(self, color): + return color + class FCLabel(QtWidgets.QLabel): clicked = QtCore.pyqtSignal(bool) right_clicked = QtCore.pyqtSignal(bool) middle_clicked = QtCore.pyqtSignal(bool) - def __init__(self, title=None, color=None, bold=None, size=None, parent=None): """ diff --git a/appGUI/MainGUI.py b/appGUI/MainGUI.py index 18ee9590..fc1e47be 100644 --- a/appGUI/MainGUI.py +++ b/appGUI/MainGUI.py @@ -98,6 +98,7 @@ class MainGUI(QtWidgets.QMainWindow): self.decimals = self.app.decimals FCLabel.patching_text_color = self.theme_safe_color + FCButton.patching_text_color = self.theme_safe_color # self.setWindowFlags(QtCore.Qt.WindowType.FramelessWindowHint) diff --git a/appGUI/ObjectUI.py b/appGUI/ObjectUI.py index f889a195..fef5527d 100644 --- a/appGUI/ObjectUI.py +++ b/appGUI/ObjectUI.py @@ -241,29 +241,17 @@ class GerberObjectUI(ObjectUI): plot_grid.addWidget(self.follow_cb, 2, 2) # Editor - self.editor_button = FCButton(_('Gerber Editor')) + self.editor_button = FCButton(_('Gerber Editor'), bold=True) self.editor_button.setIcon(QtGui.QIcon(self.app.resource_location + '/edit_file32.png')) self.editor_button.setToolTip( _("Start the Object Editor") ) - self.editor_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.custom_box.addWidget(self.editor_button) # INFO CB - self.info_button = FCButton('%s' % _("INFO"), checkable=True) + self.info_button = FCButton('%s' % _("INFO"), checkable=True, bold=True) self.info_button.setIcon(QtGui.QIcon(self.app.resource_location + '/properties32.png')) self.info_button.setToolTip(_("Show the Object Attributes.")) - self.info_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.custom_box.addWidget(self.info_button) # INFO Frame @@ -382,18 +370,12 @@ class GerberObjectUI(ObjectUI): plugins_frame.setLayout(plugins_grid) # Isolation Tool - will create isolation paths around the copper features - self.iso_button = FCButton(_('Isolation Routing')) + self.iso_button = FCButton(_('Isolation Routing'), bold=True) # self.iso_button.setIcon(QtGui.QIcon(self.app.resource_location + '/iso_16.png')) self.iso_button.setToolTip( _("Create a Geometry object with\n" "toolpaths to cut around polygons.") ) - self.iso_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) plugins_grid.addWidget(self.iso_button, 0, 0) # ## Board cutout @@ -457,15 +439,9 @@ class GerberObjectUI(ObjectUI): # self.custom_box.addWidget(separator_line) # UTILITIES BUTTON - self.util_button = FCButton('%s' % _("Utilities").upper(), checkable=True) + self.util_button = FCButton('%s' % _("Utilities").upper(), checkable=True, bold=True) self.util_button.setIcon(QtGui.QIcon(self.app.resource_location + '/settings18.png')) self.util_button.setToolTip(_("Show the Utilities.")) - self.util_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.custom_box.addWidget(self.util_button) # UTILITIES Frame @@ -647,30 +623,18 @@ class ExcellonObjectUI(ObjectUI): plot_grid.addLayout(self.name_hlay, 2, 0, 1, 3) # Editor - self.editor_button = FCButton(_('Excellon Editor')) + self.editor_button = FCButton(_('Excellon Editor'), bold=True) self.editor_button.setIcon(QtGui.QIcon(self.app.resource_location + '/edit_file32.png')) self.editor_button.setToolTip( _("Start the Object Editor") ) - self.editor_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.custom_box.addWidget(self.editor_button) # INFO CB - self.info_button = FCButton('%s' % _("INFO"), checkable=True) + self.info_button = FCButton('%s' % _("INFO"), checkable=True, bold=True) self.info_button.setIcon(QtGui.QIcon(self.app.resource_location + '/properties32.png')) self.info_button.setToolTip(_("Show the Object Attributes.")) - self.info_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.custom_box.addWidget(self.info_button) # INFO Frame @@ -787,17 +751,11 @@ class ExcellonObjectUI(ObjectUI): plugins_frame.setLayout(plugins_grid) # Drilling Tool - will create GCode for drill holes - self.drill_button = FCButton(_('Drilling')) + self.drill_button = FCButton(_('Drilling'), bold=True) self.drill_button.setIcon(QtGui.QIcon(self.app.resource_location + '/drilling_tool32.png')) self.drill_button.setToolTip( _("Generate GCode from the drill holes in an Excellon object.") ) - self.drill_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) plugins_grid.addWidget(self.drill_button, 0, 0) # Milling Tool - will create GCode for slot holes @@ -806,12 +764,6 @@ class ExcellonObjectUI(ObjectUI): self.milling_button.setToolTip( _("Generate a Geometry for milling drills or slots in an Excellon object.") ) - # self.milling_button.setStyleSheet(""" - # QPushButton - # { - # font-weight: bold; - # } - # """) plugins_grid.addWidget(self.milling_button, 2, 0) # separator_line = QtWidgets.QFrame() @@ -820,15 +772,9 @@ class ExcellonObjectUI(ObjectUI): # self.custom_box.addWidget(separator_line) # UTILITIES BUTTON - self.util_button = FCButton('%s' % _("Utilities").upper(), checkable=True) + self.util_button = FCButton('%s' % _("Utilities").upper(), checkable=True, bold=True) self.util_button.setIcon(QtGui.QIcon(self.app.resource_location + '/settings18.png')) self.util_button.setToolTip(_("Show the Utilities.")) - self.util_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.custom_box.addWidget(self.util_button) # UTILITIES Frame @@ -870,17 +816,11 @@ class ExcellonObjectUI(ObjectUI): self.tooldia_entry.set_range(0.0, 10000.0000) self.tooldia_entry.setSingleStep(0.1) - self.generate_milling_button = FCButton(_('Mill Drills')) + self.generate_milling_button = FCButton(_('Mill Drills'), bold=True) self.generate_milling_button.setToolTip( _("Create the Geometry Object\n" "for milling drills.") ) - self.generate_milling_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) grid_mill.addWidget(self.tooldia_entry, 2, 0, 1, 2) grid_mill.addWidget(self.generate_milling_button, 2, 2) @@ -890,17 +830,11 @@ class ExcellonObjectUI(ObjectUI): self.slot_tooldia_entry.set_range(0.0, 10000.0000) self.slot_tooldia_entry.setSingleStep(0.1) - self.generate_milling_slots_button = FCButton(_('Mill Slots')) + self.generate_milling_slots_button = FCButton(_('Mill Slots'), bold=True) self.generate_milling_slots_button.setToolTip( _("Create the Geometry Object\n" "for milling slots.") ) - self.generate_milling_slots_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) grid_mill.addWidget(self.slot_tooldia_entry, 4, 0, 1, 2) grid_mill.addWidget(self.generate_milling_slots_button, 4, 2) @@ -977,30 +911,18 @@ class GeometryObjectUI(ObjectUI): self.name_hlay.addWidget(self.name_entry) # Editor - self.editor_button = FCButton(_('Geometry Editor')) + self.editor_button = FCButton(_('Geometry Editor'), bold=True) self.editor_button.setIcon(QtGui.QIcon(self.app.resource_location + '/edit_file32.png')) self.editor_button.setToolTip( _("Start the Object Editor") ) - self.editor_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.custom_box.addWidget(self.editor_button) # INFO CB - self.info_button = FCButton('%s' % _("INFO"), checkable=True) + self.info_button = FCButton('%s' % _("INFO"), checkable=True, bold=True) self.info_button.setIcon(QtGui.QIcon(self.app.resource_location + '/properties32.png')) self.info_button.setToolTip(_("Show the Object Attributes.")) - self.info_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.custom_box.addWidget(self.info_button) # INFO Frame @@ -1113,17 +1035,11 @@ class GeometryObjectUI(ObjectUI): plugins_frame.setLayout(plugins_grid) # Milling Tool - will create GCode for slot holes - self.milling_button = FCButton(_('Milling')) + self.milling_button = FCButton(_('Milling'), bold=True) self.milling_button.setIcon(QtGui.QIcon(self.app.resource_location + '/milling_tool32.png')) self.milling_button.setToolTip( _("Generate a CNCJob by milling a Geometry.") ) - self.milling_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) plugins_grid.addWidget(self.milling_button, 0, 0) # Paint Button @@ -1157,15 +1073,9 @@ class GeometryObjectUI(ObjectUI): # self.custom_box.addWidget(separator_line) # UTILITIES BUTTON - self.util_button = FCButton('%s' % _("Utilities").upper(), checkable=True) + self.util_button = FCButton('%s' % _("Utilities").upper(), checkable=True, bold=True) self.util_button.setIcon(QtGui.QIcon(self.app.resource_location + '/settings18.png')) self.util_button.setToolTip(_("Show the Utilities.")) - self.util_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.custom_box.addWidget(self.util_button) # UTILITIES Frame @@ -1327,28 +1237,16 @@ class CNCObjectUI(ObjectUI): self.name_hlay.addWidget(self.name_entry) # Editor - self.editor_button = FCButton(_('GCode Editor')) + self.editor_button = FCButton(_('GCode Editor'), bold=True) self.editor_button.setIcon(QtGui.QIcon(self.app.resource_location + '/edit_file32.png')) self.editor_button.setToolTip(_("Start the Object Editor")) - self.editor_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.custom_box.addWidget(self.editor_button) # INFO CB - self.info_button = FCButton('%s' % _("INFO"), checkable=True) + self.info_button = FCButton('%s' % _("INFO"), checkable=True, bold=True) self.info_button.setIcon(QtGui.QIcon(self.app.resource_location + '/properties32.png')) self.info_button.setToolTip(_("Show the Object Attributes.")) - self.info_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.custom_box.addWidget(self.info_button) # INFO Frame @@ -1521,17 +1419,11 @@ class CNCObjectUI(ObjectUI): self.custom_box.addWidget(self.tool_lbl) # Levelling Tool - will process the generated GCode using a Height Map generating levelled GCode - self.autolevel_button = FCButton(_('Levelling')) + self.autolevel_button = FCButton(_('Levelling'), bold=True) self.autolevel_button.setIcon(QtGui.QIcon(self.app.resource_location + '/level32.png')) self.autolevel_button.setToolTip( _("Generate CNC Code with auto-levelled paths.") ) - self.autolevel_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.custom_box.addWidget(self.autolevel_button) # self.autolevel_button.setDisabled(True) # self.autolevel_button.setToolTip("DISABLED. Work in progress!") diff --git a/appGUI/preferences/PreferencesUIManager.py b/appGUI/preferences/PreferencesUIManager.py index e70eb8b6..423552f7 100644 --- a/appGUI/preferences/PreferencesUIManager.py +++ b/appGUI/preferences/PreferencesUIManager.py @@ -1334,7 +1334,7 @@ class PreferencesUIManager(QtCore.QObject): self.old_color = self.ui.plot_tab_area.tabBar.tabTextColor(idx) self.ui.plot_tab_area.tabBar.setTabTextColor(idx, QtGui.QColor('red')) - self.ui.pref_apply_button.setStyleSheet("QPushButton {color: red;}") + self.ui.pref_apply_button.color = 'red' self.ui.pref_apply_button.setIcon(QtGui.QIcon(self.ui.app.resource_location + '/apply_red32.png')) self.preferences_changed_flag = True diff --git a/appGUI/preferences/excellon/ExcellonGenPrefGroupUI.py b/appGUI/preferences/excellon/ExcellonGenPrefGroupUI.py index 019e10ad..4b46681c 100644 --- a/appGUI/preferences/excellon/ExcellonGenPrefGroupUI.py +++ b/appGUI/preferences/excellon/ExcellonGenPrefGroupUI.py @@ -3,7 +3,7 @@ import platform from PyQt6 import QtWidgets, QtCore, QtGui from appGUI.GUIElements import FCCheckBox, FCSpinner, RadioSet, FCSliderWithSpinner, FCColorEntry, FCLabel, \ - GLay, FCFrame + GLay, FCFrame, FCButton from appGUI.preferences.OptionsGroupUI import OptionsGroupUI import gettext import appTranslation as fcTranslate @@ -212,7 +212,7 @@ class ExcellonGenPrefGroupUI(OptionsGroupUI): format_grid.addWidget(self.update_excellon_cb, 5, 0, 1, 2) # Adding the Excellon Format Defaults Button - self.excellon_defaults_button = QtWidgets.QPushButton() + self.excellon_defaults_button = FCButton() self.excellon_defaults_button.setText(str(_("Restore Defaults"))) self.excellon_defaults_button.setMinimumWidth(80) format_grid.addWidget(self.excellon_defaults_button, 6, 0, 1, 2) diff --git a/appMain.py b/appMain.py index a5323e43..b09b2da8 100644 --- a/appMain.py +++ b/appMain.py @@ -3255,7 +3255,7 @@ class App(QtCore.QObject): ) title.setOpenExternalLinks(True) - closebtn = QtWidgets.QPushButton(_("Close")) + closebtn = FCButton(_("Close")) tab_widget = QtWidgets.QTabWidget() description_label = FCLabel( @@ -3835,7 +3835,7 @@ class App(QtCore.QObject): tab_widget = QtWidgets.QTabWidget() tab_layout.addWidget(tab_widget) - closebtn = QtWidgets.QPushButton(_("Close")) + closebtn = FCButton(_("Close")) buttons_hlay.addStretch() buttons_hlay.addWidget(closebtn) diff --git a/appPlugins/ToolAlignObjects.py b/appPlugins/ToolAlignObjects.py index d8e95ace..7f2c2e1f 100644 --- a/appPlugins/ToolAlignObjects.py +++ b/appPlugins/ToolAlignObjects.py @@ -391,14 +391,7 @@ class AlignUI: self.layout = layout # ## Title - title_label = FCLabel("%s" % self.pluginName) - title_label.setStyleSheet(""" - QLabel - { - font-size: 16px; - font-weight: bold; - } - """) + title_label = FCLabel("%s" % self.pluginName, size=16, bold=True) self.layout.addWidget(title_label) self.tools_frame = QtWidgets.QFrame() @@ -521,35 +514,23 @@ class AlignUI: # GLay.set_common_column_size([grid0, grid1, grid2], 0, FCLabel) # Buttons - self.align_object_button = FCButton(_("Align Object")) + self.align_object_button = FCButton(_("Align Object"), bold=True) self.align_object_button.setIcon(QtGui.QIcon(self.app.resource_location + '/align16.png')) self.align_object_button.setToolTip( _("Align the specified object to the aligner object.\n" "If only one point is used then it assumes translation.\n" "If tho points are used it assume translation and rotation.") ) - self.align_object_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.tools_box.addWidget(self.align_object_button) self.layout.addStretch(1) # ## Reset Tool - self.reset_button = FCButton(_("Reset Tool")) + self.reset_button = FCButton(_("Reset Tool"), bold=True) self.reset_button.setIcon(QtGui.QIcon(self.app.resource_location + '/reset32.png')) self.reset_button.setToolTip( _("Will reset the tool parameters.") ) - self.reset_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.layout.addWidget(self.reset_button) # #################################### FINSIHED GUI ########################### diff --git a/appPlugins/ToolCalculators.py b/appPlugins/ToolCalculators.py index b1ff4d20..274aaf31 100644 --- a/appPlugins/ToolCalculators.py +++ b/appPlugins/ToolCalculators.py @@ -511,14 +511,7 @@ class CalcUI: self.units = self.app.app_units.lower() # ## Title - title_label = FCLabel("%s" % self.pluginName) - title_label.setStyleSheet(""" - QLabel - { - font-size: 16px; - font-weight: bold; - } - """) + title_label = FCLabel("%s" % self.pluginName, size=16, bold=True) self.layout.addWidget(title_label) # ##################### @@ -1047,17 +1040,11 @@ class CalcUI: self.layout.addStretch(1) # ## Reset Tool - self.reset_button = FCButton(_("Reset Tool")) + self.reset_button = FCButton(_("Reset Tool"), bold=True) self.reset_button.setIcon(QtGui.QIcon(self.app.resource_location + '/reset32.png')) self.reset_button.setToolTip( _("Will reset the tool parameters.") ) - self.reset_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.layout.addWidget(self.reset_button) # #################################### FINSIHED GUI ########################### diff --git a/appPlugins/ToolCopperThieving.py b/appPlugins/ToolCopperThieving.py index 9d03c758..88bb85aa 100644 --- a/appPlugins/ToolCopperThieving.py +++ b/appPlugins/ToolCopperThieving.py @@ -1257,14 +1257,7 @@ class ThievingUI: self.layout = layout # ## Title - title_label = FCLabel("%s" % self.pluginName) - title_label.setStyleSheet(""" - QLabel - { - font-size: 16px; - font-weight: bold; - } - """) + title_label = FCLabel("%s" % self.pluginName, size=16, bold=True) self.layout.addWidget(title_label) self.tools_frame = QtWidgets.QFrame() @@ -1573,18 +1566,12 @@ class ThievingUI: # ############################################################################################################# # ## Insert Copper Thieving BUTTON # ############################################################################################################# - self.fill_button = QtWidgets.QPushButton(_("Insert Copper thieving")) + self.fill_button = FCButton(_("Insert Copper thieving"), bold=True) self.fill_button.setIcon(QtGui.QIcon(self.app.resource_location + '/copperfill32.png')) self.fill_button.setToolTip( _("Will add a polygon (may be split in multiple parts)\n" "that will surround the actual Gerber traces at a certain distance.") ) - self.fill_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.tools_box.addWidget(self.fill_button) # ############################################################################################################# @@ -1638,7 +1625,7 @@ class ThievingUI: # ############################################################################################################# # ## Insert Robber Bar # ############################################################################################################# - self.rb_button = QtWidgets.QPushButton(_("Insert Robber Bar")) + self.rb_button = FCButton(_("Insert Robber Bar"), bold=True) self.rb_button.setIcon(QtGui.QIcon(self.app.resource_location + '/robber32.png')) self.rb_button.setToolTip( _("Will add a polygon with a defined thickness\n" @@ -1646,12 +1633,6 @@ class ThievingUI: "at a certain distance.\n" "Required when doing holes pattern plating.") ) - self.rb_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.tools_box.addWidget(self.rb_button) # ############################################################################################################# @@ -1751,35 +1732,23 @@ class ThievingUI: # ############################################################################################################# # ## Pattern Plating Mask Button # ############################################################################################################# - self.ppm_button = QtWidgets.QPushButton(_("Generate pattern plating mask")) + self.ppm_button = FCButton(_("Generate pattern plating mask"), bold=True) self.ppm_button.setIcon(QtGui.QIcon(self.app.resource_location + '/pattern32.png')) self.ppm_button.setToolTip( _("Will add to the soldermask gerber geometry\n" "the geometries of the copper thieving and/or\n" "the robber bar if those were generated.") ) - self.ppm_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.tools_box.addWidget(self.ppm_button) self.layout.addStretch(1) # ## Reset Tool - self.reset_button = QtWidgets.QPushButton(_("Reset Tool")) + self.reset_button = FCButton(_("Reset Tool"), bold=True) self.reset_button.setIcon(QtGui.QIcon(self.app.resource_location + '/reset32.png')) self.reset_button.setToolTip( _("Will reset the tool parameters.") ) - self.reset_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.layout.addWidget(self.reset_button) # #################################### FINSIHED GUI ########################### diff --git a/appPlugins/ToolCutOut.py b/appPlugins/ToolCutOut.py index b6dff55a..3fc6586e 100644 --- a/appPlugins/ToolCutOut.py +++ b/appPlugins/ToolCutOut.py @@ -2228,14 +2228,7 @@ class CutoutUI: self.tools_box.addLayout(self.title_box) # Title - title_label = FCLabel("%s" % self.pluginName) - title_label.setStyleSheet(""" - QLabel - { - font-size: 16px; - font-weight: bold; - } - """) + title_label = FCLabel("%s" % self.pluginName, size=16, bold=True) title_label.setToolTip( _("Create a Geometry object with toolpaths\n" "for cutting out the object from the surrounding material.") @@ -2673,17 +2666,11 @@ class CutoutUI: man_hlay.addWidget(self.man_gaps_creation_btn) # Generate Geometry Button - self.generate_cutout_btn = FCButton(_("Generate Geometry")) + self.generate_cutout_btn = FCButton(_("Generate Geometry"), bold=True) self.generate_cutout_btn.setIcon(QtGui.QIcon(self.app.resource_location + '/irregular32.png')) self.generate_cutout_btn.setToolTip( _("Generate the cutout geometry.") ) - self.generate_cutout_btn.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.tools_box.addWidget(self.generate_cutout_btn) # self.tool_param_separator_line = QtWidgets.QFrame() @@ -2768,33 +2755,21 @@ class CutoutUI: GLay.set_common_column_size([obj_grid, tool_grid, param_grid, man_grid, drill_cut_grid, gaps_grid], 0) # Drill Cut Button - self.drillcut_btn = FCButton(_("Cut by Drilling")) + self.drillcut_btn = FCButton(_("Cut by Drilling"), bold=True) self.drillcut_btn.setIcon(QtGui.QIcon(self.app.resource_location + '/drill16.png')) self.drillcut_btn.setToolTip( _("Create a series of drill holes following a geometry line.") ) - self.drillcut_btn.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.tools_box.addWidget(self.drillcut_btn) self.layout.addStretch() # ## Reset Tool - self.reset_button = FCButton(_("Reset Tool")) + self.reset_button = FCButton(_("Reset Tool"), bold=True) self.reset_button.setIcon(QtGui.QIcon(self.app.resource_location + '/reset32.png')) self.reset_button.setToolTip( _("Will reset the tool parameters.") ) - self.reset_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.layout.addWidget(self.reset_button) self.gaptype_combo.currentIndexChanged.connect(self.on_gap_type_radio) diff --git a/appPlugins/ToolDblSided.py b/appPlugins/ToolDblSided.py index 8643adb6..e4e06829 100644 --- a/appPlugins/ToolDblSided.py +++ b/appPlugins/ToolDblSided.py @@ -689,14 +689,7 @@ class DsidedUI: self.tools_box.addLayout(self.title_box) # ## Title - title_label = FCLabel("%s" % self.pluginName) - title_label.setStyleSheet(""" - QLabel - { - font-size: 16px; - font-weight: bold; - } - """) + title_label = FCLabel("%s" % self.pluginName, size=16, bold=True) title_label.setToolTip( _("Create a Geometry object with\n" "toolpaths to cover the space outside the copper pattern.") @@ -837,18 +830,12 @@ class DsidedUI: grid_bounds.addWidget(self.center_entry, 8, 1) # Calculate Bounding box - self.calculate_bb_button = FCButton(_("Calculate Bounds Values")) + self.calculate_bb_button = FCButton(_("Calculate Bounds Values"), bold=True) self.calculate_bb_button.setToolTip( _("Calculate the enveloping rectangular shape coordinates,\n" "for the selection of objects.\n" "The envelope shape is parallel with the X, Y axis.") ) - self.calculate_bb_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.tools_box.addWidget(self.calculate_bb_button) # ############################################################################################################# @@ -1005,19 +992,13 @@ class DsidedUI: # ############################################################################################################# # Mirror Button # ############################################################################################################# - self.mirror_button = FCButton(_("Mirror")) + self.mirror_button = FCButton(_("Mirror"), bold=True) self.mirror_button.setIcon(QtGui.QIcon(self.app.resource_location + '/doubleside16.png')) self.mirror_button.setToolTip( _("Mirrors (flips) the specified object around \n" "the specified axis. Does not create a new \n" "object, but modifies it.") ) - self.mirror_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.tools_box.addWidget(self.mirror_button) # ############################################################################################################# @@ -1125,35 +1106,23 @@ class DsidedUI: GLay.set_common_column_size([obj_grid, grid_bounds, grid_mirror, grid_box_ref, grid4], 0) # ## Buttons - self.create_excellon_button = FCButton(_("Create Excellon Object")) + self.create_excellon_button = FCButton(_("Create Excellon Object"), bold=True) self.create_excellon_button.setIcon(QtGui.QIcon(self.app.resource_location + '/drill32.png')) self.create_excellon_button.setToolTip( _("Creates an Excellon Object containing the\n" "specified alignment holes and their mirror\n" "images.") ) - self.create_excellon_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.tools_box.addWidget(self.create_excellon_button) self.tools_box.addStretch(1) # ## Reset Tool - self.reset_button = FCButton(_("Reset Tool")) + self.reset_button = FCButton(_("Reset Tool"), bold=True) self.reset_button.setIcon(QtGui.QIcon(self.app.resource_location + '/reset32.png')) self.reset_button.setToolTip( _("Will reset the tool parameters.") ) - self.reset_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.tools_box.addWidget(self.reset_button) self.align_type_radio.activated_custom.connect(self.on_align_type_changed) diff --git a/appPlugins/ToolDrilling.py b/appPlugins/ToolDrilling.py index be6330d9..507f2b98 100644 --- a/appPlugins/ToolDrilling.py +++ b/appPlugins/ToolDrilling.py @@ -2370,14 +2370,7 @@ class DrillingUI: self.tools_box.addLayout(self.title_box) # ## Title - title_label = FCLabel("%s" % name) - title_label.setStyleSheet(""" - QLabel - { - font-size: 16px; - font-weight: bold; - } - """) + title_label = FCLabel("%s" % name, size=16, bold=True) title_label.setToolTip( _("Create CNCJob with toolpaths for drilling or milling holes.") ) @@ -2961,7 +2954,7 @@ class DrillingUI: exclud_grid.addWidget(self.over_z_entry, 2, 1) # Button Add Area - self.add_area_button = QtWidgets.QPushButton(_('Add Area:')) + self.add_area_button = FCButton(_('Add Area:')) self.add_area_button.setToolTip(_("Add an Exclusion Area.")) # Area Selection shape @@ -2979,11 +2972,11 @@ class DrillingUI: self.exclusion_box.addLayout(h_lay_1) # Button Delete All Areas - self.delete_area_button = QtWidgets.QPushButton(_('Delete All')) + self.delete_area_button = FCButton(_('Delete All')) self.delete_area_button.setToolTip(_("Delete all exclusion areas.")) # Button Delete Selected Areas - self.delete_sel_area_button = QtWidgets.QPushButton(_('Delete Selected')) + self.delete_sel_area_button = FCButton(_('Delete Selected')) self.delete_sel_area_button.setToolTip(_("Delete all exclusion areas that are selected in the table.")) h_lay_1.addWidget(self.delete_area_button) @@ -3000,7 +2993,7 @@ class DrillingUI: GLay.set_common_column_size([obj_grid, tool_grid, param_grid, all_par_grid], 0) - self.generate_cnc_button = QtWidgets.QPushButton(_('Generate CNCJob object')) + self.generate_cnc_button = FCButton(_('Generate CNCJob object'), bold=True) self.generate_cnc_button.setIcon(QtGui.QIcon(self.app.resource_location + '/cnc16.png')) self.generate_cnc_button.setToolTip( _("Generate the CNC Job.\n" @@ -3009,28 +3002,16 @@ class DrillingUI: "Click the # header to select all, or Ctrl + LMB\n" "for custom selection of tools.") ) - self.generate_cnc_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.tools_box.addWidget(self.generate_cnc_button) self.tools_box.addStretch(1) # ## Reset Tool - self.reset_button = QtWidgets.QPushButton(_("Reset Tool")) + self.reset_button = FCButton(_("Reset Tool"), bold=True) self.reset_button.setIcon(QtGui.QIcon(self.app.resource_location + '/reset32.png')) self.reset_button.setToolTip( _("Will reset the tool parameters.") ) - self.reset_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.tools_box.addWidget(self.reset_button) # ############################ FINSIHED GUI ################################### # ############################################################################# diff --git a/appPlugins/ToolEtchCompensation.py b/appPlugins/ToolEtchCompensation.py index 2faea4f0..6341afbc 100644 --- a/appPlugins/ToolEtchCompensation.py +++ b/appPlugins/ToolEtchCompensation.py @@ -300,14 +300,7 @@ class EtchUI: self.tools_frame.setLayout(self.tools_box) # Title - title_label = FCLabel("%s" % self.pluginName) - title_label.setStyleSheet(""" - QLabel - { - font-size: 16px; - font-weight: bold; - } - """) + title_label = FCLabel("%s" % self.pluginName, size=16, bold=True) self.tools_box.addWidget(title_label) # ############################################################################################################# @@ -480,33 +473,21 @@ class EtchUI: # ############################################################################################################# # Generate Etch Compensation Button # ############################################################################################################# - self.compensate_btn = FCButton(_('Compensate')) + self.compensate_btn = FCButton(_('Compensate'), bold=True) self.compensate_btn.setIcon(QtGui.QIcon(self.app.resource_location + '/etch_32.png')) self.compensate_btn.setToolTip( _("Will increase the copper features thickness to compensate the lateral etch.") ) - self.compensate_btn.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.tools_box.addWidget(self.compensate_btn) self.tools_box.addStretch(1) # ## Reset Tool - self.reset_button = QtWidgets.QPushButton(_("Reset Tool")) + self.reset_button = FCButton(_("Reset Tool"), bold=True) self.reset_button.setIcon(QtGui.QIcon(self.app.resource_location + '/reset32.png')) self.reset_button.setToolTip( _("Will reset the tool parameters.") ) - self.reset_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.layout.addWidget(self.reset_button) # #################################### FINSIHED GUI ########################### diff --git a/appPlugins/ToolExtract.py b/appPlugins/ToolExtract.py index b8e6cbf4..bbbf462b 100644 --- a/appPlugins/ToolExtract.py +++ b/appPlugins/ToolExtract.py @@ -991,14 +991,8 @@ class ExtractUI: self.layout = layout # ## Title - title_label = FCLabel("%s" % self.pluginName) - title_label.setStyleSheet(""" - QLabel - { - font-size: 16px; - font-weight: bold; - } - """) + title_label = FCLabel("%s" % self.pluginName, size=16, bold=True) + self.layout.addWidget(title_label) self.tools_frame = QtWidgets.QFrame() @@ -1320,17 +1314,11 @@ class ExtractUI: # ############################################################################################################# # Extract drills from Gerber apertures flashes (pads) BUTTON # ############################################################################################################# - self.e_drills_button = QtWidgets.QPushButton(_("Extract Drills")) + self.e_drills_button = FCButton(_("Extract Drills"), bold=True) self.e_drills_button.setIcon(QtGui.QIcon(self.app.resource_location + '/drill16.png')) self.e_drills_button.setToolTip( _("Extract drills from a given Gerber file.") ) - self.e_drills_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.tools_box.addWidget(self.e_drills_button) # ############################################################################################################# @@ -1365,17 +1353,12 @@ class ExtractUI: # ############################################################################################################# # Extract solderemask from Gerber apertures flashes (pads) BUTTON # ############################################################################################################# - self.e_sm_button = QtWidgets.QPushButton(_("Extract Soldermask")) + self.e_sm_button = FCButton(_("Extract Soldermask")) self.e_sm_button.setIcon(QtGui.QIcon(self.app.resource_location + '/extract32.png')) self.e_sm_button.setToolTip( _("Extract soldermask from a given Gerber file.") ) - self.e_sm_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) + self.e_sm_button.bold = True self.tools_box.addWidget(self.e_sm_button) # ############################################################################################################# @@ -1427,33 +1410,22 @@ class ExtractUI: # ############################################################################################################# # Extract cutout from Gerber apertures flashes (pads) BUTTON # ############################################################################################################# - self.e_cut_button = QtWidgets.QPushButton(_("Extract Cutout")) + self.e_cut_button = FCButton(_("Extract Cutout")) self.e_cut_button.setIcon(QtGui.QIcon(self.app.resource_location + '/extract32.png')) self.e_cut_button.setToolTip( _("Extract a cutout from a given Gerber file.") ) - self.e_cut_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) + self.e_cut_button.bold = True self.tools_box.addWidget(self.e_cut_button) self.layout.addStretch(1) # ## Reset Tool - self.reset_button = QtWidgets.QPushButton(_("Reset Tool")) + self.reset_button = FCButton(_("Reset Tool"), bold=True) self.reset_button.setIcon(QtGui.QIcon(self.app.resource_location + '/reset32.png')) self.reset_button.setToolTip( _("Will reset the tool parameters.") ) - self.reset_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.layout.addWidget(self.reset_button) self.ring_frame.hide() diff --git a/appPlugins/ToolFiducials.py b/appPlugins/ToolFiducials.py index 2d8767ec..c6520977 100644 --- a/appPlugins/ToolFiducials.py +++ b/appPlugins/ToolFiducials.py @@ -902,14 +902,7 @@ class FidoUI: self.layout.addLayout(self.title_box) # ## Title - title_label = FCLabel("%s" % self.pluginName) - title_label.setStyleSheet(""" - QLabel - { - font-size: 16px; - font-weight: bold; - } - """) + title_label = FCLabel("%s" % self.pluginName, size=16, bold=True) self.title_box.addWidget(title_label) # App Level label @@ -1178,49 +1171,31 @@ class FidoUI: GLay.set_common_column_size([grid_sel, param_grid, param_grid], 0) # ## Insert Copper Fiducial - self.add_cfid_button = FCButton(_("Add Fiducial")) + self.add_cfid_button = FCButton(_("Add Fiducial"), bold=True) self.add_cfid_button.setIcon(QtGui.QIcon(self.app.resource_location + '/fiducials_32.png')) self.add_cfid_button.setToolTip( _("Will add a polygon on the copper layer to serve as fiducial.") ) - self.add_cfid_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.tools_box.addWidget(self.add_cfid_button) # ## Insert Soldermask opening for Fiducial - self.add_sm_opening_button = FCButton(_("Add Soldermask Opening")) + self.add_sm_opening_button = FCButton(_("Add Soldermask Opening"), bold=True) self.add_sm_opening_button.setToolTip( _("Will add a polygon on the soldermask layer\n" "to serve as fiducial opening.\n" "The diameter is always double of the diameter\n" "for the copper fiducial.") ) - self.add_sm_opening_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.tools_box.addWidget(self.add_sm_opening_button) self.layout.addStretch(1) # ## Reset Tool - self.reset_button = FCButton(_("Reset Tool")) + self.reset_button = FCButton(_("Reset Tool"), bold=True) self.reset_button.setIcon(QtGui.QIcon(self.app.resource_location + '/reset32.png')) self.reset_button.setToolTip( _("Will reset the tool parameters.") ) - self.reset_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.layout.addWidget(self.reset_button) # #################################### FINSIHED GUI ########################### diff --git a/appPlugins/ToolFilm.py b/appPlugins/ToolFilm.py index 8efffa3f..4d60b92a 100644 --- a/appPlugins/ToolFilm.py +++ b/appPlugins/ToolFilm.py @@ -1237,14 +1237,7 @@ class FilmUI: self.tools_box.addLayout(self.title_box) # ## Title - title_label = FCLabel("%s" % self.pluginName) - title_label.setStyleSheet(""" - QLabel - { - font-size: 16px; - font-weight: bold; - } - """) + title_label = FCLabel("%s" % self.pluginName, size=16, bold=True) title_label.setToolTip( _("Create a positive/negative film for UV exposure.") ) @@ -1778,7 +1771,7 @@ class FilmUI: GLay.set_common_column_size([adj_grid, param_grid, obj_grid, export_grid, punch_grid], 0) # Buttons - self.film_object_button = FCButton(_("Save Film")) + self.film_object_button = FCButton(_("Save Film"), bold=True) self.film_object_button.setIcon(QtGui.QIcon(self.app.resource_location + '/save_as.png')) self.film_object_button.setToolTip( _("Create a Film for the selected object, within\n" @@ -1786,28 +1779,16 @@ class FilmUI: "FlatCAM object, but directly save it in the\n" "selected format.") ) - self.film_object_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.tools_box.addWidget(self.film_object_button) self.layout.addStretch(1) # ## Reset Tool - self.reset_button = FCButton(_("Reset Tool")) + self.reset_button = FCButton(_("Reset Tool"), bold=True) self.reset_button.setIcon(QtGui.QIcon(self.app.resource_location + '/reset32.png')) self.reset_button.setToolTip( _("Will reset the tool parameters.") ) - self.reset_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.layout.addWidget(self.reset_button) # #################################### FINSIHED GUI ########################### diff --git a/appPlugins/ToolFollow.py b/appPlugins/ToolFollow.py index 1fcde462..422af7df 100644 --- a/appPlugins/ToolFollow.py +++ b/appPlugins/ToolFollow.py @@ -665,14 +665,7 @@ class FollowUI: self.tools_box.addLayout(self.title_box) # ## Title - title_label = FCLabel("%s" % self.pluginName) - title_label.setStyleSheet(""" - QLabel - { - font-size: 16px; - font-weight: bold; - } - """) + title_label = FCLabel("%s" % self.pluginName, size=16, bold=True) title_label.setToolTip( _("Create a Geometry object with\n" "toolpaths to cut through the middle of polygons.") @@ -752,14 +745,8 @@ class FollowUI: self.area_shape_label.hide() self.area_shape_radio.hide() - self.generate_geometry_button = FCButton("%s" % _("Generate Geometry")) + self.generate_geometry_button = FCButton("%s" % _("Generate Geometry"), bold=True) self.generate_geometry_button.setIcon(QtGui.QIcon(self.app.resource_location + '/geometry32.png')) - self.generate_geometry_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.generate_geometry_button.setToolTip(_("Generate a 'Follow' geometry.\n" "This means that it will cut through\n" "the middle of the trace.")) @@ -768,17 +755,11 @@ class FollowUI: self.tools_box.addStretch(1) # ## Reset Tool - self.reset_button = FCButton(_("Reset Tool")) + self.reset_button = FCButton(_("Reset Tool"), bold=True) self.reset_button.setIcon(QtGui.QIcon(self.app.resource_location + '/reset32.png')) self.reset_button.setToolTip( _("Will reset the tool parameters.") ) - self.reset_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.tools_box.addWidget(self.reset_button) # ############################ FINISHED GUI ################################### # ############################################################################# diff --git a/appPlugins/ToolImage.py b/appPlugins/ToolImage.py index 28d87b2d..00e9200e 100644 --- a/appPlugins/ToolImage.py +++ b/appPlugins/ToolImage.py @@ -516,14 +516,7 @@ class ImageUI: self.layout = layout # ## Title - title_label = FCLabel("%s" % self.pluginName) - title_label.setStyleSheet(""" - QLabel - { - font-size: 16px; - font-weight: bold; - } - """) + title_label = FCLabel("%s" % self.pluginName, size=16, bold=True) self.layout.addWidget(title_label) self.param_lbl = FCLabel('%s' % _("Parameters"), color='blue', bold=True) diff --git a/appPlugins/ToolInvertGerber.py b/appPlugins/ToolInvertGerber.py index cd6837bf..1365968d 100644 --- a/appPlugins/ToolInvertGerber.py +++ b/appPlugins/ToolInvertGerber.py @@ -199,14 +199,7 @@ class InvertUI: self.layout = layout # ## Title - title_label = FCLabel("%s" % self.pluginName) - title_label.setStyleSheet(""" - QLabel - { - font-size: 16px; - font-weight: bold; - } - """) + title_label = FCLabel("%s" % self.pluginName, size=16, bold=True) self.layout.addWidget(title_label) self.tools_frame = QtWidgets.QFrame() @@ -286,35 +279,23 @@ class InvertUI: # ############################################################################################################# # Generate Inverted Gerber Button # ############################################################################################################# - self.invert_btn = FCButton(_('Invert Gerber')) + self.invert_btn = FCButton(_('Invert Gerber'), bold=True) self.invert_btn.setIcon(QtGui.QIcon(self.app.resource_location + '/invert32.png')) self.invert_btn.setToolTip( _("Will invert the Gerber object: areas that have copper\n" "will be empty of copper and previous empty area will be\n" "filled with copper.") ) - self.invert_btn.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.tools_box.addWidget(self.invert_btn) self.tools_box.addStretch(1) # ## Reset Tool - self.reset_button = FCButton(_("Reset Tool")) + self.reset_button = FCButton(_("Reset Tool"), bold=True) self.reset_button.setIcon(QtGui.QIcon(self.app.resource_location + '/reset32.png')) self.reset_button.setToolTip( _("Will reset the tool parameters.") ) - self.reset_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.tools_box.addWidget(self.reset_button) # #################################### FINSIHED GUI ########################### diff --git a/appPlugins/ToolIsolation.py b/appPlugins/ToolIsolation.py index d97be7b0..abc6d076 100644 --- a/appPlugins/ToolIsolation.py +++ b/appPlugins/ToolIsolation.py @@ -3361,14 +3361,7 @@ class IsoUI: self.tools_box.addLayout(self.title_box) # ## Title - title_label = FCLabel("%s" % self.pluginName) - title_label.setStyleSheet(""" - QLabel - { - font-size: 16px; - font-weight: bold; - } - """) + title_label = FCLabel("%s" % self.pluginName, size=16, bold=True) title_label.setToolTip( _("Create a Geometry object with\n" "toolpaths to cut around polygons.") @@ -3971,14 +3964,8 @@ class IsoUI: # ############################################################################################################# # Generate Geometry object # ############################################################################################################# - self.generate_iso_button = FCButton("%s" % _("Generate Geometry")) + self.generate_iso_button = FCButton("%s" % _("Generate Geometry"), bold=True) self.generate_iso_button.setIcon(QtGui.QIcon(self.app.resource_location + '/geometry32.png')) - self.generate_iso_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.generate_iso_button.setToolTip( _("Create a Geometry object with toolpaths to cut \n" "isolation outside, inside or on both sides of the\n" @@ -4004,17 +3991,11 @@ class IsoUI: self.tools_box.addStretch(1) # ## Reset Tool - self.reset_button = FCButton(_("Reset Tool")) + self.reset_button = FCButton(_("Reset Tool"), bold=True) self.reset_button.setIcon(QtGui.QIcon(self.app.resource_location + '/reset32.png')) self.reset_button.setToolTip( _("Will reset the tool parameters.") ) - self.reset_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.tools_box.addWidget(self.reset_button) # ############################ FINSIHED GUI ################################### # ############################################################################# diff --git a/appPlugins/ToolLevelling.py b/appPlugins/ToolLevelling.py index c8393041..f3962545 100644 --- a/appPlugins/ToolLevelling.py +++ b/appPlugins/ToolLevelling.py @@ -1732,14 +1732,7 @@ class LevelUI: self.tools_box.addLayout(self.title_box) # ## Title - title_label = FCLabel("%s" % self.pluginName) - title_label.setStyleSheet(""" - QLabel - { - font-size: 16px; - font-weight: bold; - } - """) + title_label = FCLabel("%s" % self.pluginName, size=16, bold=True) title_label.setToolTip( _("Generate CNC Code with auto-levelled paths.") ) @@ -2332,17 +2325,11 @@ class LevelUI: self.tools_box.addStretch(1) # ## Reset Tool - self.reset_button = FCButton(_("Reset Tool")) + self.reset_button = FCButton(_("Reset Tool"), bold=True) self.reset_button.setIcon(QtGui.QIcon(self.app.resource_location + '/reset32.png')) self.reset_button.setToolTip( _("Will reset the tool parameters.") ) - self.reset_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.tools_box.addWidget(self.reset_button) # ############################ FINISHED GUI ################################### # ############################################################################# diff --git a/appPlugins/ToolMarkers.py b/appPlugins/ToolMarkers.py index e53b6dcf..c0be5dd4 100644 --- a/appPlugins/ToolMarkers.py +++ b/appPlugins/ToolMarkers.py @@ -1224,14 +1224,14 @@ class MarkersUI: self.layout.addLayout(self.title_box) # ## Title - title_label = FCLabel("%s" % self.pluginName) - title_label.setStyleSheet(""" - QLabel - { - font-size: 16px; - font-weight: bold; - } - """) + title_label = FCLabel("%s" % self.pluginName, size=16, bold=True) + # title_label.setStyleSheet(""" + # QLabel + # { + # font-size: 16px; + # font-weight: bold; + # } + # """) self.title_box.addWidget(title_label) # App Level label @@ -1478,17 +1478,11 @@ class MarkersUI: # ############################################################################################################# # ## Insert Corner Marker Button # ############################################################################################################# - self.add_marker_button = FCButton(_("Add Marker")) + self.add_marker_button = FCButton(_("Add Marker"), bold=True) self.add_marker_button.setIcon(QtGui.QIcon(self.app.resource_location + '/corners_32.png')) self.add_marker_button.setToolTip( _("Will add corner markers to the selected object.") ) - self.add_marker_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.tools_box.addWidget(self.add_marker_button,) # ############################################################################################################# @@ -1519,17 +1513,11 @@ class MarkersUI: grid_drill.addWidget(self.drill_dia_entry, 0, 1) # ## Create an Excellon object - self.drill_button = FCButton(_("Create Excellon Object")) + self.drill_button = FCButton(_("Create Excellon Object"), bold=True) self.drill_button.setIcon(QtGui.QIcon(self.app.resource_location + '/drill32.png')) self.drill_button.setToolTip( _("Will add drill holes in the center of the markers.") ) - self.drill_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.tools_box.addWidget(self.drill_button) # ############################################################################################################# @@ -1539,7 +1527,7 @@ class MarkersUI: self.tools_box.addWidget(self.check_label) # ## Create an Excellon object for checking the positioning - self.check_button = FCButton(_("Create Excellon Object")) + self.check_button = FCButton(_("Create Excellon Object"), bold=True) self.check_button.setIcon(QtGui.QIcon(self.app.resource_location + '/drill32.png')) self.check_button.setToolTip( _("Will create an Excellon object using a special preprocessor.\n" @@ -1547,12 +1535,6 @@ class MarkersUI: "the corner locations, wait for the user interaction and then\n" "move to the next location until the last one.") ) - self.check_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.tools_box.addWidget(self.check_button) # ############################################################################################################# @@ -1592,17 +1574,11 @@ class MarkersUI: insert_grid.addWidget(self.obj_insert_combo, 2, 0, 1, 2) # Insert Markers - self.insert_markers_button = FCButton(_("Insert Marker")) + self.insert_markers_button = FCButton(_("Insert Marker"), bold=True) self.insert_markers_button.setIcon(QtGui.QIcon(self.app.resource_location + '/corners_32.png')) self.insert_markers_button.setToolTip( _("Will add corner markers to the selected object.") ) - self.insert_markers_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.tools_box.addWidget(self.insert_markers_button) GLay.set_common_column_size([grid_sel, param_grid, off_grid, grid_loc, grid_drill, insert_grid], 0) @@ -1610,17 +1586,11 @@ class MarkersUI: self.layout.addStretch(1) # ## Reset Tool - self.reset_button = QtWidgets.QPushButton(_("Reset Tool")) + self.reset_button = FCButton(_("Reset Tool"), bold=True) self.reset_button.setIcon(QtGui.QIcon(self.app.resource_location + '/reset32.png')) self.reset_button.setToolTip( _("Will reset the tool parameters.") ) - self.reset_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.layout.addWidget(self.reset_button) # #################################### FINSIHED GUI ########################### diff --git a/appPlugins/ToolMilling.py b/appPlugins/ToolMilling.py index ead13415..703cf47f 100644 --- a/appPlugins/ToolMilling.py +++ b/appPlugins/ToolMilling.py @@ -3910,14 +3910,14 @@ class MillingUI: self.layout.addLayout(self.title_box) # ## Title - title_label = FCLabel("%s" % name) - title_label.setStyleSheet(""" - QLabel - { - font-size: 16px; - font-weight: bold; - } - """) + title_label = FCLabel("%s" % name, size=16, bold=True) + # title_label.setStyleSheet(""" + # QLabel + # { + # font-size: 16px; + # font-weight: bold; + # } + # """) title_label.setToolTip( _("Create CNCJob with toolpaths for milling either Geometry or drill holes.") ) @@ -5014,7 +5014,7 @@ class MillingUI: grid_a1.addWidget(self.over_z_entry, 2, 1) # Button Add Area - self.add_area_button = QtWidgets.QPushButton(_('Add Area:')) + self.add_area_button = FCButton(_('Add Area:')) self.add_area_button.setToolTip(_("Add an Exclusion Area.")) # Area Selection shape @@ -5032,11 +5032,11 @@ class MillingUI: self.exclusion_box.addLayout(h_lay_1) # Button Delete All Areas - self.delete_area_button = QtWidgets.QPushButton(_('Delete All')) + self.delete_area_button = FCButton(_('Delete All')) self.delete_area_button.setToolTip(_("Delete all exclusion areas.")) # Button Delete Selected Areas - self.delete_sel_area_button = QtWidgets.QPushButton(_('Delete Selected')) + self.delete_sel_area_button = FCButton(_('Delete Selected')) self.delete_sel_area_button.setToolTip(_("Delete all exclusion areas that are selected in the table.")) h_lay_1.addWidget(self.delete_area_button) @@ -5052,7 +5052,7 @@ class MillingUI: # ############################################################################################################# # Generate CNC Job object # ############################################################################################################# - self.generate_cnc_button = QtWidgets.QPushButton(_('Generate CNCJob object')) + self.generate_cnc_button = FCButton(_('Generate CNCJob object'), bold=True) self.generate_cnc_button.setIcon(QtGui.QIcon(self.app.resource_location + '/cnc16.png')) self.generate_cnc_button.setToolTip( _("Generate the CNC Job.\n" @@ -5061,28 +5061,16 @@ class MillingUI: "Click the # header to select all, or Ctrl + LMB\n" "for custom selection of tools.") ) - self.generate_cnc_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.tool_params_box.addWidget(self.generate_cnc_button) self.tools_box.addStretch(1) # ## Reset Tool - self.reset_button = QtWidgets.QPushButton(_("Reset Tool")) + self.reset_button = FCButton(_("Reset Tool"), bold=True) self.reset_button.setIcon(QtGui.QIcon(self.app.resource_location + '/reset32.png')) self.reset_button.setToolTip( _("Will reset the tool parameters.") ) - self.reset_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.tools_box.addWidget(self.reset_button) # ############################ FINSIHED GUI ################################### # ############################################################################# diff --git a/appPlugins/ToolNCC.py b/appPlugins/ToolNCC.py index 5b44b417..fbe6f018 100644 --- a/appPlugins/ToolNCC.py +++ b/appPlugins/ToolNCC.py @@ -4030,14 +4030,7 @@ class NccUI: self.tools_box.addLayout(self.title_box) # ## Title - title_label = FCLabel("%s" % self.pluginName) - title_label.setStyleSheet(""" - QLabel - { - font-size: 16px; - font-weight: bold; - } - """) + title_label = FCLabel("%s" % self.pluginName, size=16, bold=True) title_label.setToolTip( _("Create a Geometry object with\n" "toolpaths to cover the space outside the copper pattern.") @@ -4596,34 +4589,22 @@ class NccUI: # ############################################################################################################# # Generate NCC Geometry Button # ############################################################################################################# - self.generate_ncc_button = FCButton(_('Generate Geometry')) + self.generate_ncc_button = FCButton(_('Generate Geometry'), bold=True) self.generate_ncc_button.setIcon(QtGui.QIcon(self.app.resource_location + '/geometry32.png')) self.generate_ncc_button.setToolTip( _("Create the Geometry Object\n" "for non-copper routing.") ) - self.generate_ncc_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.tools_box.addWidget(self.generate_ncc_button) self.tools_box.addStretch(1) # ## Reset Tool - self.reset_button = FCButton(_("Reset Tool")) + self.reset_button = FCButton(_("Reset Tool"), bold=True) self.reset_button.setIcon(QtGui.QIcon(self.app.resource_location + '/reset32.png')) self.reset_button.setToolTip( _("Will reset the tool parameters.") ) - self.reset_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.tools_box.addWidget(self.reset_button) # ############################ FINSIHED GUI ################################### # ############################################################################# diff --git a/appPlugins/ToolObjectDistance.py b/appPlugins/ToolObjectDistance.py index 88d17eb4..db3229bb 100644 --- a/appPlugins/ToolObjectDistance.py +++ b/appPlugins/ToolObjectDistance.py @@ -609,17 +609,11 @@ class ObjectDistanceUI: self.layout.addStretch(1) # ## Reset Tool - self.reset_button = QtWidgets.QPushButton(_("Reset Tool")) + self.reset_button = FCButton(_("Reset Tool"), bold=True) self.reset_button.setIcon(QtGui.QIcon(self.app.resource_location + '/reset32.png')) self.reset_button.setToolTip( _("Will reset the tool parameters.") ) - self.reset_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.layout.addWidget(self.reset_button) # #################################### FINSIHED GUI ########################### # ############################################################################# diff --git a/appPlugins/ToolOptimal.py b/appPlugins/ToolOptimal.py index 60d29a5d..e1045728 100644 --- a/appPlugins/ToolOptimal.py +++ b/appPlugins/ToolOptimal.py @@ -467,14 +467,7 @@ class OptimalUI: self.units = self.app.app_units.upper() # ## Title - title_label = FCLabel("%s" % self.pluginName) - title_label.setStyleSheet(""" - QLabel - { - font-size: 16px; - font-weight: bold; - } - """) + title_label = FCLabel("%s" % self.pluginName, size=16, bold=True) self.layout.addWidget(title_label) # self.layout.addWidget(FCLabel("")) @@ -678,19 +671,13 @@ class OptimalUI: self.distances_box.addWidget(self.locate_sec_button) # GO button - self.calculate_button = FCButton(_("Find Minimum")) + self.calculate_button = FCButton(_("Find Minimum"), bold=True) self.calculate_button.setIcon(QtGui.QIcon(self.app.resource_location + '/open_excellon32.png')) self.calculate_button.setToolTip( _("Calculate the minimum distance between copper features,\n" "this will allow the determination of the right tool to\n" "use for isolation or copper clearing.") ) - self.calculate_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.calculate_button.setMinimumWidth(60) self.layout.addWidget(self.calculate_button) @@ -699,17 +686,11 @@ class OptimalUI: self.layout.addStretch(1) # ## Reset Tool - self.reset_button = FCButton(_("Reset Tool")) + self.reset_button = FCButton(_("Reset Tool"), bold=True) self.reset_button.setIcon(QtGui.QIcon(self.app.resource_location + '/reset32.png')) self.reset_button.setToolTip( _("Will reset the tool parameters.") ) - self.reset_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.layout.addWidget(self.reset_button) self.loc_ois = OptionalHideInputSection(self.locations_cb, [self.locations_textb, self.locate_button]) diff --git a/appPlugins/ToolPaint.py b/appPlugins/ToolPaint.py index 621c6e52..61e18521 100644 --- a/appPlugins/ToolPaint.py +++ b/appPlugins/ToolPaint.py @@ -2914,14 +2914,7 @@ class PaintUI: self.tools_box.addLayout(self.title_box) # ## Title - title_label = FCLabel("%s" % self.pluginName) - title_label.setStyleSheet(""" - QLabel - { - font-size: 16px; - font-weight: bold; - } - """) + title_label = FCLabel("%s" % self.pluginName, size=16, bold=True) title_label.setToolTip( _("Create a Geometry object with toolpaths\n" "that cover only the copper pattern.") @@ -3343,33 +3336,21 @@ class PaintUI: # ############################################################################################################# # Generate Paint Geometry Button # ############################################################################################################# - self.generate_paint_button = FCButton(_('Generate Geometry')) + self.generate_paint_button = FCButton(_('Generate Geometry'), bold=True) self.generate_paint_button.setIcon(QtGui.QIcon(self.app.resource_location + '/geometry32.png')) self.generate_paint_button.setToolTip( _("Create a Geometry Object which paints the polygons.") ) - self.generate_paint_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.tools_box.addWidget(self.generate_paint_button) self.tools_box.addStretch(1) # ## Reset Tool - self.reset_button = FCButton(_("Reset Tool")) + self.reset_button = FCButton(_("Reset Tool"), bold=True) self.reset_button.setIcon(QtGui.QIcon(self.app.resource_location + '/reset32.png')) self.reset_button.setToolTip( _("Will reset the tool parameters.") ) - self.reset_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.tools_box.addWidget(self.reset_button) # #################################### FINSIHED GUI ########################### diff --git a/appPlugins/ToolPanelize.py b/appPlugins/ToolPanelize.py index 158de065..9b9712fa 100644 --- a/appPlugins/ToolPanelize.py +++ b/appPlugins/ToolPanelize.py @@ -1135,14 +1135,7 @@ class PanelizeUI: self.tools_box.addLayout(self.title_box) # ## Title - title_label = FCLabel("%s" % self.pluginName) - title_label.setStyleSheet(""" - QLabel - { - font-size: 16px; - font-weight: bold; - } - """) + title_label = FCLabel("%s" % self.pluginName, size=16, bold=True) self.title_box.addWidget(title_label) # App Level label @@ -1411,35 +1404,23 @@ class PanelizeUI: # ############################################################################################################# # Generate Panel Button # ############################################################################################################# - self.panelize_object_button = FCButton(_("Panelize Object")) + self.panelize_object_button = FCButton(_("Panelize Object"), bold=True) self.panelize_object_button.setIcon(QtGui.QIcon(self.app.resource_location + '/panelize16.png')) self.panelize_object_button.setToolTip( _("Panelize the specified object around the specified box.\n" "In other words it creates multiple copies of the source object,\n" "arranged in a 2D array of rows and columns.") ) - self.panelize_object_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.tools_box.addWidget(self.panelize_object_button) self.layout.addStretch(1) # ## Reset Tool - self.reset_button = FCButton(_("Reset Tool")) + self.reset_button = FCButton(_("Reset Tool"), bold=True) self.reset_button.setIcon(QtGui.QIcon(self.app.resource_location + '/reset32.png')) self.reset_button.setToolTip( _("Will reset the tool parameters.") ) - self.reset_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.layout.addWidget(self.reset_button) # #################################### FINSIHED GUI ########################### diff --git a/appPlugins/ToolPcbWizard.py b/appPlugins/ToolPcbWizard.py index 0c2cab65..009a48fb 100644 --- a/appPlugins/ToolPcbWizard.py +++ b/appPlugins/ToolPcbWizard.py @@ -391,14 +391,7 @@ class WizardUI: self.layout = layout # ## Title - title_label = FCLabel("%s" % self.pluginName) - title_label.setStyleSheet(""" - QLabel - { - font-size: 16px; - font-weight: bold; - } - """) + title_label = FCLabel("%s" % self.pluginName, size=16, bold=True) self.layout.addWidget(title_label) self.layout.addWidget(FCLabel("")) @@ -494,7 +487,7 @@ class WizardUI: # Buttons - self.import_button = QtWidgets.QPushButton(_("Import Excellon")) + self.import_button = FCButton(_("Import Excellon")) self.import_button.setToolTip( _("Import an Excellon file\n" "that store it's information's in 2 files.\n" diff --git a/appPlugins/ToolPunchGerber.py b/appPlugins/ToolPunchGerber.py index 1d04a24f..b6b23cf9 100644 --- a/appPlugins/ToolPunchGerber.py +++ b/appPlugins/ToolPunchGerber.py @@ -2002,14 +2002,7 @@ class PunchUI: self.tools_box.addLayout(self.title_box) # ## Title - title_label = FCLabel("%s" % self.pluginName) - title_label.setStyleSheet(""" - QLabel - { - font-size: 16px; - font-weight: bold; - } - """) + title_label = FCLabel("%s" % self.pluginName, size=16, bold=True) self.title_box.addWidget(title_label) # App Level label @@ -2361,34 +2354,22 @@ class PunchUI: grid2.addLayout(sel_hlay, 2, 0, 1, 2) # Buttons - self.punch_object_button = FCButton(_("Punch Gerber")) + self.punch_object_button = FCButton(_("Punch Gerber"), bold=True) self.punch_object_button.setIcon(QtGui.QIcon(self.app.resource_location + '/punch32.png')) self.punch_object_button.setToolTip( _("Create a Gerber object from the selected object, within\n" "the specified box.") ) - self.punch_object_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.tools_box.addWidget(self.punch_object_button) self.layout.addStretch(1) # ## Reset Tool - self.reset_button = FCButton(_("Reset Tool")) + self.reset_button = FCButton(_("Reset Tool"), bold=True) self.reset_button.setIcon(QtGui.QIcon(self.app.resource_location + '/reset32.png')) self.reset_button.setToolTip( _("Will reset the tool parameters.") ) - self.reset_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.layout.addWidget(self.reset_button) self.circular_ring_entry.setEnabled(False) diff --git a/appPlugins/ToolQRCode.py b/appPlugins/ToolQRCode.py index 867d50dd..8fbb4238 100644 --- a/appPlugins/ToolQRCode.py +++ b/appPlugins/ToolQRCode.py @@ -726,14 +726,7 @@ class QRcodeUI: self.tools_box.addLayout(self.title_box) # ## Title - title_label = FCLabel("%s" % self.pluginName) - title_label.setStyleSheet(""" - QLabel - { - font-size: 16px; - font-weight: bold; - } - """) + title_label = FCLabel("%s" % self.pluginName, size=16, bold=True) self.title_box.addWidget(title_label) # App Level label @@ -933,7 +926,7 @@ class QRcodeUI: _("Set the QRCode fill color (squares color).") ) self.fill_color_entry = FCEntry() - self.fill_color_button = QtWidgets.QPushButton() + self.fill_color_button = FCButton() self.fill_color_button.setFixedSize(15, 15) fill_lay_child = QtWidgets.QHBoxLayout() @@ -957,7 +950,7 @@ class QRcodeUI: _("Set the QRCode background color.") ) self.back_color_entry = FCEntry() - self.back_color_button = QtWidgets.QPushButton() + self.back_color_button = FCButton() self.back_color_button.setFixedSize(15, 15) back_lay_child = QtWidgets.QHBoxLayout() @@ -973,59 +966,38 @@ class QRcodeUI: self.export_lay.addWidget(back_color_widget, 2, 1) # ## Export QRCode as SVG image - self.export_svg_button = QtWidgets.QPushButton(_("Export QRCode SVG")) + self.export_svg_button = FCButton(_("Export QRCode SVG")) self.export_svg_button.setToolTip( _("Export a SVG file with the QRCode content.") ) - self.export_svg_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) + self.export_svg_button.bold = True self.tools_box.addWidget(self.export_svg_button) # ## Export QRCode as PNG image - self.export_png_button = QtWidgets.QPushButton(_("Export QRCode PNG")) + self.export_png_button = FCButton(_("Export QRCode PNG")) self.export_png_button.setToolTip( _("Export a PNG image file with the QRCode content.") ) - self.export_png_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) + self.export_png_button.bold = True self.tools_box.addWidget(self.export_png_button) # ## Insert QRCode - self.qrcode_button = QtWidgets.QPushButton(_("Insert QRCode")) + self.qrcode_button = FCButton(_("Insert QRCode")) self.qrcode_button.setIcon(QtGui.QIcon(self.app.resource_location + '/qrcode32.png')) self.qrcode_button.setToolTip( _("Create the QRCode object.") ) - self.qrcode_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) + self.qrcode_button.bold = True self.tools_box.addWidget(self.qrcode_button) self.layout.addStretch(1) # ## Reset Tool - self.reset_button = QtWidgets.QPushButton(_("Reset Tool")) + self.reset_button = FCButton(_("Reset Tool"), bold=True) self.reset_button.setIcon(QtGui.QIcon(self.app.resource_location + '/reset32.png')) self.reset_button.setToolTip( _("Will reset the tool parameters.") ) - self.reset_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.layout.addWidget(self.reset_button) # #################################### FINSIHED GUI ########################### diff --git a/appPlugins/ToolReport.py b/appPlugins/ToolReport.py index 7ec9ee2a..468a3276 100644 --- a/appPlugins/ToolReport.py +++ b/appPlugins/ToolReport.py @@ -36,7 +36,7 @@ class ObjectReport(AppTool): self.info_frame.setLayout(self.info_box) # ## Title - # title_label = FCLabel("%s" % self.pluginName) + # title_label = FCLabel("%s" % self.pluginName, size=16, bold=True) # title_label.setStyleSheet(""" # QLabel # { diff --git a/appPlugins/ToolRulesCheck.py b/appPlugins/ToolRulesCheck.py index e248824c..07ab4ec9 100644 --- a/appPlugins/ToolRulesCheck.py +++ b/appPlugins/ToolRulesCheck.py @@ -1167,14 +1167,7 @@ class RulesUI: self.layout = layout # ## Title - title_label = FCLabel("%s" % self.pluginName) - title_label.setStyleSheet(""" - QLabel - { - font-size: 16px; - font-weight: bold; - } - """) + title_label = FCLabel("%s" % self.pluginName, size=16, bold=True) self.layout.addWidget(title_label) # https://www.w3schools.com/colors/colors_names.asp @@ -1755,19 +1748,13 @@ class RulesUI: self.drill_size_cb, [self.drill_size_lbl, self.drill_size_entry]) # Buttons - self.run_button = FCButton(_("Run Rules Check")) + self.run_button = FCButton(_("Run Rules Check"), bold=True) self.run_button.setIcon(QtGui.QIcon(self.app.resource_location + '/rules32.png')) self.run_button.setToolTip( _("Panelize the specified object around the specified box.\n" "In other words it creates multiple copies of the source object,\n" "arranged in a 2D array of rows and columns.") ) - self.run_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.layout.addWidget(self.run_button) GLay.set_common_column_size( @@ -1777,17 +1764,11 @@ class RulesUI: self.layout.addStretch(1) # ## Reset Tool - self.reset_button = FCButton(_("Reset Tool")) + self.reset_button = FCButton(_("Reset Tool"), bold=True) self.reset_button.setIcon(QtGui.QIcon(self.app.resource_location + '/reset32.png')) self.reset_button.setToolTip( _("Will reset the tool parameters.") ) - self.reset_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.layout.addWidget(self.reset_button) # ############################################################################################################# diff --git a/appPlugins/ToolSolderPaste.py b/appPlugins/ToolSolderPaste.py index dfd1356f..62380a37 100644 --- a/appPlugins/ToolSolderPaste.py +++ b/appPlugins/ToolSolderPaste.py @@ -1245,14 +1245,7 @@ class SolderUI: self.tools_box.addLayout(self.title_box) # ## Title - title_label = FCLabel("%s" % self.pluginName) - title_label.setStyleSheet(""" - QLabel - { - font-size: 16px; - font-weight: bold; - } - """) + title_label = FCLabel("%s" % self.pluginName, size=16, bold=True) title_label.setToolTip( _("A plugin to help dispense solder paste on the PCB pads using a CNC machine.") ) @@ -1658,18 +1651,12 @@ class SolderUI: geo_frame.setLayout(geo_grid) # Generate Geometry - self.soldergeo_btn = FCButton(_("Generate Geometry")) + self.soldergeo_btn = FCButton(_("Generate Geometry"), bold=True) self.soldergeo_btn.setIcon(QtGui.QIcon(self.app.resource_location + '/geometry32.png')) self.soldergeo_btn.setToolTip( _("Generate solder paste dispensing geometry.") ) - self.soldergeo_btn.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) geo_grid.addWidget(self.soldergeo_btn, 0, 0, 1, 2) # Geometry Object to be used for Solderpaste dispensing @@ -1699,18 +1686,12 @@ class SolderUI: cnc_frame.setLayout(cnc_grid) # ## Buttons - self.solder_gcode_btn = FCButton(_("Generate CNCJob")) + self.solder_gcode_btn = FCButton(_("Generate CNCJob"), bold=True) self.solder_gcode_btn.setIcon(QtGui.QIcon(self.app.resource_location + '/cnc16.png')) self.solder_gcode_btn.setToolTip( _("Generate GCode for Solder Paste dispensing\n" "on PCB pads.") ) - self.solder_gcode_btn.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) cnc_grid.addWidget(self.solder_gcode_btn, 0, 0, 1, 2) # Gerber Object to be used for solderpaste dispensing @@ -1730,18 +1711,12 @@ class SolderUI: # Save and Review GCode buttons_hlay = QtWidgets.QHBoxLayout() - self.solder_gcode_save_btn = FCButton(_("Save GCode")) + self.solder_gcode_save_btn = FCButton(_("Save GCode"), bold=True) self.solder_gcode_save_btn.setIcon(QtGui.QIcon(self.app.resource_location + '/save_as.png')) self.solder_gcode_save_btn.setToolTip( _("Save the generated GCode for Solder Paste dispensing\n" "on PCB pads, to a file.") ) - self.solder_gcode_save_btn.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.solder_gcode_view_btn = QtWidgets.QToolButton() self.solder_gcode_view_btn.setToolTip(_("Review CNC Code.")) @@ -1758,17 +1733,11 @@ class SolderUI: self.layout.addStretch(1) # ## Reset Tool - self.reset_button = FCButton(_("Reset Tool")) + self.reset_button = FCButton(_("Reset Tool"), bold=True) self.reset_button.setIcon(QtGui.QIcon(self.app.resource_location + '/reset32.png')) self.reset_button.setToolTip( _("Will reset the tool parameters.") ) - self.reset_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.layout.addWidget(self.reset_button) # action to be added in the combobox context menu diff --git a/appPlugins/ToolSub.py b/appPlugins/ToolSub.py index f16de017..30c36bd8 100644 --- a/appPlugins/ToolSub.py +++ b/appPlugins/ToolSub.py @@ -772,14 +772,7 @@ class SubUI: self.layout.addLayout(self.title_box) # ## Title - title_label = FCLabel("%s" % self.pluginName) - title_label.setStyleSheet(""" - QLabel - { - font-size: 16px; - font-weight: bold; - } - """) + title_label = FCLabel("%s" % self.pluginName, size=16, bold=True) title_label.setToolTip( _("A plugin to help subtract a Gerber/Geometry object from another of the same type.") ) @@ -872,7 +865,7 @@ class SubUI: # ############################################################################################################# # Gerber Subtraction Button # ############################################################################################################# - self.intersect_btn = FCButton(_('Subtract Gerber')) + self.intersect_btn = FCButton(_('Subtract Gerber'), bold=True) self.intersect_btn.setIcon(QtGui.QIcon(self.app.resource_location + '/subtract_btn32.png')) self.intersect_btn.setToolTip( _("Will remove the area occupied by the subtractor\n" @@ -880,12 +873,6 @@ class SubUI: "Can be used to remove the overlapping silkscreen\n" "over the soldermask.") ) - self.intersect_btn.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.tools_box.addWidget(self.intersect_btn) # self.tools_box.addWidget(FCLabel('')) @@ -945,35 +932,23 @@ class SubUI: # ############################################################################################################# # Geometry Subtraction Button # ############################################################################################################# - self.intersect_geo_btn = FCButton(_('Subtract Geometry')) + self.intersect_geo_btn = FCButton(_('Subtract Geometry'), bold=True) self.intersect_geo_btn.setIcon(QtGui.QIcon(self.app.resource_location + '/subtract_btn32.png')) self.intersect_geo_btn.setToolTip( _("Will remove the area occupied by the subtractor\n" "Geometry from the Target Geometry.") ) - self.intersect_geo_btn.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.tools_box.addWidget(self.intersect_geo_btn) self.tools_box.addStretch(1) # ## Reset Tool - self.reset_button = QtWidgets.QPushButton(_("Reset Tool")) + self.reset_button = FCButton(_("Reset Tool"), bold=True) self.reset_button.setIcon(QtGui.QIcon(self.app.resource_location + '/reset32.png')) self.reset_button.setToolTip( _("Will reset the tool parameters.") ) - self.reset_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.tools_box.addWidget(self.reset_button) # #################################### FINSIHED GUI ########################### diff --git a/appPlugins/ToolTransform.py b/appPlugins/ToolTransform.py index 3a495e0c..542c3cfb 100644 --- a/appPlugins/ToolTransform.py +++ b/appPlugins/ToolTransform.py @@ -574,14 +574,7 @@ class TransformUI: self.layout = layout # ## Title - title_label = FCLabel("%s" % self.pluginName) - title_label.setStyleSheet(""" - QLabel - { - font-size: 16px; - font-weight: bold; - } - """) + title_label = FCLabel("%s" % self.pluginName, size=16, bold=True) title_label.setToolTip( _("A plugin that allow geometry transformation.") ) @@ -1015,17 +1008,11 @@ class TransformUI: self.layout.addStretch() # ## Reset Tool - self.reset_button = FCButton(_("Reset Tool")) + self.reset_button = FCButton(_("Reset Tool"), bold=True) self.reset_button.setIcon(QtGui.QIcon(self.app.resource_location + '/reset32.png')) self.reset_button.setToolTip( _("Will reset the tool parameters.") ) - self.reset_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) self.layout.addWidget(self.reset_button) # #################################### FINSIHED GUI ########################### diff --git a/defaults.py b/defaults.py index 075954d2..12bfc85d 100644 --- a/defaults.py +++ b/defaults.py @@ -325,6 +325,7 @@ class AppDefaults: # Geometry Editor "geometry_editor_sel_limit": 30, "geometry_editor_milling_type": "cl", + "geometry_editor_parameters": False, # CNC Job General "cncjob_plot": True,