Changeset 836:df442f51e8de


Ignore:
Timestamp:
04/17/17 07:01:42 (8 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

Extracted the creation of the flight type combo box.

Location:
src/mlx/gui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/gui/common.py

    r834 r836  
    519519
    520520#------------------------------------------------------------------------------
     521
     522def createFlightTypeComboBox():
     523        flightTypeModel = gtk.ListStore(str, int)
     524        for type in _const.flightTypes:
     525            name = "flighttype_" + _const.flightType2string(type)
     526            flightTypeModel.append([xstr(name), type])
     527
     528        flightType = gtk.ComboBox(model = flightTypeModel)
     529        renderer = gtk.CellRendererText()
     530        flightType.pack_start(renderer, True)
     531        flightType.add_attribute(renderer, "text", 0)
     532
     533        return flightType
     534
     535#------------------------------------------------------------------------------
  • src/mlx/gui/flight.py

    r834 r836  
    45214521class FinishPage(Page):
    45224522    """Flight finish page."""
    4523     _flightTypes = [ ("flighttype_scheduled", const.FLIGHTTYPE_SCHEDULED),
    4524                      ("flighttype_ot", const.FLIGHTTYPE_OLDTIMER),
    4525                      ("flighttype_vip", const.FLIGHTTYPE_VIP),
    4526                      ("flighttype_charter", const.FLIGHTTYPE_CHARTER) ]
    4527 
    45284523    def __init__(self, wizard, saveHelper):
    45294524        """Construct the finish page."""
     
    46584653        table.attach(labelAlignment, 0, 1, row, row+1)
    46594654
    4660         flightTypeModel = gtk.ListStore(str, int)
    4661         for (name, type) in FinishPage._flightTypes:
    4662             flightTypeModel.append([xstr(name), type])
    4663 
    4664         self._flightType = gtk.ComboBox(model = flightTypeModel)
    4665         renderer = gtk.CellRendererText()
    4666         self._flightType.pack_start(renderer, True)
    4667         self._flightType.add_attribute(renderer, "text", 0)
     4655        self._flightType = createFlightTypeComboBox()
    46684656        self._flightType.set_tooltip_text(xstr("finish_type_tooltip"))
    46694657        self._flightType.set_active(0)
Note: See TracChangeset for help on using the changeset viewer.