- PEP8 cleanup in FlatCAMGui

- finished adding the Excellon Editor parameters into the app logic and added a selection limit within Excellon Editor just like in the other editors
This commit is contained in:
Marius Stanciu 2019-06-04 22:19:45 +03:00
parent dc51f6d833
commit 150bb9e999
4 changed files with 533 additions and 439 deletions

View File

@ -58,9 +58,9 @@ fcTranslate.apply_language('strings')
if '_' not in builtins.__dict__:
_ = gettext.gettext
# ##################################### ##
# # App # ##
# ##################################### ##
# ########################################
# # App ###
# ########################################
class App(QtCore.QObject):
@ -428,6 +428,17 @@ class App(QtCore.QObject):
"excellon_exp_decimals": self.ui.excellon_defaults_form.excellon_exp_group.format_dec_entry,
"excellon_exp_zeros": self.ui.excellon_defaults_form.excellon_exp_group.zeros_radio,
# Excellon Editor
"excellon_editor_sel_limit": self.ui.excellon_defaults_form.excellon_editor_group.sel_limit_entry,
"excellon_editor_newdia": self.ui.excellon_defaults_form.excellon_editor_group.addtool_entry,
"excellon_editor_array_size": self.ui.excellon_defaults_form.excellon_editor_group.drill_array_size_entry,
"excellon_editor_lin_dir": self.ui.excellon_defaults_form.excellon_editor_group.drill_axis_radio,
"excellon_editor_lin_pitch": self.ui.excellon_defaults_form.excellon_editor_group.drill_pitch_entry,
"excellon_editor_lin_angle": self.ui.excellon_defaults_form.excellon_editor_group.drill_angle_entry,
"excellon_editor_circ_dir": self.ui.excellon_defaults_form.excellon_editor_group.drill_circular_dir_radio,
"excellon_editor_circ_angle":
self.ui.excellon_defaults_form.excellon_editor_group.drill_circular_angle_entry,
# Geometry General
"geometry_plot": self.ui.geometry_defaults_form.geometry_gen_group.plot_cb,
"geometry_circle_steps": self.ui.geometry_defaults_form.geometry_gen_group.circle_steps_entry,
@ -756,6 +767,16 @@ class App(QtCore.QObject):
"excellon_exp_decimals": 4,
"excellon_exp_zeros": 'LZ',
# Excellon Editor
"excellon_editor_sel_limit": 30,
"excellon_editor_newdia": 0.039,
"excellon_editor_array_size": 5,
"excellon_editor_lin_dir": 'X',
"excellon_editor_lin_pitch": 0.1,
"excellon_editor_lin_angle": 0.0,
"excellon_editor_circ_dir": 'CW',
"excellon_editor_circ_angle": 12,
# Geometry General
"geometry_plot": True,
"geometry_circle_steps": 128,

View File

@ -12,8 +12,10 @@ CAD program, and create G-Code for Isolation routing.
4.06.2019
- PEP8 updates in FlatCAMExcEditor.py
- added the Excellon Editor parameters to the Edit -> Preferences -> Excellon
- added the Excellon Editor parameters to the Edit -> Preferences -> Excellon GUI
- fixed a small bug in Excellon Editor
- PEP8 cleanup in FlatCAMGui
- finished adding the Excellon Editor parameters into the app logic and added a selection limit within Excellon Editor just like in the other editors
3.06.2019

View File

