From be4d4387f4e0227aae87b6285e04bc0ea7068a43 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Mon, 16 Sep 2019 16:04:47 +0300 Subject: [PATCH] - more GUI optimizations related to being part of the Advanced category or not - added possibility to change the positive SVG exported file color in Tool Film --- FlatCAMApp.py | 133 ++++++++---- FlatCAMObj.py | 18 +- README.md | 2 + flatcamGUI/FlatCAMGUI.py | 427 +++++++++++++++++++++------------------ flatcamGUI/ObjectUI.py | 5 +- flatcamTools/ToolFilm.py | 2 +- 6 files changed, 336 insertions(+), 251 deletions(-) diff --git a/FlatCAMApp.py b/FlatCAMApp.py index 1c8059f5..a39c759a 100644 --- a/FlatCAMApp.py +++ b/FlatCAMApp.py @@ -399,20 +399,15 @@ class App(QtCore.QObject): "global_portable": self.ui.general_defaults_form.general_app_group.portability_cb, "global_language": self.ui.general_defaults_form.general_app_group.language_cb, - "global_shell_at_startup": self.ui.general_defaults_form.general_app_group.shell_startup_cb, "global_version_check": self.ui.general_defaults_form.general_app_group.version_check_cb, "global_send_stats": self.ui.general_defaults_form.general_app_group.send_stats_cb, "global_pan_button": self.ui.general_defaults_form.general_app_group.pan_button_radio, "global_mselect_key": self.ui.general_defaults_form.general_app_group.mselect_radio, - "global_project_at_startup": self.ui.general_defaults_form.general_app_group.project_startup_cb, - "global_project_autohide": self.ui.general_defaults_form.general_app_group.project_autohide_cb, - "global_toggle_tooltips": self.ui.general_defaults_form.general_app_group.toggle_tooltips_cb, "global_worker_number": self.ui.general_defaults_form.general_app_group.worker_number_sb, "global_tolerance": self.ui.general_defaults_form.general_app_group.tol_entry, "global_open_style": self.ui.general_defaults_form.general_app_group.open_style_cb, - "global_delete_confirmation": self.ui.general_defaults_form.general_app_group.delete_conf_cb, "global_compression_level": self.ui.general_defaults_form.general_app_group.compress_combo, "global_save_compressed": self.ui.general_defaults_form.general_app_group.save_type_cb, @@ -440,6 +435,11 @@ class App(QtCore.QObject): "global_layout": self.ui.general_defaults_form.general_gui_set_group.layout_combo, "global_hover": self.ui.general_defaults_form.general_gui_set_group.hover_cb, "global_selection_shape": self.ui.general_defaults_form.general_gui_set_group.selection_cb, + "global_shell_at_startup": self.ui.general_defaults_form.general_gui_set_group.shell_startup_cb, + "global_project_at_startup": self.ui.general_defaults_form.general_gui_set_group.project_startup_cb, + "global_project_autohide": self.ui.general_defaults_form.general_gui_set_group.project_autohide_cb, + "global_toggle_tooltips": self.ui.general_defaults_form.general_gui_set_group.toggle_tooltips_cb, + "global_delete_confirmation": self.ui.general_defaults_form.general_gui_set_group.delete_conf_cb, # Gerber General "gerber_plot": self.ui.gerber_defaults_form.gerber_gen_group.plot_cb, @@ -511,9 +511,9 @@ class App(QtCore.QObject): # Excellon Options "excellon_drillz": self.ui.excellon_defaults_form.excellon_opt_group.cutz_entry, "excellon_travelz": self.ui.excellon_defaults_form.excellon_opt_group.travelz_entry, + "excellon_endz": self.ui.excellon_defaults_form.excellon_opt_group.eendz_entry, "excellon_feedrate": self.ui.excellon_defaults_form.excellon_opt_group.feedrate_entry, "excellon_spindlespeed": self.ui.excellon_defaults_form.excellon_opt_group.spindlespeed_entry, - "excellon_spindledir": self.ui.excellon_defaults_form.excellon_opt_group.spindledir_radio, "excellon_dwell": self.ui.excellon_defaults_form.excellon_opt_group.dwell_cb, "excellon_dwelltime": self.ui.excellon_defaults_form.excellon_opt_group.dwelltime_entry, "excellon_toolchange": self.ui.excellon_defaults_form.excellon_opt_group.toolchange_cb, @@ -527,10 +527,10 @@ class App(QtCore.QObject): "excellon_offset": self.ui.excellon_defaults_form.excellon_adv_opt_group.offset_entry, "excellon_toolchangexy": self.ui.excellon_defaults_form.excellon_adv_opt_group.toolchangexy_entry, "excellon_startz": self.ui.excellon_defaults_form.excellon_adv_opt_group.estartz_entry, - "excellon_endz": self.ui.excellon_defaults_form.excellon_adv_opt_group.eendz_entry, "excellon_feedrate_rapid": self.ui.excellon_defaults_form.excellon_adv_opt_group.feedrate_rapid_entry, "excellon_z_pdepth": self.ui.excellon_defaults_form.excellon_adv_opt_group.pdepth_entry, "excellon_feedrate_probe": self.ui.excellon_defaults_form.excellon_adv_opt_group.feedrate_probe_entry, + "excellon_spindledir": self.ui.excellon_defaults_form.excellon_adv_opt_group.spindledir_radio, "excellon_f_plunge": self.ui.excellon_defaults_form.excellon_adv_opt_group.fplunge_cb, "excellon_f_retract": self.ui.excellon_defaults_form.excellon_adv_opt_group.fretract_cb, @@ -583,23 +583,23 @@ class App(QtCore.QObject): "geometry_feedrate": self.ui.geometry_defaults_form.geometry_opt_group.cncfeedrate_entry, "geometry_feedrate_z": self.ui.geometry_defaults_form.geometry_opt_group.cncplunge_entry, "geometry_spindlespeed": self.ui.geometry_defaults_form.geometry_opt_group.cncspindlespeed_entry, - "geometry_spindledir": self.ui.geometry_defaults_form.geometry_opt_group.spindledir_radio, "geometry_dwell": self.ui.geometry_defaults_form.geometry_opt_group.dwell_cb, "geometry_dwelltime": self.ui.geometry_defaults_form.geometry_opt_group.dwelltime_entry, "geometry_ppname_g": self.ui.geometry_defaults_form.geometry_opt_group.pp_geometry_name_cb, "geometry_toolchange": self.ui.geometry_defaults_form.geometry_opt_group.toolchange_cb, "geometry_toolchangez": self.ui.geometry_defaults_form.geometry_opt_group.toolchangez_entry, + "geometry_endz": self.ui.geometry_defaults_form.geometry_opt_group.gendz_entry, "geometry_depthperpass": self.ui.geometry_defaults_form.geometry_opt_group.depthperpass_entry, "geometry_multidepth": self.ui.geometry_defaults_form.geometry_opt_group.multidepth_cb, # Geometry Advanced Options "geometry_toolchangexy": self.ui.geometry_defaults_form.geometry_adv_opt_group.toolchangexy_entry, "geometry_startz": self.ui.geometry_defaults_form.geometry_adv_opt_group.gstartz_entry, - "geometry_endz": self.ui.geometry_defaults_form.geometry_adv_opt_group.gendz_entry, "geometry_feedrate_rapid": self.ui.geometry_defaults_form.geometry_adv_opt_group.cncfeedrate_rapid_entry, "geometry_extracut": self.ui.geometry_defaults_form.geometry_adv_opt_group.extracut_cb, "geometry_z_pdepth": self.ui.geometry_defaults_form.geometry_adv_opt_group.pdepth_entry, "geometry_feedrate_probe": self.ui.geometry_defaults_form.geometry_adv_opt_group.feedrate_probe_entry, + "geometry_spindledir": self.ui.geometry_defaults_form.geometry_adv_opt_group.spindledir_radio, "geometry_f_plunge": self.ui.geometry_defaults_form.geometry_adv_opt_group.fplunge_cb, "geometry_segx": self.ui.geometry_defaults_form.geometry_adv_opt_group.segx_entry, "geometry_segy": self.ui.geometry_defaults_form.geometry_adv_opt_group.segy_entry, @@ -611,8 +611,6 @@ class App(QtCore.QObject): "cncjob_plot": self.ui.cncjob_defaults_form.cncjob_gen_group.plot_cb, "cncjob_plot_kind": self.ui.cncjob_defaults_form.cncjob_gen_group.cncplot_method_radio, "cncjob_annotation": self.ui.cncjob_defaults_form.cncjob_gen_group.annotation_cb, - "cncjob_annotation_fontsize": self.ui.cncjob_defaults_form.cncjob_gen_group.annotation_fontsize_sp, - "cncjob_annotation_fontcolor": self.ui.cncjob_defaults_form.cncjob_gen_group.annotation_fontcolor_entry, "cncjob_tooldia": self.ui.cncjob_defaults_form.cncjob_gen_group.tooldia_entry, "cncjob_coords_type": self.ui.cncjob_defaults_form.cncjob_gen_group.coords_type_radio, @@ -627,6 +625,8 @@ class App(QtCore.QObject): # CNC Job Advanced Options "cncjob_toolchange_macro": self.ui.cncjob_defaults_form.cncjob_adv_opt_group.toolchange_text, "cncjob_toolchange_macro_enable": self.ui.cncjob_defaults_form.cncjob_adv_opt_group.toolchange_cb, + "cncjob_annotation_fontsize": self.ui.cncjob_defaults_form.cncjob_adv_opt_group.annotation_fontsize_sp, + "cncjob_annotation_fontcolor": self.ui.cncjob_defaults_form.cncjob_adv_opt_group.annotation_fontcolor_entry, # NCC Tool "tools_ncctools": self.ui.tools_defaults_form.tools_ncc_group.ncc_tool_dia_entry, @@ -675,6 +675,7 @@ class App(QtCore.QObject): "tools_film_type": self.ui.tools_defaults_form.tools_film_group.film_type_radio, "tools_film_boundary": self.ui.tools_defaults_form.tools_film_group.film_boundary_entry, "tools_film_scale": self.ui.tools_defaults_form.tools_film_group.film_scale_entry, + "tools_film_color": self.ui.tools_defaults_form.tools_film_group.film_color_entry, # Panelize Tool "tools_panelize_spacing_columns": self.ui.tools_defaults_form.tools_panelize_group.pspacing_columns, @@ -931,9 +932,9 @@ class App(QtCore.QObject): # Excellon Options "excellon_drillz": -0.0590551, "excellon_travelz": 0.0787402, + "excellon_endz": 0.5, "excellon_feedrate": 3.14961, "excellon_spindlespeed": None, - "excellon_spindledir": 'CW', "excellon_dwell": False, "excellon_dwelltime": 1, "excellon_toolchange": False, @@ -947,10 +948,10 @@ class App(QtCore.QObject): "excellon_offset": 0.0, "excellon_toolchangexy": "0.0, 0.0", "excellon_startz": None, - "excellon_endz": 0.5, "excellon_feedrate_rapid": 31.4961, "excellon_z_pdepth": -0.02, "excellon_feedrate_probe": 3.14961, + "excellon_spindledir": 'CW', "excellon_f_plunge": False, "excellon_f_retract": False, @@ -997,10 +998,10 @@ class App(QtCore.QObject): "geometry_travelz": 0.0787402, "geometry_toolchange": False, "geometry_toolchangez": 0.5, + "geometry_endz": 0.5, "geometry_feedrate": 3.14961, "geometry_feedrate_z": 3.14961, "geometry_spindlespeed": None, - "geometry_spindledir": 'CW', "geometry_dwell": False, "geometry_dwelltime": 1, "geometry_ppname_g": 'default', @@ -1008,11 +1009,11 @@ class App(QtCore.QObject): # Geometry Advanced Options "geometry_toolchangexy": "0.0, 0.0", "geometry_startz": None, - "geometry_endz": 0.5, "geometry_feedrate_rapid": 3.14961, "geometry_extracut": False, "geometry_z_pdepth": -0.02, "geometry_f_plunge": False, + "geometry_spindledir": 'CW', "geometry_feedrate_probe": 3.14961, "geometry_segx": 0.0, "geometry_segy": 0.0, @@ -1024,8 +1025,6 @@ class App(QtCore.QObject): "cncjob_plot": True, "cncjob_plot_kind": 'all', "cncjob_annotation": True, - "cncjob_annotation_fontsize": 9, - "cncjob_annotation_fontcolor": '#990000', "cncjob_tooldia": 0.0393701, "cncjob_coords_type": "G90", "cncjob_coords_decimals": 4, @@ -1039,7 +1038,10 @@ class App(QtCore.QObject): # CNC Job Advanced Options "cncjob_toolchange_macro": "", "cncjob_toolchange_macro_enable": False, + "cncjob_annotation_fontsize": 9, + "cncjob_annotation_fontcolor": '#990000', + # NCC Tool "tools_ncctools": "0.0393701, 0.019685", "tools_nccorder": 'rev', "tools_nccoverlap": 0.015748, @@ -1058,6 +1060,7 @@ class App(QtCore.QObject): "tools_ncctipdia": 0.00393701, "tools_ncctipangle": 30, + # Cutout Tool "tools_cutouttooldia": 0.0944882, "tools_cutoutkind": "single", "tools_cutoutmargin": 0.00393701, @@ -1065,6 +1068,7 @@ class App(QtCore.QObject): "tools_gaps_ff": "4", "tools_cutout_convexshape": False, + # Paint Tool "tools_painttooldia": 0.023622, "tools_paintorder": 'rev', "tools_paintoverlap": 0.015748, @@ -1075,14 +1079,18 @@ class App(QtCore.QObject): "tools_paintcontour": True, "tools_paint_plotting": 'normal', + # 2-Sided Tool "tools_2sided_mirror_axis": "X", "tools_2sided_axis_loc": "point", "tools_2sided_drilldia": 0.0393701, + # Film Tool "tools_film_type": 'neg', "tools_film_boundary": 0.0393701, "tools_film_scale": 0, + "tools_film_color": '#000000', + # Panel Tool "tools_panelize_spacing_columns": 0, "tools_panelize_spacing_rows": 0, "tools_panelize_columns": 1, @@ -1092,6 +1100,7 @@ class App(QtCore.QObject): "tools_panelize_constrainy": 0.0, "tools_panelize_panel_type": 'gerber', + # Calculators Tool "tools_calc_vshape_tip_dia": 0.007874, "tools_calc_vshape_tip_angle": 30, "tools_calc_vshape_cut_z": 0.000787, @@ -1100,6 +1109,7 @@ class App(QtCore.QObject): "tools_calc_electro_cdensity": 13.0, "tools_calc_electro_growth": 10.0, + # Transform Tool "tools_transform_rotate": 90, "tools_transform_skew_x": 0.0, "tools_transform_skew_y": 0.0, @@ -1112,6 +1122,7 @@ class App(QtCore.QObject): "tools_transform_mirror_reference": False, "tools_transform_mirror_point": (0, 0), + # SolderPaste Tool "tools_solderpaste_tools": "0.0393701, 0.011811", "tools_solderpaste_new": 0.011811, "tools_solderpaste_z_start": 0.00019685039, @@ -1129,6 +1140,7 @@ class App(QtCore.QObject): "tools_solderpaste_dwellrev": 1, "tools_solderpaste_pp": 'Paste_1', + # Subtract Tool "tools_sub_close_paths": True, # file associations @@ -1218,9 +1230,9 @@ class App(QtCore.QObject): "excellon_drillz": self.ui.excellon_options_form.excellon_opt_group.cutz_entry, "excellon_travelz": self.ui.excellon_options_form.excellon_opt_group.travelz_entry, + "excellon_endz": self.ui.excellon_options_form.excellon_opt_group.eendz_entry, "excellon_feedrate": self.ui.excellon_options_form.excellon_opt_group.feedrate_entry, "excellon_spindlespeed": self.ui.excellon_options_form.excellon_opt_group.spindlespeed_entry, - "excellon_spindledir": self.ui.excellon_options_form.excellon_opt_group.spindledir_radio, "excellon_dwell": self.ui.excellon_options_form.excellon_opt_group.dwell_cb, "excellon_dwelltime": self.ui.excellon_options_form.excellon_opt_group.dwelltime_entry, "excellon_toolchange": self.ui.excellon_options_form.excellon_opt_group.toolchange_cb, @@ -1232,7 +1244,7 @@ class App(QtCore.QObject): "excellon_toolchangexy": self.ui.excellon_options_form.excellon_adv_opt_group.toolchangexy_entry, "excellon_f_plunge": self.ui.excellon_options_form.excellon_adv_opt_group.fplunge_cb, "excellon_startz": self.ui.excellon_options_form.excellon_adv_opt_group.estartz_entry, - "excellon_endz": self.ui.excellon_options_form.excellon_adv_opt_group.eendz_entry, + "excellon_spindledir": self.ui.excellon_options_form.excellon_adv_opt_group.spindledir_radio, "geometry_plot": self.ui.geometry_options_form.geometry_gen_group.plot_cb, "geometry_cnctooldia": self.ui.geometry_options_form.geometry_gen_group.cnctooldia_entry, @@ -1242,12 +1254,12 @@ class App(QtCore.QObject): "geometry_feedrate": self.ui.geometry_options_form.geometry_opt_group.cncfeedrate_entry, "geometry_feedrate_z": self.ui.geometry_options_form.geometry_opt_group.cncplunge_entry, "geometry_spindlespeed": self.ui.geometry_options_form.geometry_opt_group.cncspindlespeed_entry, - "geometry_spindledir": self.ui.geometry_options_form.geometry_opt_group.spindledir_radio, "geometry_dwell": self.ui.geometry_options_form.geometry_opt_group.dwell_cb, "geometry_dwelltime": self.ui.geometry_options_form.geometry_opt_group.dwelltime_entry, "geometry_ppname_g": self.ui.geometry_options_form.geometry_opt_group.pp_geometry_name_cb, "geometry_toolchange": self.ui.geometry_options_form.geometry_opt_group.toolchange_cb, "geometry_toolchangez": self.ui.geometry_options_form.geometry_opt_group.toolchangez_entry, + "geometry_endz": self.ui.geometry_options_form.geometry_opt_group.gendz_entry, "geometry_depthperpass": self.ui.geometry_options_form.geometry_opt_group.depthperpass_entry, "geometry_multidepth": self.ui.geometry_options_form.geometry_opt_group.multidepth_cb, @@ -1255,9 +1267,9 @@ class App(QtCore.QObject): "geometry_segy": self.ui.geometry_options_form.geometry_adv_opt_group.segy_entry, "geometry_feedrate_rapid": self.ui.geometry_options_form.geometry_adv_opt_group.cncfeedrate_rapid_entry, "geometry_f_plunge": self.ui.geometry_options_form.geometry_adv_opt_group.fplunge_cb, + "geometry_spindledir": self.ui.geometry_options_form.geometry_adv_opt_group.spindledir_radio, "geometry_toolchangexy": self.ui.geometry_options_form.geometry_adv_opt_group.toolchangexy_entry, "geometry_startz": self.ui.geometry_options_form.geometry_adv_opt_group.gstartz_entry, - "geometry_endz": self.ui.geometry_options_form.geometry_adv_opt_group.gendz_entry, "geometry_extracut": self.ui.geometry_options_form.geometry_adv_opt_group.extracut_cb, "cncjob_plot": self.ui.cncjob_options_form.cncjob_gen_group.plot_cb, @@ -1501,10 +1513,17 @@ class App(QtCore.QObject): "background-color:%s" % str(self.defaults['global_proj_item_dis_color'])[:7]) # Init the Annotation CNC Job color - self.ui.cncjob_defaults_form.cncjob_gen_group.annotation_fontcolor_entry.set_value( + self.ui.cncjob_defaults_form.cncjob_adv_opt_group.annotation_fontcolor_entry.set_value( self.defaults['cncjob_annotation_fontcolor']) - self.ui.cncjob_defaults_form.cncjob_gen_group.annotation_fontcolor_button.setStyleSheet( + self.ui.cncjob_defaults_form.cncjob_adv_opt_group.annotation_fontcolor_button.setStyleSheet( "background-color:%s" % str(self.defaults['cncjob_annotation_fontcolor'])[:7]) + + # Init the Tool Film color + self.ui.tools_defaults_form.tools_film_group.film_color_entry.set_value( + self.defaults['tools_film_color']) + self.ui.tools_defaults_form.tools_film_group.film_color_button.setStyleSheet( + "background-color:%s" % str(self.defaults['tools_film_color'])[:7]) + # ### End of Data #### # ############################################### @@ -1823,11 +1842,17 @@ class App(QtCore.QObject): # ########## CNC Job related signals ############# self.ui.cncjob_defaults_form.cncjob_adv_opt_group.tc_variable_combo.currentIndexChanged[str].connect( self.on_cnc_custom_parameters) - self.ui.cncjob_defaults_form.cncjob_gen_group.annotation_fontcolor_entry.editingFinished.connect( + self.ui.cncjob_defaults_form.cncjob_adv_opt_group.annotation_fontcolor_entry.editingFinished.connect( self.on_annotation_fontcolor_entry) - self.ui.cncjob_defaults_form.cncjob_gen_group.annotation_fontcolor_button.clicked.connect( + self.ui.cncjob_defaults_form.cncjob_adv_opt_group.annotation_fontcolor_button.clicked.connect( self.on_annotation_fontcolor_button) + # ########## Tools related signals ############# + self.ui.tools_defaults_form.tools_film_group.film_color_entry.editingFinished.connect( + self.on_film_color_entry) + self.ui.tools_defaults_form.tools_film_group.film_color_button.clicked.connect( + self.on_film_color_button) + # ########## Modify G-CODE Plot Area TAB ########### self.ui.code_editor.textChanged.connect(self.handleTextChanged) self.ui.buttonOpen.clicked.connect(self.handleOpen) @@ -1844,7 +1869,7 @@ class App(QtCore.QObject): self.collection.view.activated.connect(self.on_row_activated) # Monitor the checkbox from the Application Defaults Tab and show the TCL shell or not depending on it's value - self.ui.general_defaults_form.general_app_group.shell_startup_cb.clicked.connect(self.on_toggle_shell) + self.ui.general_defaults_form.general_gui_set_group.shell_startup_cb.clicked.connect(self.on_toggle_shell) # Make sure that when the Excellon loading parameters are changed, the change is reflected in the # Export Excellon parameters. @@ -5558,8 +5583,8 @@ class App(QtCore.QObject): def on_annotation_fontcolor_entry(self): self.defaults['cncjob_annotation_fontcolor'] = \ - self.ui.cncjob_defaults_form.cncjob_gen_group.annotation_fontcolor_entry.get_value() - self.ui.cncjob_defaults_form.cncjob_gen_group.annotation_fontcolor_button.setStyleSheet( + self.ui.cncjob_defaults_form.cncjob_adv_opt_group.annotation_fontcolor_entry.get_value() + self.ui.cncjob_defaults_form.cncjob_adv_opt_group.annotation_fontcolor_button.setStyleSheet( "background-color:%s" % str(self.defaults['cncjob_annotation_fontcolor'])) def on_annotation_fontcolor_button(self): @@ -5571,12 +5596,38 @@ class App(QtCore.QObject): if annotation_color.isValid() is False: return - self.ui.cncjob_defaults_form.cncjob_gen_group.annotation_fontcolor_button.setStyleSheet( + self.ui.cncjob_defaults_form.cncjob_adv_opt_group.annotation_fontcolor_button.setStyleSheet( "background-color:%s" % str(annotation_color.name())) new_val_sel = str(annotation_color.name()) - self.ui.cncjob_defaults_form.cncjob_gen_group.annotation_fontcolor_entry.set_value(new_val_sel) - self.defaults['global_proj_item_dis_color'] = new_val_sel + self.ui.cncjob_defaults_form.cncjob_adv_opt_group.annotation_fontcolor_entry.set_value(new_val_sel) + self.defaults['cncjob_annotation_fontcolor'] = new_val_sel + + def on_film_color_entry(self): + self.defaults['tools_film_color'] = \ + self.ui.tools_defaults_form.tools_film_group.film_color_entry.get_value() + self.ui.tools_defaults_form.tools_film_group.film_color_button.setStyleSheet( + "background-color:%s" % str(self.defaults['tools_film_color'])) + + def on_film_color_button(self): + current_color = QtGui.QColor(self.defaults['tools_film_color']) + + c_dialog = QtWidgets.QColorDialog() + film_color = c_dialog.getColor(initial=current_color) + + if film_color.isValid() is False: + return + + # if new color is different then mark that the Preferences are changed + if film_color != current_color: + self.on_preferences_edited() + + self.ui.tools_defaults_form.tools_film_group.film_color_button.setStyleSheet( + "background-color:%s" % str(film_color.name())) + + new_val_sel = str(film_color.name()) + self.ui.tools_defaults_form.tools_film_group.film_color_entry.set_value(new_val_sel) + self.defaults['tools_film_color'] = new_val_sel def on_splash_changed(self, state): settings = QSettings("Open Source", "FlatCAM") @@ -8584,8 +8635,6 @@ class App(QtCore.QObject): def make_negative_film(): exported_svg = obj.export_svg(scale_factor=scale_factor) - self.progress.emit(40) - # Determine bounding area for svg export bounds = box.bounds() size = box.size() @@ -8611,8 +8660,6 @@ class App(QtCore.QObject): svg_header += '' svg_footer = ' ' - self.progress.emit(60) - # Change the attributes of the exported SVG # We don't need stroke-width - wrong, we do when we have lines with certain width # We set opacity to maximum @@ -8641,7 +8688,6 @@ class App(QtCore.QObject): exported_svg = ET.tostring(root) svg_elem = svg_header + str(exported_svg) + svg_footer - self.progress.emit(80) # Parse the xml through a xml parser just to add line feeds # and to make it look more pretty for the output @@ -8655,7 +8701,6 @@ class App(QtCore.QObject): "Most likely another app is holding the file open and not accessible.")) return 'fail' - self.progress.emit(100) if self.defaults["global_open_style"] is False: self.file_opened.emit("SVG", filename) self.file_saved.emit("SVG", filename) @@ -8677,7 +8722,7 @@ class App(QtCore.QObject): else: make_negative_film() - def export_svg_black(self, obj_name, box_name, filename, scale_factor=0.00, use_thread=True): + def export_svg_positive(self, obj_name, box_name, filename, scale_factor=0.00, use_thread=True): """ Exports a Geometry Object to an SVG file in positive black. @@ -8688,7 +8733,7 @@ class App(QtCore.QObject): :param use_thread: if to be run in a separate thread; boolean :return: """ - self.report_usage("export_svg_black()") + self.report_usage("export_svg_positive()") if filename is None: filename = self.defaults["global_last_save_folder"] @@ -8712,7 +8757,7 @@ class App(QtCore.QObject): (_("No object Box. Using instead"), obj)) box = obj - def make_black_film(): + def make_positive_film(): exported_svg = obj.export_svg(scale_factor=scale_factor) self.progress.emit(40) @@ -8723,9 +8768,9 @@ class App(QtCore.QObject): # We set the colour to WHITE root = ET.fromstring(exported_svg) for child in root: - child.set('fill', '#000000') + child.set('fill', str(self.defaults['tools_film_color'])) child.set('opacity', '1.0') - child.set('stroke', '#000000') + child.set('stroke', str(self.defaults['tools_film_color'])) exported_svg = ET.tostring(root) @@ -8793,7 +8838,7 @@ class App(QtCore.QObject): def job_thread_film(app_obj): try: - make_black_film() + make_positive_film() except Exception as e: proc.done() return @@ -8801,7 +8846,7 @@ class App(QtCore.QObject): self.worker_task.emit({'fcn': job_thread_film, 'params': [self]}) else: - make_black_film() + make_positive_film() def save_source_file(self, obj_name, filename, use_thread=True): """ diff --git a/FlatCAMObj.py b/FlatCAMObj.py index ee851354..ed863e17 100644 --- a/FlatCAMObj.py +++ b/FlatCAMObj.py @@ -600,7 +600,7 @@ class FlatCAMGerber(FlatCAMObj, Gerber): # Show/Hide Advanced Options if self.app.defaults["global_app_level"] == 'b': self.ui.level.setText(_( - 'Basic' + '%s' % _('Basic') )) self.ui.apertures_table_label.hide() self.ui.aperture_table_visibility_cb.hide() @@ -613,7 +613,7 @@ class FlatCAMGerber(FlatCAMObj, Gerber): self.ui.except_cb.hide() else: self.ui.level.setText(_( - 'Advanced' + '%s' % _('Advanced') )) if self.app.defaults["gerber_buffering"] == 'no': @@ -2325,14 +2325,12 @@ class FlatCAMExcellon(FlatCAMObj, Excellon): # Show/Hide Advanced Options if self.app.defaults["global_app_level"] == 'b': self.ui.level.setText(_( - 'Basic' + '%s' % _('Basic') )) self.ui.tools_table.setColumnHidden(4, True) self.ui.estartz_label.hide() self.ui.estartz_entry.hide() - self.ui.eendz_label.hide() - self.ui.eendz_entry.hide() self.ui.feedrate_rapid_label.hide() self.ui.feedrate_rapid_entry.hide() self.ui.pdepth_label.hide() @@ -2341,7 +2339,7 @@ class FlatCAMExcellon(FlatCAMObj, Excellon): self.ui.feedrate_probe_entry.hide() else: self.ui.level.setText(_( - 'Advanced' + '%s' % _('Advanced') )) assert isinstance(self.ui, ExcellonObjectUI), \ @@ -3605,7 +3603,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry): # Show/Hide Advanced Options if self.app.defaults["global_app_level"] == 'b': self.ui.level.setText(_( - 'Basic' + '%s' % _('Basic') )) self.ui.geo_tools_table.setColumnHidden(2, True) @@ -3616,8 +3614,8 @@ class FlatCAMGeometry(FlatCAMObj, Geometry): self.ui.addtool_btn.hide() self.ui.copytool_btn.hide() self.ui.deltool_btn.hide() - self.ui.endzlabel.hide() - self.ui.gendz_entry.hide() + # self.ui.endzlabel.hide() + # self.ui.gendz_entry.hide() self.ui.fr_rapidlabel.hide() self.ui.cncfeedrate_rapid_entry.hide() self.ui.extracut_cb.hide() @@ -3627,7 +3625,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry): self.ui.feedrate_probe_entry.hide() else: self.ui.level.setText(_( - 'Advanced' + '%s' % _('Advanced') )) self.ui.plot_cb.stateChanged.connect(self.on_plot_cb_click) self.ui.generate_cnc_button.clicked.connect(self.on_generatecnc_button_click) diff --git a/README.md b/README.md index d72b5459..c955aa73 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,8 @@ CAD program, and create G-Code for Isolation routing. - fixed the App.on_view_source() method for CNCJob objects: the Gcode will now contain the Prepend and Append code from the Edit -> Preferences -> CNCJob -> CNCJob Options - added a new parameter named 'muted' for the TclCommands: cncjob, drillcncjob and write_gcode. Setting it as -muted 1 will disable the error reporting in TCL Shell - some GUI optimizations +- more GUI optimizations related to being part of the Advanced category or not +- added possibility to change the positive SVG exported file color in Tool Film 15.09.2019 diff --git a/flatcamGUI/FlatCAMGUI.py b/flatcamGUI/FlatCAMGUI.py index d1c6b85d..ae894590 100644 --- a/flatcamGUI/FlatCAMGUI.py +++ b/flatcamGUI/FlatCAMGUI.py @@ -2044,7 +2044,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow): def eventFilter(self, obj, event): # filter the ToolTips display based on a Preferences setting - if self.general_defaults_form.general_app_group.toggle_tooltips_cb.get_value() is False: + if self.general_defaults_form.general_gui_set_group.toggle_tooltips_cb.get_value() is False: if event.type() == QtCore.QEvent.ToolTip: return True else: @@ -4026,6 +4026,7 @@ class GeneralGUISetGroupUI(OptionsGroupUI): ) self.selection_cb = FCCheckBox() + # Notebook Font Size self.notebook_font_size_label = QtWidgets.QLabel('%s:' % _('NB Font Size')) self.notebook_font_size_label.setToolTip( _("This sets the font size for the elements found in the Notebook.\n" @@ -4074,6 +4075,56 @@ class GeneralGUISetGroupUI(OptionsGroupUI): else: self.splash_cb.set_value(False) + # Shell StartUp CB + self.shell_startup_label = QtWidgets.QLabel('%s:' % _('Shell at StartUp')) + self.shell_startup_label.setToolTip( + _("Check this box if you want the shell to\n" + "start automatically at startup.") + ) + self.shell_startup_cb = FCCheckBox(label='') + self.shell_startup_cb.setToolTip( + _("Check this box if you want the shell to\n" + "start automatically at startup.") + ) + + # Project at StartUp CB + self.project_startup_label = QtWidgets.QLabel('%s:' % _('Project at StartUp')) + self.project_startup_label.setToolTip( + _("Check this box if you want the project/selected/tool tab area to\n" + "to be shown automatically at startup.") + ) + self.project_startup_cb = FCCheckBox(label='') + self.project_startup_cb.setToolTip( + _("Check this box if you want the project/selected/tool tab area to\n" + "to be shown automatically at startup.") + ) + + # Project autohide CB + self.project_autohide_label = QtWidgets.QLabel('%s:' % _('Project AutoHide')) + self.project_autohide_label.setToolTip( + _("Check this box if you want the project/selected/tool tab area to\n" + "hide automatically when there are no objects loaded and\n" + "to show whenever a new object is created.") + ) + self.project_autohide_cb = FCCheckBox(label='') + self.project_autohide_cb.setToolTip( + _("Check this box if you want the project/selected/tool tab area to\n" + "hide automatically when there are no objects loaded and\n" + "to show whenever a new object is created.") + ) + + # Enable/Disable ToolTips globally + self.toggle_tooltips_label = QtWidgets.QLabel('%s:' % _('Enable ToolTips')) + self.toggle_tooltips_label.setToolTip( + _("Check this box if you want to have toolTips displayed\n" + "when hovering with mouse over items throughout the App.") + ) + self.toggle_tooltips_cb = FCCheckBox(label='') + self.toggle_tooltips_cb.setToolTip( + _("Check this box if you want to have toolTips displayed\n" + "when hovering with mouse over items throughout the App.") + ) + # Add (label - input field) pair to the QFormLayout self.form_box.addRow(self.spacelabel, self.spacelabel) @@ -4088,11 +4139,27 @@ class GeneralGUISetGroupUI(OptionsGroupUI): self.form_box.addRow(self.axis_font_size_label, self.axis_font_size_spinner) self.form_box.addRow(QtWidgets.QLabel('')) self.form_box.addRow(self.splash_label, self.splash_cb) + self.form_box.addRow(self.shell_startup_label, self.shell_startup_cb) + self.form_box.addRow(self.project_startup_label, self.project_startup_cb) + self.form_box.addRow(self.project_autohide_label, self.project_autohide_cb) + self.form_box.addRow(QtWidgets.QLabel('')) + self.form_box.addRow(self.toggle_tooltips_label, self.toggle_tooltips_cb) # Add the QFormLayout that holds the Application general defaults # to the main layout of this TAB self.layout.addLayout(self.form_box) + # Delete confirmation + self.delete_conf_cb = FCCheckBox(_('Delete object confirmation')) + self.delete_conf_cb.setToolTip( + _("When checked the application will ask for user confirmation\n" + "whenever the Delete object(s) event is triggered, either by\n" + "menu shortcut or key shortcut.") + ) + self.layout.addWidget(self.delete_conf_cb) + + self.layout.addStretch() + def handle_style(self, style): # set current style settings = QSettings("Open Source", "FlatCAM") @@ -4141,7 +4208,7 @@ class GeneralAppPrefGroupUI(OptionsGroupUI): self.form_box = QtWidgets.QFormLayout() # Units for FlatCAM - self.unitslabel = QtWidgets.QLabel('%s:' % _('Units')) + self.unitslabel = QtWidgets.QLabel('%s:' % _('Units')) self.unitslabel.setToolTip(_("The default value for FlatCAM units.\n" "Whatever is selected here is set every time\n" "FLatCAM is started.")) @@ -4180,18 +4247,6 @@ class GeneralAppPrefGroupUI(OptionsGroupUI): "security features. In this case the language will be\n" "applied at the next app start.")) - # Shell StartUp CB - self.shell_startup_label = QtWidgets.QLabel('%s:' % _('Shell at StartUp')) - self.shell_startup_label.setToolTip( - _("Check this box if you want the shell to\n" - "start automatically at startup.") - ) - self.shell_startup_cb = FCCheckBox(label='') - self.shell_startup_cb.setToolTip( - _("Check this box if you want the shell to\n" - "start automatically at startup.") - ) - # Version Check CB self.version_check_label = QtWidgets.QLabel('%s:' % _('Version Check')) self.version_check_label.setToolTip( @@ -4232,43 +4287,7 @@ class GeneralAppPrefGroupUI(OptionsGroupUI): self.mselect_radio = RadioSet([{'label': _('CTRL'), 'value': 'Control'}, {'label': _('SHIFT'), 'value': 'Shift'}]) - # Project at StartUp CB - self.project_startup_label = QtWidgets.QLabel('%s:' % _('Project at StartUp')) - self.project_startup_label.setToolTip( - _("Check this box if you want the project/selected/tool tab area to\n" - "to be shown automatically at startup.") - ) - self.project_startup_cb = FCCheckBox(label='') - self.project_startup_cb.setToolTip( - _("Check this box if you want the project/selected/tool tab area to\n" - "to be shown automatically at startup.") - ) - - # Project autohide CB - self.project_autohide_label = QtWidgets.QLabel('%s:' % _('Project AutoHide')) - self.project_autohide_label.setToolTip( - _("Check this box if you want the project/selected/tool tab area to\n" - "hide automatically when there are no objects loaded and\n" - "to show whenever a new object is created.") - ) - self.project_autohide_cb = FCCheckBox(label='') - self.project_autohide_cb.setToolTip( - _("Check this box if you want the project/selected/tool tab area to\n" - "hide automatically when there are no objects loaded and\n" - "to show whenever a new object is created.") - ) - - # Enable/Disable ToolTips globally - self.toggle_tooltips_label = QtWidgets.QLabel('%s:' % _('Enable ToolTips')) - self.toggle_tooltips_label.setToolTip( - _("Check this box if you want to have toolTips displayed\n" - "when hovering with mouse over items throughout the App.") - ) - self.toggle_tooltips_cb = FCCheckBox(label='') - self.toggle_tooltips_cb.setToolTip( - _("Check this box if you want to have toolTips displayed\n" - "when hovering with mouse over items throughout the App.") - ) + # Worker Numbers self.worker_number_label = QtWidgets.QLabel('%s:' % _('Workers number')) self.worker_number_label.setToolTip( _("The number of Qthreads made available to the App.\n" @@ -4321,15 +4340,11 @@ class GeneralAppPrefGroupUI(OptionsGroupUI): self.form_box.addRow(self.languagespace, self.language_apply_btn) self.form_box.addRow(self.spacelabel, self.spacelabel) - self.form_box.addRow(self.shell_startup_label, self.shell_startup_cb) self.form_box.addRow(self.version_check_label, self.version_check_cb) self.form_box.addRow(self.send_stats_label, self.send_stats_cb) self.form_box.addRow(self.panbuttonlabel, self.pan_button_radio) self.form_box.addRow(self.mselectlabel, self.mselect_radio) - self.form_box.addRow(self.project_startup_label, self.project_startup_cb) - self.form_box.addRow(self.project_autohide_label, self.project_autohide_cb) - self.form_box.addRow(self.toggle_tooltips_label, self.toggle_tooltips_cb) self.form_box.addRow(self.worker_number_label, self.worker_number_sb) self.form_box.addRow(tol_label, self.tol_entry) @@ -4350,15 +4365,6 @@ class GeneralAppPrefGroupUI(OptionsGroupUI): # self.advanced_cb.setLayoutDirection(QtCore.Qt.RightToLeft) self.layout.addWidget(self.open_style_cb) - # Delete confirmation - self.delete_conf_cb = FCCheckBox(_('Delete object confirmation')) - self.delete_conf_cb.setToolTip( - _("When checked the application will ask for user confirmation\n" - "whenever the Delete object(s) event is triggered, either by\n" - "menu shortcut or key shortcut.") - ) - self.layout.addWidget(self.delete_conf_cb) - # Save compressed project CB self.save_type_cb = FCCheckBox(_('Save Compressed Project')) self.save_type_cb.setToolTip( @@ -4585,7 +4591,7 @@ class GerberAdvOptPrefGroupUI(OptionsGroupUI): self.setTitle(str(_("Gerber Adv. Options"))) # ## Advanced Gerber Parameters - self.adv_param_label = QtWidgets.QLabel("%s:" % _("Advanced Param.")) + self.adv_param_label = QtWidgets.QLabel('%s:' % _('Advanced Options')) self.adv_param_label.setToolTip( _("A list of Gerber advanced parameters.\n" "Those parameters are available only for\n" @@ -4624,8 +4630,7 @@ class GerberAdvOptPrefGroupUI(OptionsGroupUI): "<>: Don't change this unless you know what you are doing !!!") ) self.buffering_radio = RadioSet([{'label': _('None'), 'value': 'no'}, - {'label': _('Full'), 'value': 'full'}], - orientation='vertical', stretch=False) + {'label': _('Full'), 'value': 'full'}]) grid0.addWidget(buffering_label, 2, 0) grid0.addWidget(self.buffering_radio, 2, 1) @@ -5242,6 +5247,7 @@ class ExcellonOptPrefGroupUI(OptionsGroupUI): grid2 = QtWidgets.QGridLayout() self.layout.addLayout(grid2) + # Cut Z cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z')) cutzlabel.setToolTip( _("Drill depth (negative)\n" @@ -5251,6 +5257,7 @@ class ExcellonOptPrefGroupUI(OptionsGroupUI): self.cutz_entry = LengthEntry() grid2.addWidget(self.cutz_entry, 0, 1) + # Travel Z travelzlabel = QtWidgets.QLabel('%s:' % _('Travel Z')) travelzlabel.setToolTip( _("Tool height when travelling\n" @@ -5279,15 +5286,27 @@ class ExcellonOptPrefGroupUI(OptionsGroupUI): self.toolchangez_entry = LengthEntry() grid2.addWidget(self.toolchangez_entry, 3, 1) - frlabel = QtWidgets.QLabel('%s:' % _('Feedrate (Plunge)')) + # End Move Z + endzlabel = QtWidgets.QLabel('%s:' % _('End move Z')) + endzlabel.setToolTip( + _("Height of the tool after\n" + "the last move at the end of the job.") + ) + grid2.addWidget(endzlabel, 4, 0) + self.eendz_entry = LengthEntry() + grid2.addWidget(self.eendz_entry, 4, 1) + + # Feedrate Z + frlabel = QtWidgets.QLabel('%s:' % _('Feedrate Z')) frlabel.setToolTip( _("Tool speed while drilling\n" "(in units per minute).\n" + "So called 'Plunge' feedrate.\n" "This is for linear move G01.") ) - grid2.addWidget(frlabel, 4, 0) + grid2.addWidget(frlabel, 5, 0) self.feedrate_entry = LengthEntry() - grid2.addWidget(self.feedrate_entry, 4, 1) + grid2.addWidget(self.feedrate_entry, 5, 1) # Spindle speed spdlabel = QtWidgets.QLabel('%s:' % _('Spindle Speed')) @@ -5295,23 +5314,9 @@ class ExcellonOptPrefGroupUI(OptionsGroupUI): _("Speed of the spindle\n" "in RPM (optional)") ) - grid2.addWidget(spdlabel, 5, 0) + grid2.addWidget(spdlabel, 6, 0) self.spindlespeed_entry = IntEntry(allow_empty=True) - grid2.addWidget(self.spindlespeed_entry, 5, 1) - - # Spindle direction - spindle_dir_label = QtWidgets.QLabel('%s:' % _('Spindle dir.')) - spindle_dir_label.setToolTip( - _("This sets the direction that the spindle is rotating.\n" - "It can be either:\n" - "- CW = clockwise or\n" - "- CCW = counter clockwise") - ) - - self.spindledir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'}, - {'label': _('CCW'), 'value': 'CCW'}]) - grid2.addWidget(spindle_dir_label, 6, 0) - grid2.addWidget(self.spindledir_radio, 6, 1) + grid2.addWidget(self.spindlespeed_entry, 6, 1) # Dwell dwelllabel = QtWidgets.QLabel('%s:' % _('Dwell')) @@ -5325,6 +5330,7 @@ class ExcellonOptPrefGroupUI(OptionsGroupUI): ) self.dwell_cb = FCCheckBox() self.dwelltime_entry = FCEntry() + grid2.addWidget(dwelllabel, 7, 0) grid2.addWidget(self.dwell_cb, 7, 1) grid2.addWidget(dwelltime, 8, 0) @@ -5366,7 +5372,7 @@ class ExcellonOptPrefGroupUI(OptionsGroupUI): self.mill_hole_label.setToolTip( _("Create Geometry for milling holes.") ) - grid2.addWidget(excellon_gcode_type_label, 11, 0, 1, 2) + grid2.addWidget(self.mill_hole_label, 11, 0, 1, 2) tdlabel = QtWidgets.QLabel('%s:' % _('Drill Tool dia')) tdlabel.setToolTip( @@ -5408,12 +5414,13 @@ class ExcellonAdvOptPrefGroupUI(OptionsGroupUI): # ## ADVANCED OPTIONS ### # ####################### - self.cncjob_label = QtWidgets.QLabel('%s:' % _('Advanced Options')) - self.cncjob_label.setToolTip( - _("Parameters used to create a CNC Job object\n" - "for this drill object that are shown when App Level is Advanced.") + self.exc_label = QtWidgets.QLabel('%s:' % _('Advanced Options')) + self.exc_label.setToolTip( + _("A list of Excellon advanced parameters.\n" + "Those parameters are available only for\n" + "Advanced App. Level.") ) - self.layout.addWidget(self.cncjob_label) + self.layout.addWidget(self.exc_label) grid1 = QtWidgets.QGridLayout() self.layout.addLayout(grid1) @@ -5444,15 +5451,7 @@ class ExcellonAdvOptPrefGroupUI(OptionsGroupUI): self.estartz_entry = FloatEntry() grid1.addWidget(self.estartz_entry, 2, 1) - endzlabel = QtWidgets.QLabel('%s:' % _('End move Z')) - endzlabel.setToolTip( - _("Height of the tool after\n" - "the last move at the end of the job.") - ) - grid1.addWidget(endzlabel, 3, 0) - self.eendz_entry = LengthEntry() - grid1.addWidget(self.eendz_entry, 3, 1) - + # Feedrate Rapids fr_rapid_label = QtWidgets.QLabel('%s:' % _('Feedrate Rapids')) fr_rapid_label.setToolTip( _("Tool speed while drilling\n" @@ -5461,9 +5460,9 @@ class ExcellonAdvOptPrefGroupUI(OptionsGroupUI): "It is useful only for Marlin,\n" "ignore for any other cases.") ) - grid1.addWidget(fr_rapid_label, 4, 0) + grid1.addWidget(fr_rapid_label, 3, 0) self.feedrate_rapid_entry = LengthEntry() - grid1.addWidget(self.feedrate_rapid_entry, 4, 1) + grid1.addWidget(self.feedrate_rapid_entry, 3, 1) # Probe depth self.pdepth_label = QtWidgets.QLabel('%s:' % _("Probe Z depth")) @@ -5471,18 +5470,32 @@ class ExcellonAdvOptPrefGroupUI(OptionsGroupUI): _("The maximum depth that the probe is allowed\n" "to probe. Negative value, in current units.") ) - grid1.addWidget(self.pdepth_label, 5, 0) + grid1.addWidget(self.pdepth_label, 4, 0) self.pdepth_entry = FCEntry() - grid1.addWidget(self.pdepth_entry, 5, 1) + grid1.addWidget(self.pdepth_entry, 4, 1) # Probe feedrate self.feedrate_probe_label = QtWidgets.QLabel('%s:' % _("Feedrate Probe")) self.feedrate_probe_label.setToolTip( _("The feedrate used while the probe is probing.") ) - grid1.addWidget(self.feedrate_probe_label, 6, 0) + grid1.addWidget(self.feedrate_probe_label, 5, 0) self.feedrate_probe_entry = FCEntry() - grid1.addWidget(self.feedrate_probe_entry, 6, 1) + grid1.addWidget(self.feedrate_probe_entry, 5, 1) + + # Spindle direction + spindle_dir_label = QtWidgets.QLabel('%s:' % _('Spindle dir.')) + spindle_dir_label.setToolTip( + _("This sets the direction that the spindle is rotating.\n" + "It can be either:\n" + "- CW = clockwise or\n" + "- CCW = counter clockwise") + ) + + self.spindledir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'}, + {'label': _('CCW'), 'value': 'CCW'}]) + grid1.addWidget(spindle_dir_label, 6, 0) + grid1.addWidget(self.spindledir_radio, 6, 1) fplungelabel = QtWidgets.QLabel('%s:' % _('Fast Plunge')) fplungelabel.setToolTip( @@ -6056,15 +6069,25 @@ class GeometryOptPrefGroupUI(OptionsGroupUI): self.toolchangez_entry = LengthEntry() grid1.addWidget(self.toolchangez_entry, 5, 1) + # End move Z + endzlabel = QtWidgets.QLabel('%s:' % _('End move Z')) + endzlabel.setToolTip( + _("Height of the tool after\n" + "the last move at the end of the job.") + ) + grid1.addWidget(endzlabel, 6, 0) + self.gendz_entry = LengthEntry() + grid1.addWidget(self.gendz_entry, 6, 1) + # Feedrate X-Y frlabel = QtWidgets.QLabel('%s:' % _('Feed Rate X-Y')) frlabel.setToolTip( _("Cutting speed in the XY\n" "plane in units per minute") ) - grid1.addWidget(frlabel, 6, 0) + grid1.addWidget(frlabel, 7, 0) self.cncfeedrate_entry = LengthEntry() - grid1.addWidget(self.cncfeedrate_entry, 6, 1) + grid1.addWidget(self.cncfeedrate_entry, 7, 1) # Feedrate Z (Plunge) frz_label = QtWidgets.QLabel('%s:' % _('Feed Rate Z')) @@ -6073,9 +6096,9 @@ class GeometryOptPrefGroupUI(OptionsGroupUI): "plane in units per minute.\n" "It is called also Plunge.") ) - grid1.addWidget(frz_label, 7, 0) + grid1.addWidget(frz_label, 8, 0) self.cncplunge_entry = LengthEntry() - grid1.addWidget(self.cncplunge_entry, 7, 1) + grid1.addWidget(self.cncplunge_entry, 8, 1) # Spindle Speed spdlabel = QtWidgets.QLabel('%s:' % _('Spindle speed')) @@ -6086,23 +6109,9 @@ class GeometryOptPrefGroupUI(OptionsGroupUI): "this value is the power of laser." ) ) - grid1.addWidget(spdlabel, 8, 0) + grid1.addWidget(spdlabel, 9, 0) self.cncspindlespeed_entry = IntEntry(allow_empty=True) - grid1.addWidget(self.cncspindlespeed_entry, 8, 1) - - # Spindle direction - spindle_dir_label = QtWidgets.QLabel('%s:' % _('Spindle dir.')) - spindle_dir_label.setToolTip( - _("This sets the direction that the spindle is rotating.\n" - "It can be either:\n" - "- CW = clockwise or\n" - "- CCW = counter clockwise") - ) - - self.spindledir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'}, - {'label': _('CCW'), 'value': 'CCW'}]) - grid1.addWidget(spindle_dir_label, 9, 0) - grid1.addWidget(self.spindledir_radio, 9, 1) + grid1.addWidget(self.cncspindlespeed_entry, 9, 1) # Dwell self.dwell_cb = FCCheckBox(label='%s:' % _('Dwell')) @@ -6145,12 +6154,13 @@ class GeometryAdvOptPrefGroupUI(OptionsGroupUI): # ------------------------------ # ## Advanced Options # ------------------------------ - self.cncjob_label = QtWidgets.QLabel('%s:' % _('Advanced Options')) - self.cncjob_label.setToolTip( - _("Parameters to create a CNC Job object\n" - "tracing the contours of a Geometry object.") + self.geo_label = QtWidgets.QLabel('%s:' % _('Advanced Options')) + self.geo_label.setToolTip( + _("A list of Geometry advanced parameters.\n" + "Those parameters are available only for\n" + "Advanced App. Level.") ) - self.layout.addWidget(self.cncjob_label) + self.layout.addWidget(self.geo_label) grid1 = QtWidgets.QGridLayout() self.layout.addLayout(grid1) @@ -6174,16 +6184,6 @@ class GeometryAdvOptPrefGroupUI(OptionsGroupUI): self.gstartz_entry = FloatEntry() grid1.addWidget(self.gstartz_entry, 2, 1) - # End move Z - endzlabel = QtWidgets.QLabel('%s:' % _('End move Z')) - endzlabel.setToolTip( - _("Height of the tool after\n" - "the last move at the end of the job.") - ) - grid1.addWidget(endzlabel, 3, 0) - self.gendz_entry = LengthEntry() - grid1.addWidget(self.gendz_entry, 3, 1) - # Feedrate rapids fr_rapid_label = QtWidgets.QLabel('%s:' % _('Feed Rate Rapids')) fr_rapid_label.setToolTip( @@ -6226,6 +6226,20 @@ class GeometryAdvOptPrefGroupUI(OptionsGroupUI): self.feedrate_probe_entry = FCEntry() grid1.addWidget(self.feedrate_probe_entry, 7, 1) + # Spindle direction + spindle_dir_label = QtWidgets.QLabel('%s:' % _('Spindle dir.')) + spindle_dir_label.setToolTip( + _("This sets the direction that the spindle is rotating.\n" + "It can be either:\n" + "- CW = clockwise or\n" + "- CCW = counter clockwise") + ) + + self.spindledir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'}, + {'label': _('CCW'), 'value': 'CCW'}]) + grid1.addWidget(spindle_dir_label, 8, 0) + grid1.addWidget(self.spindledir_radio, 8, 1) + # Fast Move from Z Toolchange fplungelabel = QtWidgets.QLabel('%s:' % _('Fast Plunge')) fplungelabel.setToolTip( @@ -6235,8 +6249,8 @@ class GeometryAdvOptPrefGroupUI(OptionsGroupUI): "WARNING: the move is done at Toolchange X,Y coords.") ) self.fplunge_cb = FCCheckBox() - grid1.addWidget(fplungelabel, 8, 0) - grid1.addWidget(self.fplunge_cb, 8, 1) + grid1.addWidget(fplungelabel, 9, 0) + grid1.addWidget(self.fplunge_cb, 9, 1) # Size of trace segment on X axis segx_label = QtWidgets.QLabel('%s:' % _("Seg. X size")) @@ -6245,9 +6259,9 @@ class GeometryAdvOptPrefGroupUI(OptionsGroupUI): "Useful for auto-leveling.\n" "A value of 0 means no segmentation on the X axis.") ) - grid1.addWidget(segx_label, 9, 0) + grid1.addWidget(segx_label, 10, 0) self.segx_entry = FCEntry() - grid1.addWidget(self.segx_entry, 9, 1) + grid1.addWidget(self.segx_entry, 10, 1) # Size of trace segment on Y axis segy_label = QtWidgets.QLabel('%s:' % _("Seg. Y size")) @@ -6256,9 +6270,9 @@ class GeometryAdvOptPrefGroupUI(OptionsGroupUI): "Useful for auto-leveling.\n" "A value of 0 means no segmentation on the Y axis.") ) - grid1.addWidget(segy_label, 10, 0) + grid1.addWidget(segy_label, 11, 0) self.segy_entry = FCEntry() - grid1.addWidget(self.segy_entry, 10, 1) + grid1.addWidget(self.segy_entry, 11, 1) self.layout.addStretch() @@ -6352,37 +6366,6 @@ class CNCJobGenPrefGroupUI(OptionsGroupUI): grid0.addWidget(self.annotation_cb, 2, 1) grid0.addWidget(QtWidgets.QLabel(''), 2, 2) - # Annotation Font Size - self.annotation_fontsize_label = QtWidgets.QLabel('%s:' % _("Annotation Size")) - self.annotation_fontsize_label.setToolTip( - _("The font size of the annotation text. In pixels.") - ) - grid0.addWidget(self.annotation_fontsize_label, 3, 0) - self.annotation_fontsize_sp = FCSpinner() - grid0.addWidget(self.annotation_fontsize_sp, 3, 1) - grid0.addWidget(QtWidgets.QLabel(''), 3, 2) - - # Annotation Font Color - self.annotation_color_label = QtWidgets.QLabel('%s:' % _('Annotation Color')) - self.annotation_color_label.setToolTip( - _("Set the font color for the annotation texts.") - ) - self.annotation_fontcolor_entry = FCEntry() - self.annotation_fontcolor_button = QtWidgets.QPushButton() - self.annotation_fontcolor_button.setFixedSize(15, 15) - - self.form_box_child = QtWidgets.QHBoxLayout() - self.form_box_child.setContentsMargins(0, 0, 0, 0) - self.form_box_child.addWidget(self.annotation_fontcolor_entry) - self.form_box_child.addWidget(self.annotation_fontcolor_button, alignment=Qt.AlignRight) - self.form_box_child.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) - - color_widget = QtWidgets.QWidget() - color_widget.setLayout(self.form_box_child) - grid0.addWidget(self.annotation_color_label, 4, 0) - grid0.addWidget(color_widget, 4, 1) - grid0.addWidget(QtWidgets.QLabel(''), 4, 2) - # ################################################################### # Number of circle steps for circular aperture linear approximation # # ################################################################### @@ -6391,9 +6374,9 @@ class CNCJobGenPrefGroupUI(OptionsGroupUI): _("The number of circle steps for GCode \n" "circle and arc shapes linear approximation.") ) - grid0.addWidget(self.steps_per_circle_label, 5, 0) + grid0.addWidget(self.steps_per_circle_label, 3, 0) self.steps_per_circle_entry = IntEntry() - grid0.addWidget(self.steps_per_circle_entry, 5, 1) + grid0.addWidget(self.steps_per_circle_entry, 3, 1) # Tool dia for plot tdlabel = QtWidgets.QLabel('%s:' % _('Travel dia')) @@ -6402,11 +6385,11 @@ class CNCJobGenPrefGroupUI(OptionsGroupUI): "rendered in the plot.") ) self.tooldia_entry = LengthEntry() - grid0.addWidget(tdlabel, 6, 0) - grid0.addWidget(self.tooldia_entry, 6, 1) + grid0.addWidget(tdlabel, 4, 0) + grid0.addWidget(self.tooldia_entry, 4, 1) # add a space - grid0.addWidget(QtWidgets.QLabel(''), 7, 0) + grid0.addWidget(QtWidgets.QLabel(''), 5, 0) # Number of decimals to use in GCODE coordinates cdeclabel = QtWidgets.QLabel('%s:' % _('Coordinates decimals')) @@ -6415,8 +6398,8 @@ class CNCJobGenPrefGroupUI(OptionsGroupUI): "the X, Y, Z coordinates in CNC code (GCODE, etc.)") ) self.coords_dec_entry = IntEntry() - grid0.addWidget(cdeclabel, 8, 0) - grid0.addWidget(self.coords_dec_entry, 8, 1) + grid0.addWidget(cdeclabel, 6, 0) + grid0.addWidget(self.coords_dec_entry, 6, 1) # Number of decimals to use in GCODE feedrate frdeclabel = QtWidgets.QLabel('%s:' % _('Feedrate decimals')) @@ -6425,8 +6408,8 @@ class CNCJobGenPrefGroupUI(OptionsGroupUI): "the Feedrate parameter in CNC code (GCODE, etc.)") ) self.fr_dec_entry = IntEntry() - grid0.addWidget(frdeclabel, 9, 0) - grid0.addWidget(self.fr_dec_entry, 9, 1) + grid0.addWidget(frdeclabel, 7, 0) + grid0.addWidget(self.fr_dec_entry, 7, 1) # The type of coordinates used in the Gcode: Absolute or Incremental coords_type_label = QtWidgets.QLabel('%s:' % _('Coordinates type')) @@ -6440,8 +6423,8 @@ class CNCJobGenPrefGroupUI(OptionsGroupUI): {"label": _("Absolute G90"), "value": "G90"}, {"label": _("Incremental G91"), "value": "G91"} ], orientation='vertical', stretch=False) - grid0.addWidget(coords_type_label, 10, 0) - grid0.addWidget(self.coords_type_radio, 10, 1) + grid0.addWidget(coords_type_label, 8, 0) + grid0.addWidget(self.coords_type_radio, 8, 1) # hidden for the time being, until implemented coords_type_label.hide() @@ -6578,6 +6561,42 @@ class CNCJobAdvOptPrefGroupUI(OptionsGroupUI): # ) # hlay1.addWidget(self.tc_insert_buton) + grid0 = QtWidgets.QGridLayout() + self.layout.addLayout(grid0) + + grid0.addWidget(QtWidgets.QLabel(''), 1, 0, 1, 2) + + # Annotation Font Size + self.annotation_fontsize_label = QtWidgets.QLabel('%s:' % _("Annotation Size")) + self.annotation_fontsize_label.setToolTip( + _("The font size of the annotation text. In pixels.") + ) + grid0.addWidget(self.annotation_fontsize_label, 2, 0) + self.annotation_fontsize_sp = FCSpinner() + grid0.addWidget(self.annotation_fontsize_sp, 2, 1) + grid0.addWidget(QtWidgets.QLabel(''), 2, 2) + + # Annotation Font Color + self.annotation_color_label = QtWidgets.QLabel('%s:' % _('Annotation Color')) + self.annotation_color_label.setToolTip( + _("Set the font color for the annotation texts.") + ) + self.annotation_fontcolor_entry = FCEntry() + self.annotation_fontcolor_button = QtWidgets.QPushButton() + self.annotation_fontcolor_button.setFixedSize(15, 15) + + self.form_box_child = QtWidgets.QHBoxLayout() + self.form_box_child.setContentsMargins(0, 0, 0, 0) + self.form_box_child.addWidget(self.annotation_fontcolor_entry) + self.form_box_child.addWidget(self.annotation_fontcolor_button, alignment=Qt.AlignRight) + self.form_box_child.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) + + color_widget = QtWidgets.QWidget() + color_widget.setLayout(self.form_box_child) + grid0.addWidget(self.annotation_color_label, 3, 0) + grid0.addWidget(color_widget, 3, 1) + grid0.addWidget(QtWidgets.QLabel(''), 3, 2) + self.layout.addStretch() @@ -7183,6 +7202,26 @@ class ToolsFilmPrefGroupUI(OptionsGroupUI): grid0.addWidget(ftypelbl, 0, 0) grid0.addWidget(self.film_type_radio, 0, 1) + # Film Color + self.film_color_label = QtWidgets.QLabel('%s:' % _('Film Color')) + self.film_color_label.setToolTip( + _("Set the film color when positive film is selected.") + ) + self.film_color_entry = FCEntry() + self.film_color_button = QtWidgets.QPushButton() + self.film_color_button.setFixedSize(15, 15) + + self.form_box_child = QtWidgets.QHBoxLayout() + self.form_box_child.setContentsMargins(0, 0, 0, 0) + self.form_box_child.addWidget(self.film_color_entry) + self.form_box_child.addWidget(self.film_color_button, alignment=Qt.AlignRight) + self.form_box_child.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) + + film_color_widget = QtWidgets.QWidget() + film_color_widget.setLayout(self.form_box_child) + grid0.addWidget(self.film_color_label, 1, 0) + grid0.addWidget(film_color_widget, 1, 1) + self.film_boundary_entry = FCEntry() self.film_boundary_label = QtWidgets.QLabel('%s:' % _("Border")) self.film_boundary_label.setToolTip( @@ -7195,8 +7234,8 @@ class ToolsFilmPrefGroupUI(OptionsGroupUI): "white color like the rest and which may confound with the\n" "surroundings if not for this border.") ) - grid0.addWidget(self.film_boundary_label, 1, 0) - grid0.addWidget(self.film_boundary_entry, 1, 1) + grid0.addWidget(self.film_boundary_label, 2, 0) + grid0.addWidget(self.film_boundary_entry, 2, 1) self.film_scale_entry = FCEntry() self.film_scale_label = QtWidgets.QLabel('%s:' % _("Scale Stroke")) @@ -7205,8 +7244,8 @@ class ToolsFilmPrefGroupUI(OptionsGroupUI): "It means that the line that envelope each SVG feature will be thicker or thinner,\n" "therefore the fine features may be more affected by this parameter.") ) - grid0.addWidget(self.film_scale_label, 2, 0) - grid0.addWidget(self.film_scale_entry, 2, 1) + grid0.addWidget(self.film_scale_label, 3, 0) + grid0.addWidget(self.film_scale_entry, 3, 1) self.layout.addStretch() diff --git a/flatcamGUI/ObjectUI.py b/flatcamGUI/ObjectUI.py index 94856810..5a8b1922 100644 --- a/flatcamGUI/ObjectUI.py +++ b/flatcamGUI/ObjectUI.py @@ -713,11 +713,12 @@ class ExcellonObjectUI(ObjectUI): self.eendz_entry = LengthEntry() grid1.addWidget(self.eendz_entry, 5, 1) - # Excellon Feedrate - frlabel = QtWidgets.QLabel('%s:' % _('Feedrate (Plunge)')) + # Excellon Feedrate Z + frlabel = QtWidgets.QLabel('%s:' % _('Feedrate Z')) frlabel.setToolTip( _("Tool speed while drilling\n" "(in units per minute).\n" + "So called 'Plunge' feedrate.\n" "This is for linear move G01.") ) grid1.addWidget(frlabel, 6, 0) diff --git a/flatcamTools/ToolFilm.py b/flatcamTools/ToolFilm.py index 875d4586..dbd39bca 100644 --- a/flatcamTools/ToolFilm.py +++ b/flatcamTools/ToolFilm.py @@ -274,7 +274,7 @@ class Film(FlatCAMTool): self.app.inform.emit('[WARNING_NOTCL] %s' % _("Export SVG positive cancelled.")) return else: - self.app.export_svg_black(name, boxname, filename, scale_factor=scale_stroke_width) + self.app.export_svg_positive(name, boxname, filename, scale_factor=scale_stroke_width) else: try: filename, _f = QtWidgets.QFileDialog.getSaveFileName(