- some refactoring
- working on Milling Tool and Drilling Tool: made sure that the plugin UI is initialized only when the plugin (Tool) is run in order to avoid errors like (wrapped C++ objects was deleted)
This commit is contained in:
@@ -47,7 +47,7 @@ class ToolSub(AppTool):
|
||||
# ######################### Tool GUI ##########################################
|
||||
# #############################################################################
|
||||
self.ui = SubUI(layout=self.layout, app=self.app)
|
||||
self.toolName = self.ui.toolName
|
||||
self.pluginName = self.ui.pluginName
|
||||
|
||||
# QTimer for periodic check
|
||||
self.check_thread = QtCore.QTimer()
|
||||
@@ -112,11 +112,11 @@ class ToolSub(AppTool):
|
||||
# self.app.ui.splitter.setSizes([1, 1])
|
||||
# else:
|
||||
# try:
|
||||
# if self.app.ui.tool_scroll_area.widget().objectName() == self.toolName:
|
||||
# if self.app.ui.plugin_scroll_area.widget().objectName() == self.pluginName:
|
||||
# # if tab is populated with the tool but it does not have the focus, focus on it
|
||||
# if not self.app.ui.notebook.currentWidget() is self.app.ui.tool_tab:
|
||||
# if not self.app.ui.notebook.currentWidget() is self.app.ui.plugin_tab:
|
||||
# # focus on Tool Tab
|
||||
# self.app.ui.notebook.setCurrentWidget(self.app.ui.tool_tab)
|
||||
# self.app.ui.notebook.setCurrentWidget(self.app.ui.plugin_tab)
|
||||
# else:
|
||||
# self.app.ui.splitter.setSizes([0, 1])
|
||||
# except AttributeError:
|
||||
@@ -133,21 +133,21 @@ class ToolSub(AppTool):
|
||||
# if the Tool Tab is hidden display it, else hide it but only if the objectName is the same
|
||||
found_idx = None
|
||||
for idx in range(self.app.ui.notebook.count()):
|
||||
if self.app.ui.notebook.widget(idx).objectName() == "tool_tab":
|
||||
if self.app.ui.notebook.widget(idx).objectName() == "plugin_tab":
|
||||
found_idx = idx
|
||||
break
|
||||
# show the Tab
|
||||
if not found_idx:
|
||||
self.app.ui.notebook.addTab(self.app.ui.tool_tab, _("Plugin"))
|
||||
self.app.ui.notebook.addTab(self.app.ui.plugin_tab, _("Plugin"))
|
||||
# focus on Tool Tab
|
||||
self.app.ui.notebook.setCurrentWidget(self.app.ui.tool_tab)
|
||||
self.app.ui.notebook.setCurrentWidget(self.app.ui.plugin_tab)
|
||||
|
||||
try:
|
||||
if self.app.ui.tool_scroll_area.widget().objectName() == self.toolName and found_idx:
|
||||
if self.app.ui.plugin_scroll_area.widget().objectName() == self.pluginName and found_idx:
|
||||
# if the Tool Tab is not focused, focus on it
|
||||
if not self.app.ui.notebook.currentWidget() is self.app.ui.tool_tab:
|
||||
if not self.app.ui.notebook.currentWidget() is self.app.ui.plugin_tab:
|
||||
# focus on Tool Tab
|
||||
self.app.ui.notebook.setCurrentWidget(self.app.ui.tool_tab)
|
||||
self.app.ui.notebook.setCurrentWidget(self.app.ui.plugin_tab)
|
||||
else:
|
||||
# else remove the Tool Tab
|
||||
self.app.ui.notebook.setCurrentWidget(self.app.ui.properties_tab)
|
||||
@@ -743,7 +743,7 @@ class ToolSub(AppTool):
|
||||
|
||||
class SubUI:
|
||||
|
||||
toolName = _("Subtract")
|
||||
pluginName = _("Subtract")
|
||||
|
||||
def __init__(self, layout, app):
|
||||
self.app = app
|
||||
@@ -754,7 +754,7 @@ class SubUI:
|
||||
self.layout.addLayout(self.title_box)
|
||||
|
||||
# ## Title
|
||||
title_label = FCLabel("%s" % self.toolName)
|
||||
title_label = FCLabel("%s" % self.pluginName)
|
||||
title_label.setStyleSheet("""
|
||||
QLabel
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user