- more refactoring class names

- moved some of the methods from the App class to the ObjectCollection class
This commit is contained in:
Marius Stanciu 2020-05-18 16:39:26 +03:00 committed by Marius
parent a0a805217d
commit 710a84b442
40 changed files with 5592 additions and 5596 deletions

256
App.py
View File

@ -70,7 +70,7 @@ from camlib import to_dict, dict2obj, ET, ParseError, Geometry, CNCjob
# FlatCAM AppGUI
from AppGUI.PlotCanvas import *
from AppGUI.PlotCanvasLegacy import *
from AppGUI.FlatCAMGUI import *
from AppGUI.MainGUI import *
from AppGUI.GUIElements import FCFileSaveDialog, message_dialog, FlatCAMSystemTray
# FlatCAM Pre-processors
@ -417,7 +417,7 @@ class App(QtCore.QObject):
fp.close()
# Application directory. CHDIR to it. Otherwise, trying to load
# AppGUI icons will fail as their path is relative.
# GUI icons will fail as their path is relative.
# This will fail under cx_freeze ...
self.app_home = os.path.dirname(os.path.realpath(__file__))
@ -496,7 +496,7 @@ class App(QtCore.QObject):
show_splash = 0
# ###########################################################################################################
# ######################################### Initialize AppGUI ##################################################
# ######################################### Initialize GUI ##################################################
# ###########################################################################################################
# FlatCAM colors used in plotting
@ -505,7 +505,7 @@ class App(QtCore.QObject):
self.FC_light_blue = '#a5a5ffbf'
self.FC_dark_blue = '#0000ffbf'
self.ui = FlatCAMGUI(self)
self.ui = MainGUI(self)
theme_settings = QtCore.QSettings("Open Source", "FlatCAM")
if theme_settings.contains("theme"):
@ -581,14 +581,14 @@ class App(QtCore.QObject):
self.ui.excellon_defaults_form.excellon_opt_group.pp_excellon_name_cb.addItem(name)
# ###########################################################################################################
# ##################################### UPDATE PREFERENCES AppGUI FORMS ########################################
# ##################################### UPDATE PREFERENCES GUI FORMS ########################################
# ###########################################################################################################
self.preferencesUiManager = PreferencesUIManager(defaults=self.defaults, data_path=self.data_path, ui=self.ui,
inform=self.inform)
self.preferencesUiManager.defaults_write_form()
# When the self.defaults dictionary changes will update the Preferences AppGUI forms
# When the self.defaults dictionary changes will update the Preferences GUI forms
self.defaults.set_change_callback(self.on_defaults_dict_change)
# ###########################################################################################################
@ -596,7 +596,7 @@ class App(QtCore.QObject):
# ################################ It's done only once after install #####################################
# ###########################################################################################################
if self.defaults["first_run"] is True:
# ONLY AT FIRST STARTUP INIT THE AppGUI LAYOUT TO 'COMPACT'
# ONLY AT FIRST STARTUP INIT THE GUI LAYOUT TO 'COMPACT'
initial_lay = 'minimal'
self.ui.general_defaults_form.general_gui_group.on_layout(lay=initial_lay)
@ -957,7 +957,7 @@ class App(QtCore.QObject):
act.triggered.connect(self.on_set_color_action_triggered)
# ###########################################################################################################
# #################################### AppGUI PREFERENCES SIGNALS ##############################################
# #################################### GUI PREFERENCES SIGNALS ##############################################
# ###########################################################################################################
self.ui.general_defaults_form.general_app_group.units_radio.activated_custom.connect(
@ -973,7 +973,7 @@ class App(QtCore.QObject):
self.ui.general_defaults_form.general_app_set_group.workspace_cb.stateChanged.connect(self.on_workspace)
# ###########################################################################################################
# ######################################## AppGUI SETTINGS SIGNALS #############################################
# ######################################## GUI SETTINGS SIGNALS #############################################
# ###########################################################################################################
self.ui.general_defaults_form.general_app_set_group.cursor_radio.activated_custom.connect(self.on_cursor_type)
@ -998,10 +998,7 @@ class App(QtCore.QObject):
self.ui.general_defaults_form.general_app_group.portability_cb.stateChanged.connect(self.on_portable_checked)
# Object list
self.collection.view.activated.connect(self.on_row_activated)
self.collection.item_selected.connect(self.on_row_selected)
self.object_status_changed.connect(self.on_collection_updated)
self.object_status_changed.connect(self.collection.on_collection_updated)
# Make sure that when the Excellon loading parameters are changed, the change is reflected in the
# Export Excellon parameters.
@ -1606,7 +1603,7 @@ class App(QtCore.QObject):
App.log.debug("END of constructor. Releasing control.")
# ###########################################################################################################
# ########################################## SHOW AppGUI #######################################################
# ########################################## SHOW GUI #######################################################
# ###########################################################################################################
# if the app is not started as headless, show it
@ -2267,7 +2264,7 @@ class App(QtCore.QObject):
self.geo_editor.deactivate()
# restore AppGUI to the Selected TAB
# restore GUI to the Selected TAB
# Remove anything else in the AppGUI
self.ui.tool_scroll_area.takeWidget()
@ -2306,7 +2303,7 @@ class App(QtCore.QObject):
self.inform.emit('[success] %s' % _("Editor exited. Editor content saved."))
# restore AppGUI to the Selected TAB
# restore GUI to the Selected TAB
# Remove anything else in the AppGUI
self.ui.selected_scroll_area.takeWidget()
@ -2318,7 +2315,7 @@ class App(QtCore.QObject):
self.exc_editor.deactivate()
# restore AppGUI to the Selected TAB
# restore GUI to the Selected TAB
# Remove anything else in the AppGUI
self.ui.tool_scroll_area.takeWidget()
@ -2671,7 +2668,7 @@ class App(QtCore.QObject):
def new_object(self, kind, name, initialize, plot=True, autoselected=True):
"""
Creates a new specialized FlatCAMObj and attaches it to the application,
this is, updates the AppGUI accordingly, any other records and plots it.
this is, updates the GUI accordingly, any other records and plots it.
This method is thread-safe.
Notes:
@ -3568,7 +3565,7 @@ class App(QtCore.QObject):
def on_portable_checked(self, state):
"""
Callback called when the checkbox in Preferences AppGUI is checked.
Callback called when the checkbox in Preferences GUI is checked.
It will set the application as portable by creating the preferences and recent files in the
'config' folder found in the FlatCAM installation folder.
@ -4125,7 +4122,7 @@ class App(QtCore.QObject):
def on_defaults_dict_change(self, field):
"""
Called whenever a key changed in the self.defaults dictionary. It will set the required AppGUI element in the
Called whenever a key changed in the self.defaults dictionary. It will set the required GUI element in the
Edit -> Preferences tab window.
:param field: the key of the self.defaults dictionary that was changed.
@ -4401,7 +4398,7 @@ class App(QtCore.QObject):
self.preferencesUiManager.defaults_read_form()
# the self.preferencesUiManager.defaults_read_form() will update all defaults values
# in self.defaults from the AppGUI elements but
# in self.defaults from the GUI elements but
# I don't want it for the grid values, so I update them here
self.defaults['global_gridx'] = val_x
self.defaults['global_gridy'] = val_y
@ -6068,8 +6065,7 @@ class App(QtCore.QObject):
sel_obj.rotate(-float(num), point=(px, py))
sel_obj.plot()
self.object_changed.emit(sel_obj)
self.inform.emit('[success] %s' %
_("Rotation done."))
self.inform.emit('[success] %s' % _("Rotation done."))
except Exception as e:
self.inform.emit('[ERROR_NOTCL] %s: %s' % (_("Rotation movement was not executed."), str(e)))
return
@ -6088,8 +6084,7 @@ class App(QtCore.QObject):
yminlist = []
if not obj_list:
self.inform.emit('[WARNING_NOTCL] %s' %
_("No object selected to Skew/Shear on X axis."))
self.inform.emit('[WARNING_NOTCL] %s' % _("No object selected to Skew/Shear on X axis."))
else:
skewxbox = FCInputDialog(title=_("Transform"), text=_("Enter the Angle value:"),
min=-360, max=360, decimals=4,
@ -6110,8 +6105,7 @@ class App(QtCore.QObject):
obj.skew(num, 0, point=(xminimal, yminimal))
obj.plot()
self.object_changed.emit(obj)
self.inform.emit('[success] %s' %
_("Skew on X axis done."))
self.inform.emit('[success] %s' % _("Skew on X axis done."))
def on_skewy(self):
"""
@ -6127,8 +6121,7 @@ class App(QtCore.QObject):
yminlist = []
if not obj_list:
self.inform.emit('[WARNING_NOTCL] %s' %
_("No object selected to Skew/Shear on Y axis."))
self.inform.emit('[WARNING_NOTCL] %s' % _("No object selected to Skew/Shear on Y axis."))
else:
skewybox = FCInputDialog(title=_("Transform"), text=_("Enter the Angle value:"),
min=-360, max=360, decimals=4,
@ -6149,8 +6142,7 @@ class App(QtCore.QObject):
obj.skew(0, num, point=(xminimal, yminimal))
obj.plot()
self.object_changed.emit(obj)
self.inform.emit('[success] %s' %
_("Skew on Y axis done."))
self.inform.emit('[success] %s' % _("Skew on Y axis done."))
def on_plots_updated(self):
"""
@ -6186,202 +6178,6 @@ class App(QtCore.QObject):
self.plot_all()
def on_row_activated(self, index):
if index.isValid():
if index.internalPointer().parent_item != self.collection.root_item:
self.ui.notebook.setCurrentWidget(self.ui.selected_tab)
self.collection.on_item_activated(index)
def on_row_selected(self, obj_name):
"""
This is a special string; when received it will make all Menu -> AppObjects entries unchecked
It mean we clicked outside of the items and deselected all
:param obj_name:
:return:
"""
if obj_name == 'none':
for act in self.ui.menuobjects.actions():
act.setChecked(False)
return
# get the name of the selected objects and add them to a list
name_list = []
for obj in self.collection.get_selected():
name_list.append(obj.options['name'])
# set all actions as unchecked but the ones selected make them checked
for act in self.ui.menuobjects.actions():
act.setChecked(False)
if act.text() in name_list:
act.setChecked(True)
def on_collection_updated(self, obj, state, old_name):
"""
Create a menu from the object loaded in the collection.
:param obj: object that was changed (added, deleted, renamed)
:param state: what was done with the object. Can be: added, deleted, delete_all, renamed
:param old_name: the old name of the object before the action that triggered this slot happened
:return: None
"""
icon_files = {
"gerber": self.resource_location + "/flatcam_icon16.png",
"excellon": self.resource_location + "/drill16.png",
"cncjob": self.resource_location + "/cnc16.png",
"geometry": self.resource_location + "/geometry16.png",
"script": self.resource_location + "/script_new16.png",
"document": self.resource_location + "/notes16_1.png"
}
if state == 'append':
for act in self.ui.menuobjects.actions():
try:
act.triggered.disconnect()
except TypeError:
pass
self.ui.menuobjects.clear()
gerber_list = []
exc_list = []
cncjob_list = []
geo_list = []
script_list = []
doc_list = []
for name in self.collection.get_names():
obj_named = self.collection.get_by_name(name)
if obj_named.kind == 'gerber':
gerber_list.append(name)
elif obj_named.kind == 'excellon':
exc_list.append(name)
elif obj_named.kind == 'cncjob':
cncjob_list.append(name)
elif obj_named.kind == 'geometry':
geo_list.append(name)
elif obj_named.kind == 'script':
script_list.append(name)
elif obj_named.kind == 'document':
doc_list.append(name)
def add_act(o_name):
obj_for_icon = self.collection.get_by_name(o_name)
add_action = QtWidgets.QAction(parent=self.ui.menuobjects)
add_action.setCheckable(True)
add_action.setText(o_name)
add_action.setIcon(QtGui.QIcon(icon_files[obj_for_icon.kind]))
add_action.triggered.connect(
lambda: self.collection.set_active(o_name) if add_action.isChecked() is True else
self.collection.set_inactive(o_name))
self.ui.menuobjects.addAction(add_action)
for name in gerber_list:
add_act(name)
self.ui.menuobjects.addSeparator()
for name in exc_list:
add_act(name)
self.ui.menuobjects.addSeparator()
for name in cncjob_list:
add_act(name)
self.ui.menuobjects.addSeparator()
for name in geo_list:
add_act(name)
self.ui.menuobjects.addSeparator()
for name in script_list:
add_act(name)
self.ui.menuobjects.addSeparator()
for name in doc_list:
add_act(name)
self.ui.menuobjects.addSeparator()
self.ui.menuobjects_selall = self.ui.menuobjects.addAction(
QtGui.QIcon(self.resource_location + '/select_all.png'),
_('Select All')
)
self.ui.menuobjects_unselall = self.ui.menuobjects.addAction(
QtGui.QIcon(self.resource_location + '/deselect_all32.png'),
_('Deselect All')
)
self.ui.menuobjects_selall.triggered.connect(lambda: self.on_objects_selection(True))
self.ui.menuobjects_unselall.triggered.connect(lambda: self.on_objects_selection(False))
elif state == 'delete':
for act in self.ui.menuobjects.actions():
if act.text() == obj.options['name']:
try:
act.triggered.disconnect()
except TypeError:
pass
self.ui.menuobjects.removeAction(act)
break
elif state == 'rename':
for act in self.ui.menuobjects.actions():
if act.text() == old_name:
add_action = QtWidgets.QAction(parent=self.ui.menuobjects)
add_action.setText(obj.options['name'])
add_action.setIcon(QtGui.QIcon(icon_files[obj.kind]))
add_action.triggered.connect(
lambda: self.collection.set_active(obj.options['name']) if add_action.isChecked() is True else
self.collection.set_inactive(obj.options['name']))
self.ui.menuobjects.insertAction(act, add_action)
try:
act.triggered.disconnect()
except TypeError:
pass
self.ui.menuobjects.removeAction(act)
break
elif state == 'delete_all':
for act in self.ui.menuobjects.actions():
try:
act.triggered.disconnect()
except TypeError:
pass
self.ui.menuobjects.clear()
self.ui.menuobjects.addSeparator()
self.ui.menuobjects_selall = self.ui.menuobjects.addAction(
QtGui.QIcon(self.resource_location + '/select_all.png'),
_('Select All')
)
self.ui.menuobjects_unselall = self.ui.menuobjects.addAction(
QtGui.QIcon(self.resource_location + '/deselect_all32.png'),
_('Deselect All')
)
self.ui.menuobjects_selall.triggered.connect(lambda: self.on_objects_selection(True))
self.ui.menuobjects_unselall.triggered.connect(lambda: self.on_objects_selection(False))
def on_objects_selection(self, on_off):
obj_list = self.collection.get_names()
if on_off is True:
self.collection.set_all_active()
for act in self.ui.menuobjects.actions():
try:
act.setChecked(True)
except Exception:
pass
if obj_list:
self.inform.emit('[selected] %s' % _("All objects are selected."))
else:
self.collection.set_all_inactive()
for act in self.ui.menuobjects.actions():
try:
act.setChecked(False)
except Exception:
pass
if obj_list:
self.inform.emit('%s' % _("AppObjects selection is cleared."))
else:
self.inform.emit('')
def grid_status(self):
return True if self.ui.grid_snap_btn.isChecked() else False
@ -6881,7 +6677,7 @@ class App(QtCore.QObject):
curr_sel_obj.selection_shape_drawn = True
elif curr_sel_obj.options['name'] not in self.objects_under_the_click_list:
self.on_objects_selection(False)
self.collection.on_objects_selection(False)
self.delete_selection_shape()
curr_sel_obj.selection_shape_drawn = False
@ -6899,7 +6695,7 @@ class App(QtCore.QObject):
self.draw_selection_shape(curr_sel_obj)
curr_sel_obj.selection_shape_drawn = True
else:
self.on_objects_selection(False)
self.collection.on_objects_selection(False)
self.delete_selection_shape()
if self.call_source != 'app':
@ -6941,7 +6737,7 @@ class App(QtCore.QObject):
else:
# deselect everything
self.on_objects_selection(False)
self.collection.on_objects_selection(False)
# delete the possible selection box around a possible selected object
self.delete_selection_shape()

View File

@ -1623,7 +1623,7 @@ class ToolsDB2(QtWidgets.QWidget):
# ####################################################################
# ####################################################################
# AppGUI for the lower part of the window
# GUI for the lower part of the window
# ####################################################################
# ####################################################################

View File

@ -2415,7 +2415,7 @@ class FlatCAMExcEditor(QtCore.QObject):
drill_count = QtWidgets.QTableWidgetItem('%d' % drill_cnt)
drill_count.setFlags(QtCore.Qt.ItemIsEnabled)
# if the slot number is zero is better to not clutter the AppGUI with zero's so we print a space
# if the slot number is zero is better to not clutter the GUI with zero's so we print a space
if slot_cnt > 0:
slot_count = QtWidgets.QTableWidgetItem('%d' % slot_cnt)
else:
@ -2532,9 +2532,9 @@ class FlatCAMExcEditor(QtCore.QObject):
# make sure no rows are selected so the user have to click the correct row, meaning selecting the correct tool
self.tools_table_exc.clearSelection()
# Remove anything else in the AppGUI Selected Tab
# Remove anything else in the GUI Selected Tab
self.app.ui.selected_scroll_area.takeWidget()
# Put ourself in the AppGUI Selected Tab
# Put ourself in the GUI Selected Tab
self.app.ui.selected_scroll_area.setWidget(self.exc_edit_widget)
# Switch notebook to Selected page
self.app.ui.notebook.setCurrentWidget(self.app.ui.selected_tab)

View File

@ -3463,7 +3463,7 @@ class FlatCAMGeoEditor(QtCore.QObject):
"""
:param opt: A option from the self.options dictionary
:param entry: A AppGUI element which text value is used
:param entry: A GUI element which text value is used
:return:
"""
try:
@ -3480,7 +3480,7 @@ class FlatCAMGeoEditor(QtCore.QObject):
"""
:param goption: String. Can be either 'global_gridx' or 'global_gridy'
:param gentry: A AppGUI element which text value is read and used
:param gentry: A GUI element which text value is read and used
:return:
"""
if goption not in ['global_gridx', 'global_gridy']:
@ -3567,7 +3567,7 @@ class FlatCAMGeoEditor(QtCore.QObject):
self.units = self.app.defaults['units'].upper()
self.decimals = self.app.decimals
# Remove anything else in the AppGUI Selected Tab
# Remove anything else in the GUI Selected Tab
self.app.ui.selected_scroll_area.takeWidget()
# Put ourselves in the AppGUI Selected Tab
self.app.ui.selected_scroll_area.setWidget(self.geo_edit_widget)

View File

@ -3298,9 +3298,9 @@ class FlatCAMGrbEditor(QtCore.QObject):
# make sure no rows are selected so the user have to click the correct row, meaning selecting the correct tool
self.apertures_table.clearSelection()
# Remove anything else in the AppGUI Selected Tab
# Remove anything else in the GUI Selected Tab
self.app.ui.selected_scroll_area.takeWidget()
# Put ourselves in the AppGUI Selected Tab
# Put ourselves in the GUI Selected Tab
self.app.ui.selected_scroll_area.setWidget(self.grb_edit_widget)
# Switch notebook to Selected page
self.app.ui.notebook.setCurrentWidget(self.app.ui.selected_tab)
@ -4039,7 +4039,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
# else:
# raise AttributeError
# except AttributeError:
# # now that we have data (empty data actually), create the AppGUI interface and add it to the Tool Tab
# # now that we have data (empty data actually), create the GUI interface and add it to the Tool Tab
# self.build_ui(first_run=True)
# # and add the first aperture to have something to play with
# self.on_aperture_add('10')
@ -4913,7 +4913,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
# def setup_ui_after_delayed_plot(self):
# self.plot_finished.disconnect()
#
# # now that we have data, create the AppGUI interface and add it to the Tool Tab
# # now that we have data, create the GUI interface and add it to the Tool Tab
# self.build_ui(first_run=True)
# self.plot_all()
#

View File

@ -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

View File

@ -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.
"""

View File

@ -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

View File

@ -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

View File

@ -389,7 +389,7 @@ class ExcellonObject(FlatCAMObj, Excellon):
drill_count_item = QtWidgets.QTableWidgetItem('%d' % drill_cnt)
drill_count_item.setFlags(QtCore.Qt.ItemIsEnabled)
# if the slot number is zero is better to not clutter the AppGUI with zero's so we print a space
# if the slot number is zero is better to not clutter the GUI with zero's so we print a space
slot_count_str = '%d' % slot_cnt if slot_cnt > 0 else ''
slot_count_item = QtWidgets.QTableWidgetItem(slot_count_str)
slot_count_item.setFlags(QtCore.Qt.ItemIsEnabled)
@ -855,7 +855,7 @@ class ExcellonObject(FlatCAMObj, Excellon):
def form_to_storage(self):
if self.ui.tools_table.rowCount() == 0:
# there is no tool in tool table so we can't save the AppGUI elements values to storage
# there is no tool in tool table so we can't save the GUI elements values to storage
return
self.ui_disconnect()
@ -1778,7 +1778,7 @@ class ExcellonObject(FlatCAMObj, Excellon):
def on_apply_param_to_all_clicked(self):
if self.ui.tools_table.rowCount() == 0:
# there is no tool in tool table so we can't save the AppGUI elements values to storage
# there is no tool in tool table so we can't save the GUI elements values to storage
log.debug("ExcellonObject.on_apply_param_to_all_clicked() --> no tool in Tools Table, aborting.")
return

View File

@ -1320,7 +1320,7 @@ class GeometryObject(FlatCAMObj, Geometry):
def on_apply_param_to_all_clicked(self):
if self.ui.geo_tools_table.rowCount() == 0:
# there is no tool in tool table so we can't save the AppGUI elements values to storage
# there is no tool in tool table so we can't save the GUI elements values to storage
log.debug("GeometryObject.gui_form_to_storage() --> no tool in Tools Table, aborting.")
return
@ -1383,7 +1383,7 @@ class GeometryObject(FlatCAMObj, Geometry):
def gui_form_to_storage(self):
if self.ui.geo_tools_table.rowCount() == 0:
# there is no tool in tool table so we can't save the AppGUI elements values to storage
# there is no tool in tool table so we can't save the GUI elements values to storage
log.debug("GeometryObject.gui_form_to_storage() --> no tool in Tools Table, aborting.")
return

View File

@ -179,10 +179,10 @@ class GerberObject(FlatCAMObj, Gerber):
def set_ui(self, ui):
"""
Maps options with AppGUI inputs.
Connects AppGUI events to methods.
Maps options with GUI inputs.
Connects GUI events to methods.
:param ui: AppGUI object.
:param ui: GUI object.
:type ui: GerberObjectUI
:return: None
"""
@ -243,7 +243,7 @@ class GerberObject(FlatCAMObj, Gerber):
self.ui.type_obj_combo.currentIndexChanged.connect(self.on_type_obj_index_changed)
self.ui.tool_type_radio.activated_custom.connect(self.on_tool_type_change)
# establish visibility for the AppGUI elements found in the slot function
# establish visibility for the GUI elements found in the slot function
self.ui.tool_type_radio.activated_custom.emit(self.options['tool_type'])
# Show/Hide Advanced Options

View File

@ -324,7 +324,7 @@ class ObjectCollection(QtCore.QAbstractItemModel):
font.setFamily("Seagoe UI")
self.view.setFont(font)
# ## AppGUI Events
# ## GUI Events
self.view.selectionModel().selectionChanged.connect(self.on_list_selection_change)
# self.view.activated.connect(self.on_item_activated)
self.view.keyPressed.connect(self.app.ui.keyPressEvent)
@ -334,6 +334,8 @@ class ObjectCollection(QtCore.QAbstractItemModel):
self.click_modifier = None
self.update_list_signal.connect(self.on_update_list_signal)
self.view.activated.connect(self.on_row_activated)
self.item_selected.connect(self.on_row_selected)
def promise(self, obj_name):
log.debug("Object %s has been promised." % obj_name)
@ -999,3 +1001,199 @@ class ObjectCollection(QtCore.QAbstractItemModel):
def update_view(self):
self.dataChanged.emit(QtCore.QModelIndex(), QtCore.QModelIndex())
def on_row_activated(self, index):
if index.isValid():
if index.internalPointer().parent_item != self.root_item:
self.app.ui.notebook.setCurrentWidget(self.app.ui.selected_tab)
self.on_item_activated(index)
def on_row_selected(self, obj_name):
"""
This is a special string; when received it will make all Menu -> AppObjects entries unchecked
It mean we clicked outside of the items and deselected all
:param obj_name:
:return:
"""
if obj_name == 'none':
for act in self.app.ui.menuobjects.actions():
act.setChecked(False)
return
# get the name of the selected objects and add them to a list
name_list = []
for obj in self.get_selected():
name_list.append(obj.options['name'])
# set all actions as unchecked but the ones selected make them checked
for act in self.app.ui.menuobjects.actions():
act.setChecked(False)
if act.text() in name_list:
act.setChecked(True)
def on_collection_updated(self, obj, state, old_name):
"""
Create a menu from the object loaded in the collection.
:param obj: object that was changed (added, deleted, renamed)
:param state: what was done with the object. Can be: added, deleted, delete_all, renamed
:param old_name: the old name of the object before the action that triggered this slot happened
:return: None
"""
icon_files = {
"gerber": self.app.resource_location + "/flatcam_icon16.png",
"excellon": self.app.resource_location + "/drill16.png",
"cncjob": self.app.resource_location + "/cnc16.png",
"geometry": self.app.resource_location + "/geometry16.png",
"script": self.app.resource_location + "/script_new16.png",
"document": self.app.resource_location + "/notes16_1.png"
}
if state == 'append':
for act in self.app.ui.menuobjects.actions():
try:
act.triggered.disconnect()
except TypeError:
pass
self.app.ui.menuobjects.clear()
gerber_list = []
exc_list = []
cncjob_list = []
geo_list = []
script_list = []
doc_list = []
for name in self.get_names():
obj_named = self.get_by_name(name)
if obj_named.kind == 'gerber':
gerber_list.append(name)
elif obj_named.kind == 'excellon':
exc_list.append(name)
elif obj_named.kind == 'cncjob':
cncjob_list.append(name)
elif obj_named.kind == 'geometry':
geo_list.append(name)
elif obj_named.kind == 'script':
script_list.append(name)
elif obj_named.kind == 'document':
doc_list.append(name)
def add_act(o_name):
obj_for_icon = self.get_by_name(o_name)
add_action = QtWidgets.QAction(parent=self.app.ui.menuobjects)
add_action.setCheckable(True)
add_action.setText(o_name)
add_action.setIcon(QtGui.QIcon(icon_files[obj_for_icon.kind]))
add_action.triggered.connect(
lambda: self.set_active(o_name) if add_action.isChecked() is True else
self.set_inactive(o_name))
self.app.ui.menuobjects.addAction(add_action)
for name in gerber_list:
add_act(name)
self.app.ui.menuobjects.addSeparator()
for name in exc_list:
add_act(name)
self.app.ui.menuobjects.addSeparator()
for name in cncjob_list:
add_act(name)
self.app.ui.menuobjects.addSeparator()
for name in geo_list:
add_act(name)
self.app.ui.menuobjects.addSeparator()
for name in script_list:
add_act(name)
self.app.ui.menuobjects.addSeparator()
for name in doc_list:
add_act(name)
self.app.ui.menuobjects.addSeparator()
self.app.ui.menuobjects_selall = self.app.ui.menuobjects.addAction(
QtGui.QIcon(self.app.resource_location + '/select_all.png'),
_('Select All')
)
self.app.ui.menuobjects_unselall = self.app.ui.menuobjects.addAction(
QtGui.QIcon(self.app.resource_location + '/deselect_all32.png'),
_('Deselect All')
)
self.app.ui.menuobjects_selall.triggered.connect(lambda: self.on_objects_selection(True))
self.app.ui.menuobjects_unselall.triggered.connect(lambda: self.on_objects_selection(False))
elif state == 'delete':
for act in self.app.ui.menuobjects.actions():
if act.text() == obj.options['name']:
try:
act.triggered.disconnect()
except TypeError:
pass
self.app.ui.menuobjects.removeAction(act)
break
elif state == 'rename':
for act in self.app.ui.menuobjects.actions():
if act.text() == old_name:
add_action = QtWidgets.QAction(parent=self.app.ui.menuobjects)
add_action.setText(obj.options['name'])
add_action.setIcon(QtGui.QIcon(icon_files[obj.kind]))
add_action.triggered.connect(
lambda: self.set_active(obj.options['name']) if add_action.isChecked() is True else
self.set_inactive(obj.options['name']))
self.app.ui.menuobjects.insertAction(act, add_action)
try:
act.triggered.disconnect()
except TypeError:
pass
self.app.ui.menuobjects.removeAction(act)
break
elif state == 'delete_all':
for act in self.app.ui.menuobjects.actions():
try:
act.triggered.disconnect()
except TypeError:
pass
self.app.ui.menuobjects.clear()
self.app.ui.menuobjects.addSeparator()
self.app.ui.menuobjects_selall = self.app.ui.menuobjects.addAction(
QtGui.QIcon(self.app.resource_location + '/select_all.png'),
_('Select All')
)
self.app.ui.menuobjects_unselall = self.app.ui.menuobjects.addAction(
QtGui.QIcon(self.app.resource_location + '/deselect_all32.png'),
_('Deselect All')
)
self.app.ui.menuobjects_selall.triggered.connect(lambda: self.on_objects_selection(True))
self.app.ui.menuobjects_unselall.triggered.connect(lambda: self.on_objects_selection(False))
def on_objects_selection(self, on_off):
obj_list = self.get_names()
if on_off is True:
self.set_all_active()
for act in self.app.ui.menuobjects.actions():
try:
act.setChecked(True)
except Exception:
pass
if obj_list:
self.app.inform.emit('[selected] %s' % _("All objects are selected."))
else:
self.set_all_inactive()
for act in self.app.ui.menuobjects.actions():
try:
act.setChecked(False)
except Exception:
pass
if obj_list:
self.app.inform.emit('%s' % _("AppObjects selection is cleared."))
else:
self.app.inform.emit('')

View File

@ -1416,7 +1416,7 @@ class Gerber(Geometry):
# ######### Line did not match any pattern. Warn user. ##########
# ################################################################
log.warning("Line ignored (%d): %s" % (line_num, gline))
# provide the app with a way to process the AppGUI events when in a blocking loop
# provide the app with a way to process the GUI events when in a blocking loop
QtWidgets.QApplication.processEvents()
try:

View File

@ -1239,7 +1239,7 @@ class CutOut(AppTool):
# 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

View File

@ -293,5 +293,5 @@ class ToolImage(AppTool):
# Register recent file
self.app.file_opened.emit("image", filename)
# AppGUI feedback
# GUI feedback
self.app.inform.emit('[success] %s: %s' % (_("Opened"), filename))

View File

@ -620,7 +620,7 @@ class NonCopperClear(AppTool, Gerber):
}
""")
self.tools_box.addWidget(self.reset_button)
# ############################ FINSIHED AppGUI ###################################
# ############################ FINSIHED GUI ###################################
# #############################################################################
# #############################################################################
@ -825,7 +825,7 @@ class NonCopperClear(AppTool, Gerber):
def form_to_storage(self):
if self.tools_table.rowCount() == 0:
# there is no tool in tool table so we can't save the AppGUI elements values to storage
# there is no tool in tool table so we can't save the GUI elements values to storage
return
self.blockSignals(True)
@ -853,7 +853,7 @@ class NonCopperClear(AppTool, Gerber):
def on_apply_param_to_all_clicked(self):
if self.tools_table.rowCount() == 0:
# there is no tool in tool table so we can't save the AppGUI elements values to storage
# there is no tool in tool table so we can't save the GUI elements values to storage
log.debug("NonCopperClear.on_apply_param_to_all_clicked() --> no tool in Tools Table, aborting.")
return
@ -1860,7 +1860,7 @@ class NonCopperClear(AppTool, Gerber):
# 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
@ -2102,7 +2102,7 @@ class NonCopperClear(AppTool, Gerber):
"than isolation tool diameter."))
try:
for geo_elem in isolated_geo:
# provide the app with a way to process the AppGUI events when in a blocking loop
# provide the app with a way to process the GUI events when in a blocking loop
QtWidgets.QApplication.processEvents()
if self.app.abort_flag:
@ -2295,7 +2295,7 @@ class NonCopperClear(AppTool, Gerber):
Usage of the different one is related to when this function is called
from a TcL command.
:param run_threaded: If True the method will be run in a threaded way suitable for AppGUI usage; if False
:param run_threaded: If True the method will be run in a threaded way suitable for GUI usage; if False
it will run non-threaded for TclShell usage
:return:
"""
@ -2353,7 +2353,7 @@ class NonCopperClear(AppTool, Gerber):
log.debug("NCC Tool. Normal copper clearing task started.")
self.app.inform.emit(_("NCC Tool. Finished non-copper polygons. Normal copper clearing task started."))
# provide the app with a way to process the AppGUI events when in a blocking loop
# provide the app with a way to process the GUI events when in a blocking loop
if not run_threaded:
QtWidgets.QApplication.processEvents()
@ -2397,7 +2397,7 @@ class NonCopperClear(AppTool, Gerber):
# graceful abort requested by the user
raise grace
# provide the app with a way to process the AppGUI events when in a blocking loop
# provide the app with a way to process the GUI events when in a blocking loop
if not run_threaded:
QtWidgets.QApplication.processEvents()
@ -2455,7 +2455,7 @@ class NonCopperClear(AppTool, Gerber):
if len(area.geoms) > 0:
pol_nr = 0
for p in area.geoms:
# provide the app with a way to process the AppGUI events when in a blocking loop
# provide the app with a way to process the GUI events when in a blocking loop
if not run_threaded:
QtWidgets.QApplication.processEvents()
@ -2606,7 +2606,7 @@ class NonCopperClear(AppTool, Gerber):
log.debug("NCC Tool. Rest machining copper clearing task started.")
app_obj.inform.emit('_(NCC Tool. Rest machining copper clearing task started.')
# provide the app with a way to process the AppGUI events when in a blocking loop
# provide the app with a way to process the GUI events when in a blocking loop
if not run_threaded:
QtWidgets.QApplication.processEvents()
@ -2648,7 +2648,7 @@ class NonCopperClear(AppTool, Gerber):
# graceful abort requested by the user
raise grace
# provide the app with a way to process the AppGUI events when in a blocking loop
# provide the app with a way to process the GUI events when in a blocking loop
QtWidgets.QApplication.processEvents()
app_obj.inform.emit('[success] %s = %s%s %s' % (
@ -2690,7 +2690,7 @@ class NonCopperClear(AppTool, Gerber):
# Area to clear
for poly in cleared_by_last_tool:
# provide the app with a way to process the AppGUI events when in a blocking loop
# provide the app with a way to process the GUI events when in a blocking loop
QtWidgets.QApplication.processEvents()
if self.app.abort_flag:
@ -2731,7 +2731,7 @@ class NonCopperClear(AppTool, Gerber):
p = p.buffer(0)
if p is not None and p.is_valid:
# provide the app with a way to process the AppGUI events when in a blocking loop
# provide the app with a way to process the GUI events when in a blocking loop
QtWidgets.QApplication.processEvents()
if isinstance(p, Polygon):
@ -2763,7 +2763,7 @@ class NonCopperClear(AppTool, Gerber):
elif isinstance(p, MultiPolygon):
for poly in p:
if poly is not None:
# provide the app with a way to process the AppGUI events when
# provide the app with a way to process the GUI events when
# in a blocking loop
QtWidgets.QApplication.processEvents()
@ -2954,7 +2954,7 @@ class NonCopperClear(AppTool, Gerber):
:param tools_storage: whether to use the current tools_storage self.ncc_tools or a different one.
Usage of the different one is related to when this function is called from a TcL command.
:param plot: if True after the job is finished the result will be plotted, else it will not.
:param run_threaded: If True the method will be run in a threaded way suitable for AppGUI usage; if False it will
:param run_threaded: If True the method will be run in a threaded way suitable for GUI usage; if False it will
run non-threaded for TclShell usage
:return:
"""
@ -3098,7 +3098,7 @@ class NonCopperClear(AppTool, Gerber):
assert geo_obj.kind == 'geometry', \
"Initializer expected a GeometryObject, got %s" % type(geo_obj)
# provide the app with a way to process the AppGUI events when in a blocking loop
# provide the app with a way to process the GUI events when in a blocking loop
if not run_threaded:
QtWidgets.QApplication.processEvents()
@ -3187,7 +3187,7 @@ class NonCopperClear(AppTool, Gerber):
"than isolation tool diameter."))
try:
for geo_elem in isolated_geo:
# provide the app with a way to process the AppGUI events when in a blocking loop
# provide the app with a way to process the GUI events when in a blocking loop
QtWidgets.QApplication.processEvents()
if self.app.abort_flag:
@ -3295,7 +3295,7 @@ class NonCopperClear(AppTool, Gerber):
# graceful abort requested by the user
raise grace
# provide the app with a way to process the AppGUI events when in a blocking loop
# provide the app with a way to process the GUI events when in a blocking loop
QtWidgets.QApplication.processEvents()
app_obj.inform.emit('[success] %s = %s%s %s' % (
@ -3329,7 +3329,7 @@ class NonCopperClear(AppTool, Gerber):
if len(area.geoms) > 0:
pol_nr = 0
for p in area.geoms:
# provide the app with a way to process the AppGUI events when in a blocking loop
# provide the app with a way to process the GUI events when in a blocking loop
QtWidgets.QApplication.processEvents()
if self.app.abort_flag:
@ -3502,7 +3502,7 @@ class NonCopperClear(AppTool, Gerber):
log.debug("NCC Tool. Rest machining copper clearing task started.")
app_obj.inform.emit('_(NCC Tool. Rest machining copper clearing task started.')
# provide the app with a way to process the AppGUI events when in a blocking loop
# provide the app with a way to process the GUI events when in a blocking loop
if not run_threaded:
QtWidgets.QApplication.processEvents()
@ -3566,7 +3566,7 @@ class NonCopperClear(AppTool, Gerber):
try:
for geo_elem in isolated_geo:
# provide the app with a way to process the AppGUI events when in a blocking loop
# provide the app with a way to process the GUI events when in a blocking loop
QtWidgets.QApplication.processEvents()
if self.app.abort_flag:
@ -3694,7 +3694,7 @@ class NonCopperClear(AppTool, Gerber):
# Area to clear
for poly_r in cleared_by_last_tool:
# provide the app with a way to process the AppGUI events when in a blocking loop
# provide the app with a way to process the GUI events when in a blocking loop
QtWidgets.QApplication.processEvents()
if self.app.abort_flag:
@ -3735,7 +3735,7 @@ class NonCopperClear(AppTool, Gerber):
p = p.buffer(0)
if p is not None and p.is_valid:
# provide the app with a way to process the AppGUI events when in a blocking loop
# provide the app with a way to process the GUI events when in a blocking loop
QtWidgets.QApplication.processEvents()
if isinstance(p, Polygon):
@ -3764,7 +3764,7 @@ class NonCopperClear(AppTool, Gerber):
elif isinstance(p, MultiPolygon):
for poly_p in p:
if poly_p is not None:
# provide the app with a way to process the AppGUI events when
# provide the app with a way to process the GUI events when
# in a blocking loop
QtWidgets.QApplication.processEvents()
@ -3939,7 +3939,7 @@ class NonCopperClear(AppTool, Gerber):
except Exception:
try:
for el in target:
# provide the app with a way to process the AppGUI events when in a blocking loop
# provide the app with a way to process the GUI events when in a blocking loop
QtWidgets.QApplication.processEvents()
if self.app.abort_flag:
# graceful abort requested by the user

View File

@ -42,7 +42,7 @@ class ToolOptimal(AppTool):
self.decimals = self.app.decimals
# ############################################################################
# ############################ AppGUI creation ##################################
# ############################ GUI creation ##################################
# ## Title
title_label = QtWidgets.QLabel("%s" % self.toolName)
title_label.setStyleSheet(
@ -248,7 +248,7 @@ class ToolOptimal(AppTool):
self.loc_ois = OptionalHideInputSection(self.locations_cb, [self.locations_textb, self.locate_button])
self.sec_loc_ois = OptionalHideInputSection(self.sec_locations_cb, [self.sec_locations_frame])
# ################## Finished AppGUI creation ###################################
# ################## Finished GUI creation ###################################
# ############################################################################
# this is the line selected in the textbox with the locations of the minimum

View File

@ -211,7 +211,7 @@ class ToolPDF(AppTool):
return
# Register recent file
self.app.file_opened.emit("excellon", filename)
# AppGUI feedback
# GUI feedback
self.app.inform.emit('[success] %s: %s' % (_("Rendered"), outname))
def layer_rendering_as_gerber(self, filename, ap_dict, layer_nr):
@ -284,7 +284,7 @@ class ToolPDF(AppTool):
return
# Register recent file
self.app.file_opened.emit('gerber', filename)
# AppGUI feedback
# GUI feedback
self.app.inform.emit('[success] %s: %s' % (_("Rendered"), outname))
def periodic_check(self, check_period):

View File

@ -565,7 +565,7 @@ class ToolPaint(AppTool, Gerber):
""")
self.tools_box.addWidget(self.reset_button)
# #################################### FINSIHED AppGUI ###########################
# #################################### FINSIHED GUI ###########################
# #############################################################################
# #############################################################################
@ -790,7 +790,7 @@ class ToolPaint(AppTool, Gerber):
def form_to_storage(self):
if self.tools_table.rowCount() == 0:
# there is no tool in tool table so we can't save the AppGUI elements values to storage
# there is no tool in tool table so we can't save the GUI elements values to storage
return
self.blockSignals(True)
@ -818,7 +818,7 @@ class ToolPaint(AppTool, Gerber):
def on_apply_param_to_all_clicked(self):
if self.tools_table.rowCount() == 0:
# there is no tool in tool table so we can't save the AppGUI elements values to storage
# there is no tool in tool table so we can't save the GUI elements values to storage
log.debug("NonCopperClear.on_apply_param_to_all_clicked() --> no tool in Tools Table, aborting.")
return
@ -1028,7 +1028,7 @@ class ToolPaint(AppTool, Gerber):
"tools_paintrest": self.app.defaults["tools_paintrest"],
})
# ## Init the AppGUI interface
# ## Init the GUI interface
self.order_radio.set_value(self.app.defaults["tools_paintorder"])
self.paintmargin_entry.set_value(self.app.defaults["tools_paintmargin"])
self.paintmethod_combo.set_value(self.app.defaults["tools_paintmethod"])
@ -1758,7 +1758,7 @@ class ToolPaint(AppTool, Gerber):
# 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
@ -1928,7 +1928,7 @@ class ToolPaint(AppTool, Gerber):
# process the flashes found in the selected polygon with the 'lines' method for rectangular
# flashes and with _("Seed") for oblong and circular flashes
# and pads (flahes) need the contour therefore I override the AppGUI settings with always True
# and pads (flahes) need the contour therefore I override the GUI settings with always True
for ap_type in flash_el_dict:
for elem in flash_el_dict[ap_type]:
if 'solid' in elem:
@ -2206,7 +2206,7 @@ class ToolPaint(AppTool, Gerber):
cp = []
try:
for pp in poly_buf:
# provide the app with a way to process the AppGUI events when in a blocking loop
# provide the app with a way to process the GUI events when in a blocking loop
QtWidgets.QApplication.processEvents()
if self.app.abort_flag:
# graceful abort requested by the user
@ -2224,7 +2224,7 @@ class ToolPaint(AppTool, Gerber):
self.app.proc_container.update_view_text(' %d%%' % disp_number)
old_disp_number = disp_number
except TypeError:
# provide the app with a way to process the AppGUI events when in a blocking loop
# provide the app with a way to process the GUI events when in a blocking loop
QtWidgets.QApplication.processEvents()
if self.app.abort_flag:
# graceful abort requested by the user
@ -2524,7 +2524,7 @@ class ToolPaint(AppTool, Gerber):
cp = []
try:
for pp in poly_buf:
# provide the app with a way to process the AppGUI events when in a blocking loop
# provide the app with a way to process the GUI events when in a blocking loop
QtWidgets.QApplication.processEvents()
if self.app.abort_flag:
# graceful abort requested by the user
@ -2549,7 +2549,7 @@ class ToolPaint(AppTool, Gerber):
# log.debug("Polygons cleared: %d. Percentage done: %d%%" % (pol_nr, disp_number))
except TypeError:
# provide the app with a way to process the AppGUI events when in a blocking loop
# provide the app with a way to process the GUI events when in a blocking loop
QtWidgets.QApplication.processEvents()
if self.app.abort_flag:
# graceful abort requested by the user
@ -2712,7 +2712,7 @@ class ToolPaint(AppTool, Gerber):
cp = []
try:
for pp in poly_buf:
# provide the app with a way to process the AppGUI events when in a blocking loop
# provide the app with a way to process the GUI events when in a blocking loop
QtWidgets.QApplication.processEvents()
if self.app.abort_flag:
# graceful abort requested by the user
@ -2730,7 +2730,7 @@ class ToolPaint(AppTool, Gerber):
self.app.proc_container.update_view_text(' %d%%' % disp_number)
old_disp_number = disp_number
except TypeError:
# provide the app with a way to process the AppGUI events when in a blocking loop
# provide the app with a way to process the GUI events when in a blocking loop
QtWidgets.QApplication.processEvents()
if self.app.abort_flag:
# graceful abort requested by the user
@ -3022,7 +3022,7 @@ class ToolPaint(AppTool, Gerber):
try:
try:
for pp in poly_buf:
# provide the app with a way to process the AppGUI events when in a blocking loop
# provide the app with a way to process the GUI events when in a blocking loop
QtWidgets.QApplication.processEvents()
if self.app.abort_flag:
# graceful abort requested by the user
@ -3047,7 +3047,7 @@ class ToolPaint(AppTool, Gerber):
# log.debug("Polygons cleared: %d. Percentage done: %d%%" % (pol_nr, disp_number))
except TypeError:
# provide the app with a way to process the AppGUI events when in a blocking loop
# provide the app with a way to process the GUI events when in a blocking loop
QtWidgets.QApplication.processEvents()
if self.app.abort_flag:
# graceful abort requested by the user
@ -3200,7 +3200,7 @@ class ToolPaint(AppTool, Gerber):
try:
try:
for pp in poly_buf:
# provide the app with a way to process the AppGUI events when in a blocking loop
# provide the app with a way to process the GUI events when in a blocking loop
QtWidgets.QApplication.processEvents()
if self.app.abort_flag:
# graceful abort requested by the user
@ -3225,7 +3225,7 @@ class ToolPaint(AppTool, Gerber):
# log.debug("Polygons cleared: %d. Percentage done: %d%%" % (pol_nr, disp_number))
except TypeError:
# provide the app with a way to process the AppGUI events when in a blocking loop
# provide the app with a way to process the GUI events when in a blocking loop
QtWidgets.QApplication.processEvents()
if self.app.abort_flag:
# graceful abort requested by the user

