- more refactoring; solved some issues introduced by the refactoring

This commit is contained in:
Marius Stanciu 2020-05-18 18:45:53 +03:00 committed by Marius
parent 2bcdeff7ef
commit d61ca10e75
47 changed files with 136 additions and 159 deletions

View File

@ -50,7 +50,7 @@ from AppDatabase import ToolsDB2
from vispy.gloo.util import _screenshot
from vispy.io import write_png
# FlatCAM AppObjects
# FlatCAM Objects
from defaults import FlatCAMDefaults
from AppGUI.preferences.OptionsGroupUI import OptionsGroupUI
from AppGUI.preferences.PreferencesUIManager import PreferencesUIManager
@ -1896,7 +1896,7 @@ class App(QtCore.QObject):
self.calculator_tool = ToolCalculator(self)
self.calculator_tool.install(icon=QtGui.QIcon(self.resource_location + '/calculator16.png'), separator=True)
self.sub_tool = ToolSub(app=self)
self.sub_tool = ToolSub(self)
self.sub_tool.install(icon=QtGui.QIcon(self.resource_location + '/sub32.png'),
pos=self.ui.menutool, separator=True)
@ -2049,9 +2049,6 @@ class App(QtCore.QObject):
self.ui.zoom_out_btn.triggered.connect(lambda: self.plotcanvas.zoom(1.5))
# Edit Toolbar Signals
self.ui.newgeo_btn.triggered.connect(self.app_obj.new_geometry_object)
self.ui.newgrb_btn.triggered.connect(self.app_obj.new_gerber_object)
self.ui.newexc_btn.triggered.connect(self.app_obj.new_excellon_object)
self.ui.editgeo_btn.triggered.connect(self.object2editor)
self.ui.update_obj_btn.triggered.connect(lambda: self.editor2object())
self.ui.copy_btn.triggered.connect(self.on_copy_command)
@ -3586,7 +3583,7 @@ class App(QtCore.QObject):
if len(objs) < 2:
self.inform.emit('[ERROR_NOTCL] %s: %d' %
(_("At least two objects are required for join. AppObjects currently selected"), len(objs)))
(_("At least two objects are required for join. Objects currently selected"), len(objs)))
return 'fail'
for obj in objs:
@ -3645,7 +3642,7 @@ class App(QtCore.QObject):
if len(objs) < 2:
self.inform.emit('[ERROR_NOTCL] %s: %d' %
(_("At least two objects are required for join. AppObjects currently selected"), len(objs)))
(_("At least two objects are required for join. Objects currently selected"), len(objs)))
return 'fail'
def initialize(exc_obj, app):
@ -3673,7 +3670,7 @@ class App(QtCore.QObject):
if len(objs) < 2:
self.inform.emit('[ERROR_NOTCL] %s: %d' %
(_("At least two objects are required for join. AppObjects currently selected"), len(objs)))
(_("At least two objects are required for join. Objects currently selected"), len(objs)))
return 'fail'
def initialize(grb_obj, app):
@ -5793,7 +5790,7 @@ class App(QtCore.QObject):
else:
self.plotcanvas.auto_adjust_axes()
self.on_zoom_fit(None)
self.on_zoom_fit()
self.collection.update_view()
# self.inform.emit(_("Plots updated ..."))
@ -6285,7 +6282,7 @@ class App(QtCore.QObject):
for obj in self.all_objects_list:
# ScriptObject and DocumentObject objects can't be selected
if isinstance(obj, ScriptObject) or isinstance(obj, DocumentObject):
if obj.kind == 'script' or obj.kind == 'document':
continue
if key == 'multisel' and obj.options['name'] in self.objects_under_the_click_list:
@ -7596,8 +7593,6 @@ class App(QtCore.QObject):
Will create a new script file and open it in the Code Editor
:param silent: if True will not display status messages
:param name: if specified will be the name of the new script
:param text: pass a source file to the newly created script to be loaded in it
:return: None
"""
if silent is False:
@ -9465,8 +9460,8 @@ class App(QtCore.QObject):
# no_stats dict; just so it won't break things on website
no_ststs_dict = {}
no_ststs_dict["global_ststs"] = {}
full_url = App.version_url + "?s=" + str(self.defaults['global_serial']) + "&v=" + str(self.version) + \
"&os=" + str(self.os) + "&" + urllib.parse.urlencode(no_ststs_dict["global_ststs"])
full_url = App.version_url + "?s=" + str(self.defaults['global_serial']) + "&v=" + str(self.version)
full_url += "&os=" + str(self.os) + "&" + urllib.parse.urlencode(no_ststs_dict["global_ststs"])
App.log.debug("Checking for updates @ %s" % full_url)
# ## Get the data
@ -9569,13 +9564,12 @@ class App(QtCore.QObject):
# will use the default Matplotlib axes
self.hover_shapes = ShapeCollectionLegacy(obj=self, app=self, name='hover')
def on_zoom_fit(self, event):
def on_zoom_fit(self):
"""
Callback for zoom-fit request. This can be either from the corresponding
toolbar button or the '1' key when the canvas is focused. Calls ``self.adjust_axes()``
with axes limits from the geometry bounds of all objects.
:param event: Ignored.
:return: None
"""
if self.is_legacy is False:
@ -9644,7 +9638,7 @@ class App(QtCore.QObject):
"""
Enable plots
:param objects: list of AppObjects to be enabled
:param objects: list of Objects to be enabled
:return:
"""
log.debug("Enabling plots ...")
@ -9685,7 +9679,7 @@ class App(QtCore.QObject):
"""
Disables plots
:param objects: list of AppObjects to be disabled
:param objects: list of Objects to be disabled
:return:
"""
@ -9734,7 +9728,7 @@ class App(QtCore.QObject):
"""
Toggle plots visibility
:param objects: list of AppObjects for which to be toggled the visibility
:param objects: list of Objects for which to be toggled the visibility
:return: None
"""

View File

@ -15,10 +15,9 @@ from PyQt5 import QtGui, QtCore, QtWidgets
from PyQt5.QtCore import Qt, QSettings
from camlib import distance, arc, three_point_circle, Geometry, FlatCAMRTreeStorage
from AppTool import AppTool
from AppGUI.ObjectUI import RadioSet
from AppTools.AppTool import AppTool
from AppGUI.GUIElements import OptionalInputSection, FCCheckBox, FCEntry, FCComboBox, FCTextAreaRich, \
FCTable, FCDoubleSpinner, FCButton, EvalEntry2, FCInputDialog, FCTree
FCDoubleSpinner, FCButton, FCInputDialog, FCTree
from AppParsers.ParseFont import *
from shapely.geometry import LineString, LinearRing, MultiLineString, Polygon, MultiPolygon

View File

@ -14,15 +14,13 @@ import shapely.affinity as affinity
from vispy.geometry import Rect
import threading
import time
from copy import copy, deepcopy
import logging
from camlib import distance, arc, three_point_circle
from AppGUI.GUIElements import FCEntry, FCComboBox, FCTable, FCDoubleSpinner, FCSpinner, RadioSet, \
EvalEntry2, FCInputDialog, FCButton, OptionalInputSection, FCCheckBox
from AppTool import AppTool
from AppTools.AppTool import AppTool
import numpy as np
from numpy.linalg import norm as numpy_norm

View File

@ -581,7 +581,7 @@ class MainGUI(QtWidgets.QMainWindow):
self.geo_cutpath_menuitem = self.geo_editor_menu.addAction(
QtGui.QIcon(self.app.resource_location + '/cutpath16.png'), _('Cut Path\tX'))
# self.move_menuitem = self.menu.addAction(
# QtGui.QIcon(self.app.resource_location + '/move16.png'), "Move AppObjects 'm'")
# QtGui.QIcon(self.app.resource_location + '/move16.png'), "Move Objects 'm'")
self.geo_copy_menuitem = self.geo_editor_menu.addAction(
QtGui.QIcon(self.app.resource_location + '/copy16.png'), _("Copy Geom\tC"))
self.geo_delete_menuitem = self.geo_editor_menu.addAction(
@ -789,9 +789,9 @@ class MainGUI(QtWidgets.QMainWindow):
self.toolbarfile.setObjectName('File_TB')
self.addToolBar(self.toolbarfile)
self.toolbargeo = QtWidgets.QToolBar(_('Edit Toolbar'))
self.toolbargeo.setObjectName('Edit_TB')
self.addToolBar(self.toolbargeo)
self.toolbaredit = QtWidgets.QToolBar(_('Edit Toolbar'))
self.toolbaredit.setObjectName('Edit_TB')
self.addToolBar(self.toolbaredit)
self.toolbarview = QtWidgets.QToolBar(_('View Toolbar'))
self.toolbarview.setObjectName('View_TB')
@ -845,37 +845,30 @@ class MainGUI(QtWidgets.QMainWindow):
# ########################################################################
# ########################## Edit Toolbar# ###############################
# ########################################################################
self.newgeo_btn = self.toolbargeo.addAction(
QtGui.QIcon(self.app.resource_location + '/new_file_geo32.png'), _("New Blank Geometry"))
self.newgrb_btn = self.toolbargeo.addAction(
QtGui.QIcon(self.app.resource_location + '/new_file_grb32.png'), _("New Blank Gerber"))
self.newexc_btn = self.toolbargeo.addAction(
QtGui.QIcon(self.app.resource_location + '/new_file_exc32.png'), _("New Blank Excellon"))
self.toolbargeo.addSeparator()
self.editgeo_btn = self.toolbargeo.addAction(
self.editgeo_btn = self.toolbaredit.addAction(
QtGui.QIcon(self.app.resource_location + '/edit_file32.png'), _("Editor"))
self.update_obj_btn = self.toolbargeo.addAction(
self.update_obj_btn = self.toolbaredit.addAction(
QtGui.QIcon(self.app.resource_location + '/close_edit_file32.png'), _("Save Object and close the Editor")
)
self.toolbargeo.addSeparator()
self.copy_btn = self.toolbargeo.addAction(
self.toolbaredit.addSeparator()
self.copy_btn = self.toolbaredit.addAction(
QtGui.QIcon(self.app.resource_location + '/copy_file32.png'), _("Copy"))
self.delete_btn = self.toolbargeo.addAction(
self.delete_btn = self.toolbaredit.addAction(
QtGui.QIcon(self.app.resource_location + '/delete_file32.png'), _("&Delete"))
self.toolbargeo.addSeparator()
self.distance_btn = self.toolbargeo.addAction(
self.toolbaredit.addSeparator()
self.distance_btn = self.toolbaredit.addAction(
QtGui.QIcon(self.app.resource_location + '/distance32.png'), _("Distance Tool"))
self.distance_min_btn = self.toolbargeo.addAction(
self.distance_min_btn = self.toolbaredit.addAction(
QtGui.QIcon(self.app.resource_location + '/distance_min32.png'), _("Distance Min Tool"))
self.origin_btn = self.toolbargeo.addAction(
self.origin_btn = self.toolbaredit.addAction(
QtGui.QIcon(self.app.resource_location + '/origin32.png'), _('Set Origin'))
self.move2origin_btn = self.toolbargeo.addAction(
self.move2origin_btn = self.toolbaredit.addAction(
QtGui.QIcon(self.app.resource_location + '/origin2_32.png'), _('Move to Origin'))
self.jmp_btn = self.toolbargeo.addAction(
self.jmp_btn = self.toolbaredit.addAction(
QtGui.QIcon(self.app.resource_location + '/jump_to16.png'), _('Jump to Location'))
self.locate_btn = self.toolbargeo.addAction(
self.locate_btn = self.toolbaredit.addAction(
QtGui.QIcon(self.app.resource_location + '/locate32.png'), _('Locate in Object'))
# ########################################################################
@ -912,7 +905,7 @@ class MainGUI(QtWidgets.QMainWindow):
self.dblsided_btn = self.toolbartools.addAction(
QtGui.QIcon(self.app.resource_location + '/doubleside32.png'), _("2Sided Tool"))
self.align_btn = self.toolbartools.addAction(
QtGui.QIcon(self.app.resource_location + '/align32.png'), _("Align AppObjects Tool"))
QtGui.QIcon(self.app.resource_location + '/align32.png'), _("Align Objects Tool"))
self.extract_btn = self.toolbartools.addAction(
QtGui.QIcon(self.app.resource_location + '/extract_drill32.png'), _("Extract Drills Tool"))
@ -1035,7 +1028,7 @@ class MainGUI(QtWidgets.QMainWindow):
QtGui.QIcon(self.app.resource_location + '/transform.png'), _("Transformations"))
self.geo_edit_toolbar.addSeparator()
self.geo_move_btn = self.geo_edit_toolbar.addAction(
QtGui.QIcon(self.app.resource_location + '/move32.png'), _("Move AppObjects "))
QtGui.QIcon(self.app.resource_location + '/move32.png'), _("Move Objects "))
# ########################################################################
# ########################## Gerber Editor Toolbar# ######################
@ -1374,11 +1367,11 @@ class MainGUI(QtWidgets.QMainWindow):
self.cmenu_newmenu = self.popMenu.addMenu(
QtGui.QIcon(self.app.resource_location + '/file32.png'), _("New"))
self.popmenu_new_geo = self.cmenu_newmenu.addAction(
QtGui.QIcon(self.app.resource_location + '/new_geo32_bis.png'), _("Geometry"))
QtGui.QIcon(self.app.resource_location + '/new_file_geo16.png'), _("Geometry"))
self.popmenu_new_grb = self.cmenu_newmenu.addAction(
QtGui.QIcon(self.app.resource_location + '/flatcam_icon32.png'), "Gerber")
QtGui.QIcon(self.app.resource_location + '/new_file_grb16.png'), "Gerber")
self.popmenu_new_exc = self.cmenu_newmenu.addAction(
QtGui.QIcon(self.app.resource_location + '/new_exc32.png'), _("Excellon"))
QtGui.QIcon(self.app.resource_location + '/new_file_exc16.png'), _("Excellon"))
self.cmenu_newmenu.addSeparator()
self.popmenu_new_prj = self.cmenu_newmenu.addAction(
QtGui.QIcon(self.app.resource_location + '/file16.png'), _("Project"))
@ -1694,9 +1687,9 @@ class MainGUI(QtWidgets.QMainWindow):
self.toolbarfile.setVisible(False)
if tb & 2:
self.toolbargeo.setVisible(True)
self.toolbaredit.setVisible(True)
else:
self.toolbargeo.setVisible(False)
self.toolbaredit.setVisible(False)
if tb & 4:
self.toolbarview.setVisible(True)
@ -1816,37 +1809,30 @@ class MainGUI(QtWidgets.QMainWindow):
# ########################################################################
# ## Edit Toolbar # ##
# ########################################################################
self.newgeo_btn = self.toolbargeo.addAction(
QtGui.QIcon(self.app.resource_location + '/new_file_geo32.png'), _("New Blank Geometry"))
self.newgrb_btn = self.toolbargeo.addAction(
QtGui.QIcon(self.app.resource_location + '/new_file_grb32.png'), _("New Blank Gerber"))
self.newexc_btn = self.toolbargeo.addAction(
QtGui.QIcon(self.app.resource_location + '/new_file_exc32.png'), _("New Blank Excellon"))
self.toolbargeo.addSeparator()
self.editgeo_btn = self.toolbargeo.addAction(
self.editgeo_btn = self.toolbaredit.addAction(
QtGui.QIcon(self.app.resource_location + '/edit32.png'), _("Editor"))
self.update_obj_btn = self.toolbargeo.addAction(
self.update_obj_btn = self.toolbaredit.addAction(
QtGui.QIcon(self.app.resource_location + '/close_edit_file32.png'),
_("Save Object and close the Editor")
)
self.toolbargeo.addSeparator()
self.copy_btn = self.toolbargeo.addAction(
self.toolbaredit.addSeparator()
self.copy_btn = self.toolbaredit.addAction(
QtGui.QIcon(self.app.resource_location + '/copy_file32.png'), _("Copy"))
self.delete_btn = self.toolbargeo.addAction(
self.delete_btn = self.toolbaredit.addAction(
QtGui.QIcon(self.app.resource_location + '/delete_file32.png'), _("&Delete"))
self.toolbargeo.addSeparator()
self.distance_btn = self.toolbargeo.addAction(
self.toolbaredit.addSeparator()
self.distance_btn = self.toolbaredit.addAction(
QtGui.QIcon(self.app.resource_location + '/distance32.png'), _("Distance Tool"))
self.distance_min_btn = self.toolbargeo.addAction(
self.distance_min_btn = self.toolbaredit.addAction(
QtGui.QIcon(self.app.resource_location + '/distance_min32.png'), _("Distance Min Tool"))
self.origin_btn = self.toolbargeo.addAction(
self.origin_btn = self.toolbaredit.addAction(
QtGui.QIcon(self.app.resource_location + '/origin32.png'), _('Set Origin'))
self.move2origin_btn = self.toolbargeo.addAction(
self.move2origin_btn = self.toolbaredit.addAction(
QtGui.QIcon(self.app.resource_location + '/origin2_32.png'), _('Move to Origin'))
self.jmp_btn = self.toolbargeo.addAction(
self.jmp_btn = self.toolbaredit.addAction(
QtGui.QIcon(self.app.resource_location + '/jump_to16.png'), _('Jump to Location'))
self.locate_btn = self.toolbargeo.addAction(
self.locate_btn = self.toolbaredit.addAction(
QtGui.QIcon(self.app.resource_location + '/locate32.png'), _('Locate in Object'))
# ########################################################################
@ -1881,7 +1867,7 @@ class MainGUI(QtWidgets.QMainWindow):
self.dblsided_btn = self.toolbartools.addAction(
QtGui.QIcon(self.app.resource_location + '/doubleside32.png'), _("2Sided Tool"))
self.align_btn = self.toolbartools.addAction(
QtGui.QIcon(self.app.resource_location + '/align32.png'), _("Align AppObjects Tool"))
QtGui.QIcon(self.app.resource_location + '/align32.png'), _("Align Objects Tool"))
self.extract_btn = self.toolbartools.addAction(
QtGui.QIcon(self.app.resource_location + '/extract_drill32.png'), _("Extract Drills Tool"))
@ -1996,7 +1982,7 @@ class MainGUI(QtWidgets.QMainWindow):
self.geo_cutpath_btn = self.geo_edit_toolbar.addAction(
QtGui.QIcon(self.app.resource_location + '/cutpath32.png'), _('Cut Path'))
self.geo_copy_btn = self.geo_edit_toolbar.addAction(
QtGui.QIcon(self.app.resource_location + '/copy32.png'), _("Copy AppObjects"))
QtGui.QIcon(self.app.resource_location + '/copy32.png'), _("Copy Objects"))
self.geo_delete_btn = self.geo_edit_toolbar.addAction(
QtGui.QIcon(self.app.resource_location + '/trash32.png'), _("Delete Shape"))
self.geo_transform_btn = self.geo_edit_toolbar.addAction(
@ -2004,7 +1990,7 @@ class MainGUI(QtWidgets.QMainWindow):
self.geo_edit_toolbar.addSeparator()
self.geo_move_btn = self.geo_edit_toolbar.addAction(
QtGui.QIcon(self.app.resource_location + '/move32.png'), _("Move AppObjects"))
QtGui.QIcon(self.app.resource_location + '/move32.png'), _("Move Objects"))
# ########################################################################
# ## Gerber Editor Toolbar # ##
@ -2547,7 +2533,7 @@ class MainGUI(QtWidgets.QMainWindow):
# Zoom Fit
if key == QtCore.Qt.Key_V:
self.app.on_zoom_fit(None)
self.app.on_zoom_fit()
# Mirror on X the selected object(s)
if key == QtCore.Qt.Key_X:
@ -2726,7 +2712,7 @@ class MainGUI(QtWidgets.QMainWindow):
self.app.geo_editor.on_corner_snap()
if key == QtCore.Qt.Key_V or key == 'V':
self.app.on_zoom_fit(None)
self.app.on_zoom_fit()
# we do this so we can reuse the following keys while inside a Tool
# the above keys are general enough so were left outside
@ -3180,7 +3166,7 @@ class MainGUI(QtWidgets.QMainWindow):
# Zoom Fit
if key == QtCore.Qt.Key_V or key == 'V':
self.app.exc_editor.launched_from_shortcuts = True
self.app.on_zoom_fit(None)
self.app.on_zoom_fit()
return
# Add Slot Hole Tool
@ -4010,7 +3996,7 @@ class ShortcutsTab(QtWidgets.QWidget):
_("Skew on Y axis"),
# ALT section
_("Align AppObjects Tool"), _("Calculators Tool"), _("2-Sided PCB Tool"), _("Transformations Tool"),
_("Align Objects Tool"), _("Calculators Tool"), _("2-Sided PCB Tool"), _("Transformations Tool"),
_("Punch Gerber Tool"), _("Extract Drills Tool"), _("Fiducials Tool"),
_("Solder Paste Dispensing Tool"),
_("Film PCB Tool"), _("Corner Markers Tool"), _("Non-Copper Clearing Tool"), _("Optimal Tool"),

View File

@ -1272,7 +1272,7 @@ class ExcellonObjectUI(ObjectUI):
pp_excellon_label = QtWidgets.QLabel('%s:' % _("Preprocessor E"))
pp_excellon_label.setToolTip(
_("The preprocessor JSON file that dictates\n"
"Gcode output for Excellon AppObjects.")
"Gcode output for Excellon Objects.")
)
self.pp_excellon_name_cb = FCComboBox()
self.pp_excellon_name_cb.setFocusPolicy(QtCore.Qt.StrongFocus)
@ -1284,7 +1284,7 @@ class ExcellonObjectUI(ObjectUI):
pp_geo_label = QtWidgets.QLabel('%s:' % _("Preprocessor G"))
pp_geo_label.setToolTip(
_("The preprocessor JSON file that dictates\n"
"Gcode output for Geometry (Milling) AppObjects.")
"Gcode output for Geometry (Milling) Objects.")
)
self.pp_geo_name_cb = FCComboBox()
self.pp_geo_name_cb.setFocusPolicy(QtCore.Qt.StrongFocus)

View File

@ -1093,7 +1093,7 @@ class PreferencesUIManager:
if self.ui.toolbarfile.isVisible():
tb_status += 1
if self.ui.toolbargeo.isVisible():
if self.ui.toolbaredit.isVisible():
tb_status += 2
if self.ui.toolbarview.isVisible():

View File

@ -647,7 +647,7 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI):
# first remove the toolbars:
try:
self.app.ui.removeToolBar(self.app.ui.toolbarfile)
self.app.ui.removeToolBar(self.app.ui.toolbargeo)
self.app.ui.removeToolBar(self.app.ui.toolbaredit)
self.app.ui.removeToolBar(self.app.ui.toolbarview)
self.app.ui.removeToolBar(self.app.ui.toolbarshell)
self.app.ui.removeToolBar(self.app.ui.toolbartools)
@ -664,9 +664,9 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI):
self.app.ui.toolbarfile.setObjectName('File_TB')
self.app.ui.addToolBar(Qt.LeftToolBarArea, self.app.ui.toolbarfile)
self.app.ui.toolbargeo = QtWidgets.QToolBar('Edit Toolbar')
self.app.ui.toolbargeo.setObjectName('Edit_TB')
self.app.ui.addToolBar(Qt.LeftToolBarArea, self.app.ui.toolbargeo)
self.app.ui.toolbaredit = QtWidgets.QToolBar('Edit Toolbar')
self.app.ui.toolbaredit.setObjectName('Edit_TB')
self.app.ui.addToolBar(Qt.LeftToolBarArea, self.app.ui.toolbaredit)
self.app.ui.toolbarshell = QtWidgets.QToolBar('Shell Toolbar')
self.app.ui.toolbarshell.setObjectName('Shell_TB')
@ -702,9 +702,9 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI):
self.app.ui.toolbarfile.setObjectName('File_TB')
self.app.ui.addToolBar(self.app.ui.toolbarfile)
self.app.ui.toolbargeo = QtWidgets.QToolBar('Edit Toolbar')
self.app.ui.toolbargeo.setObjectName('Edit_TB')
self.app.ui.addToolBar(self.app.ui.toolbargeo)
self.app.ui.toolbaredit = QtWidgets.QToolBar('Edit Toolbar')
self.app.ui.toolbaredit.setObjectName('Edit_TB')
self.app.ui.addToolBar(self.app.ui.toolbaredit)
self.app.ui.toolbarview = QtWidgets.QToolBar('View Toolbar')
self.app.ui.toolbarview.setObjectName('View_TB')

View File

@ -292,7 +292,7 @@ class AppObject(QtCore.QObject):
self.app.collection.append(obj)
# after adding the object to the collection always update the list of objects that are in the collection
self.all_objects_list = self.app.collection.get_list()
self.app.all_objects_list = self.app.collection.get_list()
# self.app.inform.emit('[selected] %s created & selected: %s' %
# (str(obj.kind).capitalize(), str(obj.options['name'])))
@ -358,7 +358,7 @@ class AppObject(QtCore.QObject):
# Send to worker
# self.worker.add_task(worker_task, [self])
if plot is True:
self.worker_task.emit({'fcn': task, 'params': [obj]})
self.app.worker_task.emit({'fcn': task, 'params': [obj]})
def on_object_changed(self, obj):
"""
@ -390,4 +390,4 @@ class AppObject(QtCore.QObject):
:return: None
"""
self.app.on_zoom_fit(None)
self.app.on_zoom_fit()

View File

@ -146,7 +146,7 @@ class ExcellonObject(FlatCAMObj, Excellon):
If only one object is in exc_list parameter then this function will copy that object in the exc_final
:param exc_list: List or one object of ExcellonObject AppObjects to join.
:param exc_list: List or one object of ExcellonObject Objects to join.
:param exc_final: Destination ExcellonObject object.
:return: None
"""

