Changeset 501:2fd9b3270f6d


Ignore:
Timestamp:
04/07/13 07:09:14 (12 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
xplane
Phase:
public
Message:

Added logic to select the simulator type

Files:
5 edited

Legend:

Unmodified
Added
Removed
  • locale/en/mlx.po

    r491 r501  
    470470msgid "connect_gate"
    471471msgstr "Gate:"
     472
     473msgid "connect_sim"
     474msgstr "Simulator:"
     475
     476msgid "connect_sim_msfs"
     477msgstr "FS_9/FSX"
     478
     479msgid "connect_sim_xplane"
     480msgstr "_X-Plane 9/10"
    472481
    473482msgid "button_connect"
  • locale/hu/mlx.po

    r491 r501  
    473473msgstr "Kapu:"
    474474
     475msgid "connect_sim"
     476msgstr "Szimulátor:"
     477
     478msgid "connect_sim_msfs"
     479msgstr "FS_9/FSX"
     480
     481msgid "connect_sim_xplane"
     482msgstr "_X-Plane 9/10"
     483
    475484msgid "button_connect"
    476485msgstr "K_apcsolódás"
  • src/mlx/fs.py

    r499 r501  
    9797        with self._requestCondition:
    9898            self._toQuit = True
    99             self._requestCondition.notifty()
     99            self._requestCondition.notify()
    100100        self.join()
    101101
  • src/mlx/gui/flight.py

    r436 r501  
    880880                                          completedHelp = xstr("connect_chelp"))
    881881
     882        self._selectSimulator = os.name=="nt" or "FORCE_SELECT_SIM" in os.environ
     883
    882884        alignment = gtk.Alignment(xalign = 0.5, yalign = 0.5,
    883885                                  xscale = 0.0, yscale = 0.0)
    884886
    885         table = gtk.Table(5, 2)
     887        table = gtk.Table(7 if self._selectSimulator else 5, 2)
    886888        table.set_row_spacings(4)
    887889        table.set_col_spacings(16)
     
    949951        labelAlignment.add(self._departureGate)
    950952        table.attach(labelAlignment, 1, 2, 4, 5)
     953
     954        if self._selectSimulator:
     955            labelAlignment = gtk.Alignment(xalign=1.0, xscale=0.0, yalign=0.5)
     956            label = gtk.Label(xstr("connect_sim"))
     957            labelAlignment.add(label)
     958            table.attach(labelAlignment, 0, 1, 5, 7)
     959
     960            selectAlignment = gtk.Alignment(xalign=0.0, xscale=0.0, yalign=0.5)
     961
     962            selectBox = gtk.HBox()
     963            if pygobject:
     964                self._selectMSFS = \
     965                  gtk.RadioButton.new_with_mnemonic_from_widget(None,
     966                                                                xstr("connect_sim_msfs"))
     967            else:
     968                self._selectMSFS = gtk.RadioButton(None,
     969                                                   xstr("connect_sim_msfs"))
     970
     971            selectBox.pack_start(self._selectMSFS, False, False, 0);
     972
     973            if pygobject:
     974                self._selectXPlane = \
     975                  gtk.RadioButton.new_with_mnemonic_from_widget(self._selectMSFS,
     976                                                                xstr("connect_sim_xplane"))
     977            else:
     978                self._selectXPlane = gtk.RadioButton(self._selectMSFS,
     979                                                     xstr("connect_sim_xplane"))
     980
     981            selectBox.pack_start(self._selectXPlane, False, False, 8);
     982
     983            selectAlignment.add(selectBox)
     984            table.attach(selectAlignment, 1, 2, 5, 7)
     985
    951986
    952987        self.addCancelFlightButton()
     
    9821017        self._departureGate.set_markup(gate)
    9831018
     1019        if self._selectSimulator:
     1020            self._selectMSFS.set_active(os.name=="nt")
     1021            self._selectXPlane.set_active(os.name!="nt")
     1022
    9841023    def finalize(self):
    9851024        """Finalize the page."""
     
    9961035    def _connectClicked(self, button):
    9971036        """Called when the Connect button is pressed."""
    998         self._wizard._connectSimulator()
     1037        if self._selectSimulator:
     1038            simulatorType = const.SIM_MSFS9 if self._selectMSFS.get_active() \
     1039                                            else const.SIM_XPLANE10
     1040        else:
     1041            simulatorType = const.SIM_MSFS9 if os.name=="nt" \
     1042                                            else const.SIM_XPLANE10
     1043        self._wizard._connectSimulator(simulatorType)
    9991044
    10001045    def _forwardClicked(self, button):
     
    34943539        self.gui.rtoToggled(indicated)
    34953540
    3496     def _connectSimulator(self):
     3541    def _connectSimulator(self, simulatorType):
    34973542        """Connect to the simulator."""
    3498         self.gui.connectSimulator(self._bookedFlight.aircraftType)
     3543        self.gui.connectSimulator(self._bookedFlight.aircraftType,
     3544                                  simulatorType)
    34993545
    35003546    def _arrivalMETARCallback(self, returned, result):
  • src/mlx/gui/gui.py

    r496 r501  
    520520        self._disconnect()
    521521
     522        self._simulator = None
     523
    522524        self._flightInfo.reset()
    523525        self._flightInfo.disable()
     
    894896            self._stdioStartingLine = False
    895897
    896     def connectSimulator(self, aircraftType):
     898    def connectSimulator(self, aircraftType, simulatorType):
    897899        """Connect to the simulator for the first time."""
    898900        self._logger.reset()
     
    905907
    906908        if self._simulator is None:
    907             self._simulator = fs.createSimulator(const.SIM_MSFS9, self)
     909            self._simulator = fs.createSimulator(simulatorType, self)
    908910            fs.setupMessageSending(self.config, self._simulator)
    909911            self._setupTimeSync()
Note: See TracChangeset for help on using the changeset viewer.