- updated the new shortcut list with the shortcuts added lately

- now the special messages in the Shell are color coded according to the level. Before they all were RED. Now the WARNINGS are yellow, ERRORS are red and SUCCESS is a dark green. Also the level is in CAPS LOCK to make them more obvious
- some more changes to GUI interface (solved issues)
- added some status bar messages in the Geometry Editor to guide the user when using the Geometry Tools
- now the '`' shortcut key that shows the 'shortcut key list' in Editors points to the same window which is created in a tab no longer as a pop-up window. This tab can be detached if needed.
This commit is contained in:
Marius Stanciu
2019-02-03 15:13:09 +02:00
committed by Marius S
parent e5ebfac3ce
commit 6ea3499d39
22 changed files with 428 additions and 409 deletions

View File

@@ -260,7 +260,7 @@ class ToolCalculator(FlatCAMTool):
try:
tip_diameter = float(self.tipDia_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered, "
self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered, "
"use a number.")
return
@@ -271,7 +271,7 @@ class ToolCalculator(FlatCAMTool):
try:
half_tip_angle = float(self.tipAngle_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered, "
self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered, "
"use a number.")
return
half_tip_angle /= 2
@@ -283,7 +283,7 @@ class ToolCalculator(FlatCAMTool):
try:
cut_depth = float(self.cutDepth_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered, "
self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered, "
"use a number.")
return
@@ -305,7 +305,7 @@ class ToolCalculator(FlatCAMTool):
try:
length = float(self.pcblength_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered, "
self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered, "
"use a number.")
return
@@ -316,7 +316,7 @@ class ToolCalculator(FlatCAMTool):
try:
width = float(self.pcbwidth_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered, "
self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered, "
"use a number.")
return
@@ -327,7 +327,7 @@ class ToolCalculator(FlatCAMTool):
try:
density = float(self.cdensity_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered, "
self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered, "
"use a number.")
return
@@ -338,7 +338,7 @@ class ToolCalculator(FlatCAMTool):
try:
copper = float(self.growth_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered, "
self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered, "
"use a number.")
return

View File

