Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified TSH.exe
Binary file not shown.
38 changes: 37 additions & 1 deletion src/TSHScoreboardPlayerWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,41 @@
from .Helpers.TSHBadWordFilter import TSHBadWordFilter


class CustomQCompleter(QCompleter):
def __init__(self, parent=None):
super(CustomQCompleter, self).__init__(parent)
self.local_completion_prefix = ""
self.source_model = None

def setModel(self, model):
self.source_model = model
super(CustomQCompleter, self).setModel(self.source_model)

def updateModel(self):
local_completion_prefix = self.local_completion_prefix

class InnerProxyModel(QSortFilterProxyModel):
def filterAcceptsRow(self, sourceRow, sourceParent):
index0 = self.sourceModel().index(sourceRow, 0, sourceParent)
data = self.sourceModel().data(index0, Qt.ItemDataRole.UserRole)

if data:
for k, v in data.items():
if type(v) == str:
if local_completion_prefix.lower() in v.lower():
return True

return local_completion_prefix.lower() in self.sourceModel().data(index0).lower()
proxy_model = InnerProxyModel()
proxy_model.setSourceModel(self.source_model)
super(CustomQCompleter, self).setModel(proxy_model)

def splitPath(self, path):
self.local_completion_prefix = path
self.updateModel()
return [""]


class TSHScoreboardPlayerWidgetSignals(QObject):
playerId_changed = Signal()
player1Id_changed = Signal()
Expand Down Expand Up @@ -545,7 +580,8 @@ def ReloadCharacters(self):

