Re: [Maya-Python] Exclude QFileSystemModel.setNameFilters

2016-12-02 Thread Marcus Ottosson
An alternative to fetching the object and accessing properties of this object, you could use the “role” functionality of the model. - Reference (search for “role”) return idx.data(FileTypeRole) not in self._excludes Each index carries

Re: [Maya-Python] Exclude QFileSystemModel.setNameFilters

2016-12-02 Thread Alok Gandhi
Might I also suggest more pythonic and performant code: fileType = self.sourceModel().fileInfo(idx).suffix() return fileType not in self._excludes On Fri, Dec 2, 2016 at 4:21 PM, Justin Israel wrote: > Sure you can do it like that. It will work fine for testing

Re: [Maya-Python] Exclude QFileSystemModel.setNameFilters

2016-12-01 Thread Ruchit Bhatt
@Justin Instead of name = idx.data() for exc in self._excludes: if name.endswith(exc): return False Below one is simple & perfect in my case, wht do you think ?? fileType = self.sourceModel().fileInfo(idx).suffix() for exc in self._excludes: if exc == fileType:

Re: [Maya-Python] Exclude QFileSystemModel.setNameFilters

2016-11-30 Thread Ruchit Bhatt
> > @Marcus...Tell me, below code is going in right direction or not ?? Thank you class customProxyModel(QtGui.QSortFilterProxyModel): def __init__(self, parent=None): super(customProxyModel, self).__init__(parent) self._includes = {'fileName':[], 'fileType':[], 'fileSize':[], 'fileDate':[]}

Re: [Maya-Python] Exclude QFileSystemModel.setNameFilters

2016-11-08 Thread Marcus Ottosson
Great example, Justin. I was about to post this, which is a more complex example. - Implementation - Use

[Maya-Python] Exclude QFileSystemModel.setNameFilters

2016-11-07 Thread Ruchit Bhatt
Hi, if i run below lines, QFileSystemModel will keep files with extension xml,txt & mel. But i want invert of this..(i.e i want to remove xml, txt & mel from QFileSystemModel) So tell me how to do this ?? self.dirModel.setNameFilters(['*.xml', '*.txt', '*.mel'])