Skip to content

Commit 7210e77

Browse files
committed
fix: auto capitalize country name to display country flag
1 parent 24965d3 commit 7210e77

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/mineSweeperGUI.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,7 @@ def dump_evf_file_data(self):
640640
self.label.ms_board.generate_evf_v4_raw_data()
641641
return
642642
elif isinstance(self.label.ms_board, ms.RmvVideo):
643+
self.label.ms_board.country = "CN"
643644
self.label.ms_board.generate_evf_v4_raw_data()
644645
return
645646

@@ -1104,7 +1105,8 @@ def action_NEvent(self):
11041105
self.player_identifier = ui.player_identifier
11051106
self.label_info.setText(self.player_identifier)
11061107
self.race_identifier = ui.race_identifier
1107-
# 国家或地区名的全称,例如”中国“
1108+
# 用户的国家或地区名的全称,例如”中国“。必须是country_name中有的或None
1109+
# 播放录像时,self.country不会遭到修改
11081110
self.country = ui.country
11091111
self.set_country_flag()
11101112
self.autosave_video = ui.autosave_video

src/superGUI.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,9 +551,21 @@ def read_or_create_record(self):
551551
self.record_setting.sync()
552552

553553
def set_country_flag(self, country = None):
554+
'''
555+
设置右下角国旗图案。尽一切可能解析录像中的国旗。
556+
例如,在vsweep中,国家是用户手动输入的,可能出现”中国“、”China“、”china“、”CN“、
557+
”cn“等情况,全部应该要正确解析。
558+
不修改self.country变量
559+
'''
560+
print(country)
554561
if country == None:
555562
country = self.country
556-
# 设置右下角国旗图案
563+
if country == None:
564+
self.label_flag.clear()
565+
self.label_flag.update()
566+
return
567+
if country not in country_name:
568+
country = country.capitalize()
557569
if country not in country_name:
558570
file_path = self.r_path.with_name('media') / (country.lower() + ".svg")
559571
if os.path.exists(file_path):

0 commit comments

Comments
 (0)