|
|
@@ -6,7 +6,9 @@
|
|
|
# MIT Licence #
|
|
|
# ###########################################################
|
|
|
|
|
|
-import urllib.request, urllib.parse, urllib.error
|
|
|
+import urllib.request
|
|
|
+import urllib.parse
|
|
|
+import urllib.error
|
|
|
import getopt
|
|
|
import random
|
|
|
import simplejson as json
|
|
|
@@ -19,7 +21,6 @@ import subprocess
|
|
|
import tkinter as tk
|
|
|
from PyQt5 import QtPrintSupport
|
|
|
|
|
|
-import urllib.request, urllib.parse, urllib.error
|
|
|
from contextlib import contextmanager
|
|
|
import gc
|
|
|
|
|
|
@@ -96,8 +97,8 @@ class App(QtCore.QObject):
|
|
|
# ####################################
|
|
|
# Version and VERSION DATE ###########
|
|
|
# ####################################
|
|
|
- version = 8.93
|
|
|
- version_date = "2019/08/10"
|
|
|
+ version = 8.94
|
|
|
+ version_date = "2019/08/31"
|
|
|
beta = True
|
|
|
|
|
|
# current date now
|
|
|
@@ -221,7 +222,7 @@ class App(QtCore.QObject):
|
|
|
os.makedirs(os.path.join(self.data_path, 'postprocessors'))
|
|
|
App.log.debug('Created data postprocessors folder: ' + os.path.join(self.data_path, 'postprocessors'))
|
|
|
|
|
|
- self.postprocessorpaths = os.path.join(self.data_path,'postprocessors')
|
|
|
+ self.postprocessorpaths = os.path.join(self.data_path, 'postprocessors')
|
|
|
if not os.path.exists(self.postprocessorpaths):
|
|
|
os.makedirs(self.postprocessorpaths)
|
|
|
App.log.debug('Created postprocessors folder: ' + self.postprocessorpaths)
|
|
|
@@ -295,7 +296,7 @@ class App(QtCore.QObject):
|
|
|
|
|
|
QtCore.QObject.__init__(self)
|
|
|
self.ui = FlatCAMGUI(self.version, self.beta, self)
|
|
|
- self.set_ui_title(name="New Project")
|
|
|
+ self.set_ui_title(name=_("New Project - Not saved"))
|
|
|
|
|
|
self.ui.geom_update[int, int, int, int, int].connect(self.save_geometry)
|
|
|
self.ui.final_save.connect(self.final_save)
|
|
|
@@ -362,6 +363,7 @@ 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,
|
|
|
+
|
|
|
# Gerber General
|
|
|
"gerber_plot": self.ui.gerber_defaults_form.gerber_gen_group.plot_cb,
|
|
|
"gerber_solid": self.ui.gerber_defaults_form.gerber_gen_group.solid_cb,
|
|
|
@@ -397,10 +399,14 @@ class App(QtCore.QObject):
|
|
|
# Excellon General
|
|
|
"excellon_plot": self.ui.excellon_defaults_form.excellon_gen_group.plot_cb,
|
|
|
"excellon_solid": self.ui.excellon_defaults_form.excellon_gen_group.solid_cb,
|
|
|
- "excellon_format_upper_in": self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_upper_in_entry,
|
|
|
- "excellon_format_lower_in": self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_lower_in_entry,
|
|
|
- "excellon_format_upper_mm": self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_upper_mm_entry,
|
|
|
- "excellon_format_lower_mm": self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_lower_mm_entry,
|
|
|
+ "excellon_format_upper_in":
|
|
|
+ self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_upper_in_entry,
|
|
|
+ "excellon_format_lower_in":
|
|
|
+ self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_lower_in_entry,
|
|
|
+ "excellon_format_upper_mm":
|
|
|
+ self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_upper_mm_entry,
|
|
|
+ "excellon_format_lower_mm":
|
|
|
+ self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_lower_mm_entry,
|
|
|
"excellon_zeros": self.ui.excellon_defaults_form.excellon_gen_group.excellon_zeros_radio,
|
|
|
"excellon_units": self.ui.excellon_defaults_form.excellon_gen_group.excellon_units_radio,
|
|
|
"excellon_optimization_type": self.ui.excellon_defaults_form.excellon_gen_group.excellon_optimization_radio,
|
|
|
@@ -513,6 +519,8 @@ class App(QtCore.QObject):
|
|
|
"tools_nccconnect": self.ui.tools_defaults_form.tools_ncc_group.ncc_connect_cb,
|
|
|
"tools_ncccontour": self.ui.tools_defaults_form.tools_ncc_group.ncc_contour_cb,
|
|
|
"tools_nccrest": self.ui.tools_defaults_form.tools_ncc_group.ncc_rest_cb,
|
|
|
+ "tools_ncc_offset_choice": self.ui.tools_defaults_form.tools_ncc_group.ncc_choice_offset_cb,
|
|
|
+ "tools_ncc_offset_value": self.ui.tools_defaults_form.tools_ncc_group.ncc_offset_spinner,
|
|
|
"tools_nccref": self.ui.tools_defaults_form.tools_ncc_group.reference_radio,
|
|
|
|
|
|
# CutOut Tool
|
|
|
@@ -590,7 +598,8 @@ class App(QtCore.QObject):
|
|
|
"tools_solderpaste_dwellfwd": self.ui.tools_defaults_form.tools_solderpaste_group.dwellfwd_entry,
|
|
|
"tools_solderpaste_speedrev": self.ui.tools_defaults_form.tools_solderpaste_group.speedrev_entry,
|
|
|
"tools_solderpaste_dwellrev": self.ui.tools_defaults_form.tools_solderpaste_group.dwellrev_entry,
|
|
|
- "tools_solderpaste_pp": self.ui.tools_defaults_form.tools_solderpaste_group.pp_combo
|
|
|
+ "tools_solderpaste_pp": self.ui.tools_defaults_form.tools_solderpaste_group.pp_combo,
|
|
|
+ "tools_sub_close_paths": self.ui.tools_defaults_form.tools_sub_group.close_paths_cb
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -684,6 +693,7 @@ class App(QtCore.QObject):
|
|
|
"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.
|
|
|
@@ -702,6 +712,7 @@ class App(QtCore.QObject):
|
|
|
"global_hover": False,
|
|
|
"global_selection_shape": True,
|
|
|
"global_layout": "compact",
|
|
|
+
|
|
|
# Gerber General
|
|
|
"gerber_plot": True,
|
|
|
"gerber_solid": True,
|
|
|
@@ -853,6 +864,8 @@ class App(QtCore.QObject):
|
|
|
"tools_nccconnect": True,
|
|
|
"tools_ncccontour": True,
|
|
|
"tools_nccrest": False,
|
|
|
+ "tools_ncc_offset_choice": False,
|
|
|
+ "tools_ncc_offset_value": 0.0000,
|
|
|
"tools_nccref": 'itself',
|
|
|
|
|
|
"tools_cutouttooldia": 0.00393701,
|
|
|
@@ -922,7 +935,9 @@ class App(QtCore.QObject):
|
|
|
"tools_solderpaste_dwellfwd": 1,
|
|
|
"tools_solderpaste_speedrev": 10,
|
|
|
"tools_solderpaste_dwellrev": 1,
|
|
|
- "tools_solderpaste_pp": 'Paste_1'
|
|
|
+ "tools_solderpaste_pp": 'Paste_1',
|
|
|
+
|
|
|
+ "tools_sub_close_paths": True
|
|
|
})
|
|
|
|
|
|
# ##############################
|
|
|
@@ -1513,7 +1528,6 @@ class App(QtCore.QObject):
|
|
|
self.ui.general_defaults_form.general_app_group.units_radio.activated_custom.connect(
|
|
|
lambda: self.on_toggle_units(no_pref=False))
|
|
|
|
|
|
-
|
|
|
# ##############################
|
|
|
# ### GUI PREFERENCES SIGNALS ##
|
|
|
# ##############################
|
|
|
@@ -2084,7 +2098,7 @@ class App(QtCore.QObject):
|
|
|
('BETA' if self.beta else ''),
|
|
|
platform.architecture()[0],
|
|
|
name)
|
|
|
- )
|
|
|
+ )
|
|
|
|
|
|
def defaults_read_form(self):
|
|
|
for option in self.defaults_form_fields:
|
|
|
@@ -2514,7 +2528,7 @@ class App(QtCore.QObject):
|
|
|
:param show: Opens the shell.
|
|
|
:param error: Shows the message as an error.
|
|
|
:param warning: Shows the message as an warning.
|
|
|
- :param warning: Shows the message as an success.
|
|
|
+ :param success: Shows the message as an success.
|
|
|
:param selected: Indicate that something was selected on canvas
|
|
|
:return: None
|
|
|
"""
|
|
|
@@ -3504,6 +3518,10 @@ class App(QtCore.QObject):
|
|
|
settings.setValue('saved_gui_state', self.ui.saveState())
|
|
|
settings.setValue('maximized_gui', self.ui.isMaximized())
|
|
|
settings.setValue('language', self.ui.general_defaults_form.general_app_group.language_cb.get_value())
|
|
|
+ settings.setValue('notebook_font_size',
|
|
|
+ self.ui.general_defaults_form.general_gui_set_group.notebook_font_size_spinner.get_value())
|
|
|
+ settings.setValue('axis_font_size',
|
|
|
+ self.ui.general_defaults_form.general_gui_set_group.axis_font_size_spinner.get_value())
|
|
|
|
|
|
# This will write the setting to the platform specific storage.
|
|
|
del settings
|
|
|
@@ -4150,8 +4168,9 @@ class App(QtCore.QObject):
|
|
|
|
|
|
# Setting plot colors handlers
|
|
|
def on_pf_color_entry(self):
|
|
|
- self.defaults['global_plot_fill'] = self.ui.general_defaults_form.general_gui_group.pf_color_entry.get_value()[:7] + \
|
|
|
- self.defaults['global_plot_fill'][7:9]
|
|
|
+ self.defaults['global_plot_fill'] = \
|
|
|
+ self.ui.general_defaults_form.general_gui_group.pf_color_entry.get_value()[:7] + \
|
|
|
+ self.defaults['global_plot_fill'][7:9]
|
|
|
self.ui.general_defaults_form.general_gui_group.pf_color_button.setStyleSheet(
|
|
|
"background-color:%s" % str(self.defaults['global_plot_fill'])[:7])
|
|
|
|
|
|
@@ -4174,18 +4193,21 @@ class App(QtCore.QObject):
|
|
|
def on_pf_color_spinner(self):
|
|
|
spinner_value = self.ui.general_defaults_form.general_gui_group.pf_color_alpha_spinner.value()
|
|
|
self.ui.general_defaults_form.general_gui_group.pf_color_alpha_slider.setValue(spinner_value)
|
|
|
- self.defaults['global_plot_fill'] = self.defaults['global_plot_fill'][:7] + \
|
|
|
- (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
|
|
|
- self.defaults['global_plot_line'] = self.defaults['global_plot_line'][:7] + \
|
|
|
- (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
|
|
|
+ self.defaults['global_plot_fill'] = \
|
|
|
+ self.defaults['global_plot_fill'][:7] + \
|
|
|
+ (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
|
|
|
+ self.defaults['global_plot_line'] = \
|
|
|
+ self.defaults['global_plot_line'][:7] + \
|
|
|
+ (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
|
|
|
|
|
|
def on_pf_color_slider(self):
|
|
|
slider_value = self.ui.general_defaults_form.general_gui_group.pf_color_alpha_slider.value()
|
|
|
self.ui.general_defaults_form.general_gui_group.pf_color_alpha_spinner.setValue(slider_value)
|
|
|
|
|
|
def on_pl_color_entry(self):
|
|
|
- self.defaults['global_plot_line'] = self.ui.general_defaults_form.general_gui_group.pl_color_entry.get_value()[:7] + \
|
|
|
- self.defaults['global_plot_line'][7:9]
|
|
|
+ self.defaults['global_plot_line'] = \
|
|
|
+ self.ui.general_defaults_form.general_gui_group.pl_color_entry.get_value()[:7] + \
|
|
|
+ self.defaults['global_plot_line'][7:9]
|
|
|
self.ui.general_defaults_form.general_gui_group.pl_color_button.setStyleSheet(
|
|
|
"background-color:%s" % str(self.defaults['global_plot_line'])[:7])
|
|
|
|
|
|
@@ -4208,8 +4230,9 @@ class App(QtCore.QObject):
|
|
|
|
|
|
# Setting selection colors (left - right) handlers
|
|
|
def on_sf_color_entry(self):
|
|
|
- self.defaults['global_sel_fill'] = self.ui.general_defaults_form.general_gui_group.sf_color_entry.get_value()[:7] + \
|
|
|
- self.defaults['global_sel_fill'][7:9]
|
|
|
+ self.defaults['global_sel_fill'] = \
|
|
|
+ self.ui.general_defaults_form.general_gui_group.sf_color_entry.get_value()[:7] + \
|
|
|
+ self.defaults['global_sel_fill'][7:9]
|
|
|
self.ui.general_defaults_form.general_gui_group.sf_color_button.setStyleSheet(
|
|
|
"background-color:%s" % str(self.defaults['global_sel_fill'])[:7])
|
|
|
|
|
|
@@ -4232,18 +4255,21 @@ class App(QtCore.QObject):
|
|
|
def on_sf_color_spinner(self):
|
|
|
spinner_value = self.ui.general_defaults_form.general_gui_group.sf_color_alpha_spinner.value()
|
|
|
self.ui.general_defaults_form.general_gui_group.sf_color_alpha_slider.setValue(spinner_value)
|
|
|
- self.defaults['global_sel_fill'] = self.defaults['global_sel_fill'][:7] + \
|
|
|
- (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
|
|
|
- self.defaults['global_sel_line'] = self.defaults['global_sel_line'][:7] + \
|
|
|
- (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
|
|
|
+ self.defaults['global_sel_fill'] = \
|
|
|
+ self.defaults['global_sel_fill'][:7] + \
|
|
|
+ (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
|
|
|
+ self.defaults['global_sel_line'] = \
|
|
|
+ self.defaults['global_sel_line'][:7] + \
|
|
|
+ (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
|
|
|
|
|
|
def on_sf_color_slider(self):
|
|
|
slider_value = self.ui.general_defaults_form.general_gui_group.sf_color_alpha_slider.value()
|
|
|
self.ui.general_defaults_form.general_gui_group.sf_color_alpha_spinner.setValue(slider_value)
|
|
|
|
|
|
def on_sl_color_entry(self):
|
|
|
- self.defaults['global_sel_line'] = self.ui.general_defaults_form.general_gui_group.sl_color_entry.get_value()[:7] + \
|
|
|
- self.defaults['global_sel_line'][7:9]
|
|
|
+ self.defaults['global_sel_line'] = \
|
|
|
+ self.ui.general_defaults_form.general_gui_group.sl_color_entry.get_value()[:7] + \
|
|
|
+ self.defaults['global_sel_line'][7:9]
|
|
|
self.ui.general_defaults_form.general_gui_group.sl_color_button.setStyleSheet(
|
|
|
"background-color:%s" % str(self.defaults['global_sel_line'])[:7])
|
|
|
|
|
|
@@ -4289,10 +4315,12 @@ class App(QtCore.QObject):
|
|
|
def on_alt_sf_color_spinner(self):
|
|
|
spinner_value = self.ui.general_defaults_form.general_gui_group.alt_sf_color_alpha_spinner.value()
|
|
|
self.ui.general_defaults_form.general_gui_group.alt_sf_color_alpha_slider.setValue(spinner_value)
|
|
|
- self.defaults['global_alt_sel_fill'] = self.defaults['global_alt_sel_fill'][:7] + \
|
|
|
- (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
|
|
|
- self.defaults['global_alt_sel_line'] = self.defaults['global_alt_sel_line'][:7] + \
|
|
|
- (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
|
|
|
+ self.defaults['global_alt_sel_fill'] = \
|
|
|
+ self.defaults['global_alt_sel_fill'][:7] + \
|
|
|
+ (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
|
|
|
+ self.defaults['global_alt_sel_line'] = \
|
|
|
+ self.defaults['global_alt_sel_line'][:7] + \
|
|
|
+ (hex(spinner_value)[2:] if int(hex(spinner_value)[2:], 16) > 0 else '00')
|
|
|
|
|
|
def on_alt_sf_color_slider(self):
|
|
|
slider_value = self.ui.general_defaults_form.general_gui_group.alt_sf_color_alpha_slider.value()
|
|
|
@@ -4599,6 +4627,18 @@ class App(QtCore.QObject):
|
|
|
# Re-fresh project options
|
|
|
self.on_options_app2project()
|
|
|
|
|
|
+ # save the notebook font size
|
|
|
+ settings = QSettings("Open Source", "FlatCAM")
|
|
|
+ fsize = self.ui.general_defaults_form.general_gui_set_group.notebook_font_size_spinner.get_value()
|
|
|
+ settings.setValue('notebook_font_size', fsize)
|
|
|
+
|
|
|
+ # save the axis font size
|
|
|
+ g_fsize = self.ui.general_defaults_form.general_gui_set_group.axis_font_size_spinner.get_value()
|
|
|
+ settings.setValue('axis_font_size', g_fsize)
|
|
|
+
|
|
|
+ # This will write the setting to the platform specific storage.
|
|
|
+ del settings
|
|
|
+
|
|
|
def handlePrint(self):
|
|
|
self.report_usage("handlePrint()")
|
|
|
|
|
|
@@ -4813,7 +4853,6 @@ class App(QtCore.QObject):
|
|
|
self.inform.emit(
|
|
|
_("[WARNING_NOTCL] Adding Tool cancelled ..."))
|
|
|
|
|
|
-
|
|
|
# It's meant to delete tools in tool tables via a 'Delete' shortcut key but only if certain conditions are met
|
|
|
# See description bellow.
|
|
|
def on_delete_keypress(self):
|
|
|
@@ -4861,7 +4900,7 @@ class App(QtCore.QObject):
|
|
|
if self.collection.get_active():
|
|
|
self.log.debug("App.on_delete()")
|
|
|
|
|
|
- while (self.collection.get_active()):
|
|
|
+ while self.collection.get_active():
|
|
|
obj_active = self.collection.get_active()
|
|
|
# if the deleted object is FlatCAMGerber then make sure to delete the possible mark shapes
|
|
|
if isinstance(obj_active, FlatCAMGerber):
|
|
|
@@ -4869,6 +4908,12 @@ class App(QtCore.QObject):
|
|
|
obj_active.mark_shapes[el].clear(update=True)
|
|
|
obj_active.mark_shapes[el].enabled = False
|
|
|
obj_active.mark_shapes[el] = None
|
|
|
+ elif isinstance(obj_active, FlatCAMCNCjob):
|
|
|
+ try:
|
|
|
+ obj_active.annotation.clear(update=True)
|
|
|
+ obj_active.annotation.enabled = False
|
|
|
+ except AttributeError:
|
|
|
+ pass
|
|
|
self.delete_first_selected()
|
|
|
|
|
|
self.inform.emit(_("Object(s) deleted ..."))
|
|
|
@@ -4986,9 +5031,9 @@ class App(QtCore.QObject):
|
|
|
try:
|
|
|
if isinstance(obj, FlatCAMExcellon):
|
|
|
self.new_object("excellon", str(obj_name) + "_copy", initialize_excellon)
|
|
|
- elif isinstance(obj,FlatCAMGerber):
|
|
|
+ elif isinstance(obj, FlatCAMGerber):
|
|
|
self.new_object("gerber", str(obj_name) + "_copy", initialize)
|
|
|
- elif isinstance(obj,FlatCAMGeometry):
|
|
|
+ elif isinstance(obj, FlatCAMGeometry):
|
|
|
self.new_object("geometry", str(obj_name) + "_copy", initialize)
|
|
|
except Exception as e:
|
|
|
return "Operation failed: %s" % str(e)
|
|
|
@@ -5030,9 +5075,9 @@ class App(QtCore.QObject):
|
|
|
try:
|
|
|
if isinstance(obj, FlatCAMExcellon):
|
|
|
self.new_object("excellon", str(obj_name) + custom_name, initialize_excellon)
|
|
|
- elif isinstance(obj,FlatCAMGerber):
|
|
|
+ elif isinstance(obj, FlatCAMGerber):
|
|
|
self.new_object("gerber", str(obj_name) + custom_name, initialize_gerber)
|
|
|
- elif isinstance(obj,FlatCAMGeometry):
|
|
|
+ elif isinstance(obj, FlatCAMGeometry):
|
|
|
self.new_object("geometry", str(obj_name) + custom_name, initialize_geometry)
|
|
|
except Exception as e:
|
|
|
return "Operation failed: %s" % str(e)
|
|
|
@@ -5167,8 +5212,8 @@ class App(QtCore.QObject):
|
|
|
return "Operation failed: %s" % str(e)
|
|
|
|
|
|
def on_set_zero_click(self, event):
|
|
|
- #this function will be available only for mouse left click
|
|
|
- pos =[]
|
|
|
+ # this function will be available only for mouse left click
|
|
|
+ pos = []
|
|
|
pos_canvas = self.plotcanvas.vispy_canvas.translate_coords(event.pos)
|
|
|
if event.button == 1:
|
|
|
if self.grid_status() == True:
|
|
|
@@ -5179,7 +5224,7 @@ class App(QtCore.QObject):
|
|
|
x = 0 - pos[0]
|
|
|
y = 0 - pos[1]
|
|
|
for obj in self.collection.get_list():
|
|
|
- obj.offset((x,y))
|
|
|
+ obj.offset((x, y))
|
|
|
self.object_changed.emit(obj)
|
|
|
obj.plot()
|
|
|
# Update the object bounding box options
|
|
|
@@ -5322,7 +5367,7 @@ class App(QtCore.QObject):
|
|
|
|
|
|
if response == bt_yes:
|
|
|
self.on_save_button()
|
|
|
- self.inform.emit(_("[success] Defaults saved."))
|
|
|
+ self.inform.emit(_("[success] Preferences saved."))
|
|
|
else:
|
|
|
self.preferences_changed_flag = False
|
|
|
return
|
|
|
@@ -5555,9 +5600,9 @@ class App(QtCore.QObject):
|
|
|
|
|
|
def grid_status(self):
|
|
|
if self.ui.grid_snap_btn.isChecked():
|
|
|
- return 1
|
|
|
+ return True
|
|
|
else:
|
|
|
- return 0
|
|
|
+ return False
|
|
|
|
|
|
def populate_cmenu_grids(self):
|
|
|
units = self.ui.general_defaults_form.general_app_group.units_radio.get_value().lower()
|
|
|
@@ -5567,7 +5612,7 @@ class App(QtCore.QObject):
|
|
|
|
|
|
grid_toggle = self.ui.cmenu_gridmenu.addAction(QtGui.QIcon('share/grid32_menu.png'), _("Grid On/Off"))
|
|
|
grid_toggle.setCheckable(True)
|
|
|
- if self.grid_status():
|
|
|
+ if self.grid_status() == True:
|
|
|
grid_toggle.setChecked(True)
|
|
|
else:
|
|
|
grid_toggle.setChecked(False)
|
|
|
@@ -5701,12 +5746,13 @@ class App(QtCore.QObject):
|
|
|
self.plotcanvas.vispy_canvas.view.camera.pan_button_setting = self.defaults['global_pan_button']
|
|
|
|
|
|
self.pos_canvas = self.plotcanvas.vispy_canvas.translate_coords(event.pos)
|
|
|
- self.pos = (self.pos_canvas[0], self.pos_canvas[1])
|
|
|
- self.app_cursor.enabled = False
|
|
|
|
|
|
- if self.grid_status():
|
|
|
+ if self.grid_status() == True:
|
|
|
self.pos = self.geo_editor.snap(self.pos_canvas[0], self.pos_canvas[1])
|
|
|
self.app_cursor.enabled = True
|
|
|
+ else:
|
|
|
+ self.pos = (self.pos_canvas[0], self.pos_canvas[1])
|
|
|
+ self.app_cursor.enabled = False
|
|
|
|
|
|
try:
|
|
|
modifiers = QtWidgets.QApplication.keyboardModifiers()
|
|
|
@@ -5831,26 +5877,20 @@ class App(QtCore.QObject):
|
|
|
:param event: contains information about the event.
|
|
|
:return:
|
|
|
"""
|
|
|
-
|
|
|
+ pos = 0, 0
|
|
|
pos_canvas = self.plotcanvas.vispy_canvas.translate_coords(event.pos)
|
|
|
- if self.grid_status():
|
|
|
+ if self.grid_status() == True:
|
|
|
pos = self.geo_editor.snap(pos_canvas[0], pos_canvas[1])
|
|
|
else:
|
|
|
pos = (pos_canvas[0], pos_canvas[1])
|
|
|
|
|
|
# if the released mouse button was RMB then test if it was a panning motion or not, if not it was a context
|
|
|
# canvas menu
|
|
|
- try:
|
|
|
- if event.button == 2: # right click
|
|
|
- if self.ui.popMenu.mouse_is_panning is False:
|
|
|
-
|
|
|
- self.cursor = QtGui.QCursor()
|
|
|
- self.populate_cmenu_grids()
|
|
|
- self.ui.popMenu.popup(self.cursor.pos())
|
|
|
-
|
|
|
- except Exception as e:
|
|
|
- log.warning("Error: %s" % str(e))
|
|
|
- return
|
|
|
+ if event.button == 2: # right click
|
|
|
+ if self.ui.popMenu.mouse_is_panning is False:
|
|
|
+ self.cursor = QtGui.QCursor()
|
|
|
+ self.populate_cmenu_grids()
|
|
|
+ self.ui.popMenu.popup(self.cursor.pos())
|
|
|
|
|
|
# if the released mouse button was LMB then test if we had a right-to-left selection or a left-to-right
|
|
|
# selection and then select a type of selection ("enclosing" or "touching")
|
|
|
@@ -5866,7 +5906,6 @@ class App(QtCore.QObject):
|
|
|
# delete the selection shape(S) as it may be in the way
|
|
|
self.delete_selection_shape()
|
|
|
self.delete_hover_shape()
|
|
|
-
|
|
|
else:
|
|
|
if self.selection_type is not None:
|
|
|
self.selection_area_handler(self.pos, pos, self.selection_type)
|
|
|
@@ -5971,7 +6010,7 @@ class App(QtCore.QObject):
|
|
|
else:
|
|
|
# case when there is only an object under the click and we toggle it
|
|
|
if len(objects_under_the_click_list) == 1:
|
|
|
- if self.collection.get_active() is None :
|
|
|
+ if self.collection.get_active() is None:
|
|
|
self.collection.set_active(objects_under_the_click_list[0])
|
|
|
# create the selection box around the selected object
|
|
|
curr_sel_obj = self.collection.get_active()
|
|
|
@@ -6143,8 +6182,12 @@ class App(QtCore.QObject):
|
|
|
face = Color(self.defaults['global_sel_fill'], alpha=0.2)
|
|
|
outline = Color(self.defaults['global_sel_line'], alpha=0.8)
|
|
|
|
|
|
- self.sel_objects_list.append(self.move_tool.sel_shapes.add(sel_rect, color=outline,
|
|
|
- face_color=face, update=True, layer=0, tolerance=None))
|
|
|
+ self.sel_objects_list.append(self.move_tool.sel_shapes.add(sel_rect,
|
|
|
+ color=outline,
|
|
|
+ face_color=face,
|
|
|
+ update=True,
|
|
|
+ layer=0,
|
|
|
+ tolerance=None))
|
|
|
|
|
|
def draw_moving_selection_shape(self, old_coords, coords, **kwargs):
|
|
|
"""
|
|
|
@@ -6187,8 +6230,8 @@ class App(QtCore.QObject):
|
|
|
msgbox = QtWidgets.QMessageBox()
|
|
|
# msgbox.setText("<B>Save changes ...</B>")
|
|
|
msgbox.setText(_("There are files/objects opened in FlatCAM.\n"
|
|
|
- "Creating a New project will delete them.\n"
|
|
|
- "Do you want to Save the project?"))
|
|
|
+ "Creating a New project will delete them.\n"
|
|
|
+ "Do you want to Save the project?"))
|
|
|
msgbox.setWindowTitle(_("Save changes"))
|
|
|
msgbox.setWindowIcon(QtGui.QIcon('share/save_as.png'))
|
|
|
bt_yes = msgbox.addButton(_('Yes'), QtWidgets.QMessageBox.YesRole)
|
|
|
@@ -6282,8 +6325,7 @@ class App(QtCore.QObject):
|
|
|
# take the focus of the Notebook on Project Tab.
|
|
|
self.ui.notebook.setCurrentWidget(self.ui.project_tab)
|
|
|
|
|
|
- self.set_ui_title(name="New Project")
|
|
|
-
|
|
|
+ self.set_ui_title(name=_("New Project - Not saved"))
|
|
|
|
|
|
def obj_properties(self):
|
|
|
self.report_usage("obj_properties()")
|
|
|
@@ -6328,7 +6370,7 @@ class App(QtCore.QObject):
|
|
|
|
|
|
try:
|
|
|
filenames, _f = QtWidgets.QFileDialog.getOpenFileNames(caption=_("Open Gerber"),
|
|
|
- directory=self.get_last_folder(), filter=_filter_)
|
|
|
+ directory=self.get_last_folder(), filter=_filter_)
|
|
|
except TypeError:
|
|
|
filenames, _f = QtWidgets.QFileDialog.getOpenFileNames(caption=_("Open Gerber"), filter=_filter_)
|
|
|
|
|
|
@@ -6357,7 +6399,7 @@ class App(QtCore.QObject):
|
|
|
|
|
|
try:
|
|
|
filenames, _f = QtWidgets.QFileDialog.getOpenFileNames(caption=_("Open Excellon"),
|
|
|
- directory=self.get_last_folder(), filter=_filter_)
|
|
|
+ directory=self.get_last_folder(), filter=_filter_)
|
|
|
except TypeError:
|
|
|
filenames, _f = QtWidgets.QFileDialog.getOpenFileNames(caption=_("Open Excellon"), filter=_filter_)
|
|
|
|
|
|
@@ -6387,7 +6429,7 @@ class App(QtCore.QObject):
|
|
|
"All Files (*.*)"
|
|
|
try:
|
|
|
filenames, _f = QtWidgets.QFileDialog.getOpenFileNames(caption=_("Open G-Code"),
|
|
|
- directory=self.get_last_folder(), filter=_filter_)
|
|
|
+ directory=self.get_last_folder(), filter=_filter_)
|
|
|
except TypeError:
|
|
|
filenames, _f = QtWidgets.QFileDialog.getOpenFileNames(caption=_("Open G-Code"), filter=_filter_)
|
|
|
|
|
|
@@ -6413,9 +6455,9 @@ class App(QtCore.QObject):
|
|
|
_filter_ = "FlatCAM Project (*.FlatPrj);;All Files (*.*)"
|
|
|
try:
|
|
|
filename, _f = QtWidgets.QFileDialog.getOpenFileName(caption=_("Open Project"),
|
|
|
- directory=self.get_last_folder(), filter=_filter_)
|
|
|
+ directory=self.get_last_folder(), filter=_filter_)
|
|
|
except TypeError:
|
|
|
- filename, _f = QtWidgets.QFileDialog.getOpenFileName(caption=_("Open Project"), filter = _filter_)
|
|
|
+ filename, _f = QtWidgets.QFileDialog.getOpenFileName(caption=_("Open Project"), filter=_filter_)
|
|
|
|
|
|
# The Qt methods above will return a QString which can cause problems later.
|
|
|
# So far json.dump() will fail to serialize it.
|
|
|
@@ -6443,10 +6485,10 @@ class App(QtCore.QObject):
|
|
|
_filter_ = "FlatCAM Config (*.FlatConfig);;FlatCAM Config (*.json);;All Files (*.*)"
|
|
|
try:
|
|
|
filename, _f = QtWidgets.QFileDialog.getOpenFileName(caption=_("Open Configuration File"),
|
|
|
- directory=self.data_path, filter=_filter_)
|
|
|
+ directory=self.data_path, filter=_filter_)
|
|
|
except TypeError:
|
|
|
filename, _f = QtWidgets.QFileDialog.getOpenFileName(caption=_("Open Configuration File"),
|
|
|
- filter = _filter_)
|
|
|
+ filter=_filter_)
|
|
|
|
|
|
if filename == "":
|
|
|
self.inform.emit(_("[WARNING_NOTCL] Open Config cancelled."))
|
|
|
@@ -6488,14 +6530,14 @@ class App(QtCore.QObject):
|
|
|
|
|
|
name = obj.options["name"]
|
|
|
|
|
|
- filter = "SVG File (*.svg);;All Files (*.*)"
|
|
|
+ _filter = "SVG File (*.svg);;All Files (*.*)"
|
|
|
try:
|
|
|
filename, _f = QtWidgets.QFileDialog.getSaveFileName(
|
|
|
caption=_("Export SVG"),
|
|
|
directory=self.get_last_save_folder() + '/' + str(name),
|
|
|
- filter=filter)
|
|
|
+ filter=_filter)
|
|
|
except TypeError:
|
|
|
- filename, _f = QtWidgets.QFileDialog.getSaveFileName(caption=_("Export SVG"), filter=filter)
|
|
|
+ filename, _f = QtWidgets.QFileDialog.getSaveFileName(caption=_("Export SVG"), filter=_filter)
|
|
|
|
|
|
filename = str(filename)
|
|
|
|
|
|
@@ -6563,14 +6605,14 @@ class App(QtCore.QObject):
|
|
|
|
|
|
name = self.collection.get_active().options["name"]
|
|
|
|
|
|
- filter = "Gerber File (*.GBR);;Gerber File (*.GRB);;All Files (*.*)"
|
|
|
+ _filter = "Gerber File (*.GBR);;Gerber File (*.GRB);;All Files (*.*)"
|
|
|
try:
|
|
|
filename, _f = QtWidgets.QFileDialog.getSaveFileName(
|
|
|
caption="Save Gerber source file",
|
|
|
directory=self.get_last_save_folder() + '/' + name,
|
|
|
- filter=filter)
|
|
|
+ filter=_filter)
|
|
|
except TypeError:
|
|
|
- filename, _f = QtWidgets.QFileDialog.getSaveFileName(caption=_("Save Gerber source file"), filter=filter)
|
|
|
+ filename, _f = QtWidgets.QFileDialog.getSaveFileName(caption=_("Save Gerber source file"), filter=_filter)
|
|
|
|
|
|
filename = str(filename)
|
|
|
|
|
|
@@ -6604,14 +6646,14 @@ class App(QtCore.QObject):
|
|
|
|
|
|
name = self.collection.get_active().options["name"]
|
|
|
|
|
|
- filter = "Excellon File (*.DRL);;Excellon File (*.TXT);;All Files (*.*)"
|
|
|
+ _filter = "Excellon File (*.DRL);;Excellon File (*.TXT);;All Files (*.*)"
|
|
|
try:
|
|
|
filename, _f = QtWidgets.QFileDialog.getSaveFileName(
|
|
|
caption=_("Save Excellon source file"),
|
|
|
directory=self.get_last_save_folder() + '/' + name,
|
|
|
- filter=filter)
|
|
|
+ filter=_filter)
|
|
|
except TypeError:
|
|
|
- filename, _f = QtWidgets.QFileDialog.getSaveFileName(caption=_("Save Excellon source file"), filter=filter)
|
|
|
+ filename, _f = QtWidgets.QFileDialog.getSaveFileName(caption=_("Save Excellon source file"), filter=_filter)
|
|
|
|
|
|
filename = str(filename)
|
|
|
|
|
|
@@ -6645,14 +6687,14 @@ class App(QtCore.QObject):
|
|
|
|
|
|
name = self.collection.get_active().options["name"]
|
|
|
|
|
|
- filter = "Excellon File (*.DRL);;Excellon File (*.TXT);;All Files (*.*)"
|
|
|
+ _filter = "Excellon File (*.DRL);;Excellon File (*.TXT);;All Files (*.*)"
|
|
|
try:
|
|
|
filename, _f = QtWidgets.QFileDialog.getSaveFileName(
|
|
|
caption=_("Export Excellon"),
|
|
|
directory=self.get_last_save_folder() + '/' + name,
|
|
|
- filter=filter)
|
|
|
+ filter=_filter)
|
|
|
except TypeError:
|
|
|
- filename, _f = QtWidgets.QFileDialog.getSaveFileName(caption=_("Export Excellon"), filter=filter)
|
|
|
+ filename, _f = QtWidgets.QFileDialog.getSaveFileName(caption=_("Export Excellon"), filter=_filter)
|
|
|
|
|
|
filename = str(filename)
|
|
|
|
|
|
@@ -6823,9 +6865,9 @@ class App(QtCore.QObject):
|
|
|
self.worker_task.emit({'fcn': self.import_dxf,
|
|
|
'params': [filename, type_of_obj]})
|
|
|
|
|
|
- # ################################################################################################################ ##
|
|
|
- # # ## The following section has the functions that are displayed and call the Editor tab CNCJob Tab ############### ##
|
|
|
- # ################################################################################################################ ##
|
|
|
+ # ###############################################################################################################
|
|
|
+ # ### The following section has the functions that are displayed and call the Editor tab CNCJob Tab #############
|
|
|
+ # ###############################################################################################################
|
|
|
|
|
|
def init_code_editor(self, name):
|
|
|
# Signals section
|
|
|
@@ -6979,7 +7021,7 @@ class App(QtCore.QObject):
|
|
|
_filter_ = "TCL script (*.FlatScript);;TCL script (*.TCL);;TCL script (*.TXT);;All Files (*.*)"
|
|
|
try:
|
|
|
filename, _f = QtWidgets.QFileDialog.getOpenFileName(caption=_("Run TCL script"),
|
|
|
- directory=self.get_last_folder(), filter=_filter_)
|
|
|
+ directory=self.get_last_folder(), filter=_filter_)
|
|
|
except TypeError:
|
|
|
filename, _f = QtWidgets.QFileDialog.getOpenFileName(caption=_("Run TCL script"), filter=_filter_)
|
|
|
|
|
|
@@ -7448,7 +7490,7 @@ class App(QtCore.QObject):
|
|
|
ewhole = self.defaults["excellon_exp_integer"]
|
|
|
efract = self.defaults["excellon_exp_decimals"]
|
|
|
ezeros = self.defaults["excellon_exp_zeros"]
|
|
|
- eformat = self.defaults[ "excellon_exp_format"]
|
|
|
+ eformat = self.defaults["excellon_exp_format"]
|
|
|
|
|
|
fc_units = self.ui.general_defaults_form.general_app_group.units_radio.get_value().upper()
|
|
|
if fc_units == 'MM':
|
|
|
@@ -8594,22 +8636,27 @@ class App(QtCore.QObject):
|
|
|
_('<b>Shortcut Key List</b>'))
|
|
|
sel_title.setTextInteractionFlags(QtCore.Qt.NoTextInteraction)
|
|
|
sel_title.setFrameStyle(QtWidgets.QFrame.NoFrame)
|
|
|
- # font = self.sel_title.font()
|
|
|
- # font.setPointSize(12)
|
|
|
- # self.sel_title.setFont(font)
|
|
|
+
|
|
|
+ settings = QSettings("Open Source", "FlatCAM")
|
|
|
+ if settings.contains("notebook_font_size"):
|
|
|
+ fsize = settings.value('notebook_font_size', type=int)
|
|
|
+ else:
|
|
|
+ fsize = 12
|
|
|
+
|
|
|
+ tsize = fsize + int(fsize / 2)
|
|
|
|
|
|
selected_text = _('''
|
|
|
-<p><span style="font-size:14px"><strong>Selected Tab - Choose an Item from Project Tab</strong></span></p>
|
|
|
+<p><span style="font-size:{tsize}px"><strong>Selected Tab - Choose an Item from Project Tab</strong></span></p>
|
|
|
|
|
|
-<p><span style="font-size:10px"><strong>Details</strong>:<br />
|
|
|
+<p><span style="font-size:{fsize}px"><strong>Details</strong>:<br />
|
|
|
The normal flow when working in FlatCAM is the following:</span></p>
|
|
|
|
|
|
<ol>
|
|
|
- <li><span style="font-size:10px">Loat/Import a Gerber, Excellon, Gcode, DXF, Raster Image or SVG file into FlatCAM using either the menu's, toolbars, key shortcuts or even dragging and dropping the files on the GUI.<br />
|
|
|
+ <li><span style="font-size:{fsize}px">Loat/Import a Gerber, Excellon, Gcode, DXF, Raster Image or SVG file into FlatCAM using either the menu's, toolbars, key shortcuts or even dragging and dropping the files on the GUI.<br />
|
|
|
<br />
|
|
|
You can also load a <strong>FlatCAM project</strong> by double clicking on the project file, drag & drop of the file into the FLATCAM GUI or through the menu/toolbar links offered within the app.</span><br />
|
|
|
</li>
|
|
|
- <li><span style="font-size:10px">Once an object is available in the Project Tab, by selecting it and then focusing on <strong>SELECTED TAB </strong>(more simpler is to double click the object name in the Project Tab), <strong>SELECTED TAB </strong>will be updated with the object properties according to it's kind: Gerber, Excellon, Geometry or CNCJob object.<br />
|
|
|
+ <li><span style="font-size:{fsize}px">Once an object is available in the Project Tab, by selecting it and then focusing on <strong>SELECTED TAB </strong>(more simpler is to double click the object name in the Project Tab), <strong>SELECTED TAB </strong>will be updated with the object properties according to it's kind: Gerber, Excellon, Geometry or CNCJob object.<br />
|
|
|
<br />
|
|
|
If the selection of the object is done on the canvas by single click instead, and the <strong>SELECTED TAB</strong> is in focus, again the object properties will be displayed into the Selected Tab. Alternatively, double clicking on the object on the canvas will bring the <strong>SELECTED TAB</strong> and populate it even if it was out of focus.<br />
|
|
|
<br />
|
|
|
@@ -8618,44 +8665,15 @@ The normal flow when working in FlatCAM is the following:</span></p>
|
|
|
<strong>Gerber/Excellon Object</strong> -> Change Param -> Generate Geometry -><strong> Geometry Object </strong>-> Add tools (change param in Selected Tab) -> Generate CNCJob -><strong> CNCJob Object </strong>-> Verify GCode (through Edit CNC Code) and/or append/prepend to GCode (again, done in <strong>SELECTED TAB) </strong>-> Save GCode</span></li>
|
|
|
</ol>
|
|
|
|
|
|
-<p><span style="font-size:10px">A list of key shortcuts is available through an menu entry in <strong>Help -> Shortcuts List</strong> or through it's own key shortcut: <strng>F3</strong>.</span></p>
|
|
|
+<p><span style="font-size:{fsize}px">A list of key shortcuts is available through an menu entry in <strong>Help -> Shortcuts List</strong> or through it's own key shortcut: <strng>F3</strong>.</span></p>
|
|
|
|
|
|
- ''')
|
|
|
+ '''.format(fsize=fsize, tsize=tsize))
|
|
|
|
|
|
sel_title.setText(selected_text)
|
|
|
sel_title.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
|
|
|
|
|
|
self.ui.selected_scroll_area.setWidget(sel_title)
|
|
|
|
|
|
-# tool_title = QtWidgets.QTextEdit(
|
|
|
-# '<b>Shortcut Key List</b>')
|
|
|
-# tool_title.setTextInteractionFlags(QtCore.Qt.NoTextInteraction)
|
|
|
-# tool_title.setFrameStyle(QtWidgets.QFrame.NoFrame)
|
|
|
-# # font = self.sel_title.font()
|
|
|
-# # font.setPointSize(12)
|
|
|
-# # self.sel_title.setFont(font)
|
|
|
-#
|
|
|
-# tool_text = '''
|
|
|
-# <p><span style="font-size:14px"><strong>Tool Tab - Choose an Item in Tools Menu</strong></span></p>
|
|
|
-#
|
|
|
-# <p><span style="font-size:10px"><strong>Details</strong>:<br />
|
|
|
-# Some of the functionality of FlatCAM have been implemented as tools (a sort of plugins). </span></p>
|
|
|
-#
|
|
|
-# <p><span style="font-size:10px">Most of the tools are accessible through the Tools menu or by using the associated shortcut keys.<br />
|
|
|
-# Each such a tool, if it needs an object to be used as a source it will provide the way to select this object(s) through a series of comboboxes. The result of using a tool is either a Geometry, an information that can be used in the app or it can be a file that can be saved.</span></p>
|
|
|
-#
|
|
|
-# <ol>
|
|
|
-# </ol>
|
|
|
-#
|
|
|
-# <p><span style="font-size:10px">A list of key shortcuts is available through an menu entry in <strong>Help -> Shortcuts List</strong> or through it's own key shortcut: '`' (key left to 1).</span></p>
|
|
|
-#
|
|
|
-# '''
|
|
|
-#
|
|
|
-# tool_title.setText(tool_text)
|
|
|
-# tool_title.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
|
|
|
-#
|
|
|
-# self.ui.tool_scroll_area.setWidget(tool_title)
|
|
|
-
|
|
|
def setup_obj_classes(self):
|
|
|
"""
|
|
|
Sets up application specifics on the FlatCAMObj class.
|
|
|
@@ -8937,7 +8955,7 @@ The normal flow when working in FlatCAM is the following:</span></p>
|
|
|
to_quit = quit
|
|
|
self.save_timer = QtCore.QTimer()
|
|
|
self.save_timer.setInterval(delay)
|
|
|
- self.save_timer.timeout.connect(lambda : self.check_project_file_size(filename=filename, quit=to_quit))
|
|
|
+ self.save_timer.timeout.connect(lambda: self.check_project_file_size(filename=filename, quit=to_quit))
|
|
|
self.save_timer.start()
|
|
|
|
|
|
def check_project_file_size(self, filename, quit=None):
|