@@ -219,11 +219,11 @@ class ToolCutOut(FlatCAMTool):
try:
cutout_obj = self.app.collection.get_by_name(str(name))
except:
self.app.inform.emit("[error_notcl]Could not retrieve object: %s" % name)
self.app.inform.emit("[ERROR_NOTCL]Could not retrieve object: %s" % name)
return "Could not retrieve object: %s" % name
if cutout_obj is None:
self.app.inform.emit("[error_notcl]There is no object selected for Cutout.\nSelect one and try again.")
self.app.inform.emit("[ERROR_NOTCL]There is no object selected for Cutout.\nSelect one and try again.")
return
try:
@@ -233,7 +233,7 @@ class ToolCutOut(FlatCAMTool):
try:
dia = float(self.dia.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[warning_notcl] Tool diameter value is missing or wrong format. "
self.app.inform.emit("[WARNING_NOTCL] Tool diameter value is missing or wrong format. "
"Add it and retry.")
return
@@ -244,7 +244,7 @@ class ToolCutOut(FlatCAMTool):
try:
margin = float(self.margin.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[warning_notcl] Margin value is missing or wrong format. "
self.app.inform.emit("[WARNING_NOTCL] Margin value is missing or wrong format. "
"Add it and retry.")
return
@@ -255,27 +255,27 @@ class ToolCutOut(FlatCAMTool):
try:
gapsize = float(self.gapsize.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[warning_notcl] Gap size value is missing or wrong format. "
self.app.inform.emit("[WARNING_NOTCL] Gap size value is missing or wrong format. "
"Add it and retry.")
return
try:
gaps = self.gaps.get_value()
except TypeError:
self.app.inform.emit("[warning_notcl] Number of gaps value is missing. Add it and retry.")
self.app.inform.emit("[WARNING_NOTCL] Number of gaps value is missing. Add it and retry.")
return
if 0 in {dia}:
self.app.inform.emit("[warning_notcl]Tool Diameter is zero value. Change it to a positive integer.")
self.app.inform.emit("[WARNING_NOTCL]Tool Diameter is zero value. Change it to a positive integer.")
return "Tool Diameter is zero value. Change it to a positive integer."
if gaps not in ['lr', 'tb', '2lr', '2tb', '4', '8']:
self.app.inform.emit("[warning_notcl] Gaps value can be only one of: 'lr', 'tb', '2lr', '2tb', 4 or 8. "
self.app.inform.emit("[WARNING_NOTCL] Gaps value can be only one of: 'lr', 'tb', '2lr', '2tb', 4 or 8. "
"Fill in a correct value and retry. ")
return
if cutout_obj.multigeo is True:
self.app.inform.emit("[error]Cutout operation cannot be done on a multi-geo Geometry.\n"
self.app.inform.emit("[ERROR]Cutout operation cannot be done on a multi-geo Geometry.\n"
"Optionally, this Multi-geo Geometry can be converted to Single-geo Geometry,\n"
"and after that perform Cutout.")
return
@@ -359,11 +359,11 @@ class ToolCutOut(FlatCAMTool):
try:
cutout_obj = self.app.collection.get_by_name(str(name))
except:
self.app.inform.emit("[error_notcl]Could not retrieve object: %s" % name)
self.app.inform.emit("[ERROR_NOTCL]Could not retrieve object: %s" % name)
return "Could not retrieve object: %s" % name
if cutout_obj is None:
self.app.inform.emit("[error_notcl]Object not found: %s" % cutout_obj)
self.app.inform.emit("[ERROR_NOTCL]Object not found: %s" % cutout_obj)
try:
dia = float(self.dia.get_value())
@@ -372,7 +372,7 @@ class ToolCutOut(FlatCAMTool):
try:
dia = float(self.dia.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[warning_notcl] Tool diameter value is missing or wrong format. "
self.app.inform.emit("[WARNING_NOTCL] Tool diameter value is missing or wrong format. "
"Add it and retry.")
return
@@ -383,7 +383,7 @@ class ToolCutOut(FlatCAMTool):
try:
margin = float(self.margin.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[warning_notcl] Margin value is missing or wrong format. "
self.app.inform.emit("[WARNING_NOTCL] Margin value is missing or wrong format. "
"Add it and retry.")
return
@@ -394,22 +394,22 @@ class ToolCutOut(FlatCAMTool):
try:
gapsize = float(self.gapsize.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[warning_notcl] Gap size value is missing or wrong format. "
self.app.inform.emit("[WARNING_NOTCL] Gap size value is missing or wrong format. "
"Add it and retry.")
return
try:
gaps = self.gaps_rect_radio.get_value()
except TypeError:
self.app.inform.emit("[warning_notcl] Number of gaps value is missing. Add it and retry.")
self.app.inform.emit("[WARNING_NOTCL] Number of gaps value is missing. Add it and retry.")
return
if 0 in {dia}:
self.app.inform.emit("[error_notcl]Tool Diameter is zero value. Change it to a positive integer.")
self.app.inform.emit("[ERROR_NOTCL]Tool Diameter is zero value. Change it to a positive integer.")
return "Tool Diameter is zero value. Change it to a positive integer."
if cutout_obj.multigeo is True:
self.app.inform.emit("[error]Cutout operation cannot be done on a multi-geo Geometry.\n"
self.app.inform.emit("[ERROR]Cutout operation cannot be done on a multi-geo Geometry.\n"
"Optionally, this Multi-geo Geometry can be converted to Single-geo Geometry,\n"
"and after that perform Cutout.")
return

View File

@@ -283,7 +283,7 @@ class DblSidedTool(FlatCAMTool):
try:
px, py = self.point_entry.get_value()
except TypeError:
self.app.inform.emit("[warning_notcl] 'Point' reference is selected and 'Point' coordinates "
self.app.inform.emit("[WARNING_NOTCL] 'Point' reference is selected and 'Point' coordinates "
"are missing. Add them and retry.")
return
else:
@@ -298,14 +298,14 @@ class DblSidedTool(FlatCAMTool):
dia = self.drill_dia.get_value()
if dia is None:
self.app.inform.emit("[warning_notcl]No value or wrong format in Drill Dia entry. Add it and retry.")
self.app.inform.emit("[WARNING_NOTCL]No value or wrong format in Drill Dia entry. Add it and retry.")
return
tools = {"1": {"C": dia}}
# holes = self.alignment_holes.get_value()
holes = eval('[{}]'.format(self.alignment_holes.text()))
if not holes:
self.app.inform.emit("[warning_notcl] There are no Alignment Drill Coordinates to use. Add them and retry.")
self.app.inform.emit("[WARNING_NOTCL] There are no Alignment Drill Coordinates to use. Add them and retry.")
return
drills = []
@@ -331,11 +331,11 @@ class DblSidedTool(FlatCAMTool):
try:
fcobj = model_index.internalPointer().obj
except Exception as e:
self.app.inform.emit("[warning_notcl] There is no Gerber object loaded ...")
self.app.inform.emit("[WARNING_NOTCL] There is no Gerber object loaded ...")
return
if not isinstance(fcobj, FlatCAMGerber):
self.app.inform.emit("[error_notcl] Only Gerber, Excellon and Geometry objects can be mirrored.")
self.app.inform.emit("[ERROR_NOTCL] Only Gerber, Excellon and Geometry objects can be mirrored.")
return
axis = self.mirror_axis.get_value()
@@ -345,7 +345,7 @@ class DblSidedTool(FlatCAMTool):
try:
px, py = self.point_entry.get_value()
except TypeError:
self.app.inform.emit("[warning_notcl] 'Point' coordinates missing. "
self.app.inform.emit("[WARNING_NOTCL] 'Point' coordinates missing. "
"Using Origin (0, 0) as mirroring reference.")
px, py = (0, 0)
@@ -355,7 +355,7 @@ class DblSidedTool(FlatCAMTool):
try:
bb_obj = model_index_box.internalPointer().obj
except Exception as e:
self.app.inform.emit("[warning_notcl] There is no Box object loaded ...")
self.app.inform.emit("[WARNING_NOTCL] There is no Box object loaded ...")
return
xmin, ymin, xmax, ymax = bb_obj.bounds()
@@ -373,11 +373,11 @@ class DblSidedTool(FlatCAMTool):
try:
fcobj = model_index.internalPointer().obj
except Exception as e:
self.app.inform.emit("[warning_notcl] There is no Excellon object loaded ...")
self.app.inform.emit("[WARNING_NOTCL] There is no Excellon object loaded ...")
return
if not isinstance(fcobj, FlatCAMExcellon):
self.app.inform.emit("[error_notcl] Only Gerber, Excellon and Geometry objects can be mirrored.")
self.app.inform.emit("[ERROR_NOTCL] Only Gerber, Excellon and Geometry objects can be mirrored.")
return
axis = self.mirror_axis.get_value()
@@ -391,7 +391,7 @@ class DblSidedTool(FlatCAMTool):
try:
bb_obj = model_index_box.internalPointer().obj
except Exception as e:
self.app.inform.emit("[warning_notcl] There is no Box object loaded ...")
self.app.inform.emit("[WARNING_NOTCL] There is no Box object loaded ...")
return
xmin, ymin, xmax, ymax = bb_obj.bounds()
@@ -409,11 +409,11 @@ class DblSidedTool(FlatCAMTool):
try:
fcobj = model_index.internalPointer().obj
except Exception as e:
self.app.inform.emit("[warning_notcl] There is no Geometry object loaded ...")
self.app.inform.emit("[WARNING_NOTCL] There is no Geometry object loaded ...")
return
if not isinstance(fcobj, FlatCAMGeometry):
self.app.inform.emit("[error_notcl] Only Gerber, Excellon and Geometry objects can be mirrored.")
self.app.inform.emit("[ERROR_NOTCL] Only Gerber, Excellon and Geometry objects can be mirrored.")
return
axis = self.mirror_axis.get_value()
@@ -427,7 +427,7 @@ class DblSidedTool(FlatCAMTool):
try:
bb_obj = model_index_box.internalPointer().obj
except Exception as e:
self.app.inform.emit("[warning_notcl] There is no Box object loaded ...")
self.app.inform.emit("[WARNING_NOTCL] There is no Box object loaded ...")
return
xmin, ymin, xmax, ymax = bb_obj.bounds()

View File

@@ -164,12 +164,12 @@ class Film(FlatCAMTool):
try:
name = self.tf_object_combo.currentText()
except:
self.app.inform.emit("[error_notcl] No Film object selected. Load a Film object and retry.")
self.app.inform.emit("[ERROR_NOTCL] No Film object selected. Load a Film object and retry.")
return
try:
boxname = self.tf_box_combo.currentText()
except:
self.app.inform.emit("[error_notcl] No Box object selected. Load a Box object and retry.")
self.app.inform.emit("[ERROR_NOTCL] No Box object selected. Load a Box object and retry.")
return
try:
@@ -179,7 +179,7 @@ class Film(FlatCAMTool):
try:
border = float(self.boundary_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered, "
self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered, "
"use a number.")
return

View File

@@ -68,7 +68,7 @@ class ToolMove(FlatCAMTool):
self.setVisible(False)
# signal that there is no command active
self.app.command_active = None
self.app.inform.emit("[warning_notcl]MOVE action cancelled. No object(s) to move.")
self.app.inform.emit("[WARNING_NOTCL]MOVE action cancelled. No object(s) to move.")
def on_left_click(self, event):
# mouse click will be accepted only if the left button is clicked
@@ -115,7 +115,7 @@ class ToolMove(FlatCAMTool):
try:
if not obj_list:
self.app.inform.emit("[warning_notcl] No object(s) selected.")
self.app.inform.emit("[WARNING_NOTCL] No object(s) selected.")
return "fail"
else:
for sel_obj in obj_list:
@@ -131,7 +131,7 @@ class ToolMove(FlatCAMTool):
# self.app.collection.set_active(sel_obj.options['name'])
except Exception as e:
proc.done()
self.app.inform.emit('[error_notcl] '
self.app.inform.emit('[ERROR_NOTCL] '
'ToolMove.on_left_click() --> %s' % str(e))
return "fail"
proc.done()
@@ -146,7 +146,7 @@ class ToolMove(FlatCAMTool):
return
except TypeError:
self.app.inform.emit('[error_notcl] '
self.app.inform.emit('[ERROR_NOTCL] '
'ToolMove.on_left_click() --> Error when mouse left click.')
return
@@ -174,7 +174,7 @@ class ToolMove(FlatCAMTool):
def on_key_press(self, event):
if event.key == 'escape':
# abort the move action
self.app.inform.emit("[warning_notcl]Move action cancelled.")
self.app.inform.emit("[WARNING_NOTCL]Move action cancelled.")
self.toggle()
return
@@ -186,7 +186,7 @@ class ToolMove(FlatCAMTool):
obj_list = self.app.collection.get_selected()
if not obj_list:
self.app.inform.emit("[warning_notcl]Object(s) not selected")
self.app.inform.emit("[WARNING_NOTCL]Object(s) not selected")
self.toggle()
else:
# if we have an object selected then we can safely activate the mouse events

View File

@@ -437,12 +437,12 @@ class NonCopperClear(FlatCAMTool, Gerber):
try:
tool_dia = float(self.addtool_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered, "
self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered, "
"use a number.")
return
if tool_dia is None:
self.build_ui()
self.app.inform.emit("[warning_notcl] Please enter a tool diameter to add, in Float format.")
self.app.inform.emit("[WARNING_NOTCL] Please enter a tool diameter to add, in Float format.")
return
# construct a list of all 'tooluid' in the self.tools
@@ -466,7 +466,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
if float('%.4f' % tool_dia) in tool_dias:
if muted is None:
self.app.inform.emit("[warning_notcl]Adding tool cancelled. Tool already in Tool Table.")
self.app.inform.emit("[WARNING_NOTCL]Adding tool cancelled. Tool already in Tool Table.")
self.tools_table.itemChanged.connect(self.on_tool_edit)
return
else:
@@ -504,7 +504,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
try:
new_tool_dia = float(self.tools_table.item(row, 1).text().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered, "
self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered, "
"use a number.")
return
@@ -524,7 +524,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
break
restore_dia_item = self.tools_table.item(row, 1)
restore_dia_item.setText(str(old_tool_dia))
self.app.inform.emit("[warning_notcl] Edit cancelled. New diameter value is already in the Tool Table.")
self.app.inform.emit("[WARNING_NOTCL] Edit cancelled. New diameter value is already in the Tool Table.")
self.build_ui()
def on_tool_delete(self, rows_to_delete=None, all=None):
@@ -563,7 +563,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
self.ncc_tools.pop(t, None)
except AttributeError:
self.app.inform.emit("[warning_notcl]Delete failed. Select a tool to delete.")
self.app.inform.emit("[WARNING_NOTCL]Delete failed. Select a tool to delete.")
return
except Exception as e:
log.debug(str(e))
@@ -580,7 +580,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
try:
over = float(self.ncc_overlap_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered, "
self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered, "
"use a number.")
return
over = over if over else self.app.defaults["tools_nccoverlap"]
@@ -592,7 +592,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
try:
margin = float(self.ncc_margin_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered, "
self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered, "
"use a number.")
return
margin = margin if margin else self.app.defaults["tools_nccmargin"]
@@ -614,7 +614,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
try:
self.ncc_obj = self.app.collection.get_by_name(self.obj_name)
except:
self.app.inform.emit("[error_notcl]Could not retrieve object: %s" % self.obj_name)
self.app.inform.emit("[ERROR_NOTCL]Could not retrieve object: %s" % self.obj_name)
return "Could not retrieve object: %s" % self.obj_name
@@ -622,7 +622,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
try:
bounding_box = self.ncc_obj.solid_geometry.envelope.buffer(distance=margin, join_style=JOIN_STYLE.mitre)
except AttributeError:
self.app.inform.emit("[error_notcl]No Gerber file available.")
self.app.inform.emit("[ERROR_NOTCL]No Gerber file available.")
return
# calculate the empty area by substracting the solid_geometry from the object bounding box geometry
@@ -747,14 +747,14 @@ class NonCopperClear(FlatCAMTool, Gerber):
app_obj.new_object("geometry", name, initialize)
except Exception as e:
proc.done()
self.app.inform.emit('[error_notcl] NCCTool.clear_non_copper() --> %s' % str(e))
self.app.inform.emit('[ERROR_NOTCL] NCCTool.clear_non_copper() --> %s' % str(e))
return
proc.done()
if app_obj.poly_not_cleared is False:
self.app.inform.emit('[success] NCC Tool finished.')
else:
self.app.inform.emit('[warning_notcl] NCC Tool finished but some PCB features could not be cleared. '
self.app.inform.emit('[WARNING_NOTCL] NCC Tool finished but some PCB features could not be cleared. '
'Check the result.')
# reset the variable for next use
app_obj.poly_not_cleared = False
@@ -898,7 +898,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
app_obj.new_object("geometry", name, initialize_rm)
except Exception as e:
proc.done()
self.app.inform.emit('[error_notcl] NCCTool.clear_non_copper_rest() --> %s' % str(e))
self.app.inform.emit('[ERROR_NOTCL] NCCTool.clear_non_copper_rest() --> %s' % str(e))
return
if app_obj.poly_not_cleared is True:
@@ -906,7 +906,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
# focus on Selected Tab
self.app.ui.notebook.setCurrentWidget(self.app.ui.selected_tab)
else:
self.app.inform.emit('[error_notcl] NCC Tool finished but could not clear the object '
self.app.inform.emit('[ERROR_NOTCL] NCC Tool finished but could not clear the object '
'with current settings.')
# focus on Project Tab
self.app.ui.notebook.setCurrentWidget(self.app.ui.project_tab)

View File

@@ -493,13 +493,13 @@ class ToolPaint(FlatCAMTool, Gerber):
try:
tool_dia = float(self.addtool_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered, "
self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered, "
"use a number.")
return
if tool_dia is None:
self.build_ui()
self.app.inform.emit("[warning_notcl] Please enter a tool diameter to add, in Float format.")
self.app.inform.emit("[WARNING_NOTCL] Please enter a tool diameter to add, in Float format.")
return
# construct a list of all 'tooluid' in the self.tools
@@ -523,7 +523,7 @@ class ToolPaint(FlatCAMTool, Gerber):
if float('%.4f' % tool_dia) in tool_dias:
if muted is None:
self.app.inform.emit("[warning_notcl]Adding tool cancelled. Tool already in Tool Table.")
self.app.inform.emit("[WARNING_NOTCL]Adding tool cancelled. Tool already in Tool Table.")
self.tools_table.itemChanged.connect(self.on_tool_edit)
return
else:
@@ -563,7 +563,7 @@ class ToolPaint(FlatCAMTool, Gerber):
try:
new_tool_dia = float(self.tools_table.item(row, 1).text().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered, "
self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered, "
"use a number.")
return
tooluid = int(self.tools_table.item(row, 3).text())
@@ -582,7 +582,7 @@ class ToolPaint(FlatCAMTool, Gerber):
break
restore_dia_item = self.tools_table.item(row, 1)
restore_dia_item.setText(str(old_tool_dia))
self.app.inform.emit("[warning_notcl] Edit cancelled. New diameter value is already in the Tool Table.")
self.app.inform.emit("[WARNING_NOTCL] Edit cancelled. New diameter value is already in the Tool Table.")
self.build_ui()
# def on_tool_copy(self, all=None):
@@ -615,7 +615,7 @@ class ToolPaint(FlatCAMTool, Gerber):
# print("COPIED", self.paint_tools[td])
# self.build_ui()
# except AttributeError:
# self.app.inform.emit("[warning_notcl]Failed. Select a tool to copy.")
# self.app.inform.emit("[WARNING_NOTCL]Failed. Select a tool to copy.")
# self.build_ui()
# return
# except Exception as e:
@@ -623,7 +623,7 @@ class ToolPaint(FlatCAMTool, Gerber):
# # deselect the table
# # self.ui.geo_tools_table.clearSelection()
# else:
# self.app.inform.emit("[warning_notcl]Failed. Select a tool to copy.")
# self.app.inform.emit("[WARNING_NOTCL]Failed. Select a tool to copy.")
# self.build_ui()
# return
# else:
@@ -679,7 +679,7 @@ class ToolPaint(FlatCAMTool, Gerber):
self.paint_tools.pop(t, None)
except AttributeError:
self.app.inform.emit("[warning_notcl]Delete failed. Select a tool to delete.")
self.app.inform.emit("[WARNING_NOTCL]Delete failed. Select a tool to delete.")
return
except Exception as e:
log.debug(str(e))
@@ -690,7 +690,7 @@ class ToolPaint(FlatCAMTool, Gerber):
def on_paint_button_click(self):
self.app.report_usage("geometry_on_paint_button")
self.app.inform.emit("[warning_notcl]Click inside the desired polygon.")
self.app.inform.emit("[WARNING_NOTCL]Click inside the desired polygon.")
try:
overlap = float(self.paintoverlap_entry.get_value())
except ValueError:
@@ -698,7 +698,7 @@ class ToolPaint(FlatCAMTool, Gerber):
try:
overlap = float(self.paintoverlap_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered, "
self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered, "
"use a number.")
return
@@ -712,11 +712,11 @@ class ToolPaint(FlatCAMTool, Gerber):
try:
self.paint_obj = self.app.collection.get_by_name(str(self.obj_name))
except:
self.app.inform.emit("[error_notcl]Could not retrieve object: %s" % self.obj_name)
self.app.inform.emit("[ERROR_NOTCL]Could not retrieve object: %s" % self.obj_name)
return
if self.paint_obj is None:
self.app.inform.emit("[error_notcl]Object not found: %s" % self.paint_obj)
self.app.inform.emit("[ERROR_NOTCL]Object not found: %s" % self.paint_obj)
return
o_name = '%s_multitool_paint' % (self.obj_name)
@@ -729,7 +729,7 @@ class ToolPaint(FlatCAMTool, Gerber):
contour=contour)
if select_method == "single":
self.app.inform.emit("[warning_notcl]Click inside the desired polygon.")
self.app.inform.emit("[WARNING_NOTCL]Click inside the desired polygon.")
# use the first tool in the tool table; get the diameter
tooldia = float('%.4f' % float(self.tools_table.item(0, 1).text()))
@@ -780,14 +780,14 @@ class ToolPaint(FlatCAMTool, Gerber):
try:
paint_margin = float(self.paintmargin_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered, "
self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered, "
"use a number.")
return
# No polygon?
if poly is None:
self.app.log.warning('No polygon found.')
self.app.inform.emit('[warning] No polygon found.')
self.app.inform.emit('[WARNING] No polygon found.')
return
proc = self.app.proc_container.new("Painting polygon.")
@@ -832,7 +832,7 @@ class ToolPaint(FlatCAMTool, Gerber):
geo_obj.solid_geometry += list(cp.get_objects())
return cp
else:
self.app.inform.emit('[error_notcl] Geometry could not be painted completely')
self.app.inform.emit('[ERROR_NOTCL] Geometry could not be painted completely')
return None
geo_obj.solid_geometry = []
@@ -847,7 +847,7 @@ class ToolPaint(FlatCAMTool, Gerber):
except Exception as e:
log.debug("Could not Paint the polygons. %s" % str(e))
self.app.inform.emit(
"[error] Could not do Paint. Try a different combination of parameters. "
"[ERROR] Could not do Paint. Try a different combination of parameters. "
"Or a different strategy of paint\n%s" % str(e))
return
@@ -878,7 +878,7 @@ class ToolPaint(FlatCAMTool, Gerber):
# self.app.inform.emit("[success] Paint single polygon Done")
# else:
# print("[WARNING] Paint single polygon done with errors")
# self.app.inform.emit("[warning] Paint single polygon done with errors. "
# self.app.inform.emit("[WARNING] Paint single polygon done with errors. "
# "%d area(s) could not be painted.\n"
# "Use different paint parameters or edit the paint geometry and correct"
# "the issue."
@@ -889,7 +889,7 @@ class ToolPaint(FlatCAMTool, Gerber):
app_obj.new_object("geometry", name, gen_paintarea)
except Exception as e:
proc.done()
self.app.inform.emit('[error_notcl] PaintTool.paint_poly() --> %s' % str(e))
self.app.inform.emit('[ERROR_NOTCL] PaintTool.paint_poly() --> %s' % str(e))
return
proc.done()
# focus on Selected Tab
@@ -924,7 +924,7 @@ class ToolPaint(FlatCAMTool, Gerber):
try:
paint_margin = float(self.paintmargin_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered, "
self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered, "
"use a number.")
return
@@ -1033,7 +1033,7 @@ class ToolPaint(FlatCAMTool, Gerber):
except Exception as e:
log.debug("Could not Paint the polygons. %s" % str(e))
self.app.inform.emit(
"[error] Could not do Paint All. Try a different combination of parameters. "
"[ERROR] Could not do Paint All. Try a different combination of parameters. "
"Or a different Method of paint\n%s" % str(e))
return
@@ -1057,7 +1057,7 @@ class ToolPaint(FlatCAMTool, Gerber):
if geo_obj.tools[tooluid]['solid_geometry']:
has_solid_geo += 1
if has_solid_geo == 0:
self.app.inform.emit("[error] There is no Painting Geometry in the file.\n"
self.app.inform.emit("[ERROR] There is no Painting Geometry in the file.\n"
"Usually it means that the tool diameter is too big for the painted geometry.\n"
"Change the painting parameters and try again.")
return
@@ -1112,7 +1112,7 @@ class ToolPaint(FlatCAMTool, Gerber):
except Exception as e:
log.debug("Could not Paint the polygons. %s" % str(e))
self.app.inform.emit(
"[error] Could not do Paint All. Try a different combination of parameters. "
"[ERROR] Could not do Paint All. Try a different combination of parameters. "
"Or a different Method of paint\n%s" % str(e))
return
@@ -1142,7 +1142,7 @@ class ToolPaint(FlatCAMTool, Gerber):
if geo_obj.tools[tooluid]['solid_geometry']:
has_solid_geo += 1
if has_solid_geo == 0:
self.app.inform.emit("[error_notcl] There is no Painting Geometry in the file.\n"
self.app.inform.emit("[ERROR_NOTCL] There is no Painting Geometry in the file.\n"
"Usually it means that the tool diameter is too big for the painted geometry.\n"
"Change the painting parameters and try again.")
return

View File

@@ -214,13 +214,13 @@ class Panelize(FlatCAMTool):
try:
obj = self.app.collection.get_by_name(str(name))
except:
self.app.inform.emit("[error_notcl]Could not retrieve object: %s" % name)
self.app.inform.emit("[ERROR_NOTCL]Could not retrieve object: %s" % name)
return "Could not retrieve object: %s" % name
panel_obj = obj
if panel_obj is None:
self.app.inform.emit("[error_notcl]Object not found: %s" % panel_obj)
self.app.inform.emit("[ERROR_NOTCL]Object not found: %s" % panel_obj)
return "Object not found: %s" % panel_obj
boxname = self.box_combo.currentText()
@@ -228,11 +228,11 @@ class Panelize(FlatCAMTool):
try:
box = self.app.collection.get_by_name(boxname)
except:
self.app.inform.emit("[error_notcl]Could not retrieve object: %s" % boxname)
self.app.inform.emit("[ERROR_NOTCL]Could not retrieve object: %s" % boxname)
return "Could not retrieve object: %s" % boxname
if box is None:
self.app.inform.emit("[warning]No object Box. Using instead %s" % panel_obj)
self.app.inform.emit("[WARNING]No object Box. Using instead %s" % panel_obj)
box = panel_obj
self.outname = name + '_panelized'
@@ -244,7 +244,7 @@ class Panelize(FlatCAMTool):
try:
spacing_columns = float(self.spacing_columns.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered, "
self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered, "
"use a number.")
return
spacing_columns = spacing_columns if spacing_columns is not None else 0
@@ -256,7 +256,7 @@ class Panelize(FlatCAMTool):
try:
spacing_rows = float(self.spacing_rows.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered, "
self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered, "
"use a number.")
return
spacing_rows = spacing_rows if spacing_rows is not None else 0
@@ -269,7 +269,7 @@ class Panelize(FlatCAMTool):
rows = float(self.rows.get_value().replace(',', '.'))
rows = int(rows)
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered, "
self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered, "
"use a number.")
return
rows = rows if rows is not None else 1
@@ -282,7 +282,7 @@ class Panelize(FlatCAMTool):
columns = float(self.columns.get_value().replace(',', '.'))
columns = int(columns)
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered, "
self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered, "
"use a number.")
return
columns = columns if columns is not None else 1
@@ -294,7 +294,7 @@ class Panelize(FlatCAMTool):
try:
constrain_dx = float(self.x_width_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered, "
self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered, "
"use a number.")
return
@@ -305,12 +305,12 @@ class Panelize(FlatCAMTool):
try:
constrain_dy = float(self.y_height_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered, "
self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered, "
"use a number.")
return
if 0 in {columns, rows}:
self.app.inform.emit("[error_notcl]Columns or Rows are zero value. Change them to a positive integer.")
self.app.inform.emit("[ERROR_NOTCL]Columns or Rows are zero value. Change them to a positive integer.")
return "Columns or Rows are zero value. Change them to a positive integer."
xmin, ymin, xmax, ymax = box.bounds()
@@ -406,7 +406,7 @@ class Panelize(FlatCAMTool):
# self.app.new_object("geometry", self.outname, job_init_geometry, plot=True, autoselected=True)
#
# else:
# self.app.inform.emit("[error_notcl] Obj is None")
# self.app.inform.emit("[ERROR_NOTCL] Obj is None")
# return "ERROR: Obj is None"
# panelize()
@@ -519,7 +519,7 @@ class Panelize(FlatCAMTool):
self.app.inform.emit("[success]Panel done...")
else:
self.constrain_flag = False
self.app.inform.emit("[warning] Too big for the constrain area. Final panel has %s columns and %s rows" %
self.app.inform.emit("[WARNING] Too big for the constrain area. Final panel has %s columns and %s rows" %
(columns, rows))
proc = self.app.proc_container.new("Generating panel ... Please wait.")

View File

@@ -60,7 +60,7 @@ class Properties(FlatCAMTool):
def properties(self):
obj_list = self.app.collection.get_selected()
if not obj_list:
self.app.inform.emit("[error_notcl] Properties Tool was not displayed. No object selected.")
self.app.inform.emit("[ERROR_NOTCL] Properties Tool was not displayed. No object selected.")
self.app.ui.notebook.setTabText(2, "Tools")
self.properties_frame.hide()
self.app.ui.notebook.setCurrentWidget(self.app.ui.project_tab)

View File

@@ -234,7 +234,7 @@ class TermWidget(QWidget):
"""
Convert text to HTML for inserting it to browser
"""
assert style in ('in', 'out', 'err')
assert style in ('in', 'out', 'err', 'warning', 'success')
text = html.escape(text)
text = text.replace('\n', '<br/>')
@@ -243,6 +243,10 @@ class TermWidget(QWidget):
text = '<span style="font-weight: bold;">%s</span>' % text
elif style == 'err':
text = '<span style="font-weight: bold; color: red;">%s</span>' % text
elif style == 'warning':
text = '<span style="font-weight: bold; color: rgb(244, 182, 66);">%s</span>' % text
elif style == 'success':
text = '<span style="font-weight: bold; color: rgb(8, 68, 0);">%s</span>' % text
else:
text = '<span>%s</span>' % text # without span <br/> is ignored!!!
@@ -304,6 +308,16 @@ class TermWidget(QWidget):
"""
self._append_to_browser('out', text)
def append_success(self, text):
"""Appent text to output widget
"""
self._append_to_browser('success', text)
def append_warning(self, text):
"""Appent text to output widget
"""
self._append_to_browser('warning', text)
def append_error(self, text):
"""Appent error text to output widget. Text is drawn with red background
"""

View File

@@ -382,7 +382,7 @@ class ToolTransform(FlatCAMTool):
try:
value = float(self.rotate_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered for Rotate, "
self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered for Rotate, "
"use a number.")
return
self.app.worker_task.emit({'fcn': self.on_rotate_action,
@@ -416,7 +416,7 @@ class ToolTransform(FlatCAMTool):
try:
value = float(self.skewx_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered for Skew X, "
self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered for Skew X, "
"use a number.")
return
@@ -434,7 +434,7 @@ class ToolTransform(FlatCAMTool):
try:
value = float(self.skewy_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered for Skew Y, "
self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered for Skew Y, "
"use a number.")
return
@@ -452,7 +452,7 @@ class ToolTransform(FlatCAMTool):
try:
xvalue = float(self.scalex_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered for Scale X, "
self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered for Scale X, "
"use a number.")
return
@@ -486,7 +486,7 @@ class ToolTransform(FlatCAMTool):
try:
yvalue = float(self.scaley_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered for Scale Y, "
self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered for Scale Y, "
"use a number.")
return
@@ -515,7 +515,7 @@ class ToolTransform(FlatCAMTool):
try:
value = float(self.offx_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered for Offset X, "
self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered for Offset X, "
"use a number.")
return
@@ -533,7 +533,7 @@ class ToolTransform(FlatCAMTool):
try:
value = float(self.offy_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered for Offset Y, "
self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered for Offset Y, "
"use a number.")
return
@@ -551,7 +551,7 @@ class ToolTransform(FlatCAMTool):
ymaxlist = []
if not obj_list:
self.app.inform.emit("[warning_notcl] No object selected. Please Select an object to rotate!")
self.app.inform.emit("[WARNING_NOTCL] No object selected. Please Select an object to rotate!")
return
else:
with self.app.proc_container.new("Appying Rotate"):
@@ -592,7 +592,7 @@ class ToolTransform(FlatCAMTool):
self.app.progress.emit(100)
except Exception as e:
self.app.inform.emit("[error_notcl] Due of %s, rotation movement was not executed." % str(e))
self.app.inform.emit("[ERROR_NOTCL] Due of %s, rotation movement was not executed." % str(e))
return
def on_flip(self, axis):
@@ -603,7 +603,7 @@ class ToolTransform(FlatCAMTool):
ymaxlist = []
if not obj_list:
self.app.inform.emit("[warning_notcl] No object selected. Please Select an object to flip!")
self.app.inform.emit("[WARNING_NOTCL] No object selected. Please Select an object to flip!")
return
else:
with self.app.proc_container.new("Applying Flip"):
@@ -665,7 +665,7 @@ class ToolTransform(FlatCAMTool):
self.app.progress.emit(100)
except Exception as e:
self.app.inform.emit("[error_notcl] Due of %s, Flip action was not executed." % str(e))
self.app.inform.emit("[ERROR_NOTCL] Due of %s, Flip action was not executed." % str(e))
return
def on_skew(self, axis, num):
@@ -674,7 +674,7 @@ class ToolTransform(FlatCAMTool):
yminlist = []
if not obj_list:
self.app.inform.emit("[warning_notcl] No object selected. Please Select an object to shear/skew!")
self.app.inform.emit("[WARNING_NOTCL] No object selected. Please Select an object to shear/skew!")
return
else:
with self.app.proc_container.new("Applying Skew"):
@@ -712,7 +712,7 @@ class ToolTransform(FlatCAMTool):
self.app.progress.emit(100)
except Exception as e:
self.app.inform.emit("[error_notcl] Due of %s, Skew action was not executed." % str(e))
self.app.inform.emit("[ERROR_NOTCL] Due of %s, Skew action was not executed." % str(e))
return
def on_scale(self, axis, xfactor, yfactor, point=None):
@@ -723,7 +723,7 @@ class ToolTransform(FlatCAMTool):
ymaxlist = []
if not obj_list:
self.app.inform.emit("[warning_notcl] No object selected. Please Select an object to scale!")
self.app.inform.emit("[WARNING_NOTCL] No object selected. Please Select an object to scale!")
return
else:
with self.app.proc_container.new("Applying Scale"):
@@ -767,7 +767,7 @@ class ToolTransform(FlatCAMTool):
self.app.inform.emit('Object(s) were scaled on %s axis ...' % str(axis))
self.app.progress.emit(100)
except Exception as e:
self.app.inform.emit("[error_notcl] Due of %s, Scale action was not executed." % str(e))
self.app.inform.emit("[ERROR_NOTCL] Due of %s, Scale action was not executed." % str(e))
return
def on_offset(self, axis, num):
@@ -776,7 +776,7 @@ class ToolTransform(FlatCAMTool):
yminlist = []
if not obj_list:
self.app.inform.emit("[warning_notcl] No object selected. Please Select an object to offset!")
self.app.inform.emit("[WARNING_NOTCL] No object selected. Please Select an object to offset!")
return
else:
with self.app.proc_container.new("Applying Offset"):
@@ -813,7 +813,7 @@ class ToolTransform(FlatCAMTool):
self.app.progress.emit(100)
except Exception as e:
self.app.inform.emit("[error_notcl] Due of %s, Offset action was not executed." % str(e))
self.app.inform.emit("[ERROR_NOTCL] Due of %s, Offset action was not executed." % str(e))
return
# end of file