Changeset 816:4f970cbc02b9


Ignore:
Timestamp:
09/25/16 06:32:43 (8 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

Added function to remove a flight from the list (re #307).

File:
1 edited

Legend:

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

    r815 r816  
    134134        self._model.append(values)
    135135
     136    def removeFlight(self, index):
     137        """Remove the flight with the given index."""
     138        model = self._model
     139        idx = 0
     140        iter = model.get_iter_first()
     141        while iter is not None:
     142            nextIter = model.iter_next(iter)
     143            if model.get_value(iter, 0)==index:
     144                model.remove(iter)
     145            else:
     146                model.set_value(iter, 0, idx)
     147                idx += 1
     148            iter = nextIter
     149
    136150    def _rowActivated(self, flightList, path, column):
    137151        """Called when a row is selected."""
Note: See TracChangeset for help on using the changeset viewer.