@ -441,6 +441,8 @@ class FCDrillMove(FCShapeTool):
# self.shape_buffer = self.draw_app.shape_buffer
self.origin = None
self.destination = None
self.sel_limit = self.draw_app.app.defaults["excellon_editor_sel_limit"]
self.selection_shape = self.selection_bbox()
self.selected_dia_list = []
if self.draw_app.launched_from_shortcuts is True:
@ -504,6 +506,25 @@ class FCDrillMove(FCShapeTool):
self.draw_app.build_ui()
self.draw_app.app.inform.emit(_("[success] Done. Drill(s) Move completed."))
def selection_bbox(self):
geo_list = []
for select_shape in self.draw_app.get_selected():
geometric_data = select_shape.geo
try:
for g in geometric_data:
geo_list.append(g)
except TypeError:
geo_list.append(geometric_data)
xmin, ymin, xmax, ymax = get_shapely_list_bounds(geo_list)
pt1 = (xmin, ymin)
pt2 = (xmax, ymin)
pt3 = (xmax, ymax)
pt4 = (xmin, ymax)
return Polygon([pt1, pt2, pt3, pt4])
def utility_geometry(self, data=None):
"""
Temporary geometry on screen while using this tool.
@ -521,9 +542,22 @@ class FCDrillMove(FCShapeTool):
dx = data[0] - self.origin[0]
dy = data[1] - self.origin[1]
if len(self.draw_app.get_selected()) <= self.sel_limit:
try:
for geom in self.draw_app.get_selected():
geo_list.append(affinity.translate(geom.geo, xoff=dx, yoff=dy))
except AttributeError:
self.draw_app.select_tool('drill_select')
self.draw_app.selected = []
return
return DrawToolUtilityShape(geo_list)
else:
try:
ss_el = affinity.translate(self.selection_shape, xoff=dx, yoff=dy)
except ValueError:
ss_el = None
return DrawToolUtilityShape(ss_el)
class FCDrillCopy(FCDrillMove):
@ -985,7 +1019,6 @@ class FlatCAMExcEditor(QtCore.QObject):
self.drill_direction_radio = RadioSet([{'label': 'CW', 'value': 'CW'},
{'label': 'CCW.', 'value': 'CCW'}])
self.drill_direction_radio.set_value('CW')
self.circular_form.addRow(self.drill_direction_label, self.drill_direction_radio)
self.drill_angle_label = QtWidgets.QLabel(_('Angle:'))
@ -1077,13 +1110,6 @@ class FlatCAMExcEditor(QtCore.QObject):
self.app.ui.exc_move_drill_menuitem.triggered.connect(self.exc_move_drills)
# Init GUI
self.drill_array_size_entry.set_value(5)
self.drill_pitch_entry.set_value(2.54)
self.drill_angle_entry.set_value(12)
self.drill_direction_radio.set_value('CW')
self.drill_axis_radio.set_value('X')
self.exc_obj = None
# VisPy Visuals
@ -1166,7 +1192,6 @@ class FlatCAMExcEditor(QtCore.QObject):
@staticmethod
def make_storage():
# ## Shape storage.
storage = FlatCAMRTreeStorage()
storage.get_points = DrawToolShape.get_pts
@ -1174,7 +1199,6 @@ class FlatCAMExcEditor(QtCore.QObject):
return storage
def set_ui(self):
# updated units
self.units = self.app.ui.general_defaults_form.general_app_group.units_radio.get_value().upper()
@ -1193,6 +1217,7 @@ class FlatCAMExcEditor(QtCore.QObject):
self.points_edit[tool_dia].append(drill['point'])
except KeyError:
self.points_edit[tool_dia] = [drill['point']]
# update the olddia_newdia dict to make sure we have an updated state of the tool_table
for key in self.points_edit:
self.olddia_newdia[key] = key
@ -1218,6 +1243,15 @@ class FlatCAMExcEditor(QtCore.QObject):
tool_dia = float('%.2f' % v['C'])
self.tool2tooldia[int(k)] = tool_dia
# Init GUI
self.addtool_entry.set_value(float(self.app.defaults['excellon_editor_newdia']))
self.drill_array_size_entry.set_value(int(self.app.defaults['excellon_editor_array_size']))
self.drill_axis_radio.set_value(self.app.defaults['excellon_editor_lin_dir'])
self.drill_pitch_entry.set_value(float(self.app.defaults['excellon_editor_lin_pitch']))
self.linear_angle_spinner.set_value(float(self.app.defaults['excellon_editor_lin_angle']))
self.drill_direction_radio.set_value(self.app.defaults['excellon_editor_circ_dir'])
self.drill_angle_entry.set_value(float(self.app.defaults['excellon_editor_circ_angle']))
def build_ui(self, first_run=None):
try:
@ -1238,11 +1272,6 @@ class FlatCAMExcEditor(QtCore.QObject):
self.edited_obj_name = self.exc_obj.options['name']
self.name_entry.set_value(self.edited_obj_name)
if self.units == "IN":
self.addtool_entry.set_value(0.039)
else:
self.addtool_entry.set_value(1.00)
sort_temp = []
for diam in self.olddia_newdia:
@ -1886,7 +1915,7 @@ class FlatCAMExcEditor(QtCore.QObject):
# add a first tool in the Tool Table but only if the Excellon Object is empty
if not self.tool2tooldia:
self.on_tool_add(tooldia=1.00)
self.on_tool_add(tooldia=float(self.app.defaults['excellon_editor_newdia']))
def update_fcexcellon(self, exc_obj):
"""
@ -2324,13 +2353,15 @@ class FlatCAMExcEditor(QtCore.QObject):
log.warning("Error: %s" % str(e))
raise
def draw_selection_area_handler(self, start_pos, end_pos, sel_type):
def draw_selection_area_handler(self, start, end, sel_type):
"""
:param start_pos: mouse position when the selection LMB click was done
:param end_pos: mouse position when the left mouse button is released
:param sel_type: if True it's a left to right selection (enclosure), if False it's a 'touch' selection
:return:
"""
start_pos = (start[0], start[1])
end_pos = (end[0], end[1])
poly_selection = Polygon([start_pos, (end_pos[0], start_pos[1]), end_pos, (start_pos[0], end_pos[1])])
self.app.delete_selection_shape()
@ -2702,4 +2733,23 @@ class FlatCAMExcEditor(QtCore.QObject):
self.select_tool('drill_move')
return
def get_shapely_list_bounds(geometry_list):
xmin = Inf
ymin = Inf
xmax = -Inf
ymax = -Inf
for gs in geometry_list:
try:
gxmin, gymin, gxmax, gymax = gs.bounds
xmin = min([xmin, gxmin])
ymin = min([ymin, gymin])
xmax = max([xmax, gxmax])
ymax = max([ymax, gymax])
except Exception as e:
log.warning("DEVELOPMENT: Tried to get bounds of empty geometry. --> %s" % str(e))
return [xmin, ymin, xmax, ymax]
# EOF

