chiark / gitweb /
allow dropping profile (*.ini) onto window
authorhg42@gmx.net <hg42@gmx.net>
Sat, 21 Sep 2013 16:12:38 +0000 (18:12 +0200)
committerhg42@gmx.net <hg42@gmx.net>
Sat, 21 Sep 2013 16:12:38 +0000 (18:12 +0200)
--HG--
extra : source : 005c45b8f4f676381fb8d47a6d25065d62d88cd4

Cura/gui/mainWindow.py
Cura/gui/sceneView.py

index f6260a947af1f4938416c4696cb31caa1a2ebd8a..419f07878cb52239cc3072384e0e1d281cf69541 100644 (file)
@@ -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()
index 25dcffe9e8fb91598104b3a7d8b27a7eb17af029..bd22863e19e356119be9241e5f76821efacc0d70 100644 (file)
@@ -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: