Fixed profile saving.

Made skirt perimeter gap in mm instead of a ratio
master
daid 2012-02-21 17:33:02 +01:00
parent d1af41e61b
commit 91945fe1d3
4 changed files with 41 additions and 14 deletions

View File

@ -145,7 +145,7 @@ def getSkeinPyPyConfigInformation():
},'skirt': {
'Activate_Skirt': 'save',
'Convex': 'ignore',
'Gap_over_Perimeter_Width_ratio': 'save',
'Gap_Width_mm': 'save',
'Layers_To_index': 'ignore',
},'chamber': {
'Activate_Chamber': 'ignore',
@ -384,6 +384,10 @@ def storeRepository(repository):
continue
if info[name] == "save":
try:
globalConfigParser.add_section(repository.name)
except:
pass
globalConfigParser.set(repository.name, name, str(p.value))
return repository
@ -425,7 +429,7 @@ class StringSetting(GeneralSetting):
class BooleanSetting( GeneralSetting ):
"A class to display, read & write a boolean."
def setValueToString(self, value):
self.value = value == "True"
self.value = str(value) == "True"
class LatentStringVar:
"This is actually used as 'group' object for Radio buttons. (Did I mention the code is a mess?)"

View File

@ -22,12 +22,13 @@ class mainWindow(wx.Frame):
menubar = wx.MenuBar()
fileMenu = wx.Menu()
fitem = fileMenu.Append(-1, 'Open Profile...', 'Open Profile...')
self.Bind(wx.EVT_MENU, self.OnLoadProfile, fitem)
fitem = fileMenu.Append(-1, 'Save Profile...', 'Save Profile...')
self.Bind(wx.EVT_MENU, self.OnSaveProfile, fitem)
fitem = fileMenu.Append(wx.ID_EXIT, 'Quit', 'Quit application')
self.Bind(wx.EVT_MENU, self.OnQuit, fitem)
menubar.Append(fileMenu, '&File')
menubar.Append(wx.Menu(), 'Expert')
#menubar.Append(wx.Menu(), 'Expert')
self.SetMenuBar(menubar)
self.lastPath = ""
@ -59,7 +60,7 @@ class mainWindow(wx.Frame):
self.AddSetting(configPanel, "Layer height (mm)", self.plugins['carve'].preferencesDict['Layer_Height_mm'])
self.AddTitle(configPanel, "Skirt")
self.AddSetting(configPanel, "Enable skirt", self.plugins['skirt'].preferencesDict['Activate_Skirt'])
self.AddSetting(configPanel, "Skirt distance (mm)", self.plugins['skirt'].preferencesDict['Gap_over_Perimeter_Width_ratio'])
self.AddSetting(configPanel, "Skirt distance (mm)", self.plugins['skirt'].preferencesDict['Gap_Width_mm'])
self.AddTitle(configPanel, "Fill")
self.AddSetting(configPanel, "Solid layers", self.plugins['fill'].preferencesDict['Solid_Surface_Thickness_layers'])
self.AddSetting(configPanel, "Fill Density", self.plugins['fill'].preferencesDict['Infill_Solidity_ratio'])
@ -119,11 +120,11 @@ class mainWindow(wx.Frame):
sizer = panel.GetSizer()
title = wx.StaticText(panel, -1, name)
title.SetFont(wx.Font(8, wx.FONTFAMILY_DEFAULT, wx.NORMAL, wx.FONTWEIGHT_BOLD))
sizer.Add(title, (sizer.GetRows(),1), (1,2), flag=wx.EXPAND)
sizer.Add(wx.StaticLine(panel), (sizer.GetRows()+1,1), (1,2), flag=wx.EXPAND)
sizer.Add(title, (sizer.GetRows(),1), (1,3), flag=wx.EXPAND)
sizer.Add(wx.StaticLine(panel), (sizer.GetRows()+1,1), (1,3), flag=wx.EXPAND)
sizer.SetRows(sizer.GetRows() + 2)
def AddSetting(self, panel, name, setting):
def AddSetting(self, panel, name, setting, help = False):
sizer = panel.GetSizer()
sizer.Add(wx.StaticText(panel, -1, name), (sizer.GetRows(),1), flag=wx.ALIGN_CENTER_VERTICAL)
ctrl = None
@ -140,7 +141,19 @@ class mainWindow(wx.Frame):
ctrl.setting = setting
self.controlList.append(ctrl)
sizer.Add(ctrl, (sizer.GetRows(),2), flag=wx.ALIGN_BOTTOM|wx.EXPAND)
helpButton = wx.Button(panel, -1, "?", style=wx.BU_EXACTFIT)
sizer.Add(helpButton, (sizer.GetRows(),3))
sizer.SetRows(sizer.GetRows()+1)
def OnLoadProfile(self, e):
dlg=wx.FileDialog(self, "Select profile file to load", self.lastPath, style=wx.FD_OPEN|wx.FD_FILE_MUST_EXIST)
dlg.SetWildcard("ini files (*.ini)|*.ini")
if dlg.ShowModal() == wx.ID_OK:
profileFile = dlg.GetPath()
self.lastPath = os.path.split(profileFile)[0]
settings.loadGlobalConfig(profileFile)
self.updateConfigToControls()
dlg.Destroy()
def OnSaveProfile(self, e):
dlg=wx.FileDialog(self, "Select profile file to save", self.lastPath, style=wx.FD_SAVE)
@ -148,8 +161,8 @@ class mainWindow(wx.Frame):
if dlg.ShowModal() == wx.ID_OK:
profileFile = dlg.GetPath()
self.lastPath = os.path.split(profileFile)[0]
self.updateConfig()
settings.saveGlobalConfig(profileFile)
self.updateConfigFromControls()
dlg.Destroy()
def OnLoadSTL(self, e):
@ -190,8 +203,18 @@ class mainWindow(wx.Frame):
for spp in self.progressPanelList:
self.sizer.Add(spp, (i,0), span=(1,4), flag=wx.EXPAND)
i += 1
def updateConfigToControls(self):
for pluginName in self.plugins.keys():
settings.getReadRepository(self.plugins[pluginName])
settings.saveGlobalConfig(settings.getDefaultConfigPath())
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 updateConfig(self):
def updateConfigFromControls(self):
for ctrl in self.controlList:
ctrl.setting.setValueToString(ctrl.GetValue())
for pluginName in self.plugins.keys():

View File

@ -328,9 +328,9 @@ class ExportRepository:
self.alsoSendOutputTo = settings.StringSetting().getFromValue('Also Send Output To:', self, '')
self.analyzeGcode = settings.BooleanSetting().getFromValue('Analyze Gcode', self, True)
self.commentChoice = settings.MenuButtonDisplay().getFromName('Comment Choice:', self)
self.doNotDeleteComments = settings.MenuRadio().getFromMenuButtonDisplay(self.commentChoice, 'Do Not Delete Comments', self, False)
self.doNotDeleteComments = settings.MenuRadio().getFromMenuButtonDisplay(self.commentChoice, 'Do Not Delete Comments', self, True)
self.deleteCraftingComments = settings.MenuRadio().getFromMenuButtonDisplay(self.commentChoice, 'Delete Crafting Comments', self, False)
self.deleteAllComments = settings.MenuRadio().getFromMenuButtonDisplay(self.commentChoice, 'Delete All Comments', self, True)
self.deleteAllComments = settings.MenuRadio().getFromMenuButtonDisplay(self.commentChoice, 'Delete All Comments', self, False)
exportPluginsFolderPath = archive.getAbsoluteFrozenFolderPath(archive.getCraftPluginsDirectoryPath('export.py'), 'export_plugins')
exportStaticDirectoryPath = os.path.join(exportPluginsFolderPath, 'static_plugins')
exportPluginFileNames = archive.getPluginFileNamesFromDirectoryPath(exportPluginsFolderPath)

View File

@ -131,9 +131,9 @@ class SkirtRepository:
self.fileNameInput = settings.FileNameInput().getFromFileName(
fabmetheus_interpret.getGNUTranslatorGcodeFileTypeTuples(), 'Open File for Skirt', self, '')
self.openWikiManualHelpPage = settings.HelpPage().getOpenFromAbsolute('http://fabmetheus.crsndoo.com/wiki/index.php/Skeinforge_Skirt')
self.activateSkirt = settings.BooleanSetting().getFromValue('Activate Skirt', self, False)
self.activateSkirt = settings.BooleanSetting().getFromValue('Activate Skirt', self, True)
self.convex = settings.BooleanSetting().getFromValue('Convex:', self, True)
self.gapOverEdgeWidth = settings.FloatSpin().getFromValue(1.0, 'Gap over Perimeter Width (ratio):', self, 5.0, 3.0)
self.gapWidth = settings.FloatSpin().getFromValue(1.0, 'Gap Width (mm):', self, 5.0, 3.0)
self.layersTo = settings.IntSpin().getSingleIncrementFromValue(0, 'Layers To (index):', self, 912345678, 1)
self.executeTitle = 'Skirt'
@ -270,7 +270,7 @@ class SkirtSkein:
self.skirtFlowRate = self.oldFlowRate
elif firstWord == '(<edgeWidth>':
self.edgeWidth = float(splitLine[1])
self.skirtOutset = (self.repository.gapOverEdgeWidth.value + 0.5) * self.edgeWidth
self.skirtOutset = self.repository.gapWidth.value + 0.5 * self.edgeWidth
self.distanceFeedRate.addTagRoundedLine('skirtOutset', self.skirtOutset)
elif firstWord == '(<travelFeedRatePerSecond>':
self.travelFeedRateMinute = 60.0 * float(splitLine[1])