View File

@ -2738,7 +2738,7 @@ class GeometryObject(FlatCAMObj, Geometry):
"""
Merges the geometry of objects in grb_list into the geometry of geo_final.
:param geo_list: List of GerberObject AppObjects to join.
:param geo_list: List of GerberObject Objects to join.
:param geo_final: Destination GerberObject object.
:param multigeo: if the merged geometry objects are of type MultiGeo
:return: None

View File

@ -45,7 +45,7 @@ class GerberObject(FlatCAMObj, Gerber):
Merges the geometry of objects in geo_list into
the geometry of geo_final.
:param grb_list: List of GerberObject AppObjects to join.
:param grb_list: List of GerberObject Objects to join.
:param grb_final: Destination GeometryObject object.
:return: None
"""

View File

@ -1010,7 +1010,7 @@ class ObjectCollection(QtCore.QAbstractItemModel):
def on_row_selected(self, obj_name):
"""
This is a special string; when received it will make all Menu -> AppObjects entries unchecked
This is a special string; when received it will make all Menu -> Objects entries unchecked
It mean we clicked outside of the items and deselected all
:param obj_name:
@ -1194,6 +1194,6 @@ class ObjectCollection(QtCore.QAbstractItemModel):
pass
if obj_list:
self.app.inform.emit('%s' % _("AppObjects selection is cleared."))
self.app.inform.emit('%s' % _("Objects selection is cleared."))
else:
self.app.inform.emit('')

View File

@ -6,8 +6,7 @@
# MIT Licence #
# ########################################################## ##
from PyQt5 import QtGui, QtCore, QtWidgets, QtWidgets
from PyQt5.QtCore import Qt
from PyQt5 import QtCore, QtWidgets
from shapely.geometry import Polygon, LineString
@ -27,15 +26,16 @@ class AppTool(QtWidgets.QWidget):
def __init__(self, app, parent=None):
"""
:param app: The application this tool will run in.
:type app: AppMain
:param parent: Qt Parent
:return: AppTool
:param app: The application this tool will run in.
:type app: App.App
:param parent: Qt Parent
:return: AppTool
"""
self.app = app
self.decimals = app.decimals
QtWidgets.QWidget.__init__(self, parent)
self.app = app
self.decimals = self.app.decimals
# self.setSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Maximum)
self.layout = QtWidgets.QVBoxLayout()

View File

@ -5,8 +5,8 @@
# MIT Licence #
# ##########################################################
from PyQt5 import QtWidgets, QtGui, QtCore
from AppTool import AppTool
from PyQt5 import QtWidgets, QtCore
from AppTools.AppTool import AppTool
from AppGUI.GUIElements import FCComboBox, RadioSet
@ -29,7 +29,7 @@ log = logging.getLogger('base')
class AlignObjects(AppTool):
toolName = _("Align AppObjects")
toolName = _("Align Objects")
def __init__(self, app):
AppTool.__init__(self, app)

View File

@ -6,7 +6,7 @@
# ##########################################################
from PyQt5 import QtWidgets
from AppTool import AppTool
from AppTools.AppTool import AppTool
from AppGUI.GUIElements import FCSpinner, FCDoubleSpinner, FCEntry
import math

View File

@ -7,7 +7,7 @@
from PyQt5 import QtWidgets, QtCore, QtGui
from AppTool import AppTool
from AppTools.AppTool import AppTool
from AppGUI.GUIElements import FCDoubleSpinner, EvalEntry, FCCheckBox, OptionalInputSection, FCEntry
from AppGUI.GUIElements import FCTable, FCComboBox, RadioSet
from AppEditors.FlatCAMTextEditor import TextEditor
@ -620,7 +620,7 @@ class ToolCalibration(AppTool):
grid_lay.addWidget(QtWidgets.QLabel(''), 44, 0, 1, 3)
# STEP 5 #
step_5 = QtWidgets.QLabel('<b>%s</b>' % _("STEP 5: Calibrate FlatCAM AppObjects"))
step_5 = QtWidgets.QLabel('<b>%s</b>' % _("STEP 5: Calibrate FlatCAM Objects"))
step_5.setToolTip(
_("Adjust the FlatCAM objects\n"
"with the factors determined and verified above.")
@ -656,7 +656,7 @@ class ToolCalibration(AppTool):
grid_lay.addWidget(self.adj_object_label, 48, 0, 1, 3)
grid_lay.addWidget(self.adj_object_combo, 49, 0, 1, 3)
# ## Adjust AppObjects Button
# ## Adjust Objects Button
self.cal_button = QtWidgets.QPushButton(_("Calibrate"))
self.cal_button.setToolTip(
_("Adjust (scale and/or skew) the objects\n"

View File

@ -8,7 +8,7 @@
from PyQt5 import QtWidgets, QtCore
from Common import GracefulException as grace
from AppTool import AppTool
from AppTools.AppTool import AppTool
from AppGUI.GUIElements import FCDoubleSpinner, RadioSet, FCEntry, FCComboBox
import shapely.geometry.base as base
@ -493,7 +493,7 @@ class ToolCopperThieving(AppTool):
""")
self.layout.addWidget(self.reset_button)
# AppObjects involved in Copper thieving
# Objects involved in Copper thieving
self.grb_object = None
self.ref_obj = None
self.sel_rect = []