def SetupAutocomplete(self):
if TSHPlayerDB.model:
self.findChild(QLineEdit, "name").setCompleter(QCompleter())
self.findChild(QLineEdit, "name").setCompleter(
CustomQCompleter(TSHPlayerDB.model))
self.findChild(QLineEdit, "name").completer().activated[QModelIndex].connect(
lambda x: self.SetData(x.data(Qt.ItemDataRole.UserRole)) if x is not None else None, Qt.QueuedConnection)
self.findChild(QLineEdit, "name").completer().setCaseSensitivity(
Expand Down
62 changes: 31 additions & 31 deletions src/i18n/TSH_de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,10 @@ p, li { white-space: pre-wrap; }
<context>
<name>Form</name>
<message>
<location filename="../layout/TSHScoreboardPlayer.ui" line="25"/>
<location filename="../layout/TSHThumbnailSettings.ui" line="14"/>
<location filename="../layout/TSHScoreboardScore.ui" line="21"/>
<location filename="../layout/TSHThumbnailSettings.ui" line="14"/>
<location filename="../layout/TSHScoreboardStage.ui" line="14"/>
<location filename="../layout/TSHScoreboardPlayer.ui" line="25"/>
<location filename="../layout/TSHScoreboardTeam.ui" line="20"/>
<source>Form</source>
<translation></translation>
Expand Down Expand Up @@ -622,14 +622,14 @@ p, li { white-space: pre-wrap; }
<context>
<name>GroupBox</name>
<message>
<location filename="../layout/TSHCommentary.ui" line="23"/>
<location filename="../layout/TSHCommentator.ui" line="29"/>
<location filename="../layout/TSHCommentary.ui" line="23"/>
<source>GroupBox</source>
<translation></translation>
</message>
<message>
<location filename="../layout/TSHCommentary.ui" line="26"/>
<location filename="../layout/TSHCommentator.ui" line="32"/>
<location filename="../layout/TSHCommentary.ui" line="26"/>
<source>Commentator 1</source>
<translation>Kommentator 1</translation>
</message>
Expand All @@ -644,38 +644,38 @@ p, li { white-space: pre-wrap; }
<translation></translation>
</message>
<message>
<location filename="../layout/TSHCommentary.ui" line="90"/>
<location filename="../layout/TSHCommentator.ui" line="90"/>
<location filename="../layout/TSHCommentary.ui" line="90"/>
<source>GamerTag</source>
<translation>Spielername</translation>
</message>
<message>
<location filename="../layout/TSHCommentary.ui" line="108"/>
<location filename="../layout/TSHCommentator.ui" line="108"/>
<location filename="../layout/TSHCommentary.ui" line="108"/>
<source>REAL NAME</source>
<translation>KLARNAME</translation>
</message>
<message>
<location filename="../layout/TSHCommentary.ui" line="124"/>
<location filename="../layout/TSHCommentator.ui" line="124"/>
<location filename="../layout/TSHCommentary.ui" line="124"/>
<source>Real Name</source>
<translation>Klarname</translation>
</message>
<message>
<location filename="../layout/TSHCommentary.ui" line="140"/>
<location filename="../layout/TSHCommentator.ui" line="140"/>
<location filename="../layout/TSHCommentary.ui" line="140"/>
<source>TWITTER</source>
<translation></translation>
</message>
<message>
<location filename="../layout/TSHCommentary.ui" line="156"/>
<location filename="../layout/TSHCommentator.ui" line="156"/>
<location filename="../layout/TSHCommentary.ui" line="156"/>
<source>Handle Only</source>
<translation>Handle exkl. @</translation>
</message>
<message>
<location filename="../layout/TSHCommentary.ui" line="170"/>
<location filename="../layout/TSHCommentator.ui" line="172"/>
<location filename="../layout/TSHCommentary.ui" line="170"/>
<source>PRONOUNS</source>
<translation>PRONOMEN</translation>
</message>
Expand Down Expand Up @@ -708,21 +708,21 @@ p, li { white-space: pre-wrap; }
<translation>Spielerliste</translation>
</message>
<message>
<location filename="../TSHPlayerListWidget.py" line="54"/>
<location filename="../TSHBracketWidget.py" line="70"/>
<location filename="../TSHPlayerListWidget.py" line="54"/>
<source>Number of slots</source>
<translation>Zahl der Slots</translation>
</message>
<message>
<location filename="../TSHPlayerListWidget.py" line="63"/>
<location filename="../TSHBracketWidget.py" line="81"/>
<location filename="../TSHPlayerListWidget.py" line="63"/>
<source>Players per slot</source>
<translation>Spieler pro Slot</translation>
</message>
<message>
<location filename="../TSHPlayerListWidget.py" line="72"/>
<location filename="../TSHScoreboardWidget.py" line="116"/>
<location filename="../TSHBracketWidget.py" line="90"/>
<location filename="../TSHPlayerListWidget.py" line="72"/>
<source>Characters per player</source>
<translation>Charaktere pro Slot</translation>
</message>
Expand Down Expand Up @@ -773,8 +773,8 @@ p, li { white-space: pre-wrap; }
<translation>Das Programm wird nun geschlossen.</translation>
</message>
<message>
<location filename="../TournamentStreamHelper.py" line="167"/>
<location filename="../TSHThumbnailSettingsWidget.py" line="74"/>
<location filename="../TournamentStreamHelper.py" line="167"/>
<source>Thumbnail Settings</source>
<translation>Thumbnail-Einstellungen</translation>
</message>
Expand All @@ -789,14 +789,14 @@ p, li { white-space: pre-wrap; }
<translation>Turnierdaten</translation>
</message>
<message>
<location filename="../TournamentStreamHelper.py" line="191"/>
<location filename="../TSHScoreboardWidget.py" line="82"/>
<location filename="../TournamentStreamHelper.py" line="191"/>
<source>Scoreboard</source>
<translation></translation>
</message>
<message>
<location filename="../TournamentStreamHelper.py" line="208"/>
<location filename="../TSHCommentaryWidget.py" line="14"/>
<location filename="../TournamentStreamHelper.py" line="208"/>
<source>Commentary</source>
<translation>Kommentar</translation>
</message>
Expand Down Expand Up @@ -824,8 +824,8 @@ p, li { white-space: pre-wrap; }
<translation>Auf Updates prüfen</translation>
</message>
<message>
<location filename="../TournamentStreamHelper.py" line="304"/>
<location filename="../TSHAssetDownloader.py" line="77"/>
<location filename="../TournamentStreamHelper.py" line="304"/>
<source>Download assets</source>
<translation>Assets herunterladen</translation>
</message>
Expand Down Expand Up @@ -948,10 +948,10 @@ p, li { white-space: pre-wrap; }
<translation>ACHTUNG! FÜR /layout/ WIRD EIN BACKUP ERSTELLT, ALLE ANDEREN VERZEICHNISSE WERDEN ÜBERSCHRIEBEN</translation>
</message>
<message>
<location filename="../TournamentStreamHelper.py" line="650"/>
<location filename="../TournamentStreamHelper.py" line="660"/>
<location filename="../TSHAssetDownloader.py" line="304"/>
<location filename="../TSHAssetDownloader.py" line="457"/>
<location filename="../TournamentStreamHelper.py" line="650"/>
<location filename="../TournamentStreamHelper.py" line="660"/>
<source>Cancel</source>
<translation>Abbrechen</translation>
</message>
Expand Down Expand Up @@ -1143,9 +1143,9 @@ p, li { white-space: pre-wrap; }
<translation></translation>
</message>
<message>
<location filename="../TSHScoreboardPlayerWidget.py" line="366"/>
<location filename="../TSHSelectSetWindow.py" line="88"/>
<location filename="../TSHSelectSetWindow.py" line="90"/>
<location filename="../TSHScoreboardPlayerWidget.py" line="331"/>
<location filename="../thumbnail/main_generate_thumbnail.py" line="1126"/>
<source>Player {0}</source>
<translation>Spieler {0}</translation>
Expand All @@ -1156,23 +1156,23 @@ p, li { white-space: pre-wrap; }
<translation>Set auswählen</translation>
</message>
<message>
<location filename="../TSHScoreboardPlayerWidget.py" line="66"/>
<location filename="../TSHScoreboardPlayerWidget.py" line="759"/>
<location filename="../TSHScoreboardPlayerWidget.py" line="101"/>
<location filename="../TSHScoreboardPlayerWidget.py" line="795"/>
<source>Save new player</source>
<translation>Neuen Spieler speichern</translation>
</message>
<message>
<location filename="../TSHScoreboardPlayerWidget.py" line="79"/>
<location filename="../TSHScoreboardPlayerWidget.py" line="114"/>
<source>Delete player entry</source>
<translation>Spielereintrag löschen</translation>
</message>
<message>
<location filename="../TSHScoreboardPlayerWidget.py" line="92"/>
<location filename="../TSHScoreboardPlayerWidget.py" line="127"/>
<source>Clear</source>
<translation>Zurücksetzen</translation>
</message>
<message>
<location filename="../TSHScoreboardPlayerWidget.py" line="756"/>
<location filename="../TSHScoreboardPlayerWidget.py" line="792"/>
<source>Update player</source>
<translation>Spielereintrag aktualisieren</translation>
</message>
Expand Down Expand Up @@ -1240,11 +1240,11 @@ p, li { white-space: pre-wrap; }
<translation>TEAM {0}</translation>
</message>
<message>
<location filename="../TSHScoreboardWidget.py" line="459"/>
<location filename="../TSHThumbnailSettingsWidget.py" line="929"/>
<location filename="../TournamentStreamHelper.py" line="58"/>
<location filename="../TournamentStreamHelper.py" line="427"/>
<location filename="../TournamentStreamHelper.py" line="613"/>
<location filename="../TSHScoreboardWidget.py" line="459"/>
<location filename="../TSHThumbnailSettingsWidget.py" line="929"/>
<source>Warning</source>
<translation>ACHTUNG</translation>
</message>
Expand Down Expand Up @@ -1344,16 +1344,16 @@ p, li { white-space: pre-wrap; }
<context>
<name>punctuation</name>
<message>
<location filename="../TournamentStreamHelper.py" line="542"/>
<location filename="../TSHSelectSetWindow.py" line="111"/>
<location filename="../TSHScoreboardWidget.py" line="722"/>
<location filename="../TSHSelectSetWindow.py" line="111"/>
<location filename="../TournamentStreamHelper.py" line="542"/>
<source>(</source>
<translation></translation>
</message>
<message>
<location filename="../TournamentStreamHelper.py" line="542"/>
<location filename="../TSHSelectSetWindow.py" line="112"/>
<location filename="../TSHScoreboardWidget.py" line="722"/>
<location filename="../TSHSelectSetWindow.py" line="112"/>
<location filename="../TournamentStreamHelper.py" line="542"/>
<source>)</source>
<translation></translation>
</message>
Expand Down
Loading