-
Notifications
You must be signed in to change notification settings - Fork 0
/
completer.py
35 lines (24 loc) · 834 Bytes
/
completer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from typing import List, Optional, Union
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
class MindustryLogicCompleter(QCompleter):
def __init__(self, word_list: List[str], *args, **kwargs):
super(MindustryLogicCompleter, self).__init__(*args, **kwargs)
self.model: QStringListModel = QStringListModel(word_list)
self.setModel(self.model)
def update_model(self, word_list: List[str]) -> None:
"""
Update completer model
:param word_list: new list of words
:type word_list: List[str]
:return: None
:rtype: None
"""
if len(word_list) == 0:
return
self.model.setStringList(word_list)
self.setModel(self.model)
if __name__ == '__main__':
pass