From: daid303 Date: Mon, 11 Feb 2013 07:27:36 +0000 (+0100) Subject: Do not crash on malformed ini files. X-Git-Tag: 13.03~50 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=1cfde3aebcffa79f8d3c30c959c4d7ea5c7c7e91;p=cura.git Do not crash on malformed ini files. --- diff --git a/Cura/avr_isp/stk500v2.py b/Cura/avr_isp/stk500v2.py index 99d8e2ea..58dac2f5 100644 --- a/Cura/avr_isp/stk500v2.py +++ b/Cura/avr_isp/stk500v2.py @@ -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() diff --git a/Cura/gui/util/openglGui.py b/Cura/gui/util/openglGui.py index 710f56f9..d718b472 100644 --- a/Cura/gui/util/openglGui.py +++ b/Cura/gui/util/openglGui.py @@ -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() diff --git a/Cura/util/profile.py b/Cura/util/profile.py index 540dae12..76755226 100644 --- a/Cura/util/profile.py +++ b/Cura/util/profile.py @@ -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"))