chiark / gitweb /
Do not crash on malformed ini files.
authordaid303 <daid303@gmail.com>
Mon, 11 Feb 2013 07:27:36 +0000 (08:27 +0100)
committerdaid303 <daid303@gmail.com>
Mon, 11 Feb 2013 07:27:36 +0000 (08:27 +0100)
Cura/avr_isp/stk500v2.py
Cura/gui/util/openglGui.py
Cura/util/profile.py

index 99d8e2ea71fc0508f3068f49ee8b0cedef785cc7..58dac2f5a361314eaebe5dae82672705d667067c 100644 (file)
@@ -33,6 +33,7 @@ class Stk500v2(ispBase.IspBase):
                if self.sendMessage([0x10, 0xc8, 0x64, 0x19, 0x20, 0x00, 0x53, 0x03, 0xac, 0x53, 0x00, 0x00]) != [0x10, 0x00]:
                        self.close()
                        raise ispBase.IspError("Failed to enter programming mode")
+               self.serial.timeout = 5
 
        def close(self):
                if self.serial != None:
@@ -100,7 +101,7 @@ class Stk500v2(ispBase.IspBase):
                try:
                        self.serial.write(message)
                        self.serial.flush()
-               except SerialTimeoutException:
+               except Serial.SerialTimeoutException:
                        raise ispBase.IspError('Serial send timeout')
                self.seq = (self.seq + 1) & 0xFF
                return self.recvMessage()
index 710f56f90d6b381351df40c2a4efd88ddd764342..d718b47239ebe0589d7f13790552d6ce49c66b36 100644 (file)
@@ -323,7 +323,7 @@ class glButton(glGuiControl):
                glPopMatrix()
 
        def _checkHit(self, x, y):
-               if self._hidden:
+               if self._hidden or self._disabled:
                        return False
                bs = self.getMinSize()[0]
                pos = self._getPixelPos()
index 540dae128063a30bfd2f58f62bf80b1f273f9095..767552267a56c27a1f1b353918c8bca6e6fb246a 100644 (file)
@@ -213,7 +213,10 @@ def loadGlobalProfile(filename):
        #Read a configuration file as global config
        global globalProfileParser
        globalProfileParser = ConfigParser.ConfigParser()
-       globalProfileParser.read(filename)
+       try:
+               globalProfileParser.read(filename)
+       except ConfigParser.ParsingError:
+               pass
 
 def resetGlobalProfile():
        #Read a configuration file as global config
@@ -341,7 +344,10 @@ def getPreference(name):
        global globalPreferenceParser
        if globalPreferenceParser is None:
                globalPreferenceParser = ConfigParser.ConfigParser()
-               globalPreferenceParser.read(getPreferencePath())
+               try:
+                       globalPreferenceParser.read(getPreferencePath())
+               except ConfigParser.ParsingError:
+                       pass
        if not globalPreferenceParser.has_option('preference', name):
                if name in preferencesDefaultSettings:
                        default = preferencesDefaultSettings[name]
@@ -361,7 +367,10 @@ def putPreference(name, value):
        global globalPreferenceParser
        if globalPreferenceParser == None:
                globalPreferenceParser = ConfigParser.ConfigParser()
-               globalPreferenceParser.read(getPreferencePath())
+               try:
+                       globalPreferenceParser.read(getPreferencePath())
+               except ConfigParser.ParsingError:
+                       pass
        if not globalPreferenceParser.has_section('preference'):
                globalPreferenceParser.add_section('preference')
        globalPreferenceParser.set('preference', name, unicode(value).encode("utf-8"))