- 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:
@@ -40,7 +40,7 @@ class DistanceMin(AppTool):
|
||||
# ######################### Tool GUI ##########################################
|
||||
# #############################################################################
|
||||
self.ui = DistMinUI(layout=self.layout, app=self.app)
|
||||
self.toolName = self.ui.toolName
|
||||
self.pluginName = self.ui.pluginName
|
||||
|
||||
self.h_point = (0, 0)
|
||||
|
||||
@@ -50,7 +50,7 @@ class DistanceMin(AppTool):
|
||||
def run(self, toggle=False):
|
||||
self.app.defaults.report_usage("ToolDistanceMin()")
|
||||
|
||||
if self.app.tool_tab_locked is True:
|
||||
if self.app.plugin_tab_locked is True:
|
||||
return
|
||||
|
||||
# if the splitter is hidden, display it
|
||||
@@ -71,25 +71,25 @@ class DistanceMin(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)
|
||||
|
||||
self.app.ui.notebook.setTabText(2, _("Minimum Distance"))
|
||||
|
||||
# Remove anything else in the appGUI
|
||||
self.app.ui.tool_scroll_area.takeWidget()
|
||||
self.app.ui.plugin_scroll_area.takeWidget()
|
||||
|
||||
# Put oneself in the appGUI
|
||||
self.app.ui.tool_scroll_area.setWidget(self)
|
||||
self.app.ui.plugin_scroll_area.setWidget(self)
|
||||
|
||||
# Switch notebook to tool page
|
||||
self.app.ui.notebook.setCurrentWidget(self.app.ui.tool_tab)
|
||||
self.app.ui.notebook.setCurrentWidget(self.app.ui.plugin_tab)
|
||||
|
||||
self.units = self.app.defaults['units'].lower()
|
||||
|
||||
@@ -230,7 +230,7 @@ class DistanceMin(AppTool):
|
||||
|
||||
class DistMinUI:
|
||||
|
||||
toolName = _("Minimum Distance")
|
||||
pluginName = _("Minimum Distance")
|
||||
|
||||
def __init__(self, layout, app):
|
||||
self.app = app
|
||||
@@ -239,7 +239,7 @@ class DistMinUI:
|
||||
self.units = self.app.defaults['units'].lower()
|
||||
|
||||
# ## Title
|
||||
title_label = FCLabel("<font size=4><b>%s</b></font><br>" % self.toolName)
|
||||
title_label = FCLabel("<font size=4><b>%s</b></font><br>" % self.pluginName)
|
||||
self.layout.addWidget(title_label)
|
||||
|
||||
# ## Grid Layout
|
||||
|
||||
Reference in New Issue
Block a user