View File

@ -7,7 +7,7 @@
from PyQt5 import QtWidgets, QtCore
from AppTool import AppTool
from AppTools.AppTool import AppTool
from AppGUI.GUIElements import FCDoubleSpinner, FCCheckBox, FCComboBox, FCButton
from shapely.geometry import MultiPolygon, LineString
@ -182,7 +182,7 @@ class ToolCorners(AppTool):
""")
self.layout.addWidget(self.reset_button)
# AppObjects involved in Copper thieving
# Objects involved in Copper thieving
self.grb_object = None
# store the flattened geometry here:

View File

@ -6,7 +6,7 @@
# ##########################################################
from PyQt5 import QtWidgets, QtGui, QtCore
from AppTool import AppTool
from AppTools.AppTool import AppTool
from AppGUI.GUIElements import FCDoubleSpinner, FCCheckBox, RadioSet, FCComboBox, OptionalInputSection, FCButton
from shapely.geometry import box, MultiPolygon, Polygon, LineString, LinearRing

View File

@ -1,7 +1,7 @@
from PyQt5 import QtWidgets, QtCore
from AppTool import AppTool
from AppTools.AppTool import AppTool
from AppGUI.GUIElements import RadioSet, FCDoubleSpinner, EvalEntry, FCEntry, FCButton, FCComboBox
from numpy import Inf
@ -48,9 +48,9 @@ class DblSidedTool(AppTool):
grid_lay.setColumnStretch(1, 0)
self.layout.addLayout(grid_lay)
# AppObjects to be mirrored
# Objects to be mirrored
self.m_objects_label = QtWidgets.QLabel("<b>%s:</b>" % _("Mirror Operation"))
self.m_objects_label.setToolTip('%s.' % _("AppObjects to be mirrored"))
self.m_objects_label.setToolTip('%s.' % _("Objects to be mirrored"))
grid_lay.addWidget(self.m_objects_label, 0, 0, 1, 2)
@ -154,7 +154,7 @@ class DblSidedTool(AppTool):
grid_lay1.setColumnStretch(1, 1)
self.layout.addLayout(grid_lay1)
# AppObjects to be mirrored
# Objects to be mirrored
self.param_label = QtWidgets.QLabel("<b>%s:</b>" % _("Mirror Parameters"))
self.param_label.setToolTip('%s.' % _("Parameters for the mirror operation"))

View File

@ -7,7 +7,7 @@
from PyQt5 import QtWidgets, QtCore
from AppTool import AppTool
from AppTools.AppTool import AppTool
from AppGUI.VisPyVisuals import *
from AppGUI.GUIElements import FCEntry, FCButton, FCCheckBox

View File

@ -6,8 +6,7 @@
# ##########################################################
from PyQt5 import QtWidgets, QtCore
from AppTool import AppTool
from AppGUI.VisPyVisuals import *
from AppTools.AppTool import AppTool
from AppGUI.GUIElements import FCEntry
from shapely.ops import nearest_points
@ -291,7 +290,7 @@ class DistanceMin(AppTool):
)
else:
self.app.inform.emit('[WARNING_NOTCL] %s: %s' %
(_("AppObjects intersects or touch at"),
(_("Objects intersects or touch at"),
"(%.*f, %.*f)" % (self.decimals, self.h_point[0], self.decimals, self.h_point[1])))
def on_jump_to_half_point(self):

View File

@ -7,7 +7,7 @@
from PyQt5 import QtWidgets, QtCore
from AppTool import AppTool
from AppTools.AppTool import AppTool
from AppGUI.GUIElements import RadioSet, FCDoubleSpinner, FCCheckBox, FCComboBox
from shapely.geometry import Point

View File

@ -7,7 +7,7 @@
from PyQt5 import QtWidgets, QtCore
from AppTool import AppTool
from AppTools.AppTool import AppTool
from AppGUI.GUIElements import FCDoubleSpinner, RadioSet, EvalEntry, FCTable, FCComboBox
from shapely.geometry import Point, Polygon, MultiPolygon, LineString
@ -327,7 +327,7 @@ class ToolFiducials(AppTool):
""")
self.layout.addWidget(self.reset_button)
# AppObjects involved in Copper thieving
# Objects involved in Copper thieving
self.grb_object = None
self.sm_object = None

