-
Notifications
You must be signed in to change notification settings - Fork 0
/
player_search.py
55 lines (45 loc) · 1.61 KB
/
player_search.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Standard Library
# none
# Third Party Packages
import os
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from nba_api.stats.library import data
from nba_api.stats.endpoints import commonplayerinfo
# Relative Imports
from new_category import *
from new_player import *
from menu_status_bars import *
from restore import *
class PlayerEntry(QLineEdit, object):
"""Line edit to support auto-complete and other various methods needed for players."""
def __init__(self, parent):
super(PlayerEntry, self).__init__(parent)
self.parent = parent
list = []
self.completer = QCompleter()
self.setCompleter(self.completer)
try:
list = self.parent.all_players.last_names
except AttributeError:
list = parent.parent.all_players.last_names
my_completer = QCompleter(list)
my_completer.setCaseSensitivity(Qt.CaseInsensitive)
self.setCompleter(my_completer)
@staticmethod
def test_text_cb(self, player):
approved = True
try:
if not player in self.all_players.last_names:
QMessageBox.about(self,
'Notice!',
'Player not loaded, please try again.')
approved = False
except AttributeError:
if not player in self.parent.all_players.last_names:
QMessageBox.about(self,
'Notice!',
'Player not loaded, please try again.')
approved = False
return approved