Merged jpcgt/flatcam into master
This commit is contained in:
@@ -165,7 +165,7 @@ class DblSidedTool(FlatCAMTool):
|
||||
if not isinstance(fcobj, FlatCAMGerber) and \
|
||||
not isinstance(fcobj, FlatCAMExcellon) and \
|
||||
not isinstance(fcobj, FlatCAMGeometry):
|
||||
self.info("ERROR: Only Gerber, Excellon and Geometry objects can be mirrored.")
|
||||
self.app.inform.emit("ERROR: Only Gerber, Excellon and Geometry objects can be mirrored.")
|
||||
return
|
||||
|
||||
axis = self.mirror_axis.get_value()
|
||||
|
||||
@@ -693,7 +693,7 @@ class App(QtCore.QObject):
|
||||
:return: None
|
||||
"""
|
||||
if not isinstance(self.collection.get_active(), FlatCAMGeometry):
|
||||
self.info("Select a Geometry Object to edit.")
|
||||
self.inform.emit("Select a Geometry Object to edit.")
|
||||
return
|
||||
|
||||
self.ui.updategeo_btn.setEnabled(True)
|
||||
@@ -708,7 +708,7 @@ class App(QtCore.QObject):
|
||||
"""
|
||||
geo = self.collection.get_active()
|
||||
if not isinstance(geo, FlatCAMGeometry):
|
||||
self.info("Select a Geometry Object to update.")
|
||||
self.inform.emit("Select a Geometry Object to update.")
|
||||
return
|
||||
|
||||
self.draw.update_fcgeometry(geo)
|
||||
@@ -1639,8 +1639,9 @@ class App(QtCore.QObject):
|
||||
try:
|
||||
App.log.debug('button=%d, x=%d, y=%d, xdata=%f, ydata=%f' % (
|
||||
event.button, event.x, event.y, event.xdata, event.ydata))
|
||||
|
||||
self.clipboard.setText(self.defaults["point_clipboard_format"] % (event.xdata, event.ydata))
|
||||
modifiers = QtGui.QApplication.keyboardModifiers()
|
||||
if modifiers == QtCore.Qt.ControlModifier:
|
||||
self.clipboard.setText(self.defaults["point_clipboard_format"] % (event.xdata, event.ydata))
|
||||
|
||||
except Exception, e:
|
||||
App.log.debug("Outside plot?")
|
||||
|
||||
@@ -983,7 +983,7 @@ class FlatCAMDraw(QtCore.QObject):
|
||||
self.tools[t]["button"].setChecked(False)
|
||||
|
||||
self.active_tool = self.tools[tool]["constructor"](self)
|
||||
self.app.info(self.active_tool.start_msg)
|
||||
self.app.inform.emit(self.active_tool.start_msg)
|
||||
else:
|
||||
self.app.log.debug("%s is NOT checked." % tool)
|
||||
for t in self.tools:
|
||||
@@ -1002,7 +1002,7 @@ class FlatCAMDraw(QtCore.QObject):
|
||||
if self.active_tool is not None and event.button is 1:
|
||||
# Dispatch event to active_tool
|
||||
msg = self.active_tool.click(self.snap(event.xdata, event.ydata))
|
||||
self.app.info(msg)
|
||||
self.app.inform.emit(msg)
|
||||
|
||||
# If it is a shape generating tool
|
||||
if isinstance(self.active_tool, FCShapeTool) and self.active_tool.complete:
|
||||
@@ -1114,14 +1114,14 @@ class FlatCAMDraw(QtCore.QObject):
|
||||
self.active_tool.make()
|
||||
if self.active_tool.complete:
|
||||
self.on_shape_complete()
|
||||
self.app.info("Done.")
|
||||
self.app.inform.emit("Done.")
|
||||
return
|
||||
|
||||
### Abort the current action
|
||||
if event.key == 'escape':
|
||||
# TODO: ...?
|
||||
#self.on_tool_select("select")
|
||||
self.app.info("Cancelled.")
|
||||
self.app.inform.emit("Cancelled.")
|
||||
|
||||
self.delete_utility_geometry()
|
||||
|
||||
@@ -1141,14 +1141,14 @@ class FlatCAMDraw(QtCore.QObject):
|
||||
self.move_btn.setChecked(True)
|
||||
self.on_tool_select('move')
|
||||
self.active_tool.set_origin(self.snap(event.xdata, event.ydata))
|
||||
self.app.info("Click on target point.")
|
||||
self.app.inform.emit("Click on target point.")
|
||||
|
||||
### Copy
|
||||
if event.key == 'c':
|
||||
self.copy_btn.setChecked(True)
|
||||
self.on_tool_select('copy')
|
||||
self.active_tool.set_origin(self.snap(event.xdata, event.ydata))
|
||||
self.app.info("Click on target point.")
|
||||
self.app.inform.emit("Click on target point.")
|
||||
|
||||
### Snap
|
||||
if event.key == 'g':
|
||||
@@ -1165,7 +1165,7 @@ class FlatCAMDraw(QtCore.QObject):
|
||||
if self.active_tool is not None:
|
||||
response = self.active_tool.on_key(event.key)
|
||||
if response is not None:
|
||||
self.app.info(response)
|
||||
self.app.inform.emit(response)
|
||||
|
||||
def on_canvas_key_release(self, event):
|
||||
self.key = None
|
||||
|
||||
@@ -101,7 +101,7 @@ class FlatCAMObj(QtCore.QObject):
|
||||
old_name = copy(self.options["name"])
|
||||
new_name = self.ui.name_entry.get_value()
|
||||
self.options["name"] = self.ui.name_entry.get_value()
|
||||
self.app.info("Name changed from %s to %s" % (old_name, new_name))
|
||||
self.app.inform.emit("Name changed from %s to %s" % (old_name, new_name))
|
||||
|
||||
def on_offset_button_click(self):
|
||||
self.app.report_usage("obj_on_offset_button")
|
||||
@@ -473,7 +473,7 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
|
||||
# Propagate options
|
||||
follow_obj.options["cnctooldia"] = self.options["isotooldia"]
|
||||
follow_obj.solid_geometry = self.solid_geometry
|
||||
app_obj.info("Follow geometry created: %s" % follow_obj.options["name"])
|
||||
app_obj.inform.emit("Follow geometry created: %s" % follow_obj.options["name"])
|
||||
|
||||
# TODO: Do something if this is None. Offer changing name?
|
||||
self.app.new_object("geometry", follow_name, follow_init)
|
||||
@@ -519,7 +519,7 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
|
||||
elif type(geom) is Polygon:
|
||||
geom = Polygon(geom.exterior.coords[::-1], geom.interiors)
|
||||
else:
|
||||
raise "Unexpected Geometry"
|
||||
raise str("Unexpected Geometry")
|
||||
return geom
|
||||
|
||||
if combine:
|
||||
@@ -534,7 +534,7 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
|
||||
offset = (2 * i + 1) / 2.0 * dia - i * overlap * dia
|
||||
geom = generate_envelope (offset, i == 0)
|
||||
geo_obj.solid_geometry.append(geom)
|
||||
app_obj.info("Isolation geometry created: %s" % geo_obj.options["name"])
|
||||
app_obj.inform.emit("Isolation geometry created: %s" % geo_obj.options["name"])
|
||||
|
||||
# TODO: Do something if this is None. Offer changing name?
|
||||
self.app.new_object("geometry", iso_name, iso_init)
|
||||
@@ -553,7 +553,7 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
|
||||
# Propagate options
|
||||
geo_obj.options["cnctooldia"] = self.options["isotooldia"]
|
||||
geo_obj.solid_geometry = generate_envelope (offset, i == 0)
|
||||
app_obj.info("Isolation geometry created: %s" % geo_obj.options["name"])
|
||||
app_obj.inform.emit("Isolation geometry created: %s" % geo_obj.options["name"])
|
||||
|
||||
# TODO: Do something if this is None. Offer changing name?
|
||||
self.app.new_object("geometry", iso_name, iso_init)
|
||||
@@ -1059,6 +1059,7 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
|
||||
"tooldia": self.ui.tooldia_entry,
|
||||
"append": self.ui.append_text,
|
||||
"prepend": self.ui.prepend_text,
|
||||
"postprocess": self.ui.process_script,
|
||||
"dwell": self.ui.dwell_cb,
|
||||
"dwelltime": self.ui.dwelltime_entry
|
||||
})
|
||||
@@ -1088,8 +1089,9 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
|
||||
|
||||
preamble = str(self.ui.prepend_text.get_value())
|
||||
postamble = str(self.ui.append_text.get_value())
|
||||
processor = str(self.ui.process_script.get_value())
|
||||
|
||||
self.export_gcode(filename, preamble=preamble, postamble=postamble)
|
||||
self.export_gcode(filename, preamble=preamble, postamble=postamble, processor=processor)
|
||||
|
||||
def dwell_generator(self, lines):
|
||||
"""
|
||||
@@ -1125,7 +1127,7 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
|
||||
|
||||
raise StopIteration
|
||||
|
||||
def export_gcode(self, filename, preamble='', postamble=''):
|
||||
def export_gcode(self, filename, preamble='', postamble='', processor=''):
|
||||
|
||||
lines = StringIO(self.gcode)
|
||||
|
||||
@@ -1294,11 +1296,11 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
||||
return
|
||||
|
||||
if self.options["selectmethod"] == "single":
|
||||
self.app.info("Click inside the desired polygon.")
|
||||
self.app.inform.emit("Click inside the desired polygon.")
|
||||
|
||||
# To be called after clicking on the plot.
|
||||
def doit(event):
|
||||
self.app.info("Painting polygon...")
|
||||
self.app.inform.emit("Painting polygon...")
|
||||
self.app.plotcanvas.mpl_disconnect(subscription)
|
||||
point = [event.xdata, event.ydata]
|
||||
self.paint_poly_single_click(point, tooldia, overlap,
|
||||
|
||||
@@ -70,7 +70,6 @@ class ObjectCollection():
|
||||
self.model = QtGui.QStandardItemModel(self.view)
|
||||
self.view.setModel(self.model)
|
||||
self.model.itemChanged.connect(self.on_item_changed)
|
||||
#self.view.setModel(self)
|
||||
|
||||
self.click_modifier = None
|
||||
|
||||
@@ -164,6 +163,10 @@ class ObjectCollection():
|
||||
# Create the model item to insert into the QListView
|
||||
icon = QtGui.QIcon(self.icons[obj.kind])#self.icons["gerber"])
|
||||
item = QtGui.QStandardItem(icon, name)
|
||||
# Item is not editable, so that double click
|
||||
# does not allow cell value modification.
|
||||
item.setEditable(False)
|
||||
# The item is checkable, to add the checkbox.
|
||||
item.setCheckable(True)
|
||||
if obj.options["plot"] == True:
|
||||
item.setCheckState(2)#Qt.Checked)
|
||||
|
||||
13
ObjectUI.py
13
ObjectUI.py
@@ -196,6 +196,17 @@ class CNCObjectUI(ObjectUI):
|
||||
self.append_text = FCTextArea()
|
||||
self.custom_box.addWidget(self.append_text)
|
||||
|
||||
processorlabel = QtGui.QLabel('Postprocessing-Script:')
|
||||
processorlabel.setToolTip(
|
||||
"Enter a Postprocessing Script here.\n"
|
||||
"It gets applied to the G-Code after it\n"
|
||||
"is generated."
|
||||
)
|
||||
self.custom_box.addWidget(processorlabel)
|
||||
self.process_script = FCTextArea()
|
||||
self.custom_box.addWidget(self.process_script)
|
||||
|
||||
|
||||
# Dwell
|
||||
grid1 = QtGui.QGridLayout()
|
||||
self.custom_box.addLayout(grid1)
|
||||
@@ -814,4 +825,4 @@ class GerberObjectUI(ObjectUI):
|
||||
#
|
||||
#
|
||||
# if __name__ == '__main__':
|
||||
# main()
|
||||
# main()
|
||||
|
||||
Reference in New Issue
Block a user