View File

@ -5,9 +5,9 @@
# MIT Licence #
# ##########################################################
from PyQt5 import QtGui, QtCore, QtWidgets
from PyQt5 import QtCore, QtWidgets
from AppTool import AppTool
from AppTools.AppTool import AppTool
from AppGUI.GUIElements import RadioSet, FCDoubleSpinner, FCCheckBox, \
OptionalHideInputSection, OptionalInputSection, FCComboBox, FCFileSaveDialog

View File

@ -7,7 +7,7 @@
from PyQt5 import QtGui, QtWidgets
from AppTool import AppTool
from AppTools.AppTool import AppTool
from AppGUI.GUIElements import RadioSet, FCComboBox, FCSpinner
import gettext

View File

@ -7,7 +7,7 @@
from PyQt5 import QtWidgets, QtCore
from AppTool import AppTool
from AppTools.AppTool import AppTool
from AppGUI.GUIElements import FCButton, FCDoubleSpinner, RadioSet, FCComboBox
from shapely.geometry import box

View File

@ -6,7 +6,7 @@
# ##########################################################
from PyQt5 import QtWidgets, QtCore
from AppTool import AppTool
from AppTools.AppTool import AppTool
from AppGUI.VisPyVisuals import *
from copy import copy

View File

@ -7,7 +7,7 @@
from PyQt5 import QtWidgets, QtCore, QtGui
from AppTool import AppTool
from AppTools.AppTool import AppTool
from AppGUI.GUIElements import FCCheckBox, FCDoubleSpinner, RadioSet, FCTable, FCInputDialog, FCButton,\
FCComboBox, OptionalInputSection
from AppParsers.ParseGerber import Gerber

