- more refactoring class names
- moved some of the methods from the App class to the ObjectCollection class
This commit is contained in:
@@ -41,13 +41,13 @@ if '_' not in builtins.__dict__:
|
||||
_ = gettext.gettext
|
||||
|
||||
|
||||
class FlatCAMGUI(QtWidgets.QMainWindow):
|
||||
class MainGUI(QtWidgets.QMainWindow):
|
||||
# Emitted when persistent window geometry needs to be retained
|
||||
geom_update = QtCore.pyqtSignal(int, int, int, int, int, name='geomUpdate')
|
||||
final_save = QtCore.pyqtSignal(name='saveBeforeExit')
|
||||
|
||||
def __init__(self, app):
|
||||
super(FlatCAMGUI, self).__init__()
|
||||
super(MainGUI, self).__init__()
|
||||
|
||||
self.app = app
|
||||
self.decimals = self.app.decimals
|
||||
@@ -55,7 +55,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
|
||||
# Divine icon pack by Ipapun @ finicons.com
|
||||
|
||||
# #######################################################################
|
||||
# ############ BUILDING THE AppGUI IS EXECUTED HERE ########################
|
||||
# ############ BUILDING THE GUI IS EXECUTED HERE ########################
|
||||
# #######################################################################
|
||||
|
||||
# #######################################################################
|
||||
@@ -497,9 +497,9 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
|
||||
QtGui.QIcon(self.app.resource_location + '/hud_32.png'), _("Toggle HUD\tAlt+M"))
|
||||
|
||||
# ########################################################################
|
||||
# ########################## AppObjects # ###################################
|
||||
# ########################## Objects # ###################################
|
||||
# ########################################################################
|
||||
self.menuobjects = self.menu.addMenu(_('AppObjects'))
|
||||
self.menuobjects = self.menu.addMenu(_('Objects'))
|
||||
self.menuobjects.addSeparator()
|
||||
self.menuobjects_selall = self.menuobjects.addAction(
|
||||
QtGui.QIcon(self.app.resource_location + '/select_all.png'), _('Select All'))
|
||||
@@ -763,7 +763,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
|
||||
# ########################################################################
|
||||
|
||||
# IMPORTANT #
|
||||
# The order: SPLITTER -> NOTEBOOK -> SNAP TOOLBAR is important and without it the AppGUI will not be initialized as
|
||||
# The order: SPLITTER -> NOTEBOOK -> SNAP TOOLBAR is important and without it the GUI will not be initialized as
|
||||
# desired.
|
||||
self.splitter = QtWidgets.QSplitter()
|
||||
self.setCentralWidget(self.splitter)
|
||||
@@ -1319,11 +1319,11 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
|
||||
self.pref_tab_bottom_layout_1.addWidget(self.pref_open_button)
|
||||
|
||||
# Clear Settings
|
||||
self.clear_btn = FCButton('%s' % _('Clear AppGUI Settings'))
|
||||
self.clear_btn = FCButton('%s' % _('Clear GUI Settings'))
|
||||
self.clear_btn.setMinimumWidth(130)
|
||||
|
||||
self.clear_btn.setToolTip(
|
||||
_("Clear the AppGUI settings for FlatCAM,\n"
|
||||
_("Clear the GUI settings for FlatCAM,\n"
|
||||
"such as: layout, gui state, style, hdpi support etc.")
|
||||
)
|
||||
|
||||
@@ -1539,7 +1539,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
|
||||
# infobar.addWidget(self.progress_bar)
|
||||
|
||||
# ########################################################################
|
||||
# ########################## SET AppGUI Elements # ##########################
|
||||
# ########################## SET GUI Elements # ##########################
|
||||
# ########################################################################
|
||||
self.app_icon = QtGui.QIcon()
|
||||
self.app_icon.addFile(self.app.resource_location + '/flatcam_icon16.png', QtCore.QSize(16, 16))
|
||||
@@ -1562,7 +1562,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
|
||||
self.setAcceptDrops(True)
|
||||
|
||||
# ########################################################################
|
||||
# ########################## Build AppGUI # #################################
|
||||
# ########################## Build GUI # #################################
|
||||
# ########################################################################
|
||||
self.grid_snap_btn.setCheckable(True)
|
||||
self.corner_snap_btn.setCheckable(True)
|
||||
@@ -1595,7 +1595,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
|
||||
if flat_settings.contains("saved_gui_state"):
|
||||
saved_gui_state = flat_settings.value('saved_gui_state')
|
||||
self.restoreState(saved_gui_state)
|
||||
log.debug("FlatCAMGUI.__init__() --> UI state restored from QSettings.")
|
||||
log.debug("MainGUI.__init__() --> UI state restored from QSettings.")
|
||||
|
||||
self.corner_snap_btn.setVisible(False)
|
||||
self.snap_magnet.setVisible(False)
|
||||
@@ -1606,7 +1606,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
|
||||
self.geo_edit_toolbar.setDisabled(True)
|
||||
self.grb_edit_toolbar.setDisabled(True)
|
||||
|
||||
log.debug("FlatCAMGUI.__init__() --> UI layout restored from QSettings. Layout = %s" % str(layout))
|
||||
log.debug("MainGUI.__init__() --> UI layout restored from QSettings. Layout = %s" % str(layout))
|
||||
else:
|
||||
self.exc_edit_toolbar.setDisabled(True)
|
||||
self.geo_edit_toolbar.setDisabled(True)
|
||||
@@ -1615,7 +1615,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
|
||||
flat_settings.setValue('layout', "standard")
|
||||
# This will write the setting to the platform specific storage.
|
||||
del flat_settings
|
||||
log.debug("FlatCAMGUI.__init__() --> UI layout restored from defaults. QSettings set to 'standard'")
|
||||
log.debug("MainGUI.__init__() --> UI layout restored from defaults. QSettings set to 'standard'")
|
||||
|
||||
# construct the Toolbar Lock menu entry to the context menu of the QMainWindow
|
||||
self.lock_action = QtWidgets.QAction()
|
||||
@@ -1655,11 +1655,11 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
|
||||
# restore the toolbar view
|
||||
self.restore_toolbar_view()
|
||||
|
||||
# restore the AppGUI geometry
|
||||
# restore the GUI geometry
|
||||
self.restore_main_win_geom()
|
||||
|
||||
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
# %%%%%%%%%%%%%%%%% AppGUI Building FINISHED %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
# %%%%%%%%%%%%%%%%% GUI Building FINISHED %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
# Variable to store the status of the fullscreen event
|
||||
@@ -1677,7 +1677,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
|
||||
self.app.defaults["global_def_win_h"])
|
||||
self.splitter.setSizes([self.app.defaults["global_def_notebook_width"], 0])
|
||||
except KeyError as e:
|
||||
log.debug("AppGUI.FlatCAMGUI.restore_main_win_geom() --> %s" % str(e))
|
||||
log.debug("AppGUI.MainGUI.restore_main_win_geom() --> %s" % str(e))
|
||||
|
||||
def restore_toolbar_view(self):
|
||||
"""
|
||||
@@ -1776,8 +1776,8 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
|
||||
resource_loc = self.app.resource_location
|
||||
|
||||
msgbox = QtWidgets.QMessageBox()
|
||||
msgbox.setText(_("Are you sure you want to delete the AppGUI Settings? \n"))
|
||||
msgbox.setWindowTitle(_("Clear AppGUI Settings"))
|
||||
msgbox.setText(_("Are you sure you want to delete the GUI Settings? \n"))
|
||||
msgbox.setWindowTitle(_("Clear GUI Settings"))
|
||||
msgbox.setWindowIcon(QtGui.QIcon(resource_loc + '/trash32.png'))
|
||||
bt_yes = msgbox.addButton(_('Yes'), QtWidgets.QMessageBox.YesRole)
|
||||
bt_no = msgbox.addButton(_('No'), QtWidgets.QMessageBox.NoRole)
|
||||
@@ -2082,7 +2082,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
|
||||
# events out of the self.app.collection view (it's about Project Tab) are of type int
|
||||
if type(event) is int:
|
||||
key = event
|
||||
# events from the AppGUI are of type QKeyEvent
|
||||
# events from the GUI are of type QKeyEvent
|
||||
elif type(event) == QtGui.QKeyEvent:
|
||||
key = event.key()
|
||||
elif isinstance(event, mpl_key_event): # MatPlotLib key events are trickier to interpret than the rest
|
||||
@@ -2305,7 +2305,7 @@ class CNCObjectUI(ObjectUI):
|
||||
|
||||
def __init__(self, app, parent=None):
|
||||
"""
|
||||
Creates the user interface for CNCJob objects. AppGUI elements should
|
||||
Creates the user interface for CNCJob objects. GUI elements should
|
||||
be placed in ``self.custom_box`` to preserve the layout.
|
||||
"""
|
||||
|
||||
@@ -2638,7 +2638,7 @@ class ScriptObjectUI(ObjectUI):
|
||||
|
||||
def __init__(self, app, parent=None):
|
||||
"""
|
||||
Creates the user interface for Script objects. AppGUI elements should
|
||||
Creates the user interface for Script objects. GUI elements should
|
||||
be placed in ``self.custom_box`` to preserve the layout.
|
||||
"""
|
||||
|
||||
@@ -2705,7 +2705,7 @@ class DocumentObjectUI(ObjectUI):
|
||||
|
||||
def __init__(self, app, parent=None):
|
||||
"""
|
||||
Creates the user interface for Notes objects. AppGUI elements should
|
||||
Creates the user interface for Notes objects. GUI elements should
|
||||
be placed in ``self.custom_box`` to preserve the layout.
|
||||
"""
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ class PreferencesUIManager:
|
||||
|
||||
:param defaults: a dictionary storage where all the application settings are stored
|
||||
:param data_path: a path to the file where all the preferences are stored for persistence
|
||||
:param ui: reference to the FlatCAMGUI class which constructs the UI
|
||||
:param inform: a pyqtSignal used to display information's in the StatusBar of the AppGUI
|
||||
:param ui: reference to the MainGUI class which constructs the UI
|
||||
:param inform: a pyqtSignal used to display information's in the StatusBar of the GUI
|
||||
"""
|
||||
|
||||
self.defaults = defaults
|
||||
@@ -73,7 +73,7 @@ class PreferencesUIManager:
|
||||
"global_tpdf_lmargin": self.ui.general_defaults_form.general_app_group.lmargin_entry,
|
||||
"global_tpdf_rmargin": self.ui.general_defaults_form.general_app_group.rmargin_entry,
|
||||
|
||||
# General AppGUI Preferences
|
||||
# General GUI Preferences
|
||||
"global_theme": self.ui.general_defaults_form.general_gui_group.theme_radio,
|
||||
"global_gray_icons": self.ui.general_defaults_form.general_gui_group.gray_icons_cb,
|
||||
"global_layout": self.ui.general_defaults_form.general_gui_group.layout_combo,
|
||||
@@ -91,7 +91,7 @@ class PreferencesUIManager:
|
||||
"global_proj_item_dis_color": self.ui.general_defaults_form.general_gui_group.proj_color_dis_entry,
|
||||
"global_project_autohide": self.ui.general_defaults_form.general_gui_group.project_autohide_cb,
|
||||
|
||||
# General AppGUI Settings
|
||||
# General GUI Settings
|
||||
"global_gridx": self.ui.general_defaults_form.general_app_set_group.gridx_entry,
|
||||
"global_gridy": self.ui.general_defaults_form.general_app_set_group.gridy_entry,
|
||||
"global_snap_max": self.ui.general_defaults_form.general_app_set_group.snap_max_dist_entry,
|
||||
@@ -595,7 +595,7 @@ class PreferencesUIManager:
|
||||
|
||||
def defaults_read_form(self):
|
||||
"""
|
||||
Will read all the values in the Preferences AppGUI and update the defaults dictionary.
|
||||
Will read all the values in the Preferences GUI and update the defaults dictionary.
|
||||
|
||||
:return: None
|
||||
"""
|
||||
@@ -607,10 +607,10 @@ class PreferencesUIManager:
|
||||
|
||||
def defaults_write_form(self, factor=None, fl_units=None, source_dict=None):
|
||||
"""
|
||||
Will set the values for all the AppGUI elements in Preferences AppGUI based on the values found in the
|
||||
Will set the values for all the GUI elements in Preferences GUI based on the values found in the
|
||||
self.defaults dictionary.
|
||||
|
||||
:param factor: will apply a factor to the values that written in the AppGUI elements
|
||||
:param factor: will apply a factor to the values that written in the GUI elements
|
||||
:param fl_units: current measuring units in FlatCAM: Metric or Inch
|
||||
:param source_dict: the repository of options, usually is the self.defaults
|
||||
:return: None
|
||||
@@ -628,11 +628,11 @@ class PreferencesUIManager:
|
||||
"""
|
||||
Basically it is the worker in the self.defaults_write_form()
|
||||
|
||||
:param field: the AppGUI element in Preferences AppGUI to be updated
|
||||
:param field: the GUI element in Preferences GUI to be updated
|
||||
:param factor: factor to be applied to the field parameter
|
||||
:param units: current FlatCAM measuring units
|
||||
:param defaults_dict: the defaults storage
|
||||
:return: None, it updates AppGUI elements
|
||||
:return: None, it updates GUI elements
|
||||
"""
|
||||
|
||||
def_dict = self.defaults if defaults_dict is None else defaults_dict
|
||||
@@ -734,7 +734,7 @@ class PreferencesUIManager:
|
||||
self.ui.pref_close_button.clicked.connect(self.on_pref_close_button)
|
||||
self.ui.pref_defaults_button.clicked.connect(self.on_restore_defaults_preferences)
|
||||
|
||||
log.debug("Finished Preferences AppGUI form initialization.")
|
||||
log.debug("Finished Preferences GUI form initialization.")
|
||||
|
||||
def __init_color_pickers(self):
|
||||
# Init Gerber Plot Colors
|
||||
|
||||
@@ -23,7 +23,7 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI):
|
||||
def __init__(self, decimals=4, parent=None):
|
||||
super(GeneralGUIPrefGroupUI, self).__init__(self, parent=parent)
|
||||
|
||||
self.setTitle(str(_("AppGUI Preferences")))
|
||||
self.setTitle(str(_("GUI Preferences")))
|
||||
self.decimals = decimals
|
||||
|
||||
# Create a grid layout for the Application general settings
|
||||
@@ -382,7 +382,7 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI):
|
||||
self.layout.addStretch()
|
||||
|
||||
# #############################################################################
|
||||
# ############################# AppGUI COLORS SIGNALS ############################
|
||||
# ############################# GUI COLORS SIGNALS ############################
|
||||
# #############################################################################
|
||||
|
||||
# Setting selection (left - right) colors signals
|
||||
|
||||
Reference in New Issue
Block a user