- the notebook is automatically collapsed when there are no objects in the collection and it is showed when adding an object

- added new options in Edit -> Preferences -> General -> App Preferences to control if the Notebook is showed at startup and if the notebook is closed when there are no objects in the collection and showed when the collection has objects.
This commit is contained in:
Marius Stanciu 2019-02-15 01:48:34 +02:00 committed by Marius S
parent 098de7f030
commit a978b5621d
6 changed files with 66 additions and 18 deletions

View File

@ -305,6 +305,9 @@ class App(QtCore.QObject):
"global_shell_at_startup": self.general_defaults_form.general_app_group.shell_startup_cb,
"global_version_check": self.general_defaults_form.general_app_group.version_check_cb,
"global_send_stats": self.general_defaults_form.general_app_group.send_stats_cb,
"global_project_at_startup": self.general_defaults_form.general_app_group.project_startup_cb,
"global_project_autohide": self.general_defaults_form.general_app_group.project_autohide_cb,
"global_gridx": self.general_defaults_form.general_gui_group.gridx_entry,
"global_gridy": self.general_defaults_form.general_gui_group.gridy_entry,
"global_snap_max": self.general_defaults_form.general_gui_group.snap_max_dist_entry,
@ -471,6 +474,9 @@ class App(QtCore.QObject):
"units": "IN",
"global_version_check": True,
"global_send_stats": True,
"global_project_at_startup": False,
"global_project_autohide": True,
"global_gridx": 1.0,
"global_gridy": 1.0,
"global_snap_max": 0.05,
@ -1116,6 +1122,8 @@ class App(QtCore.QObject):
self.ui.menuview_zoom_out.triggered.connect(lambda: self.plotcanvas.zoom(1.5))
self.ui.menuview_toggle_fscreen.triggered.connect(self.on_fullscreen)
self.ui.menuview_toggle_parea.triggered.connect(self.on_toggle_plotarea)
self.ui.menuview_toggle_notebook.triggered.connect(self.on_toggle_notebook)
self.ui.menuview_toggle_grid.triggered.connect(self.on_toggle_grid)
self.ui.menuview_toggle_axis.triggered.connect(self.on_toggle_axis)
self.ui.menuview_toggle_workspace.triggered.connect(self.on_workspace_menu)
@ -1264,6 +1272,13 @@ class App(QtCore.QObject):
# this is a flag to signal to other tools that the ui tooltab is locked and not accessible
self.tool_tab_locked = False
# decide if to show or hide the Notebook side of the screen at startup
if self.defaults["global_project_at_startup"] is True:
self.ui.splitter.setSizes([1, 1])
else:
self.ui.splitter.setSizes([0, 1])
####################
### Other setups ###
####################

View File

@ -273,6 +273,8 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
QtGui.QIcon('share/fscreen32.png'), "&Toggle FullScreen\tALT+F10")
self.menuview_toggle_parea = self.menuview.addAction(
QtGui.QIcon('share/plot32.png'), "&Toggle Plot Area\tCTRL+F10")
self.menuview_toggle_notebook = self.menuview.addAction(
QtGui.QIcon('share/notebook32.png'), "&Toggle Project/Sel/Tool\t`")
self.menuview.addSeparator()
self.menuview_toggle_grid = self.menuview.addAction(QtGui.QIcon('share/grid32.png'), "&Toggle Grid Snap\tG")
@ -2819,18 +2821,31 @@ class GeneralAppPrefGroupUI(OptionsGroupUI):
self.mselect_radio = RadioSet([{'label': 'CTRL', 'value': 'Control'},
{'label': 'SHIFT', 'value': 'Shift'}])
# # Mouse panning with "Space" key, CB
# self.pan_with_space_label = QtWidgets.QLabel('Pan w/ Space:')
# self.pan_with_space_label.setToolTip(
# "Check this box if you want to pan when mouse is moved,\n"
# "and key 'Space' is pressed."
# )
# self.pan_with_space_cb = FCCheckBox(label='')
# self.pan_with_space_cb.setToolTip(
# "Check this box if you want to pan when mouse is moved,\n"
# "and key 'Space' is pressed."
# )
# Project at StartUp CB
self.project_startup_label = QtWidgets.QLabel('Project at StartUp:')
self.project_startup_label.setToolTip(
"Check this box if you want the project/selected/tool tab area to\n"
"to be shown automatically at startup."
)
self.project_startup_cb = FCCheckBox(label='')
self.project_startup_cb.setToolTip(
"Check this box if you want the project/selected/tool tab area to\n"
"to be shown automatically at startup."
)
# Project autohide CB
self.project_autohide_label = QtWidgets.QLabel('Project AutoHide:')
self.project_autohide_label.setToolTip(
"Check this box if you want the project/selected/tool tab area to\n"
"hide automatically when there are no objects loaded and\n"
"to show whenever a new object is created."
)
self.project_autohide_cb = FCCheckBox(label='')
self.project_autohide_cb.setToolTip(
"Check this box if you want the project/selected/tool tab area to\n"
"hide automatically when there are no objects loaded and\n"
"to show whenever a new object is created."
)
# Just to add empty rows
self.spacelabel = QtWidgets.QLabel('')
@ -2847,7 +2862,9 @@ class GeneralAppPrefGroupUI(OptionsGroupUI):
self.form_box.addRow(self.panbuttonlabel, self.pan_button_radio)
self.form_box.addRow(self.mselectlabel, self.mselect_radio)
# self.form_box.addRow(self.pan_with_space_label, self.pan_with_space_cb)
self.form_box.addRow(self.project_startup_label, self.project_startup_cb)
self.form_box.addRow(self.project_autohide_label, self.project_autohide_cb)
self.form_box.addRow(self.spacelabel, self.spacelabel)
# Add the QFormLayout that holds the Application general defaults