View File

@ -7,7 +7,7 @@
from PyQt5 import QtWidgets, QtCore, QtGui
from AppTool import AppTool
from AppTools.AppTool import AppTool
from AppGUI.GUIElements import OptionalHideInputSection, FCTextArea, FCEntry, FCSpinner, FCCheckBox, FCComboBox
from Common import GracefulException as grace

View File

@ -7,7 +7,7 @@
from PyQt5 import QtWidgets, QtCore
from AppTool import AppTool
from AppTools.AppTool import AppTool
from Common import GracefulException as grace
from AppParsers.ParsePDF import PdfParser
from shapely.geometry import Point, MultiPolygon

View File

@ -8,7 +8,7 @@
from PyQt5 import QtWidgets, QtGui, QtCore
from PyQt5.QtCore import Qt
from AppTool import AppTool
from AppTools.AppTool import AppTool
from copy import deepcopy
# from ObjectCollection import *
from AppParsers.ParseGerber import Gerber

View File

@ -6,7 +6,7 @@
# ##########################################################
from PyQt5 import QtWidgets, QtGui, QtCore
from AppTool import AppTool
from AppTools.AppTool import AppTool
from AppGUI.GUIElements import FCSpinner, FCDoubleSpinner, RadioSet, FCCheckBox, OptionalInputSection, FCComboBox
from Common import GracefulException as grace

