- added a default properties tab which will hold a set of information's about the application

This commit is contained in:
Marius Stanciu 2020-10-23 18:46:55 +03:00 committed by Marius
parent 55b4fbc3d8
commit 427118c495
17 changed files with 1077 additions and 918 deletions

View File

@ -16,6 +16,7 @@ CHANGELOG for FlatCAM beta
- commented the ToolsDB class since it is not used currently
- some minor changes in the AppTextEditor.py file
- removed Hungarian language since it's looking like is no longer being translated
- added a default properties tab which will hold a set of information's about the application
22.10.2020

View File

@ -1978,9 +1978,9 @@ class AppExcEditor(QtCore.QObject):
self.e_ui.tools_table_exc.clearSelection()
# Remove anything else in the GUI Selected Tab
self.app.ui.selected_scroll_area.takeWidget()
self.app.ui.properties_scroll_area.takeWidget()
# Put ourselves in the GUI Properties Tab
self.app.ui.selected_scroll_area.setWidget(self.e_ui.exc_edit_widget)
self.app.ui.properties_scroll_area.setWidget(self.e_ui.exc_edit_widget)
# Switch notebook to Properties page
self.app.ui.notebook.setCurrentWidget(self.app.ui.properties_tab)

View File

@ -3528,9 +3528,9 @@ class AppGeoEditor(QtCore.QObject):
self.decimals = self.app.decimals
# Remove anything else in the GUI Selected Tab
self.app.ui.selected_scroll_area.takeWidget()
self.app.ui.properties_scroll_area.takeWidget()
# Put ourselves in the appGUI Properties Tab
self.app.ui.selected_scroll_area.setWidget(self.geo_edit_widget)
self.app.ui.properties_scroll_area.setWidget(self.geo_edit_widget)
# Switch notebook to Properties page
self.app.ui.notebook.setCurrentWidget(self.app.ui.properties_tab)
@ -4025,9 +4025,11 @@ class AppGeoEditor(QtCore.QObject):
# make sure that the cursor shape is enabled/disabled, too
if self.options['grid_snap'] is True:
self.app.defaults['global_grid_snap'] = True
self.app.inform[str, bool].emit(_("Grid Snap enabled."), False)
self.app.app_cursor.enabled = True
else:
self.app.defaults['global_grid_snap'] = False
self.app.app_cursor.enabled = False
self.app.inform[str, bool].emit(_("Grid Snap disabled."), False)

View File

@ -3323,9 +3323,9 @@ class AppGerberEditor(QtCore.QObject):
self.apertures_table.clearSelection()
# Remove anything else in the GUI Properties Tab
self.app.ui.selected_scroll_area.takeWidget()
self.app.ui.properties_scroll_area.takeWidget()
# Put ourselves in the GUI Properties Tab
self.app.ui.selected_scroll_area.setWidget(self.grb_edit_widget)
self.app.ui.properties_scroll_area.setWidget(self.grb_edit_widget)
# Switch notebook to Properties page
self.app.ui.notebook.setCurrentWidget(self.app.ui.properties_tab)

View File

@ -91,9 +91,9 @@ class AppGCodeEditor(QtCore.QObject):
self.ui.prepend_text.set_value(self.app.defaults["cncjob_prepend"])
# Remove anything else in the GUI Properties Tab
self.app.ui.selected_scroll_area.takeWidget()
self.app.ui.properties_scroll_area.takeWidget()
# Put ourselves in the GUI Properties Tab
self.app.ui.selected_scroll_area.setWidget(self.ui.edit_widget)
self.app.ui.properties_scroll_area.setWidget(self.ui.edit_widget)
# Switch notebook to Properties page
self.app.ui.notebook.setCurrentWidget(self.app.ui.properties_tab)

View File

@ -1230,9 +1230,9 @@ class MainGUI(QtWidgets.QMainWindow):
self.properties_tab_layout = QtWidgets.QVBoxLayout(self.properties_tab)
self.properties_tab_layout.setContentsMargins(2, 2, 2, 2)
self.selected_scroll_area = VerticalScrollArea()
# self.selected_scroll_area.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContents)
self.properties_tab_layout.addWidget(self.selected_scroll_area)
self.properties_scroll_area = VerticalScrollArea()
# self.properties_scroll_area.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContents)
self.properties_tab_layout.addWidget(self.properties_scroll_area)
self.notebook.addTab(self.properties_tab, _("Properties"))
# ########################################################################

View File