View File

@ -460,7 +460,7 @@ class PcbWizard(AppTool):
# Register recent file
self.app.file_opened.emit("excellon", name)
# AppGUI feedback
# GUI feedback
self.app.inform.emit('[success] %s: %s' % (_("Imported"), name))
self.app.ui.notebook.setCurrentWidget(self.app.ui.project_tab)
else:

View File

@ -257,7 +257,7 @@ class TermWidget(QWidget):
class FCShell(TermWidget):
def __init__(self, app, version, *args):
"""
Initialize the TCL Shell. A dock widget that holds the AppGUI interface to the FlatCAM command line.
Initialize the TCL Shell. A dock widget that holds the GUI interface to the FlatCAM command line.
:param app: When instantiated the sysShell will be actually the FlatCAMApp.App() class
:param version: FlatCAM version string

View File

@ -462,7 +462,7 @@ class ToolSub(AppTool):
_('Generating new object failed.'))
return
# AppGUI feedback
# GUI feedback
self.app.inform.emit('[success] %s: %s' %
(_("Created"), outname))
@ -666,7 +666,7 @@ class ToolSub(AppTool):
return
# Register recent file
self.app.file_opened.emit('geometry', outname)
# AppGUI feedback
# GUI feedback
self.app.inform.emit('[success] %s: %s' %
(_("Created"), outname))

View File

@ -14,10 +14,12 @@ CHANGELOG for FlatCAM beta
- trying to fix the pixmap load crash when running a FlatCAMScript
- made the workspace label in the status bar clickable and also added a status bar message on status toggle for workspace
- modified the GUI for Film and Panelize Tools
- moved some of the GUI related methods from FlatCAMApp.App to the flatcamGUI.FlatCAMGUI class
- moved some of the GUI related methods from FlatCAMApp.App to the flatcamGUI.MainGUI class
- moved Shortcuts Tab creation in it's own class
- renamed classes to have shorter names and grouped
- removed reference to postprocessors and replaced it with preprocessors
- more refactoring class names
- moved some of the methods from the App class to the ObjectCollection class
17.05.2020
@ -127,7 +129,7 @@ CHANGELOG for FlatCAM beta
2.05.2020
- changed the icons for the grid snap in the status bar
- moved some of the methods from FlatCAMApp.App to flatcamGUI.FlatCAMGUI class
- moved some of the methods from FlatCAMApp.App to flatcamGUI.MainGUI class
- fixed bug in Gerber Editor in which the units conversion wasn't calculated correct
- fixed bug in Gerber Editor in which the QThread that is started on object edit was not stopped at clean up stage
- fixed bug in Gerber Editor that kept all the apertures (including the geometry) of a previously edited object that was not saved after edit
@ -1395,7 +1397,7 @@ CHANGELOG for FlatCAM beta
- optimized Rules Check Tool so it runs faster when doing Copper 2 Copper rule
- small GUI changes in Optimal Tool and in Film Tool
- some PEP8 corrections
- some code annotations to make it easier to navigate in the FlatCAMGUI.py
- some code annotations to make it easier to navigate in the MainGUI.py
- fixed exit FullScreen with Escape key
- added a new menu category in the MenuBar named 'Objects'. It will hold the objects found in the Project tab. Useful when working in FullScreen
- disabled a log.debug in ObjectColection.get_by_name()
@ -2834,7 +2836,7 @@ CHANGELOG for FlatCAM beta
- fix for issue #262: when doing Edit-> Save & Close Editor on a Geometry that is not generated through first entering into an Editor, the geometry disappear
- finished preparing for internationalization for the files: camlib and objectCollection
- fixed tools shortcuts not working anymore due of the new toggle parameter for the .run().
- finished preparing for internationalization for the files: FlatCAMEditor, FlatCAMGUI
- finished preparing for internationalization for the files: FlatCAMEditor, MainGUI
- finished preparing for internationalization for the files: FlatCAMObj, ObjectUI
- sorted the languages in the Preferences combobox
@ -3156,7 +3158,7 @@ CHANGELOG for FlatCAM beta
- fixed the name self-insert in save dialog file for GCode; added protection in case the save path is None
- fixed FlatCAM crash when trying to make drills GCode out of a file that have only slots.
- changed the messages for Units Conversion
- all key shortcuts work across the entire application; moved all the shortcuts definitions in FlatCAMGUI.keyPressEvent()
- all key shortcuts work across the entire application; moved all the shortcuts definitions in MainGUI.keyPressEvent()
- renamed the theme to layout because it is really a layout change
- added plot kind for CNC Job in the App Preferences
- combined the geocutout and cutout_any TCL commands - work in progress
@ -3677,7 +3679,7 @@ For now they are used only for Excellon objects who do have toolchange events
- fixed a reported bug generated by a typo for feedrate_z object in camlib.py. Because of that, the project could not be saved.
- fixed a G01 usage (should be G1) in Marlin preprocessor.
- changed the position of the Tool Dia entry in the Object UI and in FlatCAMGUI
- changed the position of the Tool Dia entry in the Object UI and in MainGUI
- fixed issues in the installer
30.10.2018

View File

@ -31,7 +31,7 @@ def debug_trace():
if __name__ == '__main__':
# All X11 calling should be thread safe otherwise we have strange issues
# QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_X11InitThreads)
# NOTE: Never talk to the AppGUI from threads! This is why I commented the above.
# NOTE: Never talk to the GUI from threads! This is why I commented the above.
freeze_support()
major_v = sys.version_info.major

View File

@ -1267,7 +1267,7 @@ class Geometry(object):
# graceful abort requested by the user
raise grace
# provide the app with a way to process the AppGUI events when in a blocking loop
# provide the app with a way to process the GUI events when in a blocking loop
QtWidgets.QApplication.processEvents()
# Can only result in a Polygon or MultiPolygon
@ -1359,7 +1359,7 @@ class Geometry(object):
# graceful abort requested by the user
raise grace
# provide the app with a way to process the AppGUI events when in a blocking loop
# provide the app with a way to process the GUI events when in a blocking loop
QtWidgets.QApplication.processEvents()
path = Point(seedpoint).buffer(radius, int(steps_per_circle)).exterior
@ -1473,7 +1473,7 @@ class Geometry(object):
# graceful abort requested by the user
raise grace
# provide the app with a way to process the AppGUI events when in a blocking loop
# provide the app with a way to process the GUI events when in a blocking loop
QtWidgets.QApplication.processEvents()
line = LineString([(left, y), (right, y)])
@ -1510,7 +1510,7 @@ class Geometry(object):
# graceful abort requested by the user
raise grace
# provide the app with a way to process the AppGUI events when in a blocking loop
# provide the app with a way to process the GUI events when in a blocking loop
QtWidgets.QApplication.processEvents()
line = LineString([(x, top), (x, bot)])
@ -1641,7 +1641,7 @@ class Geometry(object):
# graceful abort requested by the user
raise grace
# provide the app with a way to process the AppGUI events when in a blocking loop
# provide the app with a way to process the GUI events when in a blocking loop
QtWidgets.QApplication.processEvents()
new_line = line.parallel_offset(distance=delta, side='left', resolution=int(steps_per_circle))

View File

@ -64,7 +64,7 @@ class FlatCAMDefaults:
"global_machinist_setting": False,
# Global AppGUI Preferences
# Global GUI Preferences
"global_gridx": 1.0,
"global_gridy": 1.0,
"global_snap_max": 0.05,
@ -125,7 +125,7 @@ class FlatCAMDefaults:
"global_tcl_path": '',
# General AppGUI Settings
# General GUI Settings
"global_theme": 'white',
"global_gray_icons": False,
"global_hover": False,

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -81,5 +81,5 @@ class TclCommandImportSvg(TclCommandSignaled):
# Register recent file
self.app.file_opened.emit("svg", filename)
# AppGUI feedback
# GUI feedback
self.app.inform.emit("Opened: " + filename)

View File

@ -90,5 +90,5 @@ class TclCommandOpenDXF(TclCommandSignaled):
# Register recent file
self.app.file_opened.emit("dxf", filename)
# AppGUI feedback
# GUI feedback
self.app.inform.emit("Opened: " + filename)

View File

@ -89,5 +89,5 @@ class TclCommandOpenSVG(TclCommandSignaled):
# Register recent file
self.app.file_opened.emit("svg", filename)
# AppGUI feedback
# GUI feedback
self.app.inform.emit("Opened: " + filename)