GUI: Show game state
This commit is contained in:
@@ -145,6 +145,9 @@ def reset_stats():
|
||||
game_stats.reset(StatType.Overall)
|
||||
|
||||
|
||||
def is_ready():
|
||||
return game_stats.visibility.is_main_player_visible
|
||||
|
||||
def initialize():
|
||||
initialization_result = backend_proxy.initialize()
|
||||
backend_proxy.subscribe(game_stats.register_event)
|
||||
|
||||
@@ -16,5 +16,8 @@ class PlayerStats(QLabel):
|
||||
self.update(0, 0.0, 0.0)
|
||||
|
||||
def update(self, elapsed, fame, fame_per_hour):
|
||||
if engine.is_ready():
|
||||
self.setText("<b>{}</b> | Fame <b>{}</b> | FPH <b>{}</b>".format(
|
||||
datetime.timedelta(seconds=elapsed), fame, fame_per_hour))
|
||||
else:
|
||||
self.setText("Not ready: waiting for zone change")
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from dataclasses import dataclass, field
|
||||
from typing import List
|
||||
import re
|
||||
|
||||
from src.utils.config import config
|
||||
|
||||
from ..event_receiver import VisibilityEventReceiver
|
||||
|
||||
@@ -18,6 +18,13 @@ class Visibility(VisibilityEventReceiver):
|
||||
self.visible_players = visible_players
|
||||
|
||||
def test(self, name):
|
||||
if config()['app']['visibility']: # Note: only for testing purposes
|
||||
return True
|
||||
|
||||
pattern = re.compile('|'.join(self.visible_players) + '|{}'.format(
|
||||
self.main_player_name) if self.visible_players else self.main_player_name)
|
||||
return self.main_player_name and bool(pattern.match(name))
|
||||
|
||||
@property
|
||||
def is_main_player_visible(self) -> bool:
|
||||
return self.main_player_name is not ""
|
||||
|
||||
@@ -2,16 +2,20 @@ import os
|
||||
import sys
|
||||
import toml
|
||||
|
||||
CFG_VERSION = '0.6'
|
||||
CFG_VERSION = '0.7'
|
||||
|
||||
default = """
|
||||
[window]
|
||||
width = 300
|
||||
height = 220
|
||||
font-size = '10px'
|
||||
opacity = 0.8
|
||||
frameless = true
|
||||
always_on_top = true
|
||||
|
||||
# Note: do not change!
|
||||
# options bellow are here only for testing purposes
|
||||
# SBI politics doesn't allow opacity frameless and always on top applications!
|
||||
opacity = 1.0
|
||||
frameless = false
|
||||
always_on_top = false
|
||||
|
||||
[app]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user