-
Notifications
You must be signed in to change notification settings - Fork 226
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #748 from TheJackiMonster/optional-pov
Enabling/Disabling POV for a specific character
- Loading branch information
Showing
9 changed files
with
231 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/usr/bin/env python | ||
# --!-- coding: utf8 --!-- | ||
from PyQt5.QtCore import QModelIndex, QSortFilterProxyModel | ||
|
||
|
||
class characterPOVModel(QSortFilterProxyModel): | ||
|
||
def __init__(self, sourceModel, parent=None): | ||
QSortFilterProxyModel.__init__(self, parent) | ||
|
||
self.setSourceModel(sourceModel) | ||
|
||
if sourceModel: | ||
sourceModel.dataChanged.connect(self.sourceDataChanged) | ||
|
||
def filterAcceptsRow(self, sourceRow, sourceParent): | ||
return self.sourceModel().pov(sourceRow) | ||
|
||
def rowToSource(self, row): | ||
index = self.index(row, 0) | ||
sourceIndex = self.mapToSource(index) | ||
return sourceIndex.row() | ||
|
||
def sourceDataChanged(self, topLeft, bottomRight): | ||
self.invalidateFilter() | ||
|
||
############################################################################### | ||
# CHARACTER QUERIES | ||
############################################################################### | ||
|
||
def character(self, row): | ||
return self.sourceModel().character(self.rowToSource(row)) | ||
|
||
def name(self, row): | ||
return self.sourceModel().name(self.rowToSource(row)) | ||
|
||
def icon(self, row): | ||
return self.sourceModel().icon(self.rowToSource(row)) | ||
|
||
def ID(self, row): | ||
return self.sourceModel().ID(self.rowToSource(row)) | ||
|
||
def importance(self, row): | ||
return self.sourceModel().importance(self.rowToSource(row)) | ||
|
||
def pov(self, row): | ||
return self.sourceModel().pov(self.rowToSource(row)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.