View File

@ -531,13 +531,16 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
ap_dim_item = QtWidgets.QTableWidgetItem('')
ap_dim_item.setFlags(QtCore.Qt.ItemIsEnabled)
if self.apertures[ap_code]['size'] is not None:
ap_size_item = QtWidgets.QTableWidgetItem('%.4f' %
float(self.apertures[ap_code]['size'] *
self.file_units_factor))
ap_size_item.setFlags(QtCore.Qt.ItemIsEnabled)
else:
try:
if self.apertures[ap_code]['size'] is not None:
ap_size_item = QtWidgets.QTableWidgetItem('%.4f' %
float(self.apertures[ap_code]['size'] *
self.file_units_factor))
else:
ap_size_item = QtWidgets.QTableWidgetItem('')
except KeyError:
ap_size_item = QtWidgets.QTableWidgetItem('')
ap_size_item.setFlags(QtCore.Qt.ItemIsEnabled)
plot_item = FCCheckBox()
plot_item.setLayoutDirection(QtCore.Qt.RightToLeft)

View File

@ -676,6 +676,11 @@ class ObjectCollection(QtCore.QAbstractItemModel):
if group.child_count() is 1:
self.view.setExpanded(group_index, True)
# decide if to show or hide the Notebook side of the screen
if self.app.defaults["global_project_autohide"] is True:
# always open the notebook on object added to collection
self.app.ui.splitter.setSizes([1, 1])
def get_names(self):
"""
Gets a list of the names of all objects in the collection.
@ -768,6 +773,12 @@ class ObjectCollection(QtCore.QAbstractItemModel):
# always go to the Project Tab after object deletion as it may be done with a shortcut key
self.app.ui.notebook.setCurrentWidget(self.app.ui.project_tab)
# decide if to show or hide the Notebook side of the screen
if self.app.defaults["global_project_autohide"] is True:
# hide the notebook if there are no objects in the collection
if not self.get_list():
self.app.ui.splitter.setSizes([0, 1])
def delete_all(self):
FlatCAMApp.App.log.debug(str(inspect.stack()[1][3]) + "--> OC.delete_all()")

View File

@ -22,6 +22,8 @@ CAD program, and create G-Code for Isolation routing.
- when linked, the grid snap on Y will copy the value in grid snap on X in real time
- in Gerber aperture table now the values are displayed in the current units set in FlatCAM
- added shortcut key 'J' (jump to location) in Editors and added an icon to the dialog popup window
- the notebook is automatically collapsed when there are no objects in the collection and it is showed when adding an object
- added new options in Edit -> Preferences -> General -> App Preferences to control if the Notebook is showed at startup and if the notebook is closed when there are no objects in the collection and showed when the collection has objects.
13.02.2019

BIN
share/notebook32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 287 B