|
|
@@ -15,7 +15,6 @@ import random
|
|
|
import simplejson as json
|
|
|
import lzma
|
|
|
import shutil
|
|
|
-import stat
|
|
|
from datetime import datetime
|
|
|
import time
|
|
|
from stat import S_IREAD, S_IRGRP, S_IROTH
|
|
|
@@ -52,6 +51,7 @@ from vispy.gloo.util import _screenshot
|
|
|
from vispy.io import write_png
|
|
|
|
|
|
# FlatCAM Objects
|
|
|
+from defaults import FlatCAMDefaults
|
|
|
from flatcamObjects.ObjectCollection import *
|
|
|
from flatcamObjects.FlatCAMObj import FlatCAMObj
|
|
|
from flatcamObjects.FlatCAMCNCJob import CNCJobObject
|
|
|
@@ -436,674 +436,24 @@ class App(QtCore.QObject):
|
|
|
# ############################################################################################################
|
|
|
# ################################# DEFAULTS - PREFERENCES STORAGE ###########################################
|
|
|
# ############################################################################################################
|
|
|
- self.defaults = LoudDict()
|
|
|
- self.defaults.update({
|
|
|
- # Global APP Preferences
|
|
|
- "decimals_inch": 4,
|
|
|
- "decimals_metric": 4,
|
|
|
- "version": self.version,
|
|
|
- "first_run": True,
|
|
|
- "units": "MM",
|
|
|
- "global_serial": 0,
|
|
|
- "global_stats": dict(),
|
|
|
- "global_tabs_detachable": True,
|
|
|
- "global_jump_ref": 'abs',
|
|
|
- "global_locate_pt": 'bl',
|
|
|
- "global_tpdf_tmargin": 15.0,
|
|
|
- "global_tpdf_bmargin": 10.0,
|
|
|
- "global_tpdf_lmargin": 20.0,
|
|
|
- "global_tpdf_rmargin": 20.0,
|
|
|
- "global_autosave": False,
|
|
|
- "global_autosave_timeout": 300000,
|
|
|
-
|
|
|
- # General
|
|
|
- "global_graphic_engine": '3D',
|
|
|
- "global_app_level": 'b',
|
|
|
- "global_portable": False,
|
|
|
- "global_language": 'English',
|
|
|
- "global_version_check": True,
|
|
|
- "global_send_stats": True,
|
|
|
- "global_pan_button": '2',
|
|
|
- "global_mselect_key": 'Control',
|
|
|
- "global_project_at_startup": False,
|
|
|
- "global_systray_icon": True,
|
|
|
- "global_project_autohide": True,
|
|
|
- "global_toggle_tooltips": True,
|
|
|
- "global_worker_number": 2,
|
|
|
- "global_tolerance": 0.005,
|
|
|
- "global_open_style": True,
|
|
|
- "global_delete_confirmation": True,
|
|
|
- "global_compression_level": 3,
|
|
|
- "global_save_compressed": True,
|
|
|
-
|
|
|
- "global_machinist_setting": False,
|
|
|
-
|
|
|
- # Global GUI Preferences
|
|
|
- "global_gridx": 1.0,
|
|
|
- "global_gridy": 1.0,
|
|
|
- "global_snap_max": 0.05,
|
|
|
- "global_workspace": False,
|
|
|
- "global_workspaceT": "A4",
|
|
|
- "global_workspace_orientation": 'p',
|
|
|
-
|
|
|
- "global_grid_context_menu": {
|
|
|
- 'in': [0.01, 0.02, 0.025, 0.05, 0.1],
|
|
|
- 'mm': [0.1, 0.2, 0.5, 1, 2.54]
|
|
|
- },
|
|
|
-
|
|
|
- "global_sel_fill": '#a5a5ffbf',
|
|
|
- "global_sel_line": '#0000ffbf',
|
|
|
- "global_alt_sel_fill": '#BBF268BF',
|
|
|
- "global_alt_sel_line": '#006E20BF',
|
|
|
- "global_draw_color": '#FF0000',
|
|
|
- "global_sel_draw_color": '#0000FF',
|
|
|
- "global_proj_item_color": '#000000',
|
|
|
- "global_proj_item_dis_color": '#b7b7cb',
|
|
|
- "global_activity_icon": 'Ball green',
|
|
|
-
|
|
|
- "global_toolbar_view": 511,
|
|
|
-
|
|
|
- "global_background_timeout": 300000, # Default value is 5 minutes
|
|
|
- "global_verbose_error_level": 0, # Shell verbosity 0 = default
|
|
|
- # (python trace only for unknown errors),
|
|
|
- # 1 = show trace(show trace always),
|
|
|
- # 2 = (For the future).
|
|
|
-
|
|
|
- # Persistence
|
|
|
- "global_last_folder": None,
|
|
|
- "global_last_save_folder": None,
|
|
|
-
|
|
|
- # Default window geometry
|
|
|
- "global_def_win_x": 100,
|
|
|
- "global_def_win_y": 100,
|
|
|
- "global_def_win_w": 1024,
|
|
|
- "global_def_win_h": 650,
|
|
|
- "global_def_notebook_width": 1,
|
|
|
-
|
|
|
- # Constants...
|
|
|
- "global_defaults_save_period_ms": 20000, # Time between default saves.
|
|
|
- "global_shell_shape": [500, 300], # Shape of the shell in pixels.
|
|
|
- "global_shell_at_startup": False, # Show the shell at startup.
|
|
|
- "global_recent_limit": 10, # Max. items in recent list.
|
|
|
-
|
|
|
- "global_bookmarks": dict(),
|
|
|
- "global_bookmarks_limit": 10,
|
|
|
-
|
|
|
- "fit_key": 'V',
|
|
|
- "zoom_out_key": '-',
|
|
|
- "zoom_in_key": '=',
|
|
|
- "grid_toggle_key": 'G',
|
|
|
- "global_zoom_ratio": 1.5,
|
|
|
- "global_point_clipboard_format": "(%.*f, %.*f)",
|
|
|
- "global_zdownrate": None,
|
|
|
+ self.fcDefaults = FlatCAMDefaults()
|
|
|
+ current_defaults_path = os.path.join(self.data_path, "current_defaults.FlatConfig")
|
|
|
+ self.fcDefaults.load_defaults(filename=current_defaults_path)
|
|
|
+ self.defaults = self.fcDefaults.defaults
|
|
|
|
|
|
- # General GUI Settings
|
|
|
- "global_theme": 'white',
|
|
|
- "global_gray_icons": False,
|
|
|
- "global_hover": False,
|
|
|
- "global_selection_shape": True,
|
|
|
- "global_layout": "compact",
|
|
|
- "global_cursor_type": "small",
|
|
|
- "global_cursor_size": 20,
|
|
|
- "global_cursor_width": 2,
|
|
|
- "global_cursor_color": '#FF0000',
|
|
|
- "global_cursor_color_enabled": True,
|
|
|
-
|
|
|
- # Gerber General
|
|
|
- "gerber_plot": True,
|
|
|
- "gerber_solid": True,
|
|
|
- "gerber_multicolored": False,
|
|
|
- "gerber_circle_steps": 64,
|
|
|
- "gerber_use_buffer_for_union": True,
|
|
|
- "gerber_clean_apertures": True,
|
|
|
- "gerber_extra_buffering": True,
|
|
|
-
|
|
|
- "gerber_plot_fill": '#BBF268BF',
|
|
|
- "gerber_plot_line": '#006E20BF',
|
|
|
-
|
|
|
- "gerber_def_units": 'IN',
|
|
|
- "gerber_def_zeros": 'L',
|
|
|
- "gerber_save_filters": "Gerber File .gbr (*.gbr);;Gerber File .bot (*.bot);;Gerber File .bsm (*.bsm);;"
|
|
|
- "Gerber File .cmp (*.cmp);;Gerber File .crc (*.crc);;Gerber File .crs (*.crs);;"
|
|
|
- "Gerber File .gb0 (*.gb0);;Gerber File .gb1 (*.gb1);;Gerber File .gb2 (*.gb2);;"
|
|
|
- "Gerber File .gb3 (*.gb3);;Gerber File .gb4 (*.gb4);;Gerber File .gb5 (*.gb5);;"
|
|
|
- "Gerber File .gb6 (*.gb6);;Gerber File .gb7 (*.gb7);;Gerber File .gb8 (*.gb8);;"
|
|
|
- "Gerber File .gb9 (*.gb9);;Gerber File .gbd (*.gbd);;Gerber File .gbl (*.gbl);;"
|
|
|
- "Gerber File .gbo (*.gbo);;Gerber File .gbp (*.gbp);;Gerber File .gbs (*.gbs);;"
|
|
|
- "Gerber File .gdo (*.gdo);;Gerber File .ger (*.ger);;Gerber File .gko (*.gko);;"
|
|
|
- "Gerber File .gm1 (*.gm1);;Gerber File .gm2 (*.gm2);;Gerber File .gm3 (*.gm3);;"
|
|
|
- "Gerber File .grb (*.grb);;Gerber File .gtl (*.gtl);;Gerber File .gto (*.gto);;"
|
|
|
- "Gerber File .gtp (*.gtp);;Gerber File .gts (*.gts);;Gerber File .ly15 (*.ly15);;"
|
|
|
- "Gerber File .ly2 (*.ly2);;Gerber File .mil (*.mil);;"
|
|
|
- "Gerber File .outline (*.outline);;Gerber File .pho (*.pho);;"
|
|
|
- "Gerber File .plc (*.plc);;Gerber File .pls (*.pls);;Gerber File .smb (*.smb);;"
|
|
|
- "Gerber File .smt (*.smt);;Gerber File .sol (*.sol);;Gerber File .spb (*.spb);;"
|
|
|
- "Gerber File .spt (*.spt);;Gerber File .ssb (*.ssb);;Gerber File .sst (*.sst);;"
|
|
|
- "Gerber File .stc (*.stc);;Gerber File .sts (*.sts);;Gerber File .top (*.top);;"
|
|
|
- "Gerber File .tsm (*.tsm);;Gerber File .art (*.art)"
|
|
|
- "All Files (*.*)",
|
|
|
-
|
|
|
- # Gerber Options
|
|
|
- "gerber_isotooldia": 0.1,
|
|
|
- "gerber_isopasses": 1,
|
|
|
- "gerber_isooverlap": 10,
|
|
|
- "gerber_milling_type": "cl",
|
|
|
- "gerber_combine_passes": False,
|
|
|
- "gerber_iso_scope": 'all',
|
|
|
- "gerber_noncoppermargin": 0.1,
|
|
|
- "gerber_noncopperrounded": False,
|
|
|
- "gerber_bboxmargin": 0.1,
|
|
|
- "gerber_bboxrounded": False,
|
|
|
-
|
|
|
- # Gerber Advanced Options
|
|
|
- "gerber_aperture_display": False,
|
|
|
- "gerber_aperture_scale_factor": 1.0,
|
|
|
- "gerber_aperture_buffer_factor": 0.0,
|
|
|
- "gerber_follow": False,
|
|
|
- "gerber_tool_type": 'circular',
|
|
|
- "gerber_vtipdia": 0.1,
|
|
|
- "gerber_vtipangle": 30,
|
|
|
- "gerber_vcutz": -0.05,
|
|
|
- "gerber_iso_type": "full",
|
|
|
- "gerber_buffering": "full",
|
|
|
- "gerber_simplification": False,
|
|
|
- "gerber_simp_tolerance": 0.0005,
|
|
|
-
|
|
|
- # Gerber Export
|
|
|
- "gerber_exp_units": 'IN',
|
|
|
- "gerber_exp_integer": 2,
|
|
|
- "gerber_exp_decimals": 4,
|
|
|
- "gerber_exp_zeros": 'L',
|
|
|
-
|
|
|
- # Gerber Editor
|
|
|
- "gerber_editor_sel_limit": 30,
|
|
|
- "gerber_editor_newcode": 10,
|
|
|
- "gerber_editor_newsize": 0.8,
|
|
|
- "gerber_editor_newtype": 'C',
|
|
|
- "gerber_editor_newdim": "0.5, 0.5",
|
|
|
- "gerber_editor_array_size": 5,
|
|
|
- "gerber_editor_lin_axis": 'X',
|
|
|
- "gerber_editor_lin_pitch": 0.1,
|
|
|
- "gerber_editor_lin_angle": 0.0,
|
|
|
- "gerber_editor_circ_dir": 'CW',
|
|
|
- "gerber_editor_circ_angle": 0.0,
|
|
|
- "gerber_editor_scale_f": 1.0,
|
|
|
- "gerber_editor_buff_f": 0.1,
|
|
|
- "gerber_editor_ma_low": 0.0,
|
|
|
- "gerber_editor_ma_high": 1.0,
|
|
|
-
|
|
|
- # Excellon General
|
|
|
- "excellon_plot": True,
|
|
|
- "excellon_solid": True,
|
|
|
- "excellon_format_upper_in": 2,
|
|
|
- "excellon_format_lower_in": 4,
|
|
|
- "excellon_format_upper_mm": 3,
|
|
|
- "excellon_format_lower_mm": 3,
|
|
|
- "excellon_zeros": "L",
|
|
|
- "excellon_units": "INCH",
|
|
|
- "excellon_update": True,
|
|
|
-
|
|
|
- "excellon_optimization_type": 'B',
|
|
|
-
|
|
|
- "excellon_search_time": 3,
|
|
|
- "excellon_save_filters": "Excellon File .txt (*.txt);;Excellon File .drd (*.drd);;"
|
|
|
- "Excellon File .drill (*.drill);;"
|
|
|
- "Excellon File .drl (*.drl);;Excellon File .exc (*.exc);;"
|
|
|
- "Excellon File .ncd (*.ncd);;Excellon File .tap (*.tap);;"
|
|
|
- "Excellon File .xln (*.xln);;All Files (*.*)",
|
|
|
- "excellon_plot_fill": '#C40000BF',
|
|
|
- "excellon_plot_line": '#750000BF',
|
|
|
-
|
|
|
- # Excellon Options
|
|
|
- "excellon_operation": "drill",
|
|
|
- "excellon_milling_type": "drills",
|
|
|
-
|
|
|
- "excellon_milling_dia": 0.8,
|
|
|
-
|
|
|
- "excellon_cutz": -1.7,
|
|
|
- "excellon_multidepth": False,
|
|
|
- "excellon_depthperpass": 0.7,
|
|
|
- "excellon_travelz": 2,
|
|
|
- "excellon_endz": 0.5,
|
|
|
- "excellon_endxy": None,
|
|
|
- "excellon_feedrate_z": 300,
|
|
|
- "excellon_spindlespeed": 0,
|
|
|
- "excellon_dwell": False,
|
|
|
- "excellon_dwelltime": 1,
|
|
|
- "excellon_toolchange": False,
|
|
|
- "excellon_toolchangez": 15,
|
|
|
- "excellon_ppname_e": 'default',
|
|
|
- "excellon_tooldia": 0.8,
|
|
|
- "excellon_slot_tooldia": 1.8,
|
|
|
- "excellon_gcode_type": "drills",
|
|
|
-
|
|
|
- # Excellon Advanced Options
|
|
|
- "excellon_offset": 0.0,
|
|
|
- "excellon_toolchangexy": "0.0, 0.0",
|
|
|
- "excellon_startz": None,
|
|
|
- "excellon_feedrate_rapid": 1500,
|
|
|
- "excellon_z_pdepth": -0.02,
|
|
|
- "excellon_feedrate_probe": 75,
|
|
|
- "excellon_spindledir": 'CW',
|
|
|
- "excellon_f_plunge": False,
|
|
|
- "excellon_f_retract": False,
|
|
|
-
|
|
|
- # Excellon Export
|
|
|
- "excellon_exp_units": 'INCH',
|
|
|
- "excellon_exp_format": 'ndec',
|
|
|
- "excellon_exp_integer": 2,
|
|
|
- "excellon_exp_decimals": 4,
|
|
|
- "excellon_exp_zeros": 'LZ',
|
|
|
- "excellon_exp_slot_type": 'routing',
|
|
|
-
|
|
|
- # Excellon Editor
|
|
|
- "excellon_editor_sel_limit": 30,
|
|
|
- "excellon_editor_newdia": 1.0,
|
|
|
- "excellon_editor_array_size": 5,
|
|
|
- "excellon_editor_lin_dir": 'X',
|
|
|
- "excellon_editor_lin_pitch": 2.54,
|
|
|
- "excellon_editor_lin_angle": 0.0,
|
|
|
- "excellon_editor_circ_dir": 'CW',
|
|
|
- "excellon_editor_circ_angle": 12,
|
|
|
- # Excellon Slots
|
|
|
- "excellon_editor_slot_direction": 'X',
|
|
|
- "excellon_editor_slot_angle": 0.0,
|
|
|
- "excellon_editor_slot_length": 5.0,
|
|
|
- # Excellon Slot Array
|
|
|
- "excellon_editor_slot_array_size": 5,
|
|
|
- "excellon_editor_slot_lin_dir": 'X',
|
|
|
- "excellon_editor_slot_lin_pitch": 2.54,
|
|
|
- "excellon_editor_slot_lin_angle": 0.0,
|
|
|
- "excellon_editor_slot_circ_dir": 'CW',
|
|
|
- "excellon_editor_slot_circ_angle": 0.0,
|
|
|
-
|
|
|
- # Geometry General
|
|
|
- "geometry_plot": True,
|
|
|
- "geometry_circle_steps": 64,
|
|
|
- "geometry_cnctooldia": "2.4",
|
|
|
- "geometry_plot_line": "#FF0000",
|
|
|
-
|
|
|
- # Geometry Options
|
|
|
- "geometry_cutz": -2.4,
|
|
|
- "geometry_vtipdia": 0.1,
|
|
|
- "geometry_vtipangle": 30,
|
|
|
- "geometry_multidepth": False,
|
|
|
- "geometry_depthperpass": 0.8,
|
|
|
- "geometry_travelz": 2,
|
|
|
- "geometry_toolchange": False,
|
|
|
- "geometry_toolchangez": 15.0,
|
|
|
- "geometry_endz": 15.0,
|
|
|
- "geometry_endxy": None,
|
|
|
-
|
|
|
- "geometry_feedrate": 120,
|
|
|
- "geometry_feedrate_z": 60,
|
|
|
- "geometry_spindlespeed": 0,
|
|
|
- "geometry_dwell": False,
|
|
|
- "geometry_dwelltime": 1,
|
|
|
- "geometry_ppname_g": 'default',
|
|
|
-
|
|
|
- # Geometry Advanced Options
|
|
|
- "geometry_toolchangexy": "0.0, 0.0",
|
|
|
- "geometry_startz": None,
|
|
|
- "geometry_feedrate_rapid": 1500,
|
|
|
- "geometry_extracut": False,
|
|
|
- "geometry_extracut_length": 0.1,
|
|
|
- "geometry_z_pdepth": -0.02,
|
|
|
- "geometry_f_plunge": False,
|
|
|
- "geometry_spindledir": 'CW',
|
|
|
- "geometry_feedrate_probe": 75,
|
|
|
- "geometry_segx": 0.0,
|
|
|
- "geometry_segy": 0.0,
|
|
|
-
|
|
|
- # Geometry Editor
|
|
|
- "geometry_editor_sel_limit": 30,
|
|
|
- "geometry_editor_milling_type": "cl",
|
|
|
-
|
|
|
- # CNC Job General
|
|
|
- "cncjob_plot": True,
|
|
|
- "cncjob_plot_kind": 'all',
|
|
|
- "cncjob_annotation": True,
|
|
|
- "cncjob_tooldia": 1.0,
|
|
|
- "cncjob_coords_type": "G90",
|
|
|
- "cncjob_coords_decimals": 4,
|
|
|
- "cncjob_fr_decimals": 2,
|
|
|
- "cncjob_steps_per_circle": 64,
|
|
|
- "cncjob_footer": False,
|
|
|
- "cncjob_line_ending": False,
|
|
|
- "cncjob_save_filters": "G-Code Files .nc (*.nc);;G-Code Files .din (*.din);;G-Code Files .dnc (*.dnc);;"
|
|
|
- "G-Code Files .ecs (*.ecs);;G-Code Files .eia (*.eia);;G-Code Files .fan (*.fan);;"
|
|
|
- "G-Code Files .fgc (*.fgc);;G-Code Files .fnc (*.fnc);;G-Code Files . gc (*.gc);;"
|
|
|
- "G-Code Files .gcd (*.gcd);;G-Code Files .gcode (*.gcode);;G-Code Files .h (*.h);;"
|
|
|
- "G-Code Files .hnc (*.hnc);;G-Code Files .i (*.i);;G-Code Files .min (*.min);;"
|
|
|
- "G-Code Files .mpf (*.mpf);;G-Code Files .mpr (*.mpr);;G-Code Files .cnc (*.cnc);;"
|
|
|
- "G-Code Files .ncc (*.ncc);;G-Code Files .ncg (*.ncg);;G-Code Files .ncp (*.ncp);;"
|
|
|
- "G-Code Files .ngc (*.ngc);;G-Code Files .out (*.out);;G-Code Files .ply (*.ply);;"
|
|
|
- "G-Code Files .sbp (*.sbp);;G-Code Files .tap (*.tap);;G-Code Files .xpi (*.xpi);;"
|
|
|
- "All Files (*.*)",
|
|
|
- "cncjob_plot_line": '#4650BDFF',
|
|
|
- "cncjob_plot_fill": '#5E6CFFFF',
|
|
|
- "cncjob_travel_line": '#B5AB3A4C',
|
|
|
- "cncjob_travel_fill": '#F0E24D4C',
|
|
|
-
|
|
|
- # CNC Job Options
|
|
|
- "cncjob_prepend": "",
|
|
|
- "cncjob_append": "",
|
|
|
-
|
|
|
- # CNC Job Advanced Options
|
|
|
- "cncjob_toolchange_macro": "",
|
|
|
- "cncjob_toolchange_macro_enable": False,
|
|
|
- "cncjob_annotation_fontsize": 9,
|
|
|
- "cncjob_annotation_fontcolor": '#990000',
|
|
|
-
|
|
|
- # NCC Tool
|
|
|
- "tools_ncctools": "1.0, 0.5",
|
|
|
- "tools_nccorder": 'rev',
|
|
|
- "tools_nccoperation": 'clear',
|
|
|
- "tools_nccoverlap": 40,
|
|
|
- "tools_nccmargin": 1.0,
|
|
|
- "tools_nccmethod": _("Seed"),
|
|
|
- "tools_nccconnect": True,
|
|
|
- "tools_ncccontour": True,
|
|
|
- "tools_nccrest": False,
|
|
|
- "tools_ncc_offset_choice": False,
|
|
|
- "tools_ncc_offset_value": 0.0000,
|
|
|
- "tools_nccref": _('Itself'),
|
|
|
- "tools_ncc_area_shape": "square",
|
|
|
- "tools_ncc_plotting": 'normal',
|
|
|
- "tools_nccmilling_type": 'cl',
|
|
|
- "tools_ncctool_type": 'C1',
|
|
|
- "tools_ncccutz": -0.05,
|
|
|
- "tools_ncctipdia": 0.1,
|
|
|
- "tools_ncctipangle": 30,
|
|
|
- "tools_nccnewdia": 0.1,
|
|
|
-
|
|
|
- # Cutout Tool
|
|
|
- "tools_cutouttooldia": 2.4,
|
|
|
- "tools_cutoutkind": "single",
|
|
|
- "tools_cutoutmargin": 0.1,
|
|
|
- "tools_cutout_z": -1.8,
|
|
|
- "tools_cutout_depthperpass": 0.6,
|
|
|
- "tools_cutout_mdepth": True,
|
|
|
- "tools_cutoutgapsize": 4,
|
|
|
- "tools_gaps_ff": "4",
|
|
|
- "tools_cutout_convexshape": False,
|
|
|
-
|
|
|
- # Paint Tool
|
|
|
- "tools_painttooldia": 0.3,
|
|
|
- "tools_paintorder": 'rev',
|
|
|
- "tools_paintoverlap": 20,
|
|
|
- "tools_paintmargin": 0.0,
|
|
|
- "tools_paintmethod": _("Seed"),
|
|
|
- "tools_selectmethod": _("All Polygons"),
|
|
|
- "tools_paint_area_shape": "square",
|
|
|
- "tools_pathconnect": True,
|
|
|
- "tools_paintcontour": True,
|
|
|
- "tools_paint_plotting": 'normal',
|
|
|
- "tools_paintrest": False,
|
|
|
- "tools_painttool_type": 'C1',
|
|
|
- "tools_paintcutz": -0.05,
|
|
|
- "tools_painttipdia": 0.1,
|
|
|
- "tools_painttipangle": 30,
|
|
|
- "tools_paintnewdia": 0.1,
|
|
|
-
|
|
|
- # 2-Sided Tool
|
|
|
- "tools_2sided_mirror_axis": "X",
|
|
|
- "tools_2sided_axis_loc": "point",
|
|
|
- "tools_2sided_drilldia": 3.125,
|
|
|
- "tools_2sided_allign_axis": "X",
|
|
|
-
|
|
|
- # Film Tool
|
|
|
- "tools_film_type": 'neg',
|
|
|
- "tools_film_boundary": 1.0,
|
|
|
- "tools_film_scale_stroke": 0,
|
|
|
- "tools_film_color": '#000000',
|
|
|
- "tools_film_scale_cb": False,
|
|
|
- "tools_film_scale_x_entry": 1.0,
|
|
|
- "tools_film_scale_y_entry": 1.0,
|
|
|
- "tools_film_skew_cb": False,
|
|
|
- "tools_film_skew_x_entry": 0.0,
|
|
|
- "tools_film_skew_y_entry": 0.0,
|
|
|
- "tools_film_skew_ref_radio": 'bottomleft',
|
|
|
- "tools_film_mirror_cb": False,
|
|
|
- "tools_film_mirror_axis_radio": 'none',
|
|
|
- "tools_film_file_type_radio": 'svg',
|
|
|
- "tools_film_orientation": 'p',
|
|
|
- "tools_film_pagesize": 'A4',
|
|
|
-
|
|
|
- # Panel Tool
|
|
|
- "tools_panelize_spacing_columns": 0,
|
|
|
- "tools_panelize_spacing_rows": 0,
|
|
|
- "tools_panelize_columns": 1,
|
|
|
- "tools_panelize_rows": 1,
|
|
|
- "tools_panelize_constrain": False,
|
|
|
- "tools_panelize_constrainx": 200.0,
|
|
|
- "tools_panelize_constrainy": 290.0,
|
|
|
- "tools_panelize_panel_type": 'gerber',
|
|
|
-
|
|
|
- # Calculators Tool
|
|
|
- "tools_calc_vshape_tip_dia": 0.2,
|
|
|
- "tools_calc_vshape_tip_angle": 30,
|
|
|
- "tools_calc_vshape_cut_z": 0.05,
|
|
|
- "tools_calc_electro_length": 10.0,
|
|
|
- "tools_calc_electro_width": 10.0,
|
|
|
- "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,
|
|
|
- "tools_transform_scale_x": 1.0,
|
|
|
- "tools_transform_scale_y": 1.0,
|
|
|
- "tools_transform_scale_link": True,
|
|
|
- "tools_transform_scale_reference": True,
|
|
|
- "tools_transform_offset_x": 0.0,
|
|
|
- "tools_transform_offset_y": 0.0,
|
|
|
- "tools_transform_mirror_reference": False,
|
|
|
- "tools_transform_mirror_point": (0, 0),
|
|
|
- "tools_transform_buffer_dis": 0.0,
|
|
|
- "tools_transform_buffer_factor": 100.0,
|
|
|
- "tools_transform_buffer_corner": True,
|
|
|
-
|
|
|
- # SolderPaste Tool
|
|
|
- "tools_solderpaste_tools": "1.0, 0.3",
|
|
|
- "tools_solderpaste_new": 0.3,
|
|
|
- "tools_solderpaste_z_start": 0.05,
|
|
|
- "tools_solderpaste_z_dispense": 0.1,
|
|
|
- "tools_solderpaste_z_stop": 0.05,
|
|
|
- "tools_solderpaste_z_travel": 0.1,
|
|
|
- "tools_solderpaste_z_toolchange": 1.0,
|
|
|
- "tools_solderpaste_xy_toolchange": "0.0, 0.0",
|
|
|
- "tools_solderpaste_frxy": 150,
|
|
|
- "tools_solderpaste_frz": 150,
|
|
|
- "tools_solderpaste_frz_dispense": 1.0,
|
|
|
- "tools_solderpaste_speedfwd": 300,
|
|
|
- "tools_solderpaste_dwellfwd": 1,
|
|
|
- "tools_solderpaste_speedrev": 200,
|
|
|
- "tools_solderpaste_dwellrev": 1,
|
|
|
- "tools_solderpaste_pp": 'Paste_1',
|
|
|
-
|
|
|
- # Subtract Tool
|
|
|
- "tools_sub_close_paths": True,
|
|
|
-
|
|
|
- # Distance Tool
|
|
|
- "tools_dist_snap_center": False,
|
|
|
-
|
|
|
- # ########################################################################################################
|
|
|
- # ################################ TOOLS 2 ###############################################################
|
|
|
- # ########################################################################################################
|
|
|
-
|
|
|
- # Optimal Tool
|
|
|
- "tools_opt_precision": 4,
|
|
|
-
|
|
|
- # Check Rules Tool
|
|
|
- "tools_cr_trace_size": True,
|
|
|
- "tools_cr_trace_size_val": 0.25,
|
|
|
- "tools_cr_c2c": True,
|
|
|
- "tools_cr_c2c_val": 0.25,
|
|
|
- "tools_cr_c2o": True,
|
|
|
- "tools_cr_c2o_val": 1.0,
|
|
|
- "tools_cr_s2s": True,
|
|
|
- "tools_cr_s2s_val": 0.25,
|
|
|
- "tools_cr_s2sm": True,
|
|
|
- "tools_cr_s2sm_val": 0.25,
|
|
|
- "tools_cr_s2o": True,
|
|
|
- "tools_cr_s2o_val": 1.0,
|
|
|
- "tools_cr_sm2sm": True,
|
|
|
- "tools_cr_sm2sm_val": 0.25,
|
|
|
- "tools_cr_ri": True,
|
|
|
- "tools_cr_ri_val": 0.3,
|
|
|
- "tools_cr_h2h": True,
|
|
|
- "tools_cr_h2h_val": 0.3,
|
|
|
- "tools_cr_dh": True,
|
|
|
- "tools_cr_dh_val": 0.3,
|
|
|
-
|
|
|
- # QRCode Tool
|
|
|
- "tools_qrcode_version": 1,
|
|
|
- "tools_qrcode_error": 'L',
|
|
|
- "tools_qrcode_box_size": 3,
|
|
|
- "tools_qrcode_border_size": 4,
|
|
|
- "tools_qrcode_qrdata": '',
|
|
|
- "tools_qrcode_polarity": 'pos',
|
|
|
- "tools_qrcode_rounded": 's',
|
|
|
- "tools_qrcode_fill_color": '#000000',
|
|
|
- "tools_qrcode_back_color": '#FFFFFF',
|
|
|
- "tools_qrcode_sel_limit": 330,
|
|
|
-
|
|
|
- # Copper Thieving Tool
|
|
|
- "tools_copper_thieving_clearance": 0.25,
|
|
|
- "tools_copper_thieving_margin": 1.0,
|
|
|
- "tools_copper_thieving_reference": 'itself',
|
|
|
- "tools_copper_thieving_box_type": 'rect',
|
|
|
- "tools_copper_thieving_circle_steps": 64,
|
|
|
- "tools_copper_thieving_fill_type": 'solid',
|
|
|
- "tools_copper_thieving_dots_dia": 1.0,
|
|
|
- "tools_copper_thieving_dots_spacing": 2.0,
|
|
|
- "tools_copper_thieving_squares_size": 1.0,
|
|
|
- "tools_copper_thieving_squares_spacing": 2.0,
|
|
|
- "tools_copper_thieving_lines_size": 0.25,
|
|
|
- "tools_copper_thieving_lines_spacing": 2.0,
|
|
|
- "tools_copper_thieving_rb_margin": 1.0,
|
|
|
- "tools_copper_thieving_rb_thickness": 1.0,
|
|
|
- "tools_copper_thieving_mask_clearance": 0.0,
|
|
|
-
|
|
|
- # Fiducials Tool
|
|
|
- "tools_fiducials_dia": 1.0,
|
|
|
- "tools_fiducials_margin": 1.0,
|
|
|
- "tools_fiducials_mode": 'auto',
|
|
|
- "tools_fiducials_second_pos": 'up',
|
|
|
- "tools_fiducials_type": 'circular',
|
|
|
- "tools_fiducials_line_thickness": 0.25,
|
|
|
-
|
|
|
- # Calibration Tool
|
|
|
- "tools_cal_calsource": 'object',
|
|
|
- "tools_cal_travelz": 2.0,
|
|
|
- "tools_cal_verz": 0.1,
|
|
|
- "tools_cal_zeroz": False,
|
|
|
- "tools_cal_toolchangez": 15,
|
|
|
- "tools_cal_toolchange_xy": '',
|
|
|
- "tools_cal_sec_point": 'tl',
|
|
|
-
|
|
|
- # Drills Extraction Tool
|
|
|
- "tools_edrills_hole_type": 'fixed',
|
|
|
- "tools_edrills_hole_fixed_dia": 0.5,
|
|
|
- "tools_edrills_hole_prop_factor": 80.0,
|
|
|
- "tools_edrills_circular_ring": 0.2,
|
|
|
- "tools_edrills_oblong_ring": 0.2,
|
|
|
- "tools_edrills_square_ring": 0.2,
|
|
|
- "tools_edrills_rectangular_ring": 0.2,
|
|
|
- "tools_edrills_others_ring": 0.2,
|
|
|
- "tools_edrills_circular": True,
|
|
|
- "tools_edrills_oblong": False,
|
|
|
- "tools_edrills_square": False,
|
|
|
- "tools_edrills_rectangular": False,
|
|
|
- "tools_edrills_others": False,
|
|
|
-
|
|
|
- # Punch Gerber Tool
|
|
|
- "tools_punch_hole_type": 'exc',
|
|
|
- "tools_punch_hole_fixed_dia": 0.5,
|
|
|
- "tools_punch_hole_prop_factor": 80.0,
|
|
|
- "tools_punch_circular_ring": 0.2,
|
|
|
- "tools_punch_oblong_ring": 0.2,
|
|
|
- "tools_punch_square_ring": 0.2,
|
|
|
- "tools_punch_rectangular_ring": 0.2,
|
|
|
- "tools_punch_others_ring": 0.2,
|
|
|
- "tools_punch_circular": True,
|
|
|
- "tools_punch_oblong": False,
|
|
|
- "tools_punch_square": True,
|
|
|
- "tools_punch_rectangular": False,
|
|
|
- "tools_punch_others": False,
|
|
|
-
|
|
|
- # Align Objects Tool
|
|
|
- "tools_align_objects_align_type": 'sp',
|
|
|
-
|
|
|
- # Invert Gerber Tool
|
|
|
- "tools_invert_margin": 0.1,
|
|
|
- "tools_invert_join_style": 's',
|
|
|
-
|
|
|
- # Utilities
|
|
|
- # file associations
|
|
|
- "fa_excellon": 'drd, drill, drl, exc, ncd, tap, xln',
|
|
|
- "fa_gcode": 'cnc, din, dnc, ecs, eia, fan, fgc, fnc, gc, gcd, gcode, h, hnc, i, min, mpf, mpr, nc, ncc, '
|
|
|
- 'ncg, ncp, ngc, out, ply, rol, sbp, tap, xpi',
|
|
|
- "fa_gerber": 'art, bot, bsm, cmp, crc, crs, dim, gb0, gb1, gb2, gb3, gb4, gb5, gb6, gb7, gb8, gb9, gbd, '
|
|
|
- 'gbl, gbo, gbp, gbr, gbs, gdo, ger, gko, gm1, gm2, gm3, grb, gtl, gto, gtp, gts, ly15, ly2, '
|
|
|
- 'mil, outline, pho, plc, pls, smb, smt, sol, spb, spt, ssb, sst, stc, sts, top, tsm',
|
|
|
- # Keyword list
|
|
|
- "util_autocomplete_keywords": 'Desktop, Documents, FlatConfig, FlatPrj, False, '
|
|
|
- 'Marius, My Documents, Paste_1, '
|
|
|
- 'Repetier, Roland_MDX_20, True, Users, Toolchange_Custom, '
|
|
|
- 'Toolchange_Probe_MACH3, '
|
|
|
- 'Toolchange_manual, Users, all, axis, auto, axisoffset, '
|
|
|
- 'box, center_x, center_y, columns, combine, connect, contour, default, '
|
|
|
- 'depthperpass, dia, diatol, dist, drilled_dias, drillz, dpp, dwelltime, '
|
|
|
- 'endxy, endz, extracut_length, f, feedrate, '
|
|
|
- 'feedrate_z, grbl_11, GRBL_laser, gridoffsety, gridx, gridy, has_offset, '
|
|
|
- 'holes, hpgl, iso_type, line_xyz, margin, marlin, method, milled_dias, '
|
|
|
- 'minoffset, name, offset, opt_type, order, outname, overlap, '
|
|
|
- 'passes, postamble, pp, ppname_e, ppname_g, preamble, radius, ref, rest, '
|
|
|
- 'rows, shellvar_, scale_factor, spacing_columns, spacing_rows, spindlespeed, '
|
|
|
- 'startz, startxy, toolchange_xy, toolchangez, '
|
|
|
- 'tooldia, travelz, use_threads, value, x, x0, x1, y, y0, y1, z_cut, '
|
|
|
- 'z_move',
|
|
|
- "script_autocompleter": True,
|
|
|
- "script_text": "",
|
|
|
- "script_plot": True,
|
|
|
- "script_source_file": "",
|
|
|
-
|
|
|
- "document_autocompleter": False,
|
|
|
- "document_text": "",
|
|
|
- "document_plot": True,
|
|
|
- "document_source_file": "",
|
|
|
- "document_font_color": '#000000',
|
|
|
- "document_sel_color": '#0055ff',
|
|
|
- "document_font_size": 6,
|
|
|
- "document_tab_size": 80,
|
|
|
- })
|
|
|
-
|
|
|
- # ###########################################################################################################
|
|
|
- # ################################# Load defaults from file #################################################
|
|
|
- # ###########################################################################################################
|
|
|
- self.old_defaults_found = False
|
|
|
-
|
|
|
- if user_defaults:
|
|
|
- self.load_defaults(filename='current_defaults')
|
|
|
+ if self.defaults["global_gray_icons"] is False:
|
|
|
+ self.resource_location = 'share'
|
|
|
+ else:
|
|
|
+ self.resource_location = 'share/dark_resources'
|
|
|
|
|
|
if self.defaults['units'] == 'MM':
|
|
|
self.decimals = int(self.defaults['decimals_metric'])
|
|
|
else:
|
|
|
self.decimals = int(self.defaults['decimals_inch'])
|
|
|
+ self.current_units = self.defaults['units']
|
|
|
|
|
|
- if self.defaults["global_gray_icons"] is False:
|
|
|
- self.resource_location = 'share'
|
|
|
- else:
|
|
|
- self.resource_location = 'share/dark_resources'
|
|
|
|
|
|
- self.current_units = self.defaults['units']
|
|
|
|
|
|
- # store here the current self.defaults so it can be restored if Preferences changes are cancelled
|
|
|
- self.current_defaults = {}
|
|
|
- self.current_defaults.update(self.defaults)
|
|
|
|
|
|
# ###########################################################################################################
|
|
|
# #################################### SETUP OBJECT CLASSES #################################################
|
|
|
@@ -2918,10 +2268,11 @@ class App(QtCore.QObject):
|
|
|
if App.args:
|
|
|
self.args_at_startup.emit(App.args)
|
|
|
|
|
|
- if self.old_defaults_found is True:
|
|
|
+
|
|
|
+ if self.fcDefaults.old_defaults_found is True:
|
|
|
self.inform.emit('[WARNING_NOTCL] %s' % _("Found old default preferences files. "
|
|
|
"Please reboot the application to update."))
|
|
|
- self.old_defaults_found = False
|
|
|
+ self.fcDefaults.old_defaults_found = False
|
|
|
|
|
|
# ######################################### INIT FINISHED #######################################################
|
|
|
# #################################################################################################################
|
|
|
@@ -2929,6 +2280,26 @@ class App(QtCore.QObject):
|
|
|
# #################################################################################################################
|
|
|
# #################################################################################################################
|
|
|
# #################################################################################################################
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
@staticmethod
|
|
|
def copy_and_overwrite(from_path, to_path):
|
|
|
@@ -3803,80 +3174,6 @@ class App(QtCore.QObject):
|
|
|
else:
|
|
|
self.ui.toolbarshell.setVisible(False)
|
|
|
|
|
|
- def load_defaults(self, filename):
|
|
|
- """
|
|
|
- Loads the aplication's default settings from current_defaults.FlatConfig into
|
|
|
- ``self.defaults``.
|
|
|
-
|
|
|
- :return: None
|
|
|
- """
|
|
|
- try:
|
|
|
- f = open(self.data_path + "/" + filename + ".FlatConfig")
|
|
|
- options = f.read()
|
|
|
- f.close()
|
|
|
- except IOError:
|
|
|
- self.log.error("Could not load defaults file.")
|
|
|
- self.inform.emit('[ERROR] %s' % _("Could not load defaults file."))
|
|
|
- # in case the defaults file can't be loaded, show all toolbars
|
|
|
- self.defaults["global_toolbar_view"] = 511
|
|
|
- return
|
|
|
-
|
|
|
- try:
|
|
|
- defaults = json.loads(options)
|
|
|
- except Exception:
|
|
|
- # in case the defaults file can't be loaded, show all toolbars
|
|
|
- self.defaults["global_toolbar_view"] = 511
|
|
|
- e = sys.exc_info()[0]
|
|
|
- App.log.error(str(e))
|
|
|
- self.inform.emit('[ERROR] %s' % _("Failed to parse defaults file."))
|
|
|
- return
|
|
|
-
|
|
|
- if defaults:
|
|
|
- if 'version' not in defaults or defaults['version'] != self.defaults['version']:
|
|
|
- for k, v in defaults.items():
|
|
|
- if k in self.defaults and k != 'version':
|
|
|
-
|
|
|
- # check if the types are the same. Because some types (tuple, float, int etc)
|
|
|
- # may be stored as strings we check their types.
|
|
|
- try:
|
|
|
- target = eval(self.defaults[k])
|
|
|
- except NameError:
|
|
|
- # it's an unknown string leave it as it is
|
|
|
- target = deepcopy(self.defaults[k])
|
|
|
-
|
|
|
- try:
|
|
|
- source = eval(v)
|
|
|
- except NameError:
|
|
|
- # it's an unknown string leave it as it is
|
|
|
- source = deepcopy(v)
|
|
|
-
|
|
|
- if type(target) == type(source):
|
|
|
- self.defaults[k] = v
|
|
|
-
|
|
|
- # delete old factory defaults
|
|
|
- try:
|
|
|
- fact_def_file_path = os.path.join(self.data_path, 'factory_defaults.FlatConfig')
|
|
|
- os.chmod(fact_def_file_path, stat.S_IRWXO | stat.S_IWRITE | stat.S_IWGRP)
|
|
|
- os.remove(fact_def_file_path)
|
|
|
-
|
|
|
- # recreate a new factory defaults file and save the factory defaults data into it
|
|
|
- f_f_def_s = open(self.data_path + "/factory_defaults.FlatConfig", "w")
|
|
|
- json.dump(self.defaults, f_f_def_s, default=to_dict, indent=2, sort_keys=True)
|
|
|
- f_f_def_s.close()
|
|
|
-
|
|
|
- # and then make the factory_defaults.FlatConfig file read_only
|
|
|
- # so it can't be modified after creation.
|
|
|
- os.chmod(fact_def_file_path, S_IREAD | S_IRGRP | S_IROTH)
|
|
|
- except Exception as e:
|
|
|
- log.debug("App.load_defaults() -> deleting old factory defaults file -> %s" % str(e))
|
|
|
-
|
|
|
- self.old_defaults_found = True
|
|
|
- else:
|
|
|
- self.old_defaults_found = False
|
|
|
- self.defaults.update(defaults)
|
|
|
-
|
|
|
- log.debug("FlatCAM defaults loaded from: %s" % filename)
|
|
|
-
|
|
|
def on_restore_defaults_preferences(self):
|
|
|
"""
|
|
|
Loads the application's factory default settings from factory_defaults.FlatConfig into
|
|
|
@@ -3927,6 +3224,7 @@ class App(QtCore.QObject):
|
|
|
self.report_usage("on_import_preferences")
|
|
|
App.log.debug("App.on_import_preferences()")
|
|
|
|
|
|
+ # Show file chooser
|
|
|
filter_ = "Config File (*.FlatConfig);;All Files (*.*)"
|
|
|
try:
|
|
|
filename, _f = QtWidgets.QFileDialog.getOpenFileName(caption=_("Import FlatCAM Preferences"),
|
|
|
@@ -3935,35 +3233,16 @@ class App(QtCore.QObject):
|
|
|
except TypeError:
|
|
|
filename, _f = QtWidgets.QFileDialog.getOpenFileName(caption=_("Import FlatCAM Preferences"),
|
|
|
filter=filter_)
|
|
|
-
|
|
|
filename = str(filename)
|
|
|
-
|
|
|
if filename == "":
|
|
|
self.inform.emit('[WARNING_NOTCL] %s' % _("Cancelled."))
|
|
|
- else:
|
|
|
- try:
|
|
|
- f = open(filename)
|
|
|
- options = f.read()
|
|
|
- f.close()
|
|
|
- except IOError:
|
|
|
- self.log.error("Could not load defaults file.")
|
|
|
- self.inform.emit('[ERROR_NOTCL] %s' % _("Could not load defaults file."))
|
|
|
- return
|
|
|
+ return
|
|
|
|
|
|
- try:
|
|
|
- defaults_from_file = json.loads(options)
|
|
|
- except Exception:
|
|
|
- e = sys.exc_info()[0]
|
|
|
- App.log.error(str(e))
|
|
|
- self.inform.emit('[ERROR_NOTCL] %s' % _("Failed to parse defaults file."))
|
|
|
- return
|
|
|
- self.defaults.update(defaults_from_file)
|
|
|
- # update the dict that is used to restore the values in the defaults form if Cancel is clicked in the
|
|
|
- # Preferences window
|
|
|
- self.current_defaults.update(defaults_from_file)
|
|
|
+ # Load in the defaults from the chosen file
|
|
|
+ self.fcDefaults.load_defaults(filename=filename)
|
|
|
|
|
|
- self.on_preferences_edited()
|
|
|
- self.inform.emit('[success] %s: %s' % (_("Imported Defaults from"), filename))
|
|
|
+ self.on_preferences_edited()
|
|
|
+ self.inform.emit('[success] %s: %s' % (_("Imported Defaults from"), filename))
|
|
|
|
|
|
def on_export_preferences(self):
|
|
|
"""
|
|
|
@@ -7584,8 +6863,7 @@ class App(QtCore.QObject):
|
|
|
except Exception as e:
|
|
|
return "Operation failed: %s" % str(e)
|
|
|
|
|
|
- def on_paste_command(self):
|
|
|
- pass
|
|
|
+
|
|
|
|
|
|
def on_copy_object2(self, custom_name):
|
|
|
|