- modified the extensions all over such the names include also the extension name. For Linux who does not display the extensions in the native FileDialog.

- added descriptions for some of the methods in the app.
- added lightened icons for the dark theme from Leandro Heck
This commit is contained in:
Marius Stanciu
2020-04-14 13:42:49 +03:00
committed by Marius
parent cb52f1c10a
commit c5926ae99f
272 changed files with 204 additions and 111 deletions

View File

@@ -447,10 +447,10 @@ class FlatCAMObj(QtCore.QObject):
Will modify the filter string that is used when saving a file (a list of file extensions) to have the last
used file extension as the first one in the special string
:param last_ext: the file extension that was last used to save a file
:param filter_string: a key in self.app.defaults that holds a string with the filter from QFileDialog
:param last_ext: The file extension that was last used to save a file
:param filter_string: A key in self.app.defaults that holds a string with the filter from QFileDialog
used when saving a file
:return: None
:return: None
"""
filters = copy(self.app.defaults[filter_string])
@@ -7007,6 +7007,12 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
self.app.worker_task.emit({'fcn': worker_task, 'params': []})
def on_exportgcode_button_click(self, *args):
"""
Handler activated by a button clicked when exporting GCode.
:param args:
:return:
"""
self.app.report_usage("cncjob_on_exportgcode_button")
self.read_form()
@@ -7014,9 +7020,9 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
save_gcode = False
if 'Roland' in self.pp_excellon_name or 'Roland' in self.pp_geometry_name:
_filter_ = "RML1 Files (*.rol);;All Files (*.*)"
_filter_ = "RML1 Files .rol (*.rol);;All Files (*.*)"
elif 'hpgl' in self.pp_geometry_name:
_filter_ = "HPGL Files (*.plt);;All Files (*.*)"
_filter_ = "HPGL Files .plt (*.plt);;All Files (*.*)"
else:
save_gcode = True
_filter_ = self.app.defaults['cncjob_save_filters']
@@ -7055,10 +7061,16 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
if self.app.defaults["global_open_style"] is False:
self.app.file_opened.emit("gcode", filename)
self.app.file_saved.emit("gcode", filename)
self.app.inform.emit('[success] %s: %s' %
(_("Machine Code file saved to"), filename))
self.app.inform.emit('[success] %s: %s' % (_("Machine Code file saved to"), filename))
def on_edit_code_click(self, *args):
"""
Handler activated by a button clicked when editing GCode.
:param args:
:return:
"""
self.app.proc_container.view.set_busy(_("Loading..."))
preamble = str(self.ui.prepend_text.get_value())
@@ -7116,9 +7128,9 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
"""
Will create a header to be added to all GCode files generated by FlatCAM
:param comment_start_symbol: a symbol to be used as the first symbol in a comment
:param comment_stop_symbol: a symbol to be used as the last symbol in a comment
:return: a string with a GCode header
:param comment_start_symbol: A symbol to be used as the first symbol in a comment
:param comment_stop_symbol: A symbol to be used as the last symbol in a comment
:return: A string with a GCode header
"""
log.debug("FlatCAMCNCJob.gcode_header()")
@@ -7219,6 +7231,7 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
def gcode_footer(self, end_command=None):
"""
Will add the M02 to the end of GCode, if requested.
:param end_command: 'M02' or 'M30' - String
:return:
@@ -7232,11 +7245,11 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
"""
This will save the GCode from the Gcode object to a file on the OS filesystem
:param filename: filename for the GCode file
:param preamble: a custom Gcode block to be added at the beginning of the Gcode file
:param postamble: a custom Gcode block to be added at the end of the Gcode file
:param to_file: if False then no actual file is saved but the app will know that a file was created
:return: None
:param filename: filename for the GCode file
:param preamble: a custom Gcode block to be added at the beginning of the Gcode file
:param postamble: a custom Gcode block to be added at the end of the Gcode file
:param to_file: if False then no actual file is saved but the app will know that a file was created
:return: None
"""
# gcode = ''
# roland = False
@@ -7482,6 +7495,13 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
return lines
def on_toolchange_custom_clicked(self, signal):
"""
Handler for clicking toolchange custom.
:param signal:
:return:
"""
try:
if 'toolchange_custom' not in str(self.options['ppname_e']).lower():
if self.ui.toolchange_cb.get_value():
@@ -7503,7 +7523,13 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
self.app.inform.emit('[ERROR] %s' % _("There is no preprocessor file."))
def get_gcode(self, preamble='', postamble=''):
# we need this to be able get_gcode separately for shell command export_gcode
"""
We need this to be able to get_gcode separately for shell command export_gcode
:param preamble: Extra GCode added to the beginning of the GCode
:param postamble: Extra GCode added at the end of the GCode
:return: The modified GCode
"""
return preamble + '\n' + self.gcode + "\n" + postamble
def get_svg(self):
@@ -7511,6 +7537,12 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
pass
def on_plot_cb_click(self, *args):
"""
Handler for clicking on the Plot checkbox.
:param args:
:return:
"""
if self.muted_ui:
return
kind = self.ui.cncplot_method_combo.get_value()
@@ -7528,6 +7560,12 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
self.ui_connect()
def on_plot_cb_click_table(self):
"""
Handler for clicking the plot checkboxes added into a Table on each row. Purpose: toggle visibility for the
tool/aperture found on that row.
:return:
"""
# self.ui.cnc_tools_table.cellWidget(row, 2).widget().setCheckState(QtCore.Qt.Unchecked)
self.ui_disconnect()
# cw = self.sender()
@@ -7566,9 +7604,14 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
self.ui_connect()
def plot(self, visible=None, kind='all'):
"""
# Does all the required setup and returns False
# if the 'ptint' option is set to False.
:param visible: Boolean to decide if the object will be plotted as visible or disabled on canvas
:param kind: String. Can be "all" or "travel" or "cut". For CNCJob plotting
:return: None
"""
if not FlatCAMObj.plot(self):
return
@@ -7612,6 +7655,11 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
self.annotation.clear(update=True)
def on_annotation_change(self):
"""
Handler for toggling the annotation display by clicking a checkbox.
:return:
"""
if self.app.is_legacy is False:
if self.ui.annotation_cb.get_value():
self.text_col.enabled = True
@@ -7625,6 +7673,13 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
self.plot(kind=kind)
def convert_units(self, units):
"""
Units conversion used by the CNCJob objects.
:param units: Can be "MM" or "IN"
:return:
"""
log.debug("FlatCAMObj.FlatCAMECNCjob.convert_units()")
factor = CNCjob.convert_units(self, units)
@@ -7723,6 +7778,11 @@ class FlatCAMScript(FlatCAMObj):
self.script_editor_tab = TextEditor(app=self.app, plain_text=True)
def set_ui(self, ui):
"""
Sets the Object UI in Selected Tab for the FlatCAM Script type of object.
:param ui:
:return:
"""
FlatCAMObj.set_ui(self, ui)
FlatCAMApp.App.log.debug("FlatCAMScript.set_ui()")