@ -224,6 +224,7 @@ class PlotCanvas(QtCore.QObject, VisPyCanvas):
if state:
self.axis_enabled = True
self.fcapp.defaults['global_axis'] = True
self.v_line.parent = self.view.scene
self.h_line.parent = self.view.scene
self.fcapp.ui.axis_status_label.setStyleSheet("""
@ -236,6 +237,7 @@ class PlotCanvas(QtCore.QObject, VisPyCanvas):
self.fcapp.inform[str, bool].emit(_("Axis enabled."), False)
else:
self.axis_enabled = False
self.fcapp.defaults['global_axis'] = False
self.v_line.parent = None
self.h_line.parent = None
self.fcapp.ui.axis_status_label.setStyleSheet("")
@ -271,10 +273,12 @@ class PlotCanvas(QtCore.QObject, VisPyCanvas):
state = not self.grid_lines_enabled
if state:
self.fcapp.defaults['global_grid_lines'] = True
self.grid_lines_enabled = True
self.grid.parent = self.view.scene
self.fcapp.inform[str, bool].emit(_("Grid enabled."), False)
else:
self.fcapp.defaults['global_grid_lines'] = False
self.grid_lines_enabled = False
self.grid.parent = None
self.fcapp.inform[str, bool].emit(_("Grid disabled."), False)

View File

@ -332,6 +332,7 @@ class PlotCanvasLegacy(QtCore.QObject):
if state:
self.axis_enabled = True
self.app.defaults['global_axis'] = True
if self.h_line not in self.axes.lines and self.v_line not in self.axes.lines:
self.h_line = self.axes.axhline(color=(0.70, 0.3, 0.3), linewidth=2)
self.v_line = self.axes.axvline(color=(0.70, 0.3, 0.3), linewidth=2)
@ -345,6 +346,7 @@ class PlotCanvasLegacy(QtCore.QObject):
self.app.inform[str, bool].emit(_("Axis enabled."), False)
else:
self.axis_enabled = False
self.app.defaults['global_axis'] = False
if self.h_line in self.axes.lines and self.v_line in self.axes.lines:
self.axes.lines.remove(self.h_line)
self.axes.lines.remove(self.v_line)
@ -442,6 +444,7 @@ class PlotCanvasLegacy(QtCore.QObject):
state = not self.grid_lines_enabled
if state:
self.app.defaults['global_grid_lines'] = True
self.grid_lines_enabled = True
self.axes.grid(True)
try:
@ -450,6 +453,7 @@ class PlotCanvasLegacy(QtCore.QObject):
pass
self.app.inform[str, bool].emit(_("Grid enabled."), False)
else:
self.app.defaults['global_grid_lines'] = False
self.grid_lines_enabled = False
self.axes.grid(False)
try:

View File

@ -219,12 +219,12 @@ class FlatCAMObj(QtCore.QObject):
# it seems that the takewidget() does generate a focus out event for the QDoubleSpinbox ...
# and reconnect after the takeWidget() is done
# self.ui.scale_entry.returnPressed.disconnect(self.on_scale_button_click)
self.app.ui.selected_scroll_area.takeWidget()
self.app.ui.properties_scroll_area.takeWidget()
# self.ui.scale_entry.returnPressed.connect(self.on_scale_button_click)
except Exception as e:
self.app.log.debug("FlatCAMObj.build_ui() --> Nothing to remove: %s" % str(e))
self.app.ui.selected_scroll_area.setWidget(self.ui)
self.app.ui.properties_scroll_area.setWidget(self.ui)
# self.ui.setMinimumWidth(100)
# self.ui.setMaximumWidth(self.app.ui.properties_tab.sizeHint().width())

View File

@ -967,7 +967,7 @@ class ObjectCollection(QtCore.QAbstractItemModel):
# log.debug("on_list_selection_change(): Index Error (Nothing selected?)")
self.app.inform.emit('')
try:
self.app.ui.selected_scroll_area.takeWidget()
self.app.ui.properties_scroll_area.takeWidget()
except Exception as e:
log.debug("Nothing to remove. %s" % str(e))

View File

@ -253,9 +253,9 @@ class InvertUI:
"- bevel -> the lines are joined by a third line")
)
self.join_radio = RadioSet([
{'label': 'Rounded', 'value': 'r'},
{'label': 'Square', 'value': 's'},
{'label': 'Bevel', 'value': 'b'}
{'label': _('Rounded'), 'value': 'r'},
{'label': _('Square'), 'value': 's'},
{'label': _('Bevel'), 'value': 'b'}
], orientation='vertical', stretch=False)
grid0.addWidget(self.join_label, 7, 0, 1, 2)

View File

@ -48,24 +48,23 @@ class Properties(AppTool):
self.properties_frame.setLayout(self.properties_box)
# ## Title
title_label = QtWidgets.QLabel("%s" % self.toolName)
title_label.setStyleSheet("""
QLabel
{
font-size: 16px;
font-weight: bold;
}
""")
self.properties_box.addWidget(title_label)
# title_label = QtWidgets.QLabel("%s" % self.toolName)
# title_label.setStyleSheet("""
# QLabel
# {
# font-size: 16px;
# font-weight: bold;
# }
# """)
# self.properties_box.addWidget(title_label)
# self.layout.setMargin(0) # PyQt4
self.properties_box.setContentsMargins(0, 0, 0, 0) # PyQt5
self.vlay = QtWidgets.QVBoxLayout()
self.properties_box.addLayout(self.vlay)
self.treeWidget = FCTree(columns=2)
self.treeWidget.setStyleSheet("QTreeWidget {border: 0px;}")
self.vlay.addWidget(self.treeWidget)
self.vlay.setStretch(0, 0)

View File

@ -166,7 +166,7 @@ class App(QtCore.QObject):
# ###############################################################################################################
version = "Unstable Version"
# version = 8.994
version_date = "2020/09/30"
version_date = "2020/10/30"
beta = True
engine = '3D'
@ -804,6 +804,9 @@ 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))
# when the defaults dictionary values change
self.defaults.defaults.set_change_callback(callback=self.on_properties_tab_click)
# ########################################## Standard signals ###############################################
# ### Menu
self.ui.menufilenewproject.triggered.connect(self.on_file_new_click)
@ -965,6 +968,9 @@ class App(QtCore.QObject):
for act in self.ui.menuprojectcolor.actions():
act.triggered.connect(self.on_set_color_action_triggered)
# Notebook tab clicking
self.ui.notebook.tabBarClicked.connect(self.on_properties_tab_click)
# ###########################################################################################################
# #################################### GUI PREFERENCES SIGNALS ##############################################
# ###########################################################################################################
@ -2349,7 +2355,7 @@ class App(QtCore.QObject):
# restore GUI to the Selected TAB
# Remove anything else in the GUI
self.ui.selected_scroll_area.takeWidget()
self.ui.properties_scroll_area.takeWidget()
elif edited_obj.kind == 'excellon':
obj_type = "Excellon"
@ -2471,7 +2477,7 @@ class App(QtCore.QObject):
self.call_source = 'app'
# edited_obj.plot()
self.ui.plot_tab_area.setTabText(0, "Plot Area")
self.ui.plot_tab_area.setTabText(0, _("Plot Area"))
self.ui.plot_tab_area.protectTab(0)
# make sure that we reenable the selection on Project Tab after returning from Editor Mode:
@ -6992,7 +6998,7 @@ class App(QtCore.QObject):
log.debug("App.on_file_new() --> %s" % str(e))
# # And then add again the Plot Area
self.ui.plot_tab_area.insertTab(0, self.ui.plot_tab, "Plot Area")
self.ui.plot_tab_area.insertTab(0, self.ui.plot_tab, _("Plot Area"))
self.ui.plot_tab_area.protectTab(0)
# take the focus of the Notebook on Project Tab.
@ -9677,6 +9683,10 @@ class App(QtCore.QObject):
self.log.debug("Recent items list has been populated.")
def on_properties_tab_click(self, index):
if self.ui.properties_scroll_area.widget().objectName() == 'default_properties':
self.setup_default_properties_tab()
def setup_default_properties_tab(self):
"""
Default text for the Properties tab when is not taken by the Object UI.
@ -9686,24 +9696,79 @@ class App(QtCore.QObject):
# label = QtWidgets.QLabel("Choose an item from Project")
# label.setAlignment(QtCore.Qt.AlignHCenter | QtCore.Qt.AlignVCenter)
sel_title = QtWidgets.QTextEdit()
sel_title.setTextInteractionFlags(QtCore.Qt.NoTextInteraction)
sel_title.setFrameStyle(QtWidgets.QFrame.NoFrame)
# sel_title = QtWidgets.QTextEdit()
# sel_title.setTextInteractionFlags(QtCore.Qt.NoTextInteraction)
# sel_title.setFrameStyle(QtWidgets.QFrame.NoFrame)
#
# f_settings = QSettings("Open Source", "FlatCAM")
# if f_settings.contains("notebook_font_size"):
# fsize = f_settings.value('notebook_font_size', type=int)
# else:
# fsize = 12
#
# tsize = fsize + int(fsize / 2)
#
# selected_text = ''
#
# sel_title.setText(selected_text)
# sel_title.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
f_settings = QSettings("Open Source", "FlatCAM")
if f_settings.contains("notebook_font_size"):
fsize = f_settings.value('notebook_font_size', type=int)
else:
fsize = 12
# Tree Widget
d_properties_tw = FCTree(columns=2)
d_properties_tw.setObjectName("default_properties")
d_properties_tw.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
d_properties_tw.setStyleSheet("QTreeWidget {border: 0px;}")
tsize = fsize + int(fsize / 2)
root = d_properties_tw.invisibleRootItem()
font = QtGui.QFont()
font.setBold(True)
p_color = QtGui.QColor("#000000") if self.defaults['global_gray_icons'] is False else QtGui.QColor("#FFFFFF")
selected_text = ''
# main Items categories
general_cat = d_properties_tw.addParent(root, _('General'), expanded=True, color=p_color, font=font)
d_properties_tw.addChild(parent=general_cat,
title=['%s:' % _("Name"), '%s' % _("FlatCAM Evo")], column1=True)
d_properties_tw.addChild(parent=general_cat,
title=['%s:' % _("Version"), '%s' % str(self.version)], column1=True)
d_properties_tw.addChild(parent=general_cat,
title=['%s:' % _("Release date"), '%s' % str(self.version_date)], column1=True)
sel_title.setText(selected_text)
sel_title.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
grid_cat = d_properties_tw.addParent(root, _('Grid'), expanded=True, color=p_color, font=font)
d_properties_tw.addChild(parent=grid_cat,
title=['%s:' % _("Displayed"), '%s' % str(self.defaults['global_grid_lines'])],
column1=True)
d_properties_tw.addChild(parent=grid_cat,
title=['%s:' % _("Snap"), '%s' % str(self.defaults['global_grid_snap'])],
column1=True)
d_properties_tw.addChild(parent=grid_cat,
title=['%s:' % _("X value"), '%s' % str(self.ui.grid_gap_x_entry.get_value())],
column1=True)
d_properties_tw.addChild(parent=grid_cat,
title=['%s:' % _("Y value"), '%s' % str(self.ui.grid_gap_y_entry.get_value())],
column1=True)
self.ui.selected_scroll_area.setWidget(sel_title)
canvas_cat = d_properties_tw.addParent(root, _('Canvas'), expanded=True, color=p_color, font=font)
d_properties_tw.addChild(parent=canvas_cat,
title=['%s:' % _("Axis"), '%s' % str(self.defaults['global_axis'])],
column1=True)
d_properties_tw.addChild(parent=canvas_cat,
title=['%s:' % _("Workspace active"),
'%s' % str(self.defaults['global_workspace'])],
column1=True)
d_properties_tw.addChild(parent=canvas_cat,
title=['%s:' % _("Workspace size"),
'%s' % str(self.defaults['global_workspaceT'])],
column1=True)
d_properties_tw.addChild(parent=canvas_cat,
title=['%s:' % _("Workspace orientation"),
'%s' % _("Portrait") if self.defaults[
'global_workspace_orientation'] == 'p' else
_("Landscape")],
column1=True)
d_properties_tw.addChild(parent=canvas_cat,
title=['%s:' % _("HUD"), '%s' % str(self.defaults['global_hud'])],
column1=True)
self.ui.properties_scroll_area.setWidget(d_properties_tw)
def setup_obj_classes(self):
"""

View File

@ -33,7 +33,6 @@ class FlatCAMDefaults:
"global_coords_show": True,
"global_delta_coords_show": False,
"global_grid_show": True,
"global_status_show": True,
"global_jump_ref": 'abs',
@ -51,7 +50,6 @@ class FlatCAMDefaults:
'in': [0.01, 0.02, 0.025, 0.05, 0.1],
'mm': [0.1, 0.2, 0.5, 1, 2.54]
},
"global_hud": True,
# Persistence
"global_last_folder": None,
@ -126,6 +124,7 @@ class FlatCAMDefaults:
"global_project_autohide": True,
# General App Settings
"global_grid_show": True,
"global_gridx": 1.0,
"global_gridy": 1.0,
"global_snap_max": 0.05,
@ -133,6 +132,10 @@ class FlatCAMDefaults:
"global_workspace": False,
"global_workspaceT": "A4",
"global_workspace_orientation": 'p',
"global_axis": True,
"global_hud": True,
"global_grid_lines": True,
"global_grid_snap": True,
"global_cursor_type": "small",
"global_cursor_size": 20,

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff