From e04e599c3687d4889e3b315f3ba34e4e9eeb4404 Mon Sep 17 00:00:00 2001 From: daid Date: Wed, 18 Sep 2013 10:53:07 +0200 Subject: [PATCH] Fix loading of machine settings. Minor cleanup --- Cura/avr_isp/stk500v2.py | 4 ++-- Cura/gui/configBase.py | 6 +++--- Cura/util/profile.py | 3 +++ 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Cura/avr_isp/stk500v2.py b/Cura/avr_isp/stk500v2.py index 6cd551ed..82fb12f4 100644 --- a/Cura/avr_isp/stk500v2.py +++ b/Cura/avr_isp/stk500v2.py @@ -44,7 +44,7 @@ class Stk500v2(ispBase.IspBase): #Leave ISP does not reset the serial port, only resets the device, and returns the serial port after disconnecting it from the programming interface. # This allows you to use the serial port without opening it again. def leaveISP(self): - if self.serial != None: + if self.serial is not None: if self.sendMessage([0x11]) != [0x11, 0x00]: raise ispBase.IspError("Failed to leave programming mode") ret = self.serial @@ -53,7 +53,7 @@ class Stk500v2(ispBase.IspBase): return None def isConnected(self): - return self.serial != None + return self.serial is not None def sendISP(self, data): recv = self.sendMessage([0x1D, 4, 4, 0, data[0], data[1], data[2], data[3]]) diff --git a/Cura/gui/configBase.py b/Cura/gui/configBase.py index e2cd0bdd..f416bd45 100644 --- a/Cura/gui/configBase.py +++ b/Cura/gui/configBase.py @@ -133,7 +133,7 @@ class configPanelBase(wx.Panel): size[0] = width child.SetBestSize(size) -class TitleRow(): +class TitleRow(object): def __init__(self, panel, name): "Add a title row to the configuration panel" sizer = panel.GetSizer() @@ -144,7 +144,7 @@ class TitleRow(): sizer.Add(wx.StaticLine(panel), (x+1,0), (1,3), flag=wx.EXPAND|wx.LEFT,border=10) sizer.SetRows(x + 2) -class SettingRow(): +class SettingRow(object): def __init__(self, panel, configName, valueOverride = None): "Add a setting to the configuration panel" sizer = panel.GetSizer() @@ -255,7 +255,7 @@ class SettingRow(): #Settings notify works as a validator, but instead of validating anything, it calls another function, which can use the value. # A bit hacky, bit it works. -class settingNotify(): +class settingNotify(object): def __init__(self, setting, func): self.setting = setting self.setting.validators.append(self) diff --git a/Cura/util/profile.py b/Cura/util/profile.py index 2ed52c49..e3853f91 100644 --- a/Cura/util/profile.py +++ b/Cura/util/profile.py @@ -594,6 +594,9 @@ def loadPreferences(filename): if set.isPreference(): if profileParser.has_option('preference', set.getName()): set.setValue(unicode(profileParser.get('preference', set.getName()), 'utf-8', 'replace')) + elif set.isMachineSetting(): + if profileParser.has_option('machine', set.getName()): + set.setValue(unicode(profileParser.get('machine', set.getName()), 'utf-8', 'replace')) def savePreferences(filename): #Save the current profile to an ini file -- 2.30.2