View File

@ -7,7 +7,7 @@
from PyQt5 import QtWidgets, QtCore
from AppTool import AppTool
from AppTools.AppTool import AppTool
from AppGUI.GUIElements import RadioSet, FCSpinner, FCButton, FCTable
import re

View File

@ -6,7 +6,7 @@
# ##########################################################
from PyQt5 import QtGui, QtCore, QtWidgets
from AppTool import AppTool
from AppTools.AppTool import AppTool
from AppGUI.GUIElements import FCTree
from shapely.geometry import MultiPolygon, Polygon

View File

@ -7,7 +7,7 @@
from PyQt5 import QtCore, QtWidgets
from AppTool import AppTool
from AppTools.AppTool import AppTool
from AppGUI.GUIElements import RadioSet, FCDoubleSpinner, FCCheckBox, FCComboBox
from copy import deepcopy

View File

@ -8,7 +8,7 @@
from PyQt5 import QtWidgets, QtCore, QtGui
from PyQt5.QtCore import Qt
from AppTool import AppTool
from AppTools.AppTool import AppTool
from AppGUI.GUIElements import RadioSet, FCTextArea, FCSpinner, FCEntry, FCCheckBox, FCComboBox, FCFileSaveDialog
from AppParsers.ParseSVG import *

View File

