fix rank load
This commit is contained in:
1 parent
5794934585
commit
a248228e4d
1 file changed
+19
-7
@@ -28,7 +28,15 @@ from kivymd.uix.navigationdrawer import MDNavigationDrawer
|
|||||||
from kivymd.uix.selectioncontrol import MDCheckbox
|
from kivymd.uix.selectioncontrol import MDCheckbox
|
||||||
from kivymd.uix.textfield import MDTextField
|
from kivymd.uix.textfield import MDTextField
|
||||||
|
|
||||||
from katrain.core.constants import AI_STRATEGIES_RECOMMENDED_ORDER, GAME_TYPES, MODE_PLAY, PLAYER_AI, PLAYER_HUMAN, PLAYING_NORMAL, PLAYING_TEACHING
|
from katrain.core.constants import (
|
||||||
|
AI_STRATEGIES_RECOMMENDED_ORDER,
|
||||||
|
GAME_TYPES,
|
||||||
|
MODE_PLAY,
|
||||||
|
PLAYER_AI,
|
||||||
|
PLAYER_HUMAN,
|
||||||
|
PLAYING_NORMAL,
|
||||||
|
PLAYING_TEACHING,
|
||||||
|
)
|
||||||
from katrain.core.lang import i18n
|
from katrain.core.lang import i18n
|
||||||
from katrain.gui.theme import Theme
|
from katrain.gui.theme import Theme
|
||||||
|
|
||||||
@@ -372,19 +380,23 @@ class PlayerInfo(MDBoxLayout, BackgroundMixin):
|
|||||||
rank = StringProperty("", allownone=True)
|
rank = StringProperty("", allownone=True)
|
||||||
active = BooleanProperty(True)
|
active = BooleanProperty(True)
|
||||||
|
|
||||||
def __init__(self,**kwargs):
|
def __init__(self, **kwargs):
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
self.bind(player_type=self.set_label,player_subtype=self.set_label,name=self.set_label,rank=self.set_label)
|
self.bind(player_type=self.set_label, player_subtype=self.set_label, name=self.set_label, rank=self.set_label)
|
||||||
|
|
||||||
def set_label(self,*args):
|
def set_label(self, *args):
|
||||||
if not self.subtype_label: #building
|
if not self.subtype_label: # building
|
||||||
return
|
return
|
||||||
show_player_name = self.name and self.player_type == PLAYER_HUMAN and self.player_subtype == PLAYING_NORMAL
|
show_player_name = self.name and self.player_type == PLAYER_HUMAN and self.player_subtype == PLAYING_NORMAL
|
||||||
if show_player_name:
|
if show_player_name:
|
||||||
text = self.name
|
text = self.name
|
||||||
else:
|
else:
|
||||||
text = i18n._(self.player_subtype)
|
text = i18n._(self.player_subtype)
|
||||||
if self.rank and self.player_subtype != PLAYING_TEACHING and (show_player_name or self.player_type==PLAYER_AI):
|
if (
|
||||||
|
self.rank
|
||||||
|
and self.player_subtype != PLAYING_TEACHING
|
||||||
|
and (show_player_name or self.player_type == PLAYER_AI)
|
||||||
|
):
|
||||||
text += " ({})".format(self.rank)
|
text += " ({})".format(self.rank)
|
||||||
self.subtype_label.text = text
|
self.subtype_label.text = text
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user