From: hg42@gmx.net Date: Sat, 21 Sep 2013 16:12:38 +0000 (+0200) Subject: allow dropping profile (*.ini) onto window X-Git-Tag: 13.10~53^2^2 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=302fd38d086846e2c54b36f5868a99c67d774715;p=cura.git allow dropping profile (*.ini) onto window --HG-- extra : source : 005c45b8f4f676381fb8d47a6d25065d62d88cd4 --- diff --git a/Cura/gui/mainWindow.py b/Cura/gui/mainWindow.py index f6260a94..419f0787 100644 --- a/Cura/gui/mainWindow.py +++ b/Cura/gui/mainWindow.py @@ -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 = [] @@ -286,7 +286,7 @@ class mainWindow(wx.Frame): # 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) @@ -336,7 +336,7 @@ class mainWindow(wx.Frame): self.config.SetPath("/ProfileMRU") self.profileFileHistory.Save(self.config) self.config.Flush() - # Load Profile + # Load Profile profile.loadProfile(path) self.updateProfileToAllControls() @@ -344,7 +344,7 @@ class mainWindow(wx.Frame): 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() @@ -577,17 +577,17 @@ class normalSettingsPanel(configBase.configPanelBase): 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): @@ -596,7 +596,7 @@ class normalSettingsPanel(configBase.configPanelBase): # if width(col1) > (best_width(col1) + best_width(col1)): # switch to horizontal # - + col1 = configPanel.leftPanel colSize1 = col1.GetSize() colBestSize1 = col1.GetBestSize() @@ -605,7 +605,7 @@ class normalSettingsPanel(configBase.configPanelBase): colBestSize2 = col2.GetBestSize() orientation = sizer.GetOrientation() - + if orientation == wx.HORIZONTAL: if (colSize1[0] <= colBestSize1[0]) or (colSize2[0] <= colBestSize2[0]): configPanel.Freeze() diff --git a/Cura/gui/sceneView.py b/Cura/gui/sceneView.py index 25dcffe9..bd22863e 100644 --- a/Cura/gui/sceneView.py +++ b/Cura/gui/sceneView.py @@ -145,14 +145,23 @@ class SceneView(openglGui.glGuiPanel): def loadFiles(self, filenames): gcodeFilename = None for filename in filenames: - self.GetParent().GetParent().GetParent().addToModelMRU(filename) + self.GetParent().GetParent().GetParent().addToModelMRU(filename) #??? only Model files? ext = filename[filename.rfind('.')+1:].upper() if ext == 'G' or ext == 'GCODE': gcodeFilename = filename if gcodeFilename is not None: self.loadGCodeFile(gcodeFilename) else: - self.loadSceneFiles(filenames) + profileFilename = None + for filename in filenames: + ext = filename[filename.rfind('.')+1:].upper() + if ext == 'INI': + profileFilename = filename + if profileFilename is not None: + profile.loadProfile(profileFilename) + self.GetParent().GetParent().GetParent().updateProfileToAllControls() + else: + self.loadSceneFiles(filenames) def showLoadModel(self, button = 1): if button == 1: