wx.EVT_CLOSE(self, self.OnClose)
- self.SetDropTarget(dropTarget.FileDropTarget(self.OnDropFiles, meshLoader.loadSupportedExtensions() + ['.g', '.gcode']))
+ self.SetDropTarget(dropTarget.FileDropTarget(self.OnDropFiles, meshLoader.loadSupportedExtensions() + ['.g', '.gcode', '.ini']))
self.normalModeOnlyItems = []
# Save normal mode sash
self.normalSashPos = self.splitter.GetSashPosition()
- # Change location of sash to width of quick mode pane
+ # Change location of sash to width of quick mode pane
(width, height) = self.simpleSettingsPanel.GetSizer().GetSize()
self.splitter.SetSashPosition(width, True)
self.config.SetPath("/ProfileMRU")
self.profileFileHistory.Save(self.config)
self.config.Flush()
- # Load Profile
+ # Load Profile
profile.loadProfile(path)
self.updateProfileToAllControls()
self.profileFileHistory.AddFileToHistory(file)
self.config.SetPath("/ProfileMRU")
self.profileFileHistory.Save(self.config)
- self.config.Flush()
+ self.config.Flush()
def updateProfileToAllControls(self):
self.scene.updateProfileToControls()
self.normalSettingsPanel.updateProfileToControls()
self.simpleSettingsPanel.updateProfileToControls()
+ def reloadSettingPanels(self):
+ self.leftSizer.Detach(self.simpleSettingsPanel)
+ self.leftSizer.Detach(self.normalSettingsPanel)
+ self.simpleSettingsPanel.Destroy()
+ self.normalSettingsPanel.Destroy()
+ self.simpleSettingsPanel = simpleMode.simpleModePanel(self.leftPane, lambda : self.scene.sceneUpdated())
+ self.normalSettingsPanel = normalSettingsPanel(self.leftPane, lambda : self.scene.sceneUpdated())
+ self.leftSizer.Add(self.simpleSettingsPanel, 1)
+ self.leftSizer.Add(self.normalSettingsPanel, 1, wx.EXPAND)
+ self.updateSliceMode()
+ self.updateProfileToAllControls()
+
def OnLoadProfile(self, e):
dlg=wx.FileDialog(self, _("Select profile file to load"), os.path.split(profile.getPreference('lastFile'))[0], style=wx.FD_OPEN|wx.FD_FILE_MUST_EXIST)
dlg.SetWildcard("ini files (*.ini)|*.ini")
self.Hide()
configWizard.configWizard()
self.Show()
- self.updateProfileToAllControls()
+ self.reloadSettingPanels()
def OnAddNewMachine(self, e):
self.Hide()
profile.setActiveMachine(n)
configWizard.configWizard(True)
self.Show()
- self.updateProfileToAllControls()
+ self.reloadSettingPanels()
def OnBedLevelWizard(self, e):
configWizard.bedLevelWizard()
p = right
configBase.TitleRow(p, title)
for s in profile.getSettingsForCategory(category, title):
- if s.checkConditions():
- configBase.SettingRow(p, s.getName())
+ configBase.SettingRow(p, s.getName())
def SizeLabelWidths(self, left, right):
leftWidth = self.getLabelColumnWidth(left)
def OnSize(self, e):
# Make the size of the Notebook control the same size as this control
self.nb.SetSize(self.GetSize())
-
+
# Propegate the OnSize() event (just in case)
e.Skip()
-
+
# Perform out resize magic
self.UpdateSize(self.printPanel)
self.UpdateSize(self.advancedPanel)
-
+
def UpdateSize(self, configPanel):
sizer = configPanel.GetSizer()
-
+
# Pseudocde
# if horizontal:
# if width(col1) < best_width(col1) || width(col2) < best_width(col2):
# if width(col1) > (best_width(col1) + best_width(col1)):
# switch to horizontal
#
-
+
col1 = configPanel.leftPanel
colSize1 = col1.GetSize()
colBestSize1 = col1.GetBestSize()
colBestSize2 = col2.GetBestSize()
orientation = sizer.GetOrientation()
-
+
if orientation == wx.HORIZONTAL:
if (colSize1[0] <= colBestSize1[0]) or (colSize2[0] <= colBestSize2[0]):
configPanel.Freeze()