(self, filename, options=None)
Add filename to the list of recent files.
Add filename to the list of recent files.
Add filename to the list of recent files .
def _add_recent(self, filename, options=None):
        # type: (str, Optional[Options]) -> None
        """
        Add filename to the list of recent files.
        """
        model = self.import_items_model
        index = index_where(
            (model.index(i, 0).data(ImportItem.PathRole)
             for i in range(model.rowCount())),
            lambda path: isinstance(path, str) and samepath(path, filename)
        )
        if index is not None:
            item, *_ = model.takeRow(index)
        else:
            item = ImportItem.fromPath(filename)

        # item.setData(VarPath(filename), ImportItem.VarPathRole)
        item.setData(True, ImportItem.IsSessionItemRole)
        model.insertRow(0, item)

        if options is not None:
            item.setOptions(options)

        self.recent_combo.setCurrentIndex(0)

        if not os.path.exists(filename):
            return
        self._note_recent(filename, options)
def _add_recent ( self , filename , options = None ) : # type: (str, Optional[Options]) -> None model = self . import_items_model index = index_where ( ( model . index ( i , 0 ) . data ( ImportItem . PathRole ) for i in range ( model . rowCount ( ) ) ) , lambda path : isinstance ( path , str ) and samepath ( path , filename ) ) if index is not None : item , * _ = model . takeRow ( index ) else : item = ImportItem . fromPath ( filename ) # item.setData(VarPath(filename), ImportItem.VarPathRole) item . setData ( True , ImportItem . IsSessionItemRole ) model . insertRow ( 0 , item ) if options is not None : item . setOptions ( options ) self . recent_combo . setCurrentIndex ( 0 ) if not os . path . exists ( filename ) : return self . _note_recent ( filename , options )