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

Fixed the way the altitude to edit is selected

File:
1 edited

Legend:

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

    r280 r282  
    124124        self._addingFile = False
    125125        self._fileListModel.connect("row-inserted", self._fileAdded)
     126        self._lastAddedAltitude = None
    126127       
    127128        self._fileList = gtk.TreeView(model = self._fileListModel)
     
    216217            altitude = self._getNewAltitude(baseName)
    217218            self._addingFile = True
     219            self._lastAddedAltitude = altitude
    218220            self._fileListModel.append([altitude, baseName, filePath])
    219221            self._addingFile = False
     
    224226        Makes the treeview to edit the altitude in the given row."""
    225227        if self._addingFile:
    226             gobject.idle_add(self._fileList.set_cursor,
    227                              model.get_path(iter),
    228                              self._fileList.get_column(0), True)
     228            gobject.idle_add(self._selectFile)
    229229            self._fileList.grab_focus()
    230230            self.grab_focus()
     231
     232    def _selectFile(self):
     233        """Select the file with the last added altitude."""
     234        if self._lastAddedAltitude is None: return
     235
     236        model = self._fileListModel
     237        iter = model.get_iter_first()
     238        while iter is not None:
     239            if model.get_value(iter, 0)==self._lastAddedAltitude: break
     240            iter = model.iter_next(iter)
     241        if iter is not None:
     242            self._fileList.set_cursor(model.get_path(iter),
     243                                      self._fileList.get_column(0), True)
     244        self._lastAddedAltitude = None
    231245                             
    232246    def _removeButtonClicked(self, button):
Note: See TracChangeset for help on using the changeset viewer.