View File

@ -37,13 +37,13 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
self.app = app
# Divine icon pack by Ipapun @ finicons.com
################################### ##
# ################################## ##
# ## BUILDING THE GUI IS DONE HERE # ##
################################### ##
# ################################## ##
########## ##
# ######### ##
# ## Menu # ##
########## ##
# ######### ##
self.menu = self.menuBar()
# ## File # ##
@ -177,7 +177,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
self.menufileexportexcellon = QtWidgets.QAction(QtGui.QIcon('share/drill32.png'), _('Export &Excellon ...'),
self)
self.menufileexportexcellon.setToolTip(
_( "Will export an Excellon Object as Excellon file,\n"
_("Will export an Excellon Object as Excellon file,\n"
"the coordinates format, the file units and zeros\n"
"are set in Preferences -> Excellon Export.")
)
@ -203,6 +203,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
self.menufile.addSeparator()
self.menufile_save = self.menufile.addMenu(QtGui.QIcon('share/save_as.png'), _('Save'))
# Save Project
self.menufilesaveproject = QtWidgets.QAction(QtGui.QIcon('share/floppy16.png'), _('&Save Project ...'), self)
self.menufile_save.addAction(self.menufilesaveproject)
@ -243,7 +244,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
self.menuedit_convertjoin = self.menuedit_convert.addAction(
QtGui.QIcon('share/join16.png'), _('&Join Geo/Gerber/Exc -> Geo'))
self.menuedit_convertjoin.setToolTip(
_( "Merge a selection of objects, which can be of type:\n"
_("Merge a selection of objects, which can be of type:\n"
"- Gerber\n"
"- Excellon\n"
"- Geometry\n"
@ -264,13 +265,13 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
self.menuedit_convert_sg2mg = self.menuedit_convert.addAction(
QtGui.QIcon('share/convert24.png'), _('Convert Single to MultiGeo'))
self.menuedit_convert_sg2mg.setToolTip(
_( "Will convert a Geometry object from single_geometry type\n"
_("Will convert a Geometry object from single_geometry type\n"
"to a multi_geometry type.")
)
self.menuedit_convert_mg2sg = self.menuedit_convert.addAction(
QtGui.QIcon('share/convert24.png'), _('Convert Multi to SingleGeo'))
self.menuedit_convert_mg2sg.setToolTip(
_( "Will convert a Geometry object from multi_geometry type\n"
_("Will convert a Geometry object from multi_geometry type\n"
"to a single_geometry type.")
)
# Separator
@ -376,13 +377,12 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
self.menuview_toggle_workspace = self.menuview.addAction(QtGui.QIcon('share/workspace24.png'),
_("Toggle Workspace\tSHIFT+W"))
# ## Tool # ##
# self.menutool = self.menu.addMenu('&Tool')
# ## Tool ###
self.menutool = QtWidgets.QMenu(_('&Tool'))
self.menutoolaction = self.menu.addMenu(self.menutool)
self.menutoolshell = self.menutool.addAction(QtGui.QIcon('share/shell16.png'), _('&Command Line\tS'))
# ## Help # ##
# ## Help ###
self.menuhelp = self.menu.addMenu(_('&Help'))
self.menuhelp_manual = self.menuhelp.addAction(QtGui.QIcon('share/globe16.png'), _('Help\tF1'))
self.menuhelp_home = self.menuhelp.addAction(QtGui.QIcon('share/home16.png'), _('FlatCAM.org'))
@ -393,14 +393,10 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
)
self.menuhelp_about = self.menuhelp.addAction(QtGui.QIcon('share/about32.png'), _('About'))
# ## FlatCAM Editor menu # ##
# self.editor_menu = QtWidgets.QMenu("Editor")
# self.menu.addMenu(self.editor_menu)
# ## FlatCAM Editor menu ###
self.geo_editor_menu = QtWidgets.QMenu(">Geo Editor<")
self.menu.addMenu(self.geo_editor_menu)
# self.select_menuitem = self.menu.addAction(QtGui.QIcon('share/pointer16.png'), "Select 'Esc'")
self.geo_add_circle_menuitem = self.geo_editor_menu.addAction(
QtGui.QIcon('share/circle32.png'), _('Add Circle\tO')
)
@ -468,8 +464,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
self.exc_move_drill_menuitem = self.exc_editor_menu.addAction(
QtGui.QIcon('share/move32.png'),_( 'Move Drill(s)\tM'))
# ## APPLICATION GERBER EDITOR MENU # ##
# ## APPLICATION GERBER EDITOR MENU ###
self.grb_editor_menu = QtWidgets.QMenu(_(">Gerber Editor<"))
self.menu.addMenu(self.grb_editor_menu)
@ -516,9 +511,9 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
self.exc_editor_menu.menuAction().setVisible(False)
self.exc_editor_menu.setDisabled(True)
# ############################# ##
# # ## Project Tab Context menu # ##
# ############################# ##
# ################################
# ### Project Tab Context menu ###
# ################################
self.menuproject = QtWidgets.QMenu()
self.menuprojectenable = self.menuproject.addAction(QtGui.QIcon('share/replot32.png'), _('Enable Plot'))
@ -535,9 +530,9 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
self.menuprojectproperties = self.menuproject.addAction(QtGui.QIcon('share/properties32.png'), _('Properties'))
# ############# ##
# # ## Splitter # ##
# ############# ##
# ################
# ### Splitter ###
# ################
# IMPORTANT #
# The order: SPITTER -> NOTEBOOK -> SNAP TOOLBAR is important and without it the GUI will not be initialized as
@ -557,11 +552,11 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
self.splitter_left.addWidget(self.notebook)
self.splitter_left.setHandleWidth(0)
############# ##
# ## Toolbar # ##
############# ##
# ##############
# ## Toolbar ###
# ##############
# ## TOOLBAR INSTALLATION # ##
# ## TOOLBAR INSTALLATION ###
self.toolbarfile = QtWidgets.QToolBar(_('File Toolbar'))
self.toolbarfile.setObjectName('File_TB')
self.addToolBar(self.toolbarfile)
@ -608,7 +603,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
self.snap_toolbar.setMaximumHeight(30)
self.splitter_left.addWidget(self.snap_toolbar)
# ## File Toolbar # ##
# ## File Toolbar ###
self.file_open_gerber_btn = self.toolbarfile.addAction(QtGui.QIcon('share/flatcam_icon32.png'),
_("Open Gerber"))
self.file_open_excellon_btn = self.toolbarfile.addAction(QtGui.QIcon('share/drill32.png'), _("Open Excellon"))
@ -616,7 +611,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
self.file_open_btn = self.toolbarfile.addAction(QtGui.QIcon('share/folder32.png'), _("Open project"))
self.file_save_btn = self.toolbarfile.addAction(QtGui.QIcon('share/floppy32.png'), _("Save project"))
# ## Edit Toolbar # ##
# ## Edit Toolbar ###
self.newgeo_btn = self.toolbargeo.addAction(QtGui.QIcon('share/new_geo32_bis.png'), _("New Blank Geometry"))
self.newgrb_btn = self.toolbargeo.addAction(QtGui.QIcon('share/new_geo32.png'), _("New Blank Gerber"))
self.newexc_btn = self.toolbargeo.addAction(QtGui.QIcon('share/new_exc32.png'), _("New Blank Excellon"))
@ -638,10 +633,10 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
# self.toolbarview.setVisible(False)
# ## Shell Toolbar # ##
# ## Shell Toolbar ##
self.shell_btn = self.toolbarshell.addAction(QtGui.QIcon('share/shell32.png'), _("&Command Line"))
# ## Tools Toolbar # ##
# ## Tools Toolbar ##
self.dblsided_btn = self.toolbartools.addAction(QtGui.QIcon('share/doubleside32.png'), _("2Sided Tool"))
self.cutout_btn = self.toolbartools.addAction(QtGui.QIcon('share/cut16_bis.png'), _("&Cutout Tool"))
self.ncc_btn = self.toolbartools.addAction(QtGui.QIcon('share/ncc16.png'), _("NCC Tool"))
@ -658,7 +653,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
self.calculators_btn = self.toolbartools.addAction(QtGui.QIcon('share/calculator24.png'), _("Calculators Tool"))
self.transform_btn = self.toolbartools.addAction(QtGui.QIcon('share/transform.png'), _("Transform Tool"))
# ## Drill Editor Toolbar # ##
# ## Drill Editor Toolbar ###
self.select_drill_btn = self.exc_edit_toolbar.addAction(QtGui.QIcon('share/pointer32.png'), _("Select"))
self.add_drill_btn = self.exc_edit_toolbar.addAction(QtGui.QIcon('share/plus16.png'), _('Add Drill Hole'))
self.add_drill_array_btn = self.exc_edit_toolbar.addAction(
@ -672,7 +667,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
self.exc_edit_toolbar.addSeparator()
self.move_drill_btn = self.exc_edit_toolbar.addAction(QtGui.QIcon('share/move32.png'), _("Move Drill"))
# ## Geometry Editor Toolbar # ##
# ## Geometry Editor Toolbar ###
self.geo_select_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/pointer32.png'), _("Select"))
self.geo_add_circle_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/circle32.png'), _('Add Circle'))
self.geo_add_arc_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/arc32.png'), _('Add Arc'))
@ -960,9 +955,9 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
"which is the file storing the working default preferences."))
self.pref_tab_bottom_layout_2.addWidget(self.pref_save_button)
###################################### ##
# ## HERE WE BUILD THE SHORTCUTS LIST. TAB AREA # ##
###################################### ##
# #################################################
# ## HERE WE BUILD THE SHORTCUTS LIST. TAB AREA ###
# #################################################
self.shortcuts_tab = QtWidgets.QWidget()
self.sh_tab_layout = QtWidgets.QVBoxLayout()
self.sh_tab_layout.setContentsMargins(2, 2, 2, 2)
@ -1733,6 +1728,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
self.show()
self.filename = ""
self.units = ""
self.setAcceptDrops(True)
# # restore the Toolbar State from file
@ -1744,9 +1740,9 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
# log.debug("FlatCAMGUI.__init__() --> UI state not restored. IOError")
# pass
#################### ##
# ################### ##
# ## INITIALIZE GUI # ##
#################### ##
# ################### ##
self.grid_snap_btn.setCheckable(True)
self.corner_snap_btn.setCheckable(True)
@ -2038,9 +2034,6 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
else:
key = event.key
# Propagate to tool
response = None
if self.app.call_source == 'app':
if modifiers == QtCore.Qt.ControlModifier:
if key == QtCore.Qt.Key_A:
@ -3001,7 +2994,8 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
if ok:
self.app.exc_editor.on_tool_add(tooldia=val)
self.app.inform.emit(
_("[success] Added new tool with dia: {dia} {units}").format(dia='%.4f' % float(val), units=str(self.units)))
_("[success] Added new tool with dia: {dia} {units}").format(dia='%.4f' % float(val),
units=str(self.units)))
else:
self.app.inform.emit(
_("[WARNING_NOTCL] Adding Tool cancelled ..."))
@ -3161,7 +3155,6 @@ class GerberPreferencesUI(QtWidgets.QWidget):
self.gerber_editor_group = GerberEditorPrefGroupUI()
self.gerber_editor_group.setFixedWidth(200)
self.vlay = QtWidgets.QVBoxLayout()
self.vlay.addWidget(self.gerber_opt_group)
self.vlay.addWidget(self.gerber_exp_group)
@ -3335,7 +3328,7 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI):
# Grid X Entry
self.gridx_label = QtWidgets.QLabel(_('Grid X value:'))
self.gridx_label.setToolTip(
_( "This is the Grid snap value on X axis.")
_("This is the Grid snap value on X axis.")
)
self.gridx_entry = LengthEntry()
@ -3354,12 +3347,12 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI):
# Workspace
self.workspace_lbl = QtWidgets.QLabel(_('Workspace:'))
self.workspace_lbl.setToolTip(
_( "Draw a delimiting rectangle on canvas.\n"
_("Draw a delimiting rectangle on canvas.\n"
"The purpose is to illustrate the limits for our work.")
)
self.workspace_type_lbl = QtWidgets.QLabel(_('Wk. format:'))
self.workspace_type_lbl.setToolTip(
_( "Select the type of rectangle to be used on canvas,\n"
_("Select the type of rectangle to be used on canvas,\n"
"as valid workspace.")
)
self.workspace_cb = FCCheckBox()
@ -3374,7 +3367,7 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI):
# Plot Fill Color
self.pf_color_label = QtWidgets.QLabel(_('Plot Fill:'))
self.pf_color_label.setToolTip(
_( "Set the fill color for plotted objects.\n"
_("Set the fill color for plotted objects.\n"
"First 6 digits are the color and the last 2\n"
"digits are for alpha (transparency) level.")
)
@ -3390,7 +3383,7 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI):
# Plot Fill Transparency Level
self.pf_alpha_label = QtWidgets.QLabel(_('Alpha Level:'))
self.pf_alpha_label.setToolTip(
_( "Set the fill transparency for plotted objects.")
_("Set the fill transparency for plotted objects.")
)
self.pf_color_alpha_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
self.pf_color_alpha_slider.setMinimum(0)
@ -3409,7 +3402,7 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI):
# Plot Line Color
self.pl_color_label = QtWidgets.QLabel(_('Plot Line:'))
self.pl_color_label.setToolTip(
_( "Set the line color for plotted objects.")
_("Set the line color for plotted objects.")
)
self.pl_color_entry = FCEntry()
self.pl_color_button = QtWidgets.QPushButton()
@ -3620,7 +3613,6 @@ class GeneralGUISetGroupUI(OptionsGroupUI):
# Create a form layout for the Application general settings
self.form_box = QtWidgets.QFormLayout()
# Layout selection
self.layout_label = QtWidgets.QLabel(_('Layout:'))
self.layout_label.setToolTip(
@ -3821,7 +3813,7 @@ class GeneralAppPrefGroupUI(OptionsGroupUI):
_("Check this box if you agree to send anonymous\n"
"stats automatically at startup, to help improve FlatCAM.")
)
self.send_stats_cb= FCCheckBox(label='')
self.send_stats_cb = FCCheckBox(label='')
self.send_stats_cb.setToolTip(
_("Check this box if you agree to send anonymous\n"
"stats automatically at startup, to help improve FlatCAM.")
@ -3858,7 +3850,7 @@ class GeneralAppPrefGroupUI(OptionsGroupUI):
# Project autohide CB
self.project_autohide_label = QtWidgets.QLabel(_('Project AutoHide:'))
self.project_autohide_label.setToolTip(
_( "Check this box if you want the project/selected/tool tab area to\n"
_("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.")
)
@ -3872,12 +3864,12 @@ class GeneralAppPrefGroupUI(OptionsGroupUI):
# Enable/Disable ToolTips globally
self.toggle_tooltips_label = QtWidgets.QLabel(_('<b>Enable ToolTips:</b>'))
self.toggle_tooltips_label.setToolTip(
_( "Check this box if you want to have toolTips displayed\n"
_("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"
_("Check this box if you want to have toolTips displayed\n"
"when hovering with mouse over items throughout the App.")
)
self.worker_number_label = QtWidgets.QLabel(_('Workers number:'))
@ -4047,7 +4039,6 @@ class GerberOptPrefGroupUI(OptionsGroupUI):
self.setTitle(str(_("Gerber Options")))
# ## Isolation Routing
self.isolation_routing_label = QtWidgets.QLabel(_("<b>Isolation Routing:</b>"))
self.isolation_routing_label.setToolTip(
@ -4172,7 +4163,6 @@ class GerberAdvOptPrefGroupUI(OptionsGroupUI):
self.setTitle(str(_("Gerber Adv. Options")))
# ## Advanced Gerber Parameters
self.adv_param_label = QtWidgets.QLabel(_("<b>Advanced Param.:</b>"))
self.adv_param_label.setToolTip(
@ -4191,7 +4181,6 @@ class GerberAdvOptPrefGroupUI(OptionsGroupUI):
_("Generate a 'Follow' geometry.\n"
"This means that it will cut through\n"
"the middle of the trace.")
)
grid0.addWidget(self.follow_cb, 0, 0)
@ -4426,7 +4415,7 @@ class ExcellonGenPrefGroupUI(OptionsGroupUI):
self.excellon_format_upper_in_entry.setAlignment(QtCore.Qt.AlignRight)
self.excellon_format_upper_in_entry.setFixedWidth(30)
self.excellon_format_upper_in_entry.setToolTip(
_( "This numbers signify the number of digits in\n"
_("This numbers signify the number of digits in\n"
"the whole part of Excellon coordinates.")
)
hlay1.addWidget(self.excellon_format_upper_in_entry, QtCore.Qt.AlignLeft)
@ -4464,7 +4453,7 @@ class ExcellonGenPrefGroupUI(OptionsGroupUI):
)
hlay2.addWidget(self.excellon_format_upper_mm_entry, QtCore.Qt.AlignLeft)
excellon_separator_mm_label= QtWidgets.QLabel(':')
excellon_separator_mm_label = QtWidgets.QLabel(':')
excellon_separator_mm_label.setFixedWidth(5)
hlay2.addWidget(excellon_separator_mm_label, QtCore.Qt.AlignLeft)
@ -4732,8 +4721,7 @@ class ExcellonOptPrefGroupUI(OptionsGroupUI):
self.pp_excellon_name_cb.setFocusPolicy(Qt.StrongFocus)
grid2.addWidget(self.pp_excellon_name_cb, 9, 1)
#### Choose what to use for Gcode creation: Drills, Slots or Both
# ### Choose what to use for Gcode creation: Drills, Slots or Both
excellon_gcode_type_label = QtWidgets.QLabel(_('<b>Gcode: </b>'))
excellon_gcode_type_label.setToolTip(
_("Choose what to use for GCode generation:\n"
@ -4751,7 +4739,7 @@ class ExcellonOptPrefGroupUI(OptionsGroupUI):
excellon_gcode_type_label.hide()
self.excellon_gcode_type_radio.setVisible(False)
#### Milling Holes ## ##
# ### Milling Holes ## ##
self.mill_hole_label = QtWidgets.QLabel(_('<b>Mill Holes</b>'))
self.mill_hole_label.setToolTip(
_("Create Geometry for milling holes.")
@ -4796,9 +4784,9 @@ class ExcellonAdvOptPrefGroupUI(OptionsGroupUI):
self.setTitle(str(_("Excellon Adv. Options")))
#################### ##
# ## ADVANCED OPTIONS # ##
#################### ##
# #######################
# ## ADVANCED OPTIONS ###
# #######################
self.cncjob_label = QtWidgets.QLabel(_('<b>Advanced Options:</b>'))
self.cncjob_label.setToolTip(
@ -5089,7 +5077,7 @@ class ExcellonEditorPrefGroupUI(OptionsGroupUI):
grid0.addWidget(self.drill_array_linear_label, 3, 0, 1, 2)
# Linear Drill Array direction
self.drill_axis_label = QtWidgets.QLabel(_('Direction:'))
self.drill_axis_label = QtWidgets.QLabel(_('Linear Dir.:'))
self.drill_axis_label.setToolTip(
_("Direction on which the linear array is oriented:\n"
"- 'X' - horizontal axis \n"
@ -5115,9 +5103,42 @@ class ExcellonEditorPrefGroupUI(OptionsGroupUI):
grid0.addWidget(self.drill_pitch_label, 5, 0)
grid0.addWidget(self.drill_pitch_entry, 5, 1)
# Linear Drill Array custom angle
self.drill_angle_label = QtWidgets.QLabel(_('Angle:'))
self.drill_angle_label.setToolTip(
_("Angle at which each element in circular array is placed.")
)
self.drill_angle_entry = LengthEntry()
grid0.addWidget(self.drill_angle_label, 6, 0)
grid0.addWidget(self.drill_angle_entry, 6, 1)
self.drill_array_circ_label = QtWidgets.QLabel(_('<b>Circular Drill Array:</b>'))
grid0.addWidget(self.drill_array_circ_label, 7, 0, 1, 2)
# Circular Drill Array direction
self.drill_circular_direction_label = QtWidgets.QLabel(_('Circular Dir.:'))
self.drill_circular_direction_label.setToolTip(
_("Direction for circular array."
"Can be CW = clockwise or CCW = counter clockwise.")
)
self.drill_circular_dir_radio = RadioSet([{'label': 'CW', 'value': 'CW'},
{'label': 'CCW.', 'value': 'CCW'}])
grid0.addWidget(self.drill_circular_direction_label, 8, 0)
grid0.addWidget(self.drill_circular_dir_radio, 8, 1)
# Circular Drill Array Angle
self.drill_circular_angle_label = QtWidgets.QLabel(_('Circ. Angle:'))
self.drill_circular_angle_label.setToolTip(
_("Angle at which each element in circular array is placed.")
)
self.drill_circular_angle_entry = LengthEntry()
grid0.addWidget(self.drill_circular_angle_label, 9, 0)
grid0.addWidget(self.drill_circular_angle_entry, 9, 1)
self.layout.addStretch()
@ -5539,8 +5560,7 @@ class CNCJobGenPrefGroupUI(OptionsGroupUI):
# Display Annotation
self.annotation_label = QtWidgets.QLabel(_("Display Annotation:"))
self.annotation_label.setToolTip(
_(
"This selects if to display text annotation on the plot.\n"
_("This selects if to display text annotation on the plot.\n"
"When checked it will display numbers in order for each end\n"
"of a travel line."
)
@ -5735,7 +5755,8 @@ class CNCJobAdvOptPrefGroupUI(OptionsGroupUI):
self.tc_variable_combo.setItemData(8, _("z_move = Z height for travel"), Qt.ToolTipRole)
self.tc_variable_combo.setItemData(9, _("z_depthpercut = the step value for multidepth cut"), Qt.ToolTipRole)
self.tc_variable_combo.setItemData(10, _("spindlesspeed = the value for the spindle speed"), Qt.ToolTipRole)
self.tc_variable_combo.setItemData(11, _("dwelltime = time to dwell to allow the spindle to reach it's set RPM"),
self.tc_variable_combo.setItemData(11,
_("dwelltime = time to dwell to allow the spindle to reach it's set RPM"),
Qt.ToolTipRole)
hlay1.addStretch()
@ -5829,7 +5850,7 @@ class ToolsNCCPrefGroupUI(OptionsGroupUI):
contourlabel = QtWidgets.QLabel(_("Contour:"))
contourlabel.setToolTip(
_( "Cut around the perimeter of the polygon\n"
_("Cut around the perimeter of the polygon\n"
"to trim rough edges.")
)
grid0.addWidget(contourlabel, 5, 0)
@ -5873,7 +5894,7 @@ class ToolsCutoutPrefGroupUI(OptionsGroupUI):
tdclabel = QtWidgets.QLabel(_('Tool dia:'))
tdclabel.setToolTip(
_( "Diameter of the cutting tool.")
_("Diameter of the cutting tool.")
)
grid0.addWidget(tdclabel, 0, 0)
self.cutout_tooldia_entry = LengthEntry()
@ -6438,7 +6459,7 @@ class ToolsTransformPrefGroupUI(OptionsGroupUI):
self.offx_entry = FCEntry()
self.offx_label = QtWidgets.QLabel(_("Offset_X val:"))
self.offx_label.setToolTip(
_( "Distance to offset on X axis. In current units.")
_("Distance to offset on X axis. In current units.")
)
grid0.addWidget(self.offx_label, 6, 0)
grid0.addWidget(self.offx_entry, 6, 1)
@ -6596,7 +6617,7 @@ class ToolsSolderpastePrefGroupUI(OptionsGroupUI):
self.frz_dispense_label = QtWidgets.QLabel(_("Feedrate Z Dispense:"))
self.frz_dispense_label.setToolTip(
_("Feedrate (speed) while moving up vertically\n"
" to Dispense position (on Z plane).")
"to Dispense position (on Z plane).")
)
grid0.addWidget(self.frz_dispense_label, 10, 0)
grid0.addWidget(self.frz_dispense_entry, 10, 1)