diff --git a/FlatCAMApp.py b/FlatCAMApp.py index 69e2a5ed..54efec5e 100644 --- a/FlatCAMApp.py +++ b/FlatCAMApp.py @@ -8768,7 +8768,9 @@ class App(QtCore.QObject): # only when working on App if self.call_source == 'app': if self.click_noproject is False: - self.ui.notebook.setCurrentWidget(self.ui.project_tab) + # if the Tool Tab is in focus don't change focus to Project Tab + if not self.ui.notebook.currentWidget() is self.ui.tool_tab: + self.ui.notebook.setCurrentWidget(self.ui.project_tab) else: # restore auto open the Project Tab self.click_noproject = False @@ -10648,63 +10650,44 @@ class App(QtCore.QObject): "Expected to initialize a FlatCAMGerber but got %s" % type(gerber_obj) # Opening the file happens here - self.progress.emit(30) try: gerber_obj.parse_file(filename) except IOError: - app_obj.inform.emit('[ERROR_NOTCL] %s: %s' % - (_("Failed to open file"), filename)) - app_obj.progress.emit(0) + app_obj.inform.emit('[ERROR_NOTCL] %s: %s' % (_("Failed to open file"), filename)) return "fail" except ParseError as err: - app_obj.inform.emit('[ERROR_NOTCL] %s: %s. %s' % - (_("Failed to parse file"), filename, str(err))) - app_obj.progress.emit(0) - self.log.error(str(err)) + app_obj.inform.emit('[ERROR_NOTCL] %s: %s. %s' % (_("Failed to parse file"), filename, str(err))) + app_obj.log.error(str(err)) return "fail" except Exception as e: log.debug("App.open_gerber() --> %s" % str(e)) - msg = '[ERROR] %s' % \ - _("An internal error has occurred. See shell.\n") + msg = '[ERROR] %s' % _("An internal error has occurred. See shell.\n") msg += traceback.format_exc() app_obj.inform.emit(msg) return "fail" if gerber_obj.is_empty(): - # app_obj.inform.emit("[ERROR] No geometry found in file: " + filename) - # self.collection.set_active(gerber_obj.options["name"]) - # self.collection.delete_active() - self.inform.emit('[ERROR_NOTCL] %s' % - _("Object is not Gerber file or empty. Aborting object creation.")) + app_obj.inform.emit('[ERROR_NOTCL] %s' % + _("Object is not Gerber file or empty. Aborting object creation.")) return "fail" - # Further parsing - self.progress.emit(70) # TODO: Note the mixture of self and app_obj used here - App.log.debug("open_gerber()") with self.proc_container.new(_("Opening Gerber")) as proc: - - self.progress.emit(10) - # Object name name = outname or filename.split('/')[-1].split('\\')[-1] # # ## Object creation # ## ret = self.new_object("gerber", name, obj_init, autoselected=False) if ret == 'fail': - self.inform.emit('[ERROR_NOTCL]%s' % - _(' Open Gerber failed. Probable not a Gerber file.')) - return + self.inform.emit('[ERROR_NOTCL]%s' % _(' Open Gerber failed. Probable not a Gerber file.')) + return 'fail' # Register recent file self.file_opened.emit("gerber", filename) - self.progress.emit(100) - # GUI feedback - self.inform.emit('[success] %s: %s' % - (_("Opened"), filename)) + self.inform.emit('[success] %s: %s' % (_("Opened"), filename)) def open_excellon(self, filename, outname=None, plot=True): """ diff --git a/README.md b/README.md index b7da5eea..bc389207 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,9 @@ CAD program, and create G-Code for Isolation routing. - Copper Thieving Tool - updated the way plated area is calculated making it a bit more precise but still it is a bit bigger than the actual area - fixed the Copy Object function to copy also the source_file content - Copper Thieving Tool - when the clearance value for the pattern plating mask is negative it will be applied to the origin soldermask too +- modified the GUI in all tools making the text of the buttons bold and adding a new button named Reset Tool which have to reset the tool GUI and variables (need to check all tools to see if happen) +- when the Tool tab is in focus, clicking on canvas will no longer change the focus to Project tab +- Copper Thieving Tool - when creating the pattern platting mask will make a new Gerber object with it 3.12.2019 diff --git a/flatcamTools/ToolCalibrateExcellon.py b/flatcamTools/ToolCalibrateExcellon.py index cc2c1381..6c6544a3 100644 --- a/flatcamTools/ToolCalibrateExcellon.py +++ b/flatcamTools/ToolCalibrateExcellon.py @@ -405,7 +405,12 @@ class ToolCalibrateExcellon(FlatCAMTool): "Those four points should be in the four squares of\n" "the Excellon object.") ) - + self.start_button.setStyleSheet(""" + QPushButton + { + font-weight: bold; + } + """) grid_lay.addWidget(self.start_button, 16, 0, 1, 3) # STEP 2 # @@ -422,7 +427,12 @@ class ToolCalibrateExcellon(FlatCAMTool): _("Generate GCode file to locate and align the PCB by using\n" "the four points acquired above.") ) - + self.gcode_button.setStyleSheet(""" + QPushButton + { + font-weight: bold; + } + """) grid_lay.addWidget(self.gcode_button, 18, 0, 1, 3) # STEP 3 # @@ -441,6 +451,12 @@ class ToolCalibrateExcellon(FlatCAMTool): "found when checking the PCB pattern. The differences must be filled\n" "in the fields Found (Delta).") ) + self.generate_factors_button.setStyleSheet(""" + QPushButton + { + font-weight: bold; + } + """) grid_lay.addWidget(self.generate_factors_button, 20, 0, 1, 3) scale_lbl = QtWidgets.QLabel('%s' % _("Scale")) @@ -474,6 +490,12 @@ class ToolCalibrateExcellon(FlatCAMTool): self.scale_button.setToolTip( _("Apply Scale factors on the calibration points.") ) + self.scale_button.setStyleSheet(""" + QPushButton + { + font-weight: bold; + } + """) grid_lay.addWidget(self.scale_button, 24, 0, 1, 3) skew_lbl = QtWidgets.QLabel('%s' % _("Skew")) @@ -509,6 +531,12 @@ class ToolCalibrateExcellon(FlatCAMTool): self.skew_button.setToolTip( _("Apply Skew factors on the calibration points.") ) + self.skew_button.setStyleSheet(""" + QPushButton + { + font-weight: bold; + } + """) grid_lay.addWidget(self.skew_button, 28, 0, 1, 3) # STEP 4 # @@ -525,6 +553,12 @@ class ToolCalibrateExcellon(FlatCAMTool): _("Generate verification GCode file adjusted with\n" "the factors above.") ) + self.adj_gcode_button.setStyleSheet(""" + QPushButton + { + font-weight: bold; + } + """) grid_lay.addWidget(self.adj_gcode_button, 30, 0, 1, 3) # STEP 5 # @@ -567,11 +601,31 @@ class ToolCalibrateExcellon(FlatCAMTool): _("Adjust (scale and/or skew) the objects\n" "with the factors determined above.") ) + self.adj_obj_button.setStyleSheet(""" + QPushButton + { + font-weight: bold; + } + """) grid_lay.addWidget(self.adj_obj_button, 34, 0, 1, 3) grid_lay.addWidget(QtWidgets.QLabel(''), 35, 0) + self.layout.addStretch() + # ## Reset Tool + self.reset_button = QtWidgets.QPushButton(_("Reset Tool")) + self.reset_button.setToolTip( + _("Will reset the tool parameters.") + ) + self.reset_button.setStyleSheet(""" + QPushButton + { + font-weight: bold; + } + """) + self.layout.addWidget(self.reset_button) + self.mr = None self.units = '' @@ -587,6 +641,7 @@ class ToolCalibrateExcellon(FlatCAMTool): self.start_button.clicked.connect(self.on_start_collect_points) self.gcode_button.clicked.connect(self.generate_verification_gcode) self.generate_factors_button.clicked.connect(self.calculate_factors) + self.reset_button.clicked.connect(self.set_tool_ui) def run(self, toggle=True): self.app.report_usage("ToolCalibrateExcellon()") diff --git a/flatcamTools/ToolCopperThieving.py b/flatcamTools/ToolCopperThieving.py index 700bba6a..e137ec6f 100644 --- a/flatcamTools/ToolCopperThieving.py +++ b/flatcamTools/ToolCopperThieving.py @@ -35,6 +35,7 @@ log = logging.getLogger('base') class ToolCopperThieving(FlatCAMTool): + work_finished = QtCore.pyqtSignal() toolName = _("Copper Thieving Tool") @@ -327,6 +328,12 @@ class ToolCopperThieving(FlatCAMTool): _("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.layout.addWidget(self.fill_button) # ## Grid Layout @@ -383,6 +390,12 @@ class ToolCopperThieving(FlatCAMTool): "at a certain distance.\n" "Required when doing holes pattern plating.") ) + self.rb_button.setStyleSheet(""" + QPushButton + { + font-weight: bold; + } + """) grid_lay_1.addWidget(self.rb_button, 4, 0, 1, 2) separator_line_2 = QtWidgets.QFrame() @@ -448,10 +461,29 @@ class ToolCopperThieving(FlatCAMTool): "the geometries of the copper thieving and/or\n" "the robber bar if those were generated.") ) + self.ppm_button.setStyleSheet(""" + QPushButton + { + font-weight: bold; + } + """) grid_lay_1.addWidget(self.ppm_button, 11, 0, 1, 2) self.layout.addStretch() + # ## Reset Tool + self.reset_button = QtWidgets.QPushButton(_("Reset Tool")) + self.reset_button.setToolTip( + _("Will reset the tool parameters.") + ) + self.reset_button.setStyleSheet(""" + QPushButton + { + font-weight: bold; + } + """) + self.layout.addWidget(self.reset_button) + # Objects involved in Copper thieving self.grb_object = None self.ref_obj = None @@ -494,6 +526,9 @@ class ToolCopperThieving(FlatCAMTool): self.fill_button.clicked.connect(self.execute) self.rb_button.clicked.connect(self.add_robber_bar) self.ppm_button.clicked.connect(self.on_add_ppm) + self.reset_button.clicked.connect(self.set_tool_ui) + + self.work_finished.connect(self.on_new_pattern_plating_object) def run(self, toggle=True): self.app.report_usage("ToolCopperThieving()") @@ -548,6 +583,7 @@ class ToolCopperThieving(FlatCAMTool): # INIT SECTION self.area_method = False self.robber_geo = None + self.robber_line = None self.new_solid_geometry = None def on_combo_box_type(self): @@ -1278,6 +1314,12 @@ class ToolCopperThieving(FlatCAMTool): self.app.proc_container.view.set_busy('%s ...' % _("P-Plating Mask")) + if run_threaded: + self.app.worker_task.emit({'fcn': self.on_new_pattern_plating_object, 'params': []}) + else: + self.on_new_pattern_plating_object() + + def on_new_pattern_plating_object(self): # get the Gerber object on which the Copper thieving will be inserted selection_index = self.sm_object_combo.currentIndex() model_index = self.app.collection.index(selection_index, 0, self.sm_object_combo.rootModelIndex()) @@ -1290,43 +1332,61 @@ class ToolCopperThieving(FlatCAMTool): return 'fail' ppm_clearance = self.clearance_ppm_entry.get_value() + rb_thickness = self.rb_thickness - def job_thread_ppm(app_obj): + self.app.proc_container.update_view_text(' %s' % _("Append PP-M geometry")) + geo_list = self.sm_object.solid_geometry + if isinstance(self.sm_object.solid_geometry, MultiPolygon): + geo_list = list(self.sm_object.solid_geometry.geoms) - app_obj.app.proc_container.update_view_text(' %s' % _("Append PP-M geometry")) - geo_list = app_obj.sm_object.solid_geometry - if isinstance(app_obj.sm_object.solid_geometry, MultiPolygon): - geo_list = list(app_obj.sm_object.solid_geometry.geoms) - - # if the clearance is negative apply it to the original soldermask too - if ppm_clearance < 0: - temp_geo_list = list() - for geo in geo_list: - temp_geo_list.append(geo.buffer(ppm_clearance)) - geo_list = temp_geo_list - - plated_area = 0.0 + # if the clearance is negative apply it to the original soldermask too + if ppm_clearance < 0: + temp_geo_list = list() for geo in geo_list: - plated_area += geo.area + temp_geo_list.append(geo.buffer(ppm_clearance)) + geo_list = temp_geo_list - if app_obj.new_solid_geometry: - for geo in app_obj.new_solid_geometry: - plated_area += geo.area - if app_obj.robber_geo: - plated_area += app_obj.robber_geo.area - self.plated_area_entry.set_value(plated_area) + plated_area = 0.0 + for geo in geo_list: + plated_area += geo.area + + if self.new_solid_geometry: + for geo in self.new_solid_geometry: + plated_area += geo.area + if self.robber_geo: + plated_area += self.robber_geo.area + self.plated_area_entry.set_value(plated_area) + + thieving_solid_geo = self.new_solid_geometry + robber_solid_geo = self.robber_geo + robber_line = self.robber_line + + def obj_init(grb_obj, app_obj): + grb_obj.multitool = False + grb_obj.source_file = list() + grb_obj.multigeo = False + grb_obj.follow = False + grb_obj.apertures = dict() + grb_obj.solid_geometry = list() + + # try: + # grb_obj.options['xmin'] = 0 + # grb_obj.options['ymin'] = 0 + # grb_obj.options['xmax'] = 0 + # grb_obj.options['ymax'] = 0 + # except KeyError: + # pass # if we have copper thieving geometry, add it - if app_obj.new_solid_geometry: - if '0' not in app_obj.sm_object.apertures: - app_obj.sm_object.apertures['0'] = dict() - app_obj.sm_object.apertures['0']['geometry'] = list() - app_obj.sm_object.apertures['0']['type'] = 'REG' - app_obj.sm_object.apertures['0']['size'] = 0.0 + if thieving_solid_geo: + if '0' not in grb_obj.apertures: + grb_obj.apertures['0'] = dict() + grb_obj.apertures['0']['geometry'] = list() + grb_obj.apertures['0']['type'] = 'REG' + grb_obj.apertures['0']['size'] = 0.0 try: - for poly in app_obj.new_solid_geometry: - + for poly in thieving_solid_geo: poly_b = poly.buffer(ppm_clearance) # append to the new solid geometry @@ -1336,65 +1396,71 @@ class ToolCopperThieving(FlatCAMTool): geo_elem = dict() geo_elem['solid'] = poly_b geo_elem['follow'] = poly_b.exterior - app_obj.sm_object.apertures['0']['geometry'].append(deepcopy(geo_elem)) + grb_obj.apertures['0']['geometry'].append(deepcopy(geo_elem)) except TypeError: # append to the new solid geometry - geo_list.append(app_obj.new_solid_geometry.buffer(ppm_clearance)) + geo_list.append(thieving_solid_geo.buffer(ppm_clearance)) # append into the '0' aperture geo_elem = dict() - geo_elem['solid'] = app_obj.new_solid_geometry.buffer(ppm_clearance) - geo_elem['follow'] = app_obj.new_solid_geometry.buffer(ppm_clearance).exterior - app_obj.sm_object.apertures['0']['geometry'].append(deepcopy(geo_elem)) + geo_elem['solid'] = thieving_solid_geo.buffer(ppm_clearance) + geo_elem['follow'] = thieving_solid_geo.buffer(ppm_clearance).exterior + grb_obj.apertures['0']['geometry'].append(deepcopy(geo_elem)) # if we have robber bar geometry, add it - if app_obj.robber_geo: + if robber_solid_geo: aperture_found = None - for ap_id, ap_val in app_obj.sm_object.apertures.items(): + for ap_id, ap_val in grb_obj.apertures.items(): if ap_val['type'] == 'C' and ap_val['size'] == app_obj.rb_thickness + ppm_clearance: aperture_found = ap_id break if aperture_found: geo_elem = dict() - geo_elem['solid'] = app_obj.robber_geo - geo_elem['follow'] = app_obj.robber_line - app_obj.sm_object.apertures[aperture_found]['geometry'].append(deepcopy(geo_elem)) + geo_elem['solid'] = robber_solid_geo + geo_elem['follow'] = robber_line + grb_obj.apertures[aperture_found]['geometry'].append(deepcopy(geo_elem)) else: - ap_keys = list(app_obj.sm_object.apertures.keys()) - if ap_keys: - new_apid = str(int(max(ap_keys)) + 1) + ap_keys = list(grb_obj.apertures.keys()) + max_apid = int(max(ap_keys)) + if ap_keys and max_apid != 0: + new_apid = str(max_apid + 1) else: new_apid = '10' - app_obj.sm_object.apertures[new_apid] = dict() - app_obj.sm_object.apertures[new_apid]['type'] = 'C' - app_obj.sm_object.apertures[new_apid]['size'] = app_obj.rb_thickness + ppm_clearance - app_obj.sm_object.apertures[new_apid]['geometry'] = list() + grb_obj.apertures[new_apid] = dict() + grb_obj.apertures[new_apid]['type'] = 'C' + grb_obj.apertures[new_apid]['size'] = rb_thickness + ppm_clearance + grb_obj.apertures[new_apid]['geometry'] = list() geo_elem = dict() - geo_elem['solid'] = app_obj.robber_geo.buffer(ppm_clearance) - geo_elem['follow'] = Polygon(app_obj.robber_line).buffer(ppm_clearance / 2.0).exterior - app_obj.sm_object.apertures[new_apid]['geometry'].append(deepcopy(geo_elem)) + geo_elem['solid'] = robber_solid_geo.buffer(ppm_clearance) + geo_elem['follow'] = Polygon(robber_line).buffer(ppm_clearance / 2.0).exterior + grb_obj.apertures[new_apid]['geometry'].append(deepcopy(geo_elem)) - geo_list.append(app_obj.robber_geo.buffer(ppm_clearance)) + geo_list.append(robber_solid_geo.buffer(ppm_clearance)) - app_obj.sm_object.solid_geometry = MultiPolygon(geo_list).buffer(0.0000001).buffer(-0.0000001) + grb_obj.solid_geometry = MultiPolygon(geo_list).buffer(0.0000001).buffer(-0.0000001) - app_obj.app.proc_container.update_view_text(' %s' % _("Append source file")) + app_obj.proc_container.update_view_text(' %s' % _("Append source file")) # update the source file with the new geometry: - app_obj.sm_object.source_file = app_obj.app.export_gerber(obj_name=app_obj.sm_object.options['name'], - filename=None, - local_use=app_obj.sm_object, - use_thread=False) - app_obj.app.proc_container.update_view_text(' %s' % '') - app_obj.on_exit() - app_obj.app.inform.emit('[success] %s' % _("Generating Pattern Plating Mask done.")) + grb_obj.source_file = app_obj.export_gerber(obj_name=name, + filename=None, + local_use=grb_obj, + use_thread=False) + app_obj.proc_container.update_view_text(' %s' % '') - if run_threaded: - self.app.worker_task.emit({'fcn': job_thread_ppm, 'params': [self]}) - else: - job_thread_ppm(self) + # Object name + obj_name, separatpr, obj_extension = self.sm_object.options['name'].rpartition('.') + name = '%s_%s.%s' % (obj_name, 'plating_mask', obj_extension) + + self.app.new_object('gerber', name, obj_init, autoselected=False) + + # Register recent file + self.app.file_opened.emit("gerber", name) + + self.on_exit() + self.app.inform.emit('[success] %s' % _("Generating Pattern Plating Mask done.")) def replot(self, obj): def worker_task(): diff --git a/flatcamTools/ToolCutOut.py b/flatcamTools/ToolCutOut.py index 9d7be5b2..1ddf8964 100644 --- a/flatcamTools/ToolCutOut.py +++ b/flatcamTools/ToolCutOut.py @@ -356,6 +356,19 @@ class CutOut(FlatCAMTool): self.layout.addStretch() + # ## Reset Tool + self.reset_button = QtWidgets.QPushButton(_("Reset Tool")) + self.reset_button.setToolTip( + _("Will reset the tool parameters.") + ) + self.reset_button.setStyleSheet(""" + QPushButton + { + font-weight: bold; + } + """) + self.layout.addWidget(self.reset_button) + self.cutting_gapsize = 0.0 self.cutting_dia = 0.0 @@ -386,6 +399,7 @@ class CutOut(FlatCAMTool): self.type_obj_combo.currentIndexChanged.connect(self.on_type_obj_index_changed) self.man_geo_creation_btn.clicked.connect(self.on_manual_geo) self.man_gaps_creation_btn.clicked.connect(self.on_manual_gap_click) + self.reset_button.clicked.connect(self.set_tool_ui) def on_type_obj_index_changed(self, index): obj_type = self.type_obj_combo.currentIndex() diff --git a/flatcamTools/ToolDblSided.py b/flatcamTools/ToolDblSided.py index 2ec3a1c8..e005a281 100644 --- a/flatcamTools/ToolDblSided.py +++ b/flatcamTools/ToolDblSided.py @@ -63,6 +63,12 @@ class DblSidedTool(FlatCAMTool): "the specified axis. Does not create a new \n" "object, but modifies it.") ) + self.mirror_gerber_button.setStyleSheet(""" + QPushButton + { + font-weight: bold; + } + """) self.mirror_gerber_button.setMinimumWidth(60) # grid_lay.addRow("Bottom Layer:", self.object_combo) @@ -85,6 +91,12 @@ class DblSidedTool(FlatCAMTool): "the specified axis. Does not create a new \n" "object, but modifies it.") ) + self.mirror_exc_button.setStyleSheet(""" + QPushButton + { + font-weight: bold; + } + """) self.mirror_exc_button.setMinimumWidth(60) # grid_lay.addRow("Bottom Layer:", self.object_combo) @@ -109,6 +121,12 @@ class DblSidedTool(FlatCAMTool): "the specified axis. Does not create a new \n" "object, but modifies it.") ) + self.mirror_geo_button.setStyleSheet(""" + QPushButton + { + font-weight: bold; + } + """) self.mirror_geo_button.setMinimumWidth(60) # grid_lay.addRow("Bottom Layer:", self.object_combo) @@ -171,6 +189,12 @@ class DblSidedTool(FlatCAMTool): "The (x, y) coordinates are captured by pressing SHIFT key\n" "and left mouse button click on canvas or you can enter the coords manually.") ) + self.add_point_button.setStyleSheet(""" + QPushButton + { + font-weight: bold; + } + """) self.add_point_button.setMinimumWidth(60) grid_lay2.addWidget(self.pb_label, 10, 0) @@ -221,6 +245,12 @@ class DblSidedTool(FlatCAMTool): "- press SHIFT key and left mouse clicking on canvas. Then RMB click in the field and click Paste.\n" "- by entering the coords manually in the format: (x1, y1), (x2, y2), ...") ) + self.add_drill_point_button.setStyleSheet(""" + QPushButton + { + font-weight: bold; + } + """) self.add_drill_point_button.setMinimumWidth(60) grid_lay3.addWidget(self.alignment_holes, 0, 0) @@ -251,9 +281,6 @@ class DblSidedTool(FlatCAMTool): grid0.addWidget(self.dd_label, 1, 0) grid0.addWidget(self.drill_dia, 1, 1) - hlay2 = QtWidgets.QHBoxLayout() - self.layout.addLayout(hlay2) - # ## Buttons self.create_alignment_hole_button = QtWidgets.QPushButton(_("Create Excellon Object")) self.create_alignment_hole_button.setToolTip( @@ -261,17 +288,29 @@ class DblSidedTool(FlatCAMTool): "specified alignment holes and their mirror\n" "images.") ) - hlay2.addWidget(self.create_alignment_hole_button) - - self.reset_button = QtWidgets.QPushButton(_("Reset")) - self.reset_button.setToolTip( - _("Resets all the fields.") - ) - self.reset_button.setMinimumWidth(60) - hlay2.addWidget(self.reset_button) + self.create_alignment_hole_button.setStyleSheet(""" + QPushButton + { + font-weight: bold; + } + """) + self.layout.addWidget(self.create_alignment_hole_button) self.layout.addStretch() + # ## Reset Tool + self.reset_button = QtWidgets.QPushButton(_("Reset Tool")) + self.reset_button.setToolTip( + _("Will reset the tool parameters.") + ) + self.reset_button.setStyleSheet(""" + QPushButton + { + font-weight: bold; + } + """) + self.layout.addWidget(self.reset_button) + # ## Signals self.create_alignment_hole_button.clicked.connect(self.on_create_alignment_holes) self.mirror_gerber_button.clicked.connect(self.on_mirror_gerber) diff --git a/flatcamTools/ToolFiducials.py b/flatcamTools/ToolFiducials.py index 20e29872..6508030c 100644 --- a/flatcamTools/ToolFiducials.py +++ b/flatcamTools/ToolFiducials.py @@ -268,6 +268,12 @@ class ToolFiducials(FlatCAMTool): 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; + } + """) grid_lay.addWidget(self.add_cfid_button, 11, 0, 1, 2) separator_line_2 = QtWidgets.QFrame() @@ -296,10 +302,29 @@ class ToolFiducials(FlatCAMTool): "The diameter is always double of the diameter\n" "for the copper fiducial.") ) + self.add_sm_opening_button.setStyleSheet(""" + QPushButton + { + font-weight: bold; + } + """) grid_lay.addWidget(self.add_sm_opening_button, 15, 0, 1, 2) self.layout.addStretch() + # ## Reset Tool + self.reset_button = QtWidgets.QPushButton(_("Reset Tool")) + self.reset_button.setToolTip( + _("Will reset the tool parameters.") + ) + self.reset_button.setStyleSheet(""" + QPushButton + { + font-weight: bold; + } + """) + self.layout.addWidget(self.reset_button) + # Objects involved in Copper thieving self.grb_object = None self.sm_object = None @@ -337,6 +362,7 @@ class ToolFiducials(FlatCAMTool): self.fid_type_radio.activated_custom.connect(self.on_fiducial_type) self.pos_radio.activated_custom.connect(self.on_second_point) self.mode_radio.activated_custom.connect(self.on_method_change) + self.reset_button.clicked.connect(self.set_tool_ui) def run(self, toggle=True): self.app.report_usage("ToolFiducials()") diff --git a/flatcamTools/ToolFilm.py b/flatcamTools/ToolFilm.py index 8acab8d7..a94462a4 100644 --- a/flatcamTools/ToolFilm.py +++ b/flatcamTools/ToolFilm.py @@ -504,10 +504,29 @@ class Film(FlatCAMTool): "FlatCAM object, but directly save it in the\n" "selected format.") ) + self.film_object_button.setStyleSheet(""" + QPushButton + { + font-weight: bold; + } + """) grid1.addWidget(self.film_object_button, 4, 0, 1, 2) self.layout.addStretch() + # ## Reset Tool + self.reset_button = QtWidgets.QPushButton(_("Reset Tool")) + self.reset_button.setToolTip( + _("Will reset the tool parameters.") + ) + self.reset_button.setStyleSheet(""" + QPushButton + { + font-weight: bold; + } + """) + self.layout.addWidget(self.reset_button) + self.units = self.app.defaults['units'] # ## Signals @@ -518,6 +537,7 @@ class Film(FlatCAMTool): self.film_type.activated_custom.connect(self.on_film_type) self.source_punch.activated_custom.connect(self.on_punch_source) self.file_type_radio.activated_custom.connect(self.on_file_type) + self.reset_button.clicked.connect(self.set_tool_ui) def on_type_obj_index_changed(self, index): obj_type = self.tf_type_obj_combo.currentIndex() diff --git a/flatcamTools/ToolNonCopperClear.py b/flatcamTools/ToolNonCopperClear.py index 6095e14d..46b890f1 100644 --- a/flatcamTools/ToolNonCopperClear.py +++ b/flatcamTools/ToolNonCopperClear.py @@ -479,8 +479,27 @@ class NonCopperClear(FlatCAMTool, Gerber): _("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() + + # ## Reset Tool + self.reset_button = QtWidgets.QPushButton(_("Reset Tool")) + 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 ################################### # ############################################################################# @@ -557,6 +576,7 @@ class NonCopperClear(FlatCAMTool, Gerber): self.ncc_order_radio.activated_custom[str].connect(self.on_order_changed) self.type_obj_combo.currentIndexChanged.connect(self.on_type_obj_index_changed) + self.reset_button.clicked.connect(self.set_tool_ui) def on_type_obj_index_changed(self, index): obj_type = self.type_obj_combo.currentIndex() diff --git a/flatcamTools/ToolOptimal.py b/flatcamTools/ToolOptimal.py index 99aa0ff3..6bd4291b 100644 --- a/flatcamTools/ToolOptimal.py +++ b/flatcamTools/ToolOptimal.py @@ -222,9 +222,30 @@ class ToolOptimal(FlatCAMTool): "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) + self.layout.addStretch() + + # ## Reset Tool + self.reset_button = QtWidgets.QPushButton(_("Reset Tool")) + 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]) self.sec_loc_ois = OptionalHideInputSection(self.sec_locations_cb, [self.sec_locations_frame]) # ################## Finished GUI creation ################################### @@ -253,7 +274,7 @@ class ToolOptimal(FlatCAMTool): self.distances_textb.cursorPositionChanged.connect(self.on_distances_textb_clicked) self.locations_sec_textb.cursorPositionChanged.connect(self.on_locations_sec_clicked) - self.layout.addStretch() + self.reset_button.clicked.connect(self.set_tool_ui) def install(self, icon=None, separator=None, **kwargs): FlatCAMTool.install(self, icon, separator, shortcut='ALT+O', **kwargs) diff --git a/flatcamTools/ToolPaint.py b/flatcamTools/ToolPaint.py index e74cc5eb..720040a6 100644 --- a/flatcamTools/ToolPaint.py +++ b/flatcamTools/ToolPaint.py @@ -364,9 +364,29 @@ class ToolPaint(FlatCAMTool, Gerber): "- 'Reference Object' - will do non copper clearing within the area\n" "specified by another object.") ) + self.generate_paint_button.setStyleSheet(""" + QPushButton + { + font-weight: bold; + } + """) self.tools_box.addWidget(self.generate_paint_button) self.tools_box.addStretch() + + # ## Reset Tool + self.reset_button = QtWidgets.QPushButton(_("Reset Tool")) + 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 ##################################### # ####################################################################################### @@ -453,6 +473,7 @@ class ToolPaint(FlatCAMTool, Gerber): self.box_combo_type.currentIndexChanged.connect(self.on_combo_box_type) self.type_obj_combo.currentIndexChanged.connect(self.on_type_obj_index_changed) + self.reset_button.clicked.connect(self.set_tool_ui) # ############################################################################# # ###################### Setup CONTEXT MENU ################################### diff --git a/flatcamTools/ToolPanelize.py b/flatcamTools/ToolPanelize.py index 1c97b0fa..81233410 100644 --- a/flatcamTools/ToolPanelize.py +++ b/flatcamTools/ToolPanelize.py @@ -245,25 +245,41 @@ class Panelize(FlatCAMTool): self.constrain_cb, [self.x_width_lbl, self.x_width_entry, self.y_height_lbl, self.y_height_entry]) # Buttons - hlay_2 = QtWidgets.QHBoxLayout() - self.layout.addLayout(hlay_2) - - hlay_2.addStretch() self.panelize_object_button = QtWidgets.QPushButton(_("Panelize Object")) 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.") ) - hlay_2.addWidget(self.panelize_object_button) + self.panelize_object_button.setStyleSheet(""" + QPushButton + { + font-weight: bold; + } + """) + self.layout.addWidget(self.panelize_object_button) self.layout.addStretch() + # ## Reset Tool + self.reset_button = QtWidgets.QPushButton(_("Reset Tool")) + self.reset_button.setToolTip( + _("Will reset the tool parameters.") + ) + self.reset_button.setStyleSheet(""" + QPushButton + { + font-weight: bold; + } + """) + self.layout.addWidget(self.reset_button) + # Signals self.reference_radio.activated_custom.connect(self.on_reference_radio_changed) self.panelize_object_button.clicked.connect(self.on_panelize) self.type_obj_combo.currentIndexChanged.connect(self.on_type_obj_index_changed) self.type_box_combo.currentIndexChanged.connect(self.on_type_box_index_changed) + self.reset_button.clicked.connect(self.set_tool_ui) # list to hold the temporary objects self.objs = [] diff --git a/flatcamTools/ToolQRCode.py b/flatcamTools/ToolQRCode.py index 9fff40fe..97c0cef3 100644 --- a/flatcamTools/ToolQRCode.py +++ b/flatcamTools/ToolQRCode.py @@ -274,6 +274,12 @@ class QRCode(FlatCAMTool): self.export_svg_button.setToolTip( _("Export a SVG file with the QRCode content.") ) + self.export_svg_button.setStyleSheet(""" + QPushButton + { + font-weight: bold; + } + """) self.export_lay.addWidget(self.export_svg_button, 3, 0, 1, 2) # ## Export QRCode as PNG image @@ -281,6 +287,12 @@ class QRCode(FlatCAMTool): 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_lay.addWidget(self.export_png_button, 4, 0, 1, 2) # ## Insert QRCode @@ -288,10 +300,29 @@ class QRCode(FlatCAMTool): self.qrcode_button.setToolTip( _("Create the QRCode object.") ) + self.qrcode_button.setStyleSheet(""" + QPushButton + { + font-weight: bold; + } + """) self.layout.addWidget(self.qrcode_button) self.layout.addStretch() + # ## Reset Tool + self.reset_button = QtWidgets.QPushButton(_("Reset Tool")) + self.reset_button.setToolTip( + _("Will reset the tool parameters.") + ) + self.reset_button.setStyleSheet(""" + QPushButton + { + font-weight: bold; + } + """) + self.layout.addWidget(self.reset_button) + self.grb_object = None self.box_poly = None self.proc = None @@ -320,6 +351,7 @@ class QRCode(FlatCAMTool): self.back_color_button.clicked.connect(self.on_qrcode_back_color_button) self.transparent_cb.stateChanged.connect(self.on_transparent_back_color) + self.reset_button.clicked.connect(self.set_tool_ui) def run(self, toggle=True): self.app.report_usage("QRCode()") diff --git a/flatcamTools/ToolRulesCheck.py b/flatcamTools/ToolRulesCheck.py index 4008323d..509380d7 100644 --- a/flatcamTools/ToolRulesCheck.py +++ b/flatcamTools/ToolRulesCheck.py @@ -493,10 +493,29 @@ class RulesCheck(FlatCAMTool): "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; + } + """) hlay_2.addWidget(self.run_button) self.layout.addStretch() + # ## Reset Tool + self.reset_button = QtWidgets.QPushButton(_("Reset Tool")) + self.reset_button.setToolTip( + _("Will reset the tool parameters.") + ) + self.reset_button.setStyleSheet(""" + QPushButton + { + font-weight: bold; + } + """) + self.layout.addWidget(self.reset_button) + # ####################################################### # ################ SIGNALS ############################## # ####################################################### @@ -520,6 +539,7 @@ class RulesCheck(FlatCAMTool): # self.app.collection.rowsInserted.connect(self.on_object_loaded) self.tool_finished.connect(self.on_tool_finished) + self.reset_button.clicked.connect(self.set_tool_ui) # list to hold the temporary objects self.objs = [] diff --git a/flatcamTools/ToolSolderPaste.py b/flatcamTools/ToolSolderPaste.py index 76688ec3..f954db42 100644 --- a/flatcamTools/ToolSolderPaste.py +++ b/flatcamTools/ToolSolderPaste.py @@ -134,6 +134,12 @@ class SolderPaste(FlatCAMTool): self.soldergeo_btn.setToolTip( _("Generate solder paste dispensing geometry.") ) + self.soldergeo_btn.setStyleSheet(""" + QPushButton + { + font-weight: bold; + } + """) grid0.addWidget(self.addtool_btn, 0, 0) # grid2.addWidget(self.copytool_btn, 0, 1) @@ -343,6 +349,12 @@ class SolderPaste(FlatCAMTool): _("Generate GCode for Solder Paste dispensing\n" "on PCB pads.") ) + self.solder_gcode_btn.setStyleSheet(""" + QPushButton + { + font-weight: bold; + } + """) self.generation_frame = QtWidgets.QFrame() self.generation_frame.setContentsMargins(0, 0, 0, 0) @@ -423,12 +435,24 @@ class SolderPaste(FlatCAMTool): _("View the generated GCode for Solder Paste dispensing\n" "on PCB pads.") ) + self.solder_gcode_view_btn.setStyleSheet(""" + QPushButton + { + font-weight: bold; + } + """) self.solder_gcode_save_btn = QtWidgets.QPushButton(_("Save GCode")) 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; + } + """) step4_lbl = QtWidgets.QLabel("%s:" % _('STEP 4')) step4_lbl.setToolTip( @@ -438,10 +462,23 @@ class SolderPaste(FlatCAMTool): grid4.addWidget(step4_lbl, 0, 0) grid4.addWidget(self.solder_gcode_view_btn, 0, 2) - grid4.addWidget(self.solder_gcode_save_btn, 1, 2) + grid4.addWidget(self.solder_gcode_save_btn, 1, 0, 1, 3) self.layout.addStretch() + # ## Reset Tool + self.reset_button = QtWidgets.QPushButton(_("Reset Tool")) + self.reset_button.setToolTip( + _("Will reset the tool parameters.") + ) + self.reset_button.setStyleSheet(""" + QPushButton + { + font-weight: bold; + } + """) + self.layout.addWidget(self.reset_button) + # self.gcode_frame.setDisabled(True) # self.save_gcode_frame.setDisabled(True) @@ -479,6 +516,7 @@ class SolderPaste(FlatCAMTool): self.cnc_obj_combo.currentIndexChanged.connect(self.on_cncjob_select) self.app.object_status_changed.connect(self.update_comboboxes) + self.reset_button.clicked.connect(self.set_tool_ui) def run(self, toggle=True): self.app.report_usage("ToolSolderPaste()") diff --git a/flatcamTools/ToolSub.py b/flatcamTools/ToolSub.py index 84bc56d3..3d472874 100644 --- a/flatcamTools/ToolSub.py +++ b/flatcamTools/ToolSub.py @@ -100,6 +100,12 @@ class ToolSub(FlatCAMTool): "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(e_lab_1) @@ -148,11 +154,30 @@ class ToolSub(FlatCAMTool): _("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.addWidget(e_lab_1) self.tools_box.addStretch() + # ## Reset Tool + self.reset_button = QtWidgets.QPushButton(_("Reset Tool")) + self.reset_button.setToolTip( + _("Will reset the tool parameters.") + ) + self.reset_button.setStyleSheet(""" + QPushButton + { + font-weight: bold; + } + """) + self.tools_box.addWidget(self.reset_button) + # QTimer for periodic check self.check_thread = QtCore.QTimer() # Every time an intersection job is started we add a promise; every time an intersection job is finished @@ -198,6 +223,7 @@ class ToolSub(FlatCAMTool): pass self.intersect_geo_btn.clicked.connect(self.on_geo_intersection_click) self.job_finished.connect(self.on_job_finished) + self.reset_button.clicked.connect(self.set_tool_ui) def install(self, icon=None, separator=None, **kwargs): FlatCAMTool.install(self, icon, separator, shortcut='ALT+W', **kwargs)