- some PEP8 changes in FlatCAMApp.py
This commit is contained in:
parent
ee3b38327e
commit
d5f74ae8b4
118
FlatCAMApp.py
118
FlatCAMApp.py
|
@ -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
|
||||
|
||||
|
@ -397,10 +398,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,
|
||||
|
@ -1516,7 +1521,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 ##
|
||||
# ##############################
|
||||
|
@ -2517,7 +2521,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
|
||||
"""
|
||||
|
@ -4153,7 +4157,8 @@ 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'] = \
|
||||
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])
|
||||
|
@ -4177,9 +4182,11 @@ 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] + \
|
||||
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] + \
|
||||
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):
|
||||
|
@ -4187,7 +4194,8 @@ class App(QtCore.QObject):
|
|||
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'] = \
|
||||
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])
|
||||
|
@ -4211,7 +4219,8 @@ 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'] = \
|
||||
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])
|
||||
|
@ -4235,9 +4244,11 @@ 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] + \
|
||||
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] + \
|
||||
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):
|
||||
|
@ -4245,7 +4256,8 @@ class App(QtCore.QObject):
|
|||
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'] = \
|
||||
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])
|
||||
|
@ -4292,9 +4304,11 @@ 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] + \
|
||||
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] + \
|
||||
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):
|
||||
|
@ -4816,7 +4830,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):
|
||||
|
@ -6146,8 +6159,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):
|
||||
"""
|
||||
|
@ -6490,14 +6507,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)
|
||||
|
||||
|
@ -6565,14 +6582,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)
|
||||
|
||||
|
@ -6606,14 +6623,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)
|
||||
|
||||
|
@ -6647,14 +6664,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)
|
||||
|
||||
|
@ -6825,9 +6842,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
|
||||
|
@ -8629,35 +8646,6 @@ The normal flow when working in FlatCAM is the following:</span></p>
|
|||
|
||||
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.
|
||||
|
|
|
@ -12,6 +12,7 @@ CAD program, and create G-Code for Isolation routing.
|
|||
13.08.2019
|
||||
|
||||
- added new option in ToolSub: the ability to close (or not) the resulting paths when using tool on Geometry objects. Added also a new category in the Edit -> Preferences -> Tools, the Substractor Tool Options
|
||||
- some PEP8 changes in FlatCAMApp.py
|
||||
|
||||
12.08.2019
|
||||
|
||||
|
|
Loading…
Reference in New Issue