@ -7,7 +7,7 @@
from PyQt5 import QtWidgets
from AppTool import AppTool
from AppTools.AppTool import AppTool
from AppGUI.GUIElements import FCDoubleSpinner, FCCheckBox, OptionalInputSection, FCComboBox
from copy import deepcopy
@ -196,7 +196,7 @@ class RulesCheck(AppTool):
self.grid_layout.addWidget(QtWidgets.QLabel(""), 8, 0, 1, 3)
self.excellon_title_lbl = QtWidgets.QLabel('<b>%s</b>:' % _("Excellon AppObjects"))
self.excellon_title_lbl = QtWidgets.QLabel('<b>%s</b>:' % _("Excellon Objects"))
self.excellon_title_lbl.setToolTip(
_("Excellon objects for which to check rules.")
)

View File

@ -5,11 +5,11 @@
# MIT Licence #
# ##########################################################
from AppTool import AppTool
from AppTools.AppTool import AppTool
from Common import LoudDict
from AppGUI.GUIElements import FCComboBox, FCEntry, FCTable, \
FCInputDialog, FCDoubleSpinner, FCSpinner, FCFileSaveDialog
from AppMain import log
from App import log
from camlib import distance
from AppEditors.FlatCAMTextEditor import TextEditor

View File

@ -7,7 +7,7 @@
from PyQt5 import QtWidgets, QtCore
from AppTool import AppTool
from AppTools.AppTool import AppTool
from AppGUI.GUIElements import FCCheckBox, FCButton, FCComboBox
from shapely.geometry import Polygon, MultiPolygon, MultiLineString, LineString
@ -62,7 +62,7 @@ class ToolSub(AppTool):
form_layout = QtWidgets.QFormLayout()
self.tools_box.addLayout(form_layout)
self.gerber_title = QtWidgets.QLabel("<b>%s</b>" % _("Gerber AppObjects"))
self.gerber_title = QtWidgets.QLabel("<b>%s</b>" % _("Gerber Objects"))
form_layout.addRow(self.gerber_title)
# Target Gerber Object
@ -117,7 +117,7 @@ class ToolSub(AppTool):
form_geo_layout = QtWidgets.QFormLayout()
self.tools_box.addLayout(form_geo_layout)
self.geo_title = QtWidgets.QLabel("<b>%s</b>" % _("Geometry AppObjects"))
self.geo_title = QtWidgets.QLabel("<b>%s</b>" % _("Geometry Objects"))
form_geo_layout.addRow(self.geo_title)
# Target Geometry Object

View File

@ -6,7 +6,7 @@
# ##########################################################
from PyQt5 import QtWidgets
from AppTool import AppTool
from AppTools.AppTool import AppTool
from AppGUI.GUIElements import FCDoubleSpinner, FCCheckBox, FCButton, OptionalInputSection, FCEntry
import gettext

View File

@ -21,6 +21,7 @@ CHANGELOG for FlatCAM beta
- more refactoring class names
- moved some of the methods from the App class to the ObjectCollection class
- moved all the new_object related methods in their own class AppObjects.AppObject
- more refactoring; solved some issues introduced by the refactoring
17.05.2020

View File

@ -15,7 +15,7 @@ from PyQt5 import QtCore
from shapely.geometry import Polygon, MultiPolygon
from AppGUI.VisPyVisuals import ShapeCollection
from AppTool import AppTool
from AppTools.AppTool import AppTool
import numpy as np

View File

@ -3,7 +3,7 @@ import os
from PyQt5 import QtWidgets
from PyQt5.QtCore import QSettings, Qt
from AppMain import App
from App import App
from AppGUI import VisPyPatches
from multiprocessing import freeze_support

View File

@ -6418,7 +6418,7 @@ def distance_euclidian(x1, y1, x2, y2):
class FlatCAMRTree(object):
"""
Indexes geometry (Any object with "cooords" property containing
a list of tuples with x, y values). AppObjects are indexed by
a list of tuples with x, y values). Objects are indexed by
all their points by default. To index by arbitrary points,
override self.points2obj.
"""

View File

@ -636,7 +636,7 @@ class FlatCAMDefaults:
"tools_punch_rectangular": False,
"tools_punch_others": False,
# Align AppObjects Tool
# Align Objects Tool
"tools_align_objects_align_type": 'sp',
# Invert Gerber Tool

View File

@ -1,6 +1,6 @@
import sys
import re
import AppMain
import App
import abc
import collections
from PyQt5 import QtCore
@ -53,7 +53,7 @@ class TclCommand(object):
if self.app is None:
raise TypeError('Expected app to be FlatCAMApp instance.')
if not isinstance(self.app, AppMain.App):
if not isinstance(self.app, App.App):
raise TypeError('Expected FlatCAMApp, got %s.' % type(app))
self.log = self.app.log