1 __copyright__ = "Copyright (C) 2013 David Braam - Released under terms of the AGPLv3 License"
5 from Cura.gui import configBase
6 from Cura.util import profile
8 class expertConfigWindow(wx.Dialog):
9 "Expert configuration window"
10 def _addSettingsToPanels(self, category, sub_category, left, right):
11 count = len(profile.getSubCategoriesFor(category)) + len(profile.getSettingsForCategory(category))
15 for title in profile.getSubCategoriesFor(category):
16 if sub_category is not None and sub_category != title:
18 n += 1 + len(profile.getSettingsForCategory(category, title))
21 configBase.TitleRow(p, _(title))
22 for s in profile.getSettingsForCategory(category, title):
23 if s.checkConditions():
24 configBase.SettingRow(p, s.getName())
26 def __init__(self, callback, sub_category=None):
27 super(expertConfigWindow, self).__init__(None, title=_('Expert config'), style=wx.DEFAULT_DIALOG_STYLE)
29 wx.EVT_CLOSE(self, self.OnClose)
30 self.panel = configBase.configPanelBase(self, callback)
32 left, right, main = self.panel.CreateConfigPanel(self)
33 self._addSettingsToPanels('expert', sub_category, left, right)
36 if sub_category is not None:
38 self.okButton = wx.Button(button_panel, -1, 'Ok')
39 button_panel.GetSizer().Add(self.okButton, (button_panel.GetSizer().GetRows(), 0), flag=wx.LEFT|wx.TOP|wx.BOTTOM, border=10)
40 self.Bind(wx.EVT_BUTTON, lambda e: self.Close(), self.okButton)