chiark / gitweb /
Merge branch 'SteamEngine' of github.com:daid/Cura into SteamEngine
authordaid <daid303@gmail.com>
Tue, 24 Sep 2013 15:20:33 +0000 (17:20 +0200)
committerdaid <daid303@gmail.com>
Tue, 24 Sep 2013 15:20:33 +0000 (17:20 +0200)
1  2 
Cura/gui/mainWindow.py

diff --combined Cura/gui/mainWindow.py
index 3070ea38ab4211cb1675c6f41168551769b9b50b,e1bf8934a1d4c7dc401a8515b943420bde79e450..97a871f2ba1de1404d6627af5b6662f8186f95ff
@@@ -30,7 -30,7 +30,7 @@@ class mainWindow(wx.Frame)
  
                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()
@@@ -592,7 -580,8 +592,7 @@@ class normalSettingsPanel(configBase.co
                                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()