chiark / gitweb /
Renamed "config" to "profile"
authordaid <daid303@gmail.com>
Thu, 23 Feb 2012 11:04:23 +0000 (12:04 +0100)
committerdaid <daid303@gmail.com>
Thu, 23 Feb 2012 11:04:23 +0000 (12:04 +0100)
SkeinPyPy_NewUI/fabmetheus_utilities/settings.py
SkeinPyPy_NewUI/newui/mainWindow.py

index 55bf0fa0951ee3c42a7dac7dce1109cc27411ceb..dcb76fb11b801bf89669e79b41aa2e4e38c4b4f8 100644 (file)
@@ -12,7 +12,7 @@ import os, sys
 
 from fabmetheus_utilities import archive
 
-def getSkeinPyPyConfigInformation():
+def getSkeinPyPyProfileInformation():
        return {
                'carve': {
                        'Add_Layer_Template_to_SVG': 'ignore',
@@ -305,17 +305,17 @@ def getSkeinPyPyConfigInformation():
                }
        }
 
-def loadGlobalConfig(filename):
+def loadGlobalProfile(filename):
        "Read a configuration file as global config"
-       global globalConfigParser
-       globalConfigParser = ConfigParser.ConfigParser()
-       globalConfigParser.read(filename)
+       global globalProfileParser
+       globalProfileParser = ConfigParser.ConfigParser()
+       globalProfileParser.read(filename)
 
-def saveGlobalConfig(filename):
-       globalConfigParser.write(open(filename, 'w'))
+def saveGlobalProfile(filename):
+       globalProfileParser.write(open(filename, 'w'))
 
-def getDefaultConfigPath():
-       return os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "../current_config.ini"))
+def getDefaultProfilePath():
+       return os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "../current_profile.ini"))
 
 def safeConfigName(name):
        return name.replace("=", "").replace(":", "").replace(" ", "_").replace("(", "").replace(")", "")
@@ -324,10 +324,10 @@ def getReadRepository(repository):
        "Read the configuration for this 'repository'"
        
        #Check if we have a configuration file loaded, else load the default.
-       if not globals().has_key('globalConfigParser'):
-               loadGlobalConfig(getDefaultConfigPath())
+       if not globals().has_key('globalProfileParser'):
+               loadGlobalProfile(getDefaultProfilePath())
        
-       info = getSkeinPyPyConfigInformation()
+       info = getSkeinPyPyProfileInformation()
        if not info.has_key(repository.name):
                print "Warning: Plugin: " + repository.name + " missing from SkeinPyPy info"
                return repository
@@ -348,29 +348,29 @@ def getReadRepository(repository):
                #Load this setting from another value.
                if info[name][0:4] == "use:":
                        i = info[name][4:].split(':')
-                       p.setValueToString(globalConfigParser.get(i[0], i[1]))
+                       p.setValueToString(globalProfileParser.get(i[0], i[1]))
                        continue
                
                try:
-                       p.setValueToString(globalConfigParser.get(repository.name, name))
+                       p.setValueToString(globalProfileParser.get(repository.name, name))
                except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
                        #Value not in configuration, add it.
                        try:
-                               globalConfigParser.add_section(repository.name)
+                               globalProfileParser.add_section(repository.name)
                        except:
                                pass
-                       globalConfigParser.set(repository.name, name, str(p.value))
-                       #saveGlobalConfig(getDefaultConfigPath())
+                       globalProfileParser.set(repository.name, name, str(p.value))
+                       #saveGlobalProfile(getDefaultProfilePath())
                #print "============" + str(p) + "|" + p.name + "|" + str(p.value) + "|" + str(type(p.value))
        return repository
 
 def storeRepository(repository):
        "Store the configuration for this 'repository'"
        #Check if we have a configuration file loaded, else load the default.
-       if not globals().has_key('globalConfigParser'):
-               loadGlobalConfig(getDefaultConfigPath())
+       if not globals().has_key('globalProfileParser'):
+               loadGlobalProfile(getDefaultProfilePath())
        
-       info = getSkeinPyPyConfigInformation()
+       info = getSkeinPyPyProfileInformation()
        if not info.has_key(repository.name):
                print "Warning: Plugin: " + repository.name + " missing from SkeinPyPy info"
                return repository
@@ -387,10 +387,10 @@ def storeRepository(repository):
 
                if info[name] == "save":
                        try:
-                               globalConfigParser.add_section(repository.name)
+                               globalProfileParser.add_section(repository.name)
                        except:
                                pass
-                       globalConfigParser.set(repository.name, name, str(p.value))
+                       globalProfileParser.set(repository.name, name, str(p.value))
        return repository
 
 def printProgress(layerIndex, procedureName):
index 1d94fc1ec64c99da348b8343ac4dbe6735df005c..657a55b4b39efa278b1affe7a36b2133faea19f9 100644 (file)
@@ -43,7 +43,7 @@ class mainWindow(wx.Frame):
                        self.plugins[m] = archive.getModuleWithDirectoryPath(archive.getCraftPluginsDirectoryPath(), m).getNewRepository()
                        settings.getReadRepository(self.plugins[m])
                
-               skeinPyPySettingInfo = settings.getSkeinPyPyConfigInformation()
+               skeinPyPySettingInfo = settings.getSkeinPyPyProfileInformation()
 
                for pluginName in self.plugins.keys():
                        self.plugins[pluginName].preferencesDict = {}
@@ -67,6 +67,9 @@ class mainWindow(wx.Frame):
                self.AddTitle(configPanel, "Skirt")
                self.AddSetting(configPanel, "Line count", self.plugins['skirt'].preferencesDict['Skirt_line_count'])
                self.AddSetting(configPanel, "Start distance (mm)", self.plugins['skirt'].preferencesDict['Gap_Width_mm'])
+               self.AddTitle(configPanel, "Cool")
+               #self.AddSetting(configPanel, "Cool type", self.plugins['cool'].preferencesDict['Cool_Type'])
+               self.AddSetting(configPanel, "Minimal layer time", self.plugins['cool'].preferencesDict['Minimum_Layer_Time_seconds'])
                self.AddTitle(configPanel, "Retraction")
                self.AddSetting(configPanel, "Speed (mm/s)", self.plugins['dimension'].preferencesDict['Extruder_Retraction_Speed_mm/s'])
                self.AddSetting(configPanel, "Distance (mm)", self.plugins['dimension'].preferencesDict['Retraction_Distance_millimeters'])
@@ -161,8 +164,8 @@ class mainWindow(wx.Frame):
                if dlg.ShowModal() == wx.ID_OK:
                        profileFile = dlg.GetPath()
                        self.lastPath = os.path.split(profileFile)[0]
-                       settings.loadGlobalConfig(profileFile)
-                       self.updateConfigToControls()
+                       settings.loadGlobalProfile(profileFile)
+                       self.updateProfileToControls()
                dlg.Destroy()
        
        def OnSaveProfile(self, e):
@@ -171,8 +174,8 @@ class mainWindow(wx.Frame):
                if dlg.ShowModal() == wx.ID_OK:
                        profileFile = dlg.GetPath()
                        self.lastPath = os.path.split(profileFile)[0]
-                       settings.saveGlobalConfig(profileFile)
-                       self.updateConfigFromControls()
+                       settings.saveGlobalProfile(profileFile)
+                       self.updateProfileFromControls()
                dlg.Destroy()
        
        def OnLoadSTL(self, e):
@@ -189,7 +192,7 @@ class mainWindow(wx.Frame):
        def OnSlice(self, e):
                if self.filename == None:
                        return
-               self.updateConfigFromControls()
+               self.updateProfileFromControls()
                
                #Create a progress panel and add it to the window. The progress panel will start the Skein operation.
                spp = sliceProgessPanel.sliceProgessPanel(self, self.panel, self.filename)
@@ -214,24 +217,24 @@ class mainWindow(wx.Frame):
                        i += 1
                self.sizer.Layout()
        
-       def updateConfigToControls(self):
+       def updateProfileToControls(self):
                "Update the configuration wx controls to show the new configuration settings"
                for pluginName in self.plugins.keys():
                        settings.getReadRepository(self.plugins[pluginName])
-               settings.saveGlobalConfig(settings.getDefaultConfigPath())
+               settings.saveGlobalProfile(settings.getDefaultProfilePath())
                for ctrl in self.controlList:
                        if ctrl.setting.__class__ is settings.BooleanSetting:
                                ctrl.SetValue(ctrl.setting.value)
                        else:
                                ctrl.SetValue(str(ctrl.setting.value))
 
-       def updateConfigFromControls(self):
+       def updateProfileFromControls(self):
                "Update the configuration settings with values from the wx controls"
                for ctrl in self.controlList:
                        ctrl.setting.setValueToString(ctrl.GetValue())
                for pluginName in self.plugins.keys():
                        settings.storeRepository(self.plugins[pluginName])
-               settings.saveGlobalConfig(settings.getDefaultConfigPath())
+               settings.saveGlobalProfile(settings.getDefaultProfilePath())
        
        def OnQuit(self, e):
                self.Close()