diff --git a/CHANGELOG.md b/CHANGELOG.md index 065dc290..d816b22a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,8 @@ CHANGELOG for FlatCAM beta - split the FlatCAMObj file into multiple files located in the flatcamObjects folder and renamed the contained classes with names more suggestive - updated the Google Translation for the German language - added support for Hungarian language - no translation for now +- minor changes +- moved the ObjectCollection class to the flatcamObjects folder where it belongs 25.04.2020 diff --git a/FlatCAMApp.py b/FlatCAMApp.py index 35ef604e..936b11cf 100644 --- a/FlatCAMApp.py +++ b/FlatCAMApp.py @@ -17,6 +17,7 @@ import lzma import shutil import stat from datetime import datetime +import time from stat import S_IREAD, S_IRGRP, S_IROTH import ctypes import traceback @@ -38,14 +39,20 @@ from multiprocessing.connection import Listener, Client from multiprocessing import Pool import socket -# ####################################### -# # Imports part of FlatCAM ## -# ####################################### +# #################################################################################################################### +# ################################### Imports part of FlatCAM ############################################# +# #################################################################################################################### + +# Diverse from FlatCAMCommon import LoudDict, color_variant from FlatCAMBookmark import BookmarkManager from FlatCAMDB import ToolsDB2 -from ObjectCollection import * +from vispy.gloo.util import _screenshot +from vispy.io import write_png + +# FlatCAM Objects +from flatcamObjects.ObjectCollection import * from flatcamObjects.FlatCAMObj import FlatCAMObj from flatcamObjects.FlatCAMCNCJob import CNCJobObject from flatcamObjects.FlatCAMDocument import DocumentObject @@ -54,32 +61,35 @@ from flatcamObjects.FlatCAMGeometry import GeometryObject from flatcamObjects.FlatCAMGerber import GerberObject from flatcamObjects.FlatCAMScript import ScriptObject +# FlatCAM Parsing files from flatcamParsers.ParseExcellon import Excellon from flatcamParsers.ParseGerber import Gerber from camlib import to_dict, dict2obj, ET, ParseError, Geometry, CNCjob +# FlatCAM GUI from flatcamGUI.PlotCanvas import * from flatcamGUI.PlotCanvasLegacy import * from flatcamGUI.FlatCAMGUI import * from flatcamGUI.GUIElements import FCFileSaveDialog +# FlatCAM Pre-processors from FlatCAMPostProc import load_preprocessors +# FlatCAM Editors from flatcamEditors.FlatCAMGeoEditor import FlatCAMGeoEditor from flatcamEditors.FlatCAMExcEditor import FlatCAMExcEditor from flatcamEditors.FlatCAMGrbEditor import FlatCAMGrbEditor from flatcamEditors.FlatCAMTextEditor import TextEditor - from flatcamParsers.ParseHPGL2 import HPGL2 +# FlatCAM Workers from FlatCAMProcess import * from FlatCAMWorkerStack import WorkerStack -# from flatcamGUI.VisPyVisuals import Color -from vispy.gloo.util import _screenshot -from vispy.io import write_png +# FlatCAM Tools from flatcamTools import * +# FlatCAM Translation import gettext import FlatCAMTranslation as fcTranslate import builtins @@ -301,9 +311,9 @@ class App(QtCore.QObject): else: App.log.debug("Win64!") - # ######################################################################### - # ####### CONFIG FILE WITH PARAMETERS REGARDING PORTABILITY ############### - # ######################################################################### + # ####################################################################################################### + # ####### CONFIG FILE WITH PARAMETERS REGARDING PORTABILITY ############################################# + # ####################################################################################################### config_file = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) + '\\config\\configuration.txt' try: with open(config_file, 'r'): @@ -919,9 +929,9 @@ class App(QtCore.QObject): # Distance Tool "tools_dist_snap_center": False, - # ################################################################################### - # ################################ TOOLS 2 ########################################## - # ################################################################################### + # ######################################################################################################## + # ################################ TOOLS 2 ############################################################### + # ######################################################################################################## # Optimal Tool "tools_opt_precision": 4, @@ -1071,9 +1081,9 @@ class App(QtCore.QObject): "document_tab_size": 80, }) - # ############################################################ - # ############### Load defaults from file #################### - # ############################################################ + # ########################################################################################################### + # ################################# Load defaults from file ################################################# + # ########################################################################################################### self.old_defaults_found = False if user_defaults: @@ -1095,19 +1105,19 @@ class App(QtCore.QObject): self.current_defaults = {} self.current_defaults.update(self.defaults) - # ########################################################################## - # ##################### SETUP OBJECT CLASSES ############################### - # ########################################################################## + # ########################################################################################################### + # #################################### SETUP OBJECT CLASSES ################################################# + # ########################################################################################################### self.setup_obj_classes() - # ########################################################################## - # ##################### CREATE MULTIPROCESSING POOL ######################## - # ########################################################################## + # ########################################################################################################### + # ###################################### CREATE MULTIPROCESSING POOL ####################################### + # ########################################################################################################### self.pool = Pool() - # ########################################################################## - # ################## Setting the Splash Screen ############################# - # ########################################################################## + # ########################################################################################################### + # ###################################### Setting the Splash Screen ########################################## + # ########################################################################################################### splash_settings = QSettings("Open Source", "FlatCAM") if splash_settings.contains("splash_screen"): @@ -1137,9 +1147,9 @@ class App(QtCore.QObject): else: show_splash = 0 - # ############################################################################# - # ##################### Initialize GUI ######################################## - # ############################################################################# + # ########################################################################################################### + # ######################################### Initialize GUI ################################################## + # ########################################################################################################### # FlatCAM colors used in plotting self.FC_light_green = '#BBF268BF' @@ -1178,18 +1188,18 @@ class App(QtCore.QObject): # set FlatCAM units in the Status bar self.set_screen_units(self.defaults['units']) - # ############################################################################# - # ################################ AUTOSAVE SETUP ############################# - # ############################################################################# + # ########################################################################################################### + # ########################################### AUTOSAVE SETUP ################################################ + # ########################################################################################################### self.block_autosave = False self.autosave_timer = QtCore.QTimer(self) self.save_project_auto_update() self.autosave_timer.timeout.connect(self.save_project_auto) - # ############################################################################# - # ######################## UPDATE PREFERENCES GUI FORMS ####################### - # ############################################################################# + # ########################################################################################################### + # ##################################### UPDATE PREFERENCES GUI FORMS ######################################## + # ########################################################################################################### # when adding entries here read the comments in the method found bellow named: # def new_object(self, kind, name, initialize, active=True, fit=True, plot=True) @@ -1612,9 +1622,9 @@ class App(QtCore.QObject): "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, - # ################################################################################### - # ################################ TOOLS 2 ########################################## - # ################################################################################### + # ####################################################################################################### + # ########################################## TOOLS 2 #################################################### + # ####################################################################################################### # Optimal Tool "tools_opt_precision": self.ui.tools2_defaults_form.tools2_optimal_group.precision_sp, @@ -1738,10 +1748,10 @@ class App(QtCore.QObject): # When the self.defaults dictionary changes will update the Preferences GUI forms self.defaults.set_change_callback(self.on_defaults_dict_change) - # ############################################################################## - # ########################## FIRST RUN SECTION ################################# - # ##################### It's done only once after install #################### - # ############################################################################## + # ########################################################################################################### + # ##################################### FIRST RUN SECTION ################################################### + # ################################ It's done only once after install ##################################### + # ########################################################################################################### if self.defaults["first_run"] is True: self.save_factory_defaults(silent_message=False) @@ -1761,9 +1771,9 @@ class App(QtCore.QObject): self.defaults["first_run"] = False self.save_defaults(silent=True) - # ############################################################################# - # ############################## Data ######################################### - # ############################################################################# + # ########################################################################################################### + # ############################################ Data ######################################################### + # ########################################################################################################### self.recent = [] self.recent_projects = [] @@ -1773,9 +1783,9 @@ class App(QtCore.QObject): self.project_filename = None self.toggle_units_ignore = False - # ############################################################################# - # ########################## LOAD PREPROCESSORS ############################### - # ############################################################################# + # ########################################################################################################### + # #################################### LOAD PREPROCESSORS ################################################### + # ########################################################################################################### # a dictionary that have as keys the name of the preprocessor files and the value is the class from # the preprocessor file @@ -1809,32 +1819,31 @@ class App(QtCore.QObject): self.ui.excellon_defaults_form.excellon_opt_group.pp_excellon_name_cb.addItem(name) - # ############################################################################# - # ########################## LOAD LANGUAGES ################################## - # ############################################################################# + # ########################################################################################################### + # ########################################## LOAD LANGUAGES ################################################ + # ########################################################################################################### self.languages = fcTranslate.load_languages() for name in sorted(self.languages.values()): self.ui.general_defaults_form.general_app_group.language_cb.addItem(name) - # ############################################################################# - # ############################ APPLY APP LANGUAGE ############################# - # ############################################################################# + # ########################################################################################################### + # ####################################### APPLY APP LANGUAGE ################################################ + # ########################################################################################################### ret_val = fcTranslate.apply_language('strings') if ret_val == "no language": - self.inform.emit('[ERROR] %s' % - _("Could not find the Language files. The App strings are missing.")) + self.inform.emit('[ERROR] %s' % _("Could not find the Language files. The App strings are missing.")) log.debug("Could not find the Language files. The App strings are missing.") else: # make the current language the current selection on the language combobox self.ui.general_defaults_form.general_app_group.language_cb.setCurrentText(ret_val) log.debug("App.__init__() --> Applied %s language." % str(ret_val).capitalize()) - # ############################################################################# - # ########################### CREATE UNIQUE SERIAL NUMBER ##################### - # ############################################################################# + # ########################################################################################################### + # ###################################### CREATE UNIQUE SERIAL NUMBER ######################################## + # ########################################################################################################### chars = 'abcdefghijklmnopqrstuvwxyz0123456789' if self.defaults['global_serial'] == 0 or len(str(self.defaults['global_serial'])) < 10: @@ -1854,15 +1863,15 @@ class App(QtCore.QObject): # if user_defaults: # QtCore.QTimer.singleShot(self.defaults["global_defaults_save_period_ms"], auto_save_defaults) - # ############################################################################# - # ########################### UPDATE THE OPTIONS ############################## - # ############################################################################# + # ########################################################################################################### + # ######################################## UPDATE THE OPTIONS ############################################### + # ########################################################################################################### self.options = LoudDict() - # ---------------------------------------------------------------------------------------------------- + # ----------------------------------------------------------------------------------------------------------- # Update the self.options from the self.defaults # The self.defaults holds the application defaults while the self.options holds the object defaults - # ----------------------------------------------------------------------------------------------------- + # ----------------------------------------------------------------------------------------------------------- # Copy app defaults to project options for def_key, def_val in self.defaults.items(): self.options[def_key] = deepcopy(def_val) @@ -1884,9 +1893,9 @@ class App(QtCore.QObject): # ### End of Data #### - # ############################################################################# - # ######################## SETUP OBJECT COLLECTION ############################ - # ############################################################################# + # ########################################################################################################### + # #################################### SETUP OBJECT COLLECTION ############################################## + # ########################################################################################################### self.collection = ObjectCollection(self) self.ui.project_tab_layout.addWidget(self.collection.view) @@ -1897,9 +1906,9 @@ class App(QtCore.QObject): self.collection.view.setMinimumWidth(290) self.log.debug("Finished creating Object Collection.") - # ############################################################################# - # ############################## SETUP Plot Area ############################## - # ############################################################################# + # ########################################################################################################### + # ######################################## SETUP Plot Area ################################################## + # ########################################################################################################### # determine if the Legacy Graphic Engine is to be used or the OpenGL one if self.defaults["global_graphic_engine"] == '3D': @@ -1946,9 +1955,9 @@ class App(QtCore.QObject): color=QtGui.QColor("gray")) self.ui.splitter.setStretchFactor(1, 2) - # ############################################################################# - # ################################### SYS TRAY ################################ - # ############################################################################# + # ########################################################################################################### + # ############################################### SYS TRAY ################################################## + # ########################################################################################################### if self.defaults["global_systray_icon"]: self.parent_w = QtWidgets.QWidget() @@ -1964,9 +1973,9 @@ class App(QtCore.QObject): '/flatcam_icon32_green.png'), parent=self.parent_w) - # ############################################################################# - # ################################## Worker SETUP ############################# - # ############################################################################# + # ########################################################################################################### + # ############################################### Worker SETUP ############################################## + # ########################################################################################################### if self.defaults["global_worker_number"]: self.workers = WorkerStack(workers_number=int(self.defaults["global_worker_number"])) else: @@ -1974,18 +1983,18 @@ class App(QtCore.QObject): self.worker_task.connect(self.workers.add_task) self.log.debug("Finished creating Workers crew.") - # ############################################################################# - # ################################# Activity Monitor ########################## - # ############################################################################# + # ########################################################################################################### + # ############################################# Activity Monitor ########################################### + # ########################################################################################################### self.activity_view = FlatCAMActivityView(app=self) self.ui.infobar.addWidget(self.activity_view) self.proc_container = FCVisibleProcessContainer(self.activity_view) - # ############################################################################# - # ################################## Signal handling ########################## - # ############################################################################# + # ########################################################################################################### + # ############################################# Signal handling ############################################# + # ########################################################################################################### - # ################################# Custom signals ########################### + # ########################################## Custom signals ################################################ # signal for displaying messages in status bar self.inform.connect(self.info) # signal to be called when the app is quiting @@ -2004,7 +2013,7 @@ class App(QtCore.QObject): self.file_opened.connect(lambda kind, filename: self.register_folder(filename)) self.file_saved.connect(lambda kind, filename: self.register_save_folder(filename)) - # ############# Standard signals ################### + # ########################################## Standard signals ############################################### # ### Menu self.ui.menufilenewproject.triggered.connect(self.on_file_new_click) self.ui.menufilenewgeo.triggered.connect(self.new_geometry_object) @@ -2175,14 +2184,14 @@ class App(QtCore.QObject): self.ui.pref_defaults_button.clicked.connect(self.on_restore_defaults_preferences) - # ############################################################################# - # ######################### GUI PREFERENCES SIGNALS ########################### - # ############################################################################# + # ########################################################################################################### + # #################################### GUI PREFERENCES SIGNALS ############################################## + # ########################################################################################################### self.ui.general_defaults_form.general_app_group.units_radio.activated_custom.connect( lambda: self.on_toggle_units(no_pref=False)) - # ############################# Workspace Setting Signals ##################### + # ##################################### Workspace Setting Signals ########################################### self.ui.general_defaults_form.general_app_set_group.wk_cb.currentIndexChanged.connect( self.on_workspace_modified) self.ui.general_defaults_form.general_app_set_group.wk_orientation_radio.activated_custom.connect( @@ -2191,13 +2200,13 @@ class App(QtCore.QObject): self.ui.general_defaults_form.general_app_set_group.workspace_cb.stateChanged.connect(self.on_workspace) - # ############################################################################# - # ############################# GUI SETTINGS SIGNALS ########################## - # ############################################################################# + # ########################################################################################################### + # ######################################## GUI SETTINGS SIGNALS ############################################# + # ########################################################################################################### self.ui.general_defaults_form.general_app_group.ge_radio.activated_custom.connect(self.on_app_restart) self.ui.general_defaults_form.general_app_set_group.cursor_radio.activated_custom.connect(self.on_cursor_type) - # ########## Tools related signals ############# + # ######################################## Tools related signals ############################################ # Film Tool self.ui.tools_defaults_form.tools_film_group.film_color_entry.editingFinished.connect( self.on_film_color_entry) @@ -2235,9 +2244,9 @@ class App(QtCore.QObject): # when there are arguments at application startup this get launched self.args_at_startup[list].connect(self.on_startup_args) - # ############################################################################# - # ########################## FILE ASSOCIATIONS SIGNALS ######################## - # ############################################################################# + # ########################################################################################################### + # ####################################### FILE ASSOCIATIONS SIGNALS ######################################### + # ########################################################################################################### self.ui.util_defaults_form.fa_excellon_group.restore_btn.clicked.connect( lambda: self.restore_extensions(ext_type='excellon')) @@ -2275,9 +2284,9 @@ class App(QtCore.QObject): self.ui.util_defaults_form.fa_gerber_group.grb_list_btn.clicked.connect( lambda: self.on_register_files(obj_type='gerber')) - # ############################################################################# - # ################################ KEYWORDS SIGNALS ########################### - # ############################################################################# + # ########################################################################################################### + # ########################################### KEYWORDS SIGNALS ############################################## + # ########################################################################################################### self.ui.util_defaults_form.kw_group.restore_btn.clicked.connect( lambda: self.restore_extensions(ext_type='keyword')) self.ui.util_defaults_form.kw_group.del_all_btn.clicked.connect( @@ -2298,14 +2307,16 @@ class App(QtCore.QObject): # signal to close the application self.close_app_signal.connect(self.kill_app) - # ##################################################################################### - # ########### FINISHED CONNECTING SIGNALS ############################################# - # ##################################################################################### + # ################################# FINISHED CONNECTING SIGNALS ############################################# + # ########################################################################################################### + # ########################################################################################################### + # ########################################################################################################### + self.log.debug("Finished connecting Signals.") - # ##################################################################################### - # ########################## Other setups ############################################# - # ##################################################################################### + # ########################################################################################################### + # ########################################## Other setups ################################################### + # ########################################################################################################### # to use for tools like Distance tool who depends on the event sources who are changed inside the Editors # depending on from where those tools are called different actions can be done @@ -2323,9 +2334,9 @@ class App(QtCore.QObject): # Sets up FlatCAMObj, FCProcess and FCProcessContainer. self.setup_component_editor() - # ##################################################################################### - # ######################### Auto-complete KEYWORDS #################################### - # ##################################################################################### + # ########################################################################################################### + # ####################################### Auto-complete KEYWORDS ############################################ + # ########################################################################################################### self.tcl_commands_list = ['add_circle', 'add_poly', 'add_polygon', 'add_polyline', 'add_rectangle', 'aligndrill', 'aligndrillgrid', 'bbox', 'clear', 'cncjob', 'cutout', 'del', 'drillcncjob', 'export_dxf', 'edxf', 'export_excellon', @@ -2555,9 +2566,9 @@ class App(QtCore.QObject): self.autocomplete_kw_list = self.defaults['util_autocomplete_keywords'].replace(' ', '').split(',') self.myKeywords = self.tcl_commands_list + self.autocomplete_kw_list + self.tcl_keywords - # #################################################################################### - # ####################### Shell SETUP ################################################ - # #################################################################################### + # ########################################################################################################### + # ############################################## Shell SETUP ################################################ + # ########################################################################################################### self.shell = FCShell(app=self, version=self.version) @@ -2570,9 +2581,9 @@ class App(QtCore.QObject): else: self.ui.shell_dock.hide() - # ################################################################################## - # ###################### Tools and Plugins ######################################### - # ################################################################################## + # ########################################################################################################### + # ########################################## Tools and Plugins ############################################## + # ########################################################################################################### self.dblsidedtool = None self.distance_tool = None @@ -2608,22 +2619,22 @@ class App(QtCore.QObject): except AttributeError as e: log.debug("App.__init__() install tools() --> %s" % str(e)) - # ################################################################################## - # ########################### SETUP RECENT ITEMS ################################### - # ################################################################################## + # ########################################################################################################### + # ############################################ SETUP RECENT ITEMS ########################################### + # ########################################################################################################### self.setup_recent_items() - # ################################################################################## - # ########################### BookMarks Manager #################################### - # ################################################################################## + # ########################################################################################################### + # ######################################### BookMarks Manager ############################################### + # ########################################################################################################### # install Bookmark Manager and populate bookmarks in the Help -> Bookmarks self.install_bookmarks() self.book_dialog_tab = BookmarkManager(app=self, storage=self.defaults["global_bookmarks"]) - # ################################################################################## - # ############################## Tools Database #################################### - # ################################################################################## + # ########################################################################################################### + # ########################################### Tools Database ################################################ + # ########################################################################################################### self.tools_db_tab = None @@ -2631,9 +2642,9 @@ class App(QtCore.QObject): # self.f_parse = ParseFont(self) # self.parse_system_fonts() - # ##################################################################################### - # ######################## Check for updates ########################################## - # ##################################################################################### + # ########################################################################################################### + # ######################################### Check for updates ############################################### + # ########################################################################################################### # Separate thread (Not worker) # Check for updates on startup but only if the user consent and the app is not in Beta version @@ -2646,16 +2657,16 @@ class App(QtCore.QObject): 'params': []}) self.thr2.start(QtCore.QThread.LowPriority) - # ##################################################################################### - # ######################### Register files with FlatCAM; ############################# - # ######################### It works only for Windows for now ######################## - # ##################################################################################### + # ########################################################################################################### + # ##################################### Register files with FlatCAM; ####################################### + # ################################### It works only for Windows for now #################################### + # ########################################################################################################### if sys.platform == 'win32' and self.defaults["first_run"] is True: self.on_register_files() - # ##################################################################################### - # ###################### Variables for global usage ################################### - # ##################################################################################### + # ########################################################################################################### + # ######################################## Variables for global usage ####################################### + # ########################################################################################################### # hold the App units self.units = 'MM' @@ -2790,9 +2801,9 @@ class App(QtCore.QObject): # used in the delayed shutdown self.start_delayed_quit() method self.save_timer = None - # ############################################################################### - # ################# ADDING FlatCAM EDITORS section ############################## - # ############################################################################### + # ########################################################################################################### + # ################################## ADDING FlatCAM EDITORS section ######################################### + # ########################################################################################################### # watch out for the position of the editors instantiation ... if it is done before a save of the default values # at the first launch of the App , the editors will not be functional. @@ -2820,14 +2831,14 @@ class App(QtCore.QObject): self.ui.excellon_defaults_form.excellon_gen_group.excellon_optimization_radio.set_value('T') self.ui.excellon_defaults_form.excellon_gen_group.excellon_optimization_radio.setDisabled(True) - # ############################################################################### - # ####################### Finished the CONSTRUCTOR ############################## - # ############################################################################### + # ########################################################################################################### + # ##################################### Finished the CONSTRUCTOR ############################################ + # ########################################################################################################### App.log.debug("END of constructor. Releasing control.") - # ##################################################################################### - # ########################## SHOW GUI ################################################# - # ##################################################################################### + # ########################################################################################################### + # ########################################## SHOW GUI ####################################################### + # ########################################################################################################### # if the app is not started as headless, show it if self.cmd_line_headless != 1: @@ -2850,9 +2861,9 @@ class App(QtCore.QObject): else: log.warning("******************* RUNNING HEADLESS *******************") - # ##################################################################################### - # ########################## START-UP ARGUMENTS ####################################### - # ##################################################################################### + # ########################################################################################################### + # ######################################## START-UP ARGUMENTS ############################################### + # ########################################################################################################### # test if the program was started with a script as parameter if self.cmd_line_shellvar: diff --git a/FlatCAMBookmark.py b/FlatCAMBookmark.py index ab372baa..af0df8a5 100644 --- a/FlatCAMBookmark.py +++ b/FlatCAMBookmark.py @@ -278,12 +278,12 @@ class BookmarkManager(QtWidgets.QWidget): date = date.replace(' ', '_') filter__ = "Text File (*.TXT);;All Files (*.*)" - filename, _f = FCFileSaveDialog.get_saved_filename( caption=_("Export FlatCAM Bookmarks"), - directory='{l_save}/FlatCAM_{n}_{date}'.format( - l_save=str(self.app.get_last_save_folder()), - n=_("Bookmarks"), - date=date), - filter=filter__) + filename, _f = FCFileSaveDialog.get_saved_filename(caption=_("Export FlatCAM Bookmarks"), + directory='{l_save}/FlatCAM_{n}_{date}'.format( + l_save=str(self.app.get_last_save_folder()), + n=_("Bookmarks"), + date=date), + filter=filter__) filename = str(filename) @@ -378,4 +378,4 @@ class BookmarkManager(QtWidgets.QWidget): def closeEvent(self, QCloseEvent): self.rebuild_actions() - super().closeEvent(QCloseEvent) \ No newline at end of file + super().closeEvent(QCloseEvent) diff --git a/flatcamGUI/FlatCAMGUI.py b/flatcamGUI/FlatCAMGUI.py index 76b2ee51..df280edb 100644 --- a/flatcamGUI/FlatCAMGUI.py +++ b/flatcamGUI/FlatCAMGUI.py @@ -16,7 +16,7 @@ from flatcamEditors.FlatCAMGeoEditor import FCShapeTool from matplotlib.backend_bases import KeyEvent as mpl_key_event import webbrowser -from ObjectCollection import KeySensitiveListView +from flatcamObjects.ObjectCollection import KeySensitiveListView import subprocess import os diff --git a/flatcamGUI/PlotCanvas.py b/flatcamGUI/PlotCanvas.py index cfb24039..de7a7028 100644 --- a/flatcamGUI/PlotCanvas.py +++ b/flatcamGUI/PlotCanvas.py @@ -8,7 +8,7 @@ from PyQt5 import QtCore import logging -from flatcamGUI.VisPyCanvas import VisPyCanvas, time, Color +from flatcamGUI.VisPyCanvas import VisPyCanvas, Color from flatcamGUI.VisPyVisuals import ShapeGroup, ShapeCollection, TextCollection, TextGroup, Cursor from vispy.scene.visuals import InfiniteLine, Line @@ -244,7 +244,7 @@ class PlotCanvas(QtCore.QObject, VisPyCanvas): """ if big is True: self.big_cursor = True - self.c = CursorBig() + self.c = CursorBig(app=self.fcapp) # in case there are multiple new_cursor calls, best to disconnect first the signals try: @@ -410,9 +410,9 @@ class CursorBig(QtCore.QObject): mouse_state_updated = QtCore.pyqtSignal(bool) mouse_position_updated = QtCore.pyqtSignal(list) - def __init__(self): + def __init__(self, app): super().__init__() - + self.app = app self._enabled = None @property diff --git a/ObjectCollection.py b/flatcamObjects/ObjectCollection.py similarity index 100% rename from ObjectCollection.py rename to flatcamObjects/ObjectCollection.py