Ignore:
Timestamp:
03/24/19 08:15:59 (5 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
python3
Phase:
public
Message:

Ran 2to3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/xplane.py

    r909 r919  
    11
    2 import fs
    3 import const
    4 import util
    5 from watchdog import Watchdog
     2from . import fs
     3from . import const
     4from . import util
     5from .watchdog import Watchdog
    66
    77import threading
     
    106106            else:
    107107                return False
    108         except ProtocolException, e:
     108        except ProtocolException as e:
    109109            self._result = None
    110110            return True
     
    241241        try:
    242242            return fun()
    243         except Exception, e:
    244             print >> sys.stderr, util.utf2unicode(str(e))
     243        except Exception as e:
     244            print(util.utf2unicode(str(e)), file=sys.stderr)
    245245            return None
    246246
     
    312312            try:
    313313                multiGetter.execute()
    314             except ProtocolException, e:
    315                 print "xplane.Handler._performRead: " + str(e)
     314            except ProtocolException as e:
     315                print("xplane.Handler._performRead: " + str(e))
    316316                raise
    317317
     
    514514                self._connected = True
    515515                return attempts
    516             except Exception, e:
    517                 print "xplane.Handler._connect: connection failed: " + \
     516            except Exception as e:
     517                print("xplane.Handler._connect: connection failed: " + \
    518518                      util.utf2unicode(str(e)) + \
    519                       " (attempts: %d)" % (attempts,)
     519                      " (attempts: %d)" % (attempts,))
    520520                if attempts<self.NUM_CONNECTATTEMPTS:
    521521                    time.sleep(self.CONNECT_INTERVAL)
     
    549549    def _disconnect(self):
    550550        """Disconnect from the flight simulator."""
    551         print "xplane.Handler._disconnect"
     551        print("xplane.Handler._disconnect")
    552552        if self._connected:
    553553            try:
     
    578578            try:
    579579                if not request.process(time):
    580                     print "xplane.Handler._processRequest: X-Plane returned invalid data too many times, reconnecting"
     580                    print("xplane.Handler._processRequest: X-Plane returned invalid data too many times, reconnecting")
    581581                    needReconnect = True
    582582            except Exception as e:
    583                 print "xplane.Handler._processRequest: X-Plane connection failed (" + \
     583                print("xplane.Handler._processRequest: X-Plane connection failed (" + \
    584584                      util.utf2unicode(str(e)) + \
    585                       "), reconnecting (attempts=%d)." % (attempts,)
     585                      "), reconnecting (attempts=%d)." % (attempts,))
    586586                needReconnect = True
    587587
     
    804804
    805805        duration is the number of seconds to keep the message displayed."""
    806         print "xplra.Simulator.sendMessage:", message
     806        print("xplra.Simulator.sendMessage:", message)
    807807        self._handler.requestShowMessage(message, duration,
    808808                                         self._handleMessageSent,
     
    887887        assert not self._monitoringRequested
    888888
    889         print "xplra.Simulator.disconnect", closingMessage, duration
     889        print("xplra.Simulator.disconnect", closingMessage, duration)
    890890
    891891        self._stopNormal()
     
    938938        if self._lastZuluSeconds is not None and \
    939939           zuluSeconds<self._lastZuluSeconds:
    940             print "xplane.Simulator._getTimestamp: Zulu seconds have gone backwards (%f -> %f), increasing day offset" % \
    941               (self._lastZuluSeconds, zuluSeconds)
     940            print("xplane.Simulator._getTimestamp: Zulu seconds have gone backwards (%f -> %f), increasing day offset" % \
     941              (self._lastZuluSeconds, zuluSeconds))
    942942            self._timestampDaysOffset += 1
    943943
     
    10161016            return False
    10171017
    1018         print "xplane.Simulator: new data: %s, %s, %s, %s, %s, %s" % \
    1019               (tailnum, author, description, notes, icao, liveryPath)
     1018        print("xplane.Simulator: new data: %s, %s, %s, %s, %s, %s" % \
     1019              (tailnum, author, description, notes, icao, liveryPath))
    10201020
    10211021        self._aircraftInfo = aircraftInfo
     
    11401140            self._handler.disconnect()
    11411141
    1142     def _handleHotkeysRegistered(self, success, (id, generation)):
     1142    def _handleHotkeysRegistered(self, success, xxx_todo_changeme2):
    11431143        """Handle the result of the hotkeys having been written."""
     1144        (id, generation) = xxx_todo_changeme2
    11441145        with self._hotkeyLock:
    11451146            if success and id==self._hotkeySetID and \
     
    11501151                                                    (id, generation))
    11511152
    1152     def _handleHotkeys(self, data, (id, generation)):
     1153    def _handleHotkeys(self, data, xxx_todo_changeme3):
    11531154        """Handle the hotkeys."""
     1155        (id, generation) = xxx_todo_changeme3
    11541156        with self._hotkeyLock:
    11551157            if id!=self._hotkeySetID or generation!=self._hotkeySetGeneration:
     
    16171619                              [level * self._fuelTankCapacities[index]]) )
    16181620            except:
    1619                 print "xplane.Simulator.setFuelLevel: invalid tank constant: %d" % \
    1620                   (tank,)
     1621                print("xplane.Simulator.setFuelLevel: invalid tank constant: %d" % \
     1622                  (tank,))
    16211623
    16221624        handler.requestWrite(data, self._handleFuelWritten)
     
    17481750    """Model handler for the FlyJSim Dash 8-Q400."""
    17491751    @staticmethod
    1750     def doesHandle(aircraft, (tailnum, author, description, notes,
    1751                               icao, liveryPath)):
     1752    def doesHandle(aircraft, xxx_todo_changeme):
    17521753        """Determine if this model handler handles the aircraft with the given
    17531754        name."""
     1755        (tailnum, author, description, notes,
     1756                              icao, liveryPath) = xxx_todo_changeme
    17541757        return aircraft.type==const.AIRCRAFT_DH8D and \
    17551758          description.find("Dash 8 Q400")!=-1 and \
     
    19091912    """Model for Felis' Tupolev Tu-154-M aircraft."""
    19101913    @staticmethod
    1911     def doesHandle(aircraft, (tailnum, author, description, notes,
    1912                               icao, liveryPath)):
     1914    def doesHandle(aircraft, xxx_todo_changeme1):
    19131915        """Determine if this model handler handles the aircraft with the given
    19141916        name."""
     1917        (tailnum, author, description, notes,
     1918                              icao, liveryPath) = xxx_todo_changeme1
    19151919        return aircraft.type==const.AIRCRAFT_T154 and \
    19161920          author.find("Felis")!=-1 and \
Note: See TracChangeset for help on using the changeset viewer.