Changeset 401:15ad3c16ee11 for src/mlx
- Timestamp:
- 12/27/12 08:04:59 (12 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- src/mlx
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/config.py
r392 r401 2 2 3 3 import const 4 from util import secondaryInstallation 4 from util import secondaryInstallation, utf2unicode 5 5 6 6 import os … … 788 788 self._modified = False 789 789 except Exception, e: 790 print >> sys.stderr, "Failed to update config: " + str(e) 790 print >> sys.stderr, "Failed to update config: " + \ 791 utf2unicode(str(e)) 791 792 792 793 def _getBoolean(self, config, section, option, default): -
src/mlx/fsuipc.py
r394 r401 104 104 return fun() 105 105 except Exception, e: 106 print >> sys.stderr, str(e)106 print >> sys.stderr, util.utf2unicode(str(e)) 107 107 return None 108 108 … … 386 386 return attempts 387 387 except Exception, e: 388 print "fsuipc.Handler._connect: connection failed: " + str(e) + \ 388 print "fsuipc.Handler._connect: connection failed: " + \ 389 util.utf2unicode(str(e)) + \ 389 390 " (attempts: %d)" % (attempts,) 390 391 if attempts<self.NUM_CONNECTATTEMPTS: … … 446 447 except Exception as e: 447 448 print "fsuipc.Handler._processRequest: FSUIPC connection failed (" + \ 448 str(e) + "), reconnecting (attempts=%d)." % (attempts,) 449 util.utf2unicode(str(e)) + \ 450 "), reconnecting (attempts=%d)." % (attempts,) 449 451 needReconnect = True 450 452 … … 895 897 896 898 Return if a new model was created.""" 899 name = self._latin1decoder(name)[0] 900 airPath = self._latin1decoder(airPath)[0] 901 897 902 aircraftName = (name, airPath) 898 903 if aircraftName==self._aircraftName: … … 912 917 913 918 if needNew: 914 self._setAircraftModel(AircraftModel.create(self._aircraft, aircraftName)) 915 916 917 self._aircraft.modelChanged(timestamp, self._latin1decoder(name)[0], 918 self._aircraftModel.name) 919 self._setAircraftModel(AircraftModel.create(self._aircraft, 920 aircraftName)) 921 922 self._aircraft.modelChanged(timestamp, name, self._aircraftModel.name) 919 923 920 924 return needNew -
src/mlx/gui/common.py
r373 r401 96 96 """Convert the given text, returned by xstr to a string.""" 97 97 return str(text) 98 98 99 else: 99 100 print "Using PyGObject" … … 106 107 from gi.repository import Pango as pango 107 108 appIndicator = True 108 109 109 110 MESSAGETYPE_ERROR = gtk.MessageType.ERROR 110 111 MESSAGETYPE_QUESTION = gtk.MessageType.QUESTION … … 156 157 import codecs 157 158 _utf8Decoder = codecs.getdecoder("utf-8") 158 159 159 160 def text2unicode(str): 160 161 """Convert the given text, returned by a Gtk widget, to Unicode.""" … … 182 183 self._noGoReason = None 183 184 self._updateFlightStatus() 184 185 185 186 def setStage(self, stage): 186 187 """Set the stage of the flight.""" … … 233 234 self.emit("integer-changed", self._currentInteger) 234 235 self._set_text() 235 236 236 237 def _handle_changed(self, widget): 237 238 """Handle the changed signal.""" … … 253 254 else str(self._currentInteger)) 254 255 self._selfSetting = False 255 256 256 257 #------------------------------------------------------------------------------ 257 258 -
src/mlx/gui/flight.py
r393 r401 512 512 flight.writeIntoFile(f) 513 513 except Exception, e: 514 print "Failed to save flight:", str(e)514 print "Failed to save flight:", util.utf2unicode(str(e)) 515 515 dialog = gtk.MessageDialog(parent = self._wizard.gui.mainWindow, 516 516 type = MESSAGETYPE_ERROR, … … 555 555 self._addFlight(bookedFlight) 556 556 except Exception, e: 557 print "Failed to load flight:", str(e)557 print "Failed to load flight:", util.utf2unicode(str(e)) 558 558 dialog = gtk.MessageDialog(parent = self._wizard.gui.mainWindow, 559 559 type = MESSAGETYPE_ERROR, -
src/mlx/pirep.py
r393 r401 1 2 from util import utf2unicode 1 3 2 4 import const … … 52 54 return pirep 53 55 except Exception, e: 54 print "Failed loading PIREP from %s: %s" % (path, str(e)) 56 print "Failed loading PIREP from %s: %s" % (path, 57 utf2unicode(str(e))) 55 58 return None 56 59 … … 157 160 return None 158 161 except Exception, e: 159 error = str(e)160 #print u"Failed saving PIREP to %s: %s" % (path, error)162 error = utf2unicode(str(e)) 163 print u"Failed saving PIREP to %s: %s" % (path, error) 161 164 return error -
src/mlx/singleton.py
r298 r401 1 2 from util import utf2unicode 1 3 2 4 import os … … 72 74 print "singleton._PipeServer.run: failed to read from the pipe" 73 75 except Exception, e: 74 print "singleton._PipeServer.run: exception:", str(e) 76 print "singleton._PipeServer.run: exception:", 77 print utf2unicode(str(e)) 75 78 finally: 76 79 win32pipe.DisconnectNamedPipe(handle) 77 80 win32file.CloseHandle(handle) 78 81 except Exception, e: 79 print "singleton._PipeServer.run: fatal exception:", str(e) 82 print "singleton._PipeServer.run: fatal exception:", 83 print utf2unicode(str(e)) 80 84 81 85 def _createPipe(self): … … 141 145 return 142 146 except Exception, e: 143 print "SingleInstance._notifySingleton: failed:", str(e) 147 print "SingleInstance._notifySingleton: failed:", 148 print utf2unicode(str(e)) 144 149 time.sleep(0.5) 145 150 … … 190 195 self._raiseCallback() 191 196 except Exception, e: 192 print "singleton._SocketServer.run: fatal exception:", str(e) 197 print "singleton._SocketServer.run: fatal exception:", 198 print utf2unicode(str(e)) 193 199 194 200 class SingleInstance(object): … … 254 260 return 255 261 except Exception, e: 256 print "singleton.SingleInstance._notifySingleton: failed:", str(e) 262 print "singleton.SingleInstance._notifySingleton: failed:", 263 print utf2unicode(str(e)) 257 264 time.sleep(0.5) 258 265 -
src/mlx/sound.py
r299 r401 1 2 from util import utf2unicode 1 3 2 4 import os … … 115 117 print "Closed", alias 116 118 except Exception, e: 117 print "Failed closing " + alias + ":", str(e) 119 print "Failed closing " + alias + ":", 120 print utf2unicode(str(e)) 118 121 success = False 119 122 … … 143 146 print "Started to play", path 144 147 except Exception, e: 145 print "Failed to start playing " + path + ":", str(e) 148 print "Failed to start playing " + path + ":", 149 print utf2unicode(str(e)) 146 150 (finishCallback, extra) = finishData 147 151 if finishCallback is not None: -
src/mlx/update.py
r298 r401 1 1 2 2 from config import Config 3 from util import utf2unicode 3 4 4 5 import os … … 206 207 manifest.readFrom(f) 207 208 except Exception, e: 208 print "Error reading the manifest, ignoring:", str(e)209 print "Error reading the manifest, ignoring:", utf2unicode(str(e)) 209 210 manifest = Manifest() 210 211 … … 228 229 229 230 except Exception, e: 230 print >> sys.stderr, "Error downloading manifest:", str(e) 231 listener.failed(str(e)) 231 error = utf2unicode(str(e)) 232 print >> sys.stderr, "Error downloading manifest:", error 233 listener.failed(error) 232 234 return None 233 235 finally: … … 291 293 os.rename(path, os.path.join(toremoveDir, sum.hexdigest())) 292 294 except Exception, e: 293 print "Cannot remove file " + path + ": " + str(e)295 print "Cannot remove file " + path + ": " + utf2unicode(str(e)) 294 296 295 297 #------------------------------------------------------------------------------ … … 370 372 listener.done() 371 373 except Exception, e: 372 print >> sys.stderr, "Error:", str(e) 373 listener.failed(str(e)) 374 error = utf2unicode(str(e)) 375 print >> sys.stderr, "Error:", error 376 listener.failed(error) 374 377 375 378 #------------------------------------------------------------------------------ … … 432 435 except Exception, e: 433 436 print >> sys.stderr, "Failed to parse line '%s': %s" % \ 434 (line, str(e))437 (line, utf2unicode(str(e))) 435 438 436 439 return buffer … … 488 491 489 492 except Exception, e: 490 print >> sys.stderr, "Failed updating:", str(e) 491 listener.failed(str(e)) 493 error = utf2unicode(str(e)) 494 print >> sys.stderr, "Failed updating:", error 495 listener.failed(error) 492 496 finally: 493 497 if serverSocket is not None: -
src/mlx/util.py
r373 r401 3 3 import time 4 4 import sys 5 import codecs 5 6 6 7 #------------------------------------------------------------------------------ … … 165 166 166 167 secondaryInstallation="secondary" in sys.argv 168 169 #------------------------------------------------------------------------------ 170 171 _utf8decoder = codecs.getdecoder("utf-8") 172 173 def utf2unicode(text): 174 """Convert the given text from UTF-8 encoding to unicode.""" 175 return unicode(_utf8decoder(text)[0]) -
src/mlx/web.py
r326 r401 465 465 self._callback(returned, result) 466 466 except Exception, e: 467 print >> sys.stderr, "web.Handler.Request.perform: callback throwed an exception: " + str(e)467 print >> sys.stderr, "web.Handler.Request.perform: callback throwed an exception: " + util.utf2unicode(str(e)) 468 468 traceback.print_exc() 469 469
Note:
See TracChangeset
for help on using the changeset viewer.