Expose task panel layout through preferences.
This commit is contained in:
committed by
Yorik van Havre
parent
52a0eb8f13
commit
485cf86454
@@ -64,6 +64,7 @@ void DlgSettingsPathColor::saveSettings()
|
||||
DefaultBBoxSelectionColor->onSave();
|
||||
DefaultBBoxNormalColor->onSave();
|
||||
DefaultSelectionStyle->onSave();
|
||||
DefaultTaskPanelLayout->onSave();
|
||||
}
|
||||
|
||||
void DlgSettingsPathColor::loadSettings()
|
||||
@@ -79,6 +80,7 @@ void DlgSettingsPathColor::loadSettings()
|
||||
DefaultBBoxSelectionColor->onRestore();
|
||||
DefaultBBoxNormalColor->onRestore();
|
||||
DefaultSelectionStyle->onRestore();
|
||||
DefaultTaskPanelLayout->onRestore();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>357</width>
|
||||
<height>372</height>
|
||||
<width>483</width>
|
||||
<height>536</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -396,6 +396,43 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Task Panel Layout</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="Gui::PrefComboBox" name="DefaultTaskPanelLayout">
|
||||
<property name="prefEntry" stdset="0">
|
||||
<string>DefaultTaskPanelLayout</string>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<string>Mod/Path</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Classic</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Classic - reversed</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Multi Panel</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Multi Panel - reversed</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -35,20 +35,13 @@ import importlib
|
||||
|
||||
from PySide import QtCore, QtGui
|
||||
from PathScripts.PathGeom import PathGeom
|
||||
from PathScripts.PathPreferences import PathPreferences
|
||||
|
||||
__title__ = "Path Operation UI base classes"
|
||||
__author__ = "sliptonic (Brad Collette)"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
__doc__ = "Base classes and framework for Path operation's UI"
|
||||
|
||||
# TaskPanelLayout
|
||||
# 0 ... existing toolbox layout
|
||||
# 1 ... reverse order
|
||||
# 2 ... multi panel layout
|
||||
# 3 ... multi panel layout reverse
|
||||
TaskPanelLayout = 0
|
||||
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
@@ -748,11 +741,13 @@ class TaskPanel(object):
|
||||
page.initPage(obj)
|
||||
page.onDirtyChanged(self.pageDirtyChanged)
|
||||
|
||||
if TaskPanelLayout < 2:
|
||||
taskPanelLayout = PathPreferences.defaultTaskPanelLayout()
|
||||
|
||||
if taskPanelLayout < 2:
|
||||
opTitle = opPage.getTitle(obj)
|
||||
opPage.setTitle(translate('PathOp', 'Operation'))
|
||||
toolbox = QtGui.QToolBox()
|
||||
if TaskPanelLayout == 0:
|
||||
if taskPanelLayout == 0:
|
||||
for page in self.featurePages:
|
||||
toolbox.addItem(page.form, page.getTitle(obj))
|
||||
toolbox.setCurrentIndex(len(self.featurePages)-1)
|
||||
@@ -765,13 +760,13 @@ class TaskPanel(object):
|
||||
toolbox.setWindowIcon(QtGui.QIcon(opPage.getIcon(obj)))
|
||||
|
||||
self.form = toolbox
|
||||
elif TaskPanelLayout == 2:
|
||||
elif taskPanelLayout == 2:
|
||||
forms = []
|
||||
for page in self.featurePages:
|
||||
page.form.setWindowTitle(page.getTitle(obj))
|
||||
forms.append(page.form)
|
||||
self.form = forms
|
||||
elif TaskPanelLayout == 3:
|
||||
elif taskPanelLayout == 3:
|
||||
forms = []
|
||||
for page in reversed(self.featurePages):
|
||||
page.form.setWindowTitle(page.getTitle(obj))
|
||||
|
||||
@@ -34,6 +34,7 @@ class PathPreferences:
|
||||
DefaultFilePath = "DefaultFilePath"
|
||||
DefaultJobTemplate = "DefaultJobTemplate"
|
||||
DefaultStockTemplate = "DefaultStockTemplate"
|
||||
DefaultTaskPanelLayout = "DefaultTaskPanelLayout"
|
||||
|
||||
PostProcessorDefault = "PostProcessorDefault"
|
||||
PostProcessorDefaultArgs = "PostProcessorDefaultArgs"
|
||||
@@ -180,6 +181,12 @@ class PathPreferences:
|
||||
def setDefaultStockTemplate(cls, template):
|
||||
cls.preferences().SetString(cls.DefaultStockTemplate, template)
|
||||
|
||||
@classmethod
|
||||
def defaultTaskPanelLayout(cls):
|
||||
return cls.preferences().GetInt(cls.DefaultTaskPanelLayout, 0)
|
||||
@classmethod
|
||||
def setDefaultTaskPanelLayout(cls, style):
|
||||
cls.preferences().SetInt(cls.DefaultTaskPanelLayout, style)
|
||||
|
||||
@classmethod
|
||||
def experimentalFeaturesEnabled(cls):
|
||||
|
||||
Reference in New Issue
Block a user