forked from Support/sp-hydra-veil-gui
Streamline sync through action plumbing. Redundant UK node art for future likely format switch
This commit is contained in:
parent
b0b0c3c1c4
commit
ec90b2bf7a
8 changed files with 19 additions and 18 deletions
BIN
gui/resources/images/icon_GB_COV.png
Normal file
BIN
gui/resources/images/icon_GB_COV.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1 MiB |
BIN
gui/resources/images/icon_mini_GB_COV.png
Normal file
BIN
gui/resources/images/icon_mini_GB_COV.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.9 KiB |
|
|
@ -5,28 +5,27 @@ from core.errors.logger import logger
|
||||||
|
|
||||||
from gui.v2.infrastructure.setup_observers import connection_observer
|
from gui.v2.infrastructure.setup_observers import connection_observer
|
||||||
|
|
||||||
from gui.v2.infrastructure.ThreadSafetyTool import ThreadSafetyTool
|
# from gui.v2.infrastructure.ThreadSafetyTool import ThreadSafetyTool
|
||||||
mainthread = ThreadSafetyTool()
|
# mainthread = ThreadSafetyTool()
|
||||||
from gui.v2.infrastructure.take_plumbing_action import take_action
|
from gui.v2.infrastructure.take_plumbing_action import take_action
|
||||||
|
|
||||||
@mainthread
|
|
||||||
def post_state_evaluation(result: Result):
|
def post_state_evaluation(result: Result):
|
||||||
"""Success path for initial state evaluation"""
|
"""Success path for initial state evaluation"""
|
||||||
print("Initial State evaluation complete.")
|
print("Initial State evaluation complete.")
|
||||||
|
|
||||||
if not result.valid and result.error_type == ResultError.ZOMBIE_SESSION and result.data:
|
# if not result.valid and result.error_type == ResultError.ZOMBIE_SESSION and result.data:
|
||||||
active_session_profiles = result.data
|
# active_session_profiles = result.data
|
||||||
logger.info("Removing Zombie Session profiles on the main thread.")
|
# logger.info("Removing Zombie Session profiles on the main thread.")
|
||||||
for each_profile in active_session_profiles:
|
# for each_profile in active_session_profiles:
|
||||||
logger.info(f"Removing this profile {active_session_profiles} from session since it's a fresh restart.")
|
# logger.info(f"Removing this profile {active_session_profiles} from session since it's a fresh restart.")
|
||||||
SessionStateController.remove(each_profile.id)
|
# SessionStateController.remove(each_profile.id)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@mainthread
|
|
||||||
@register_action(ResultError.ZOMBIE_SYSTEM)
|
@register_action(ResultError.ZOMBIE_SYSTEM)
|
||||||
def evaluate_bad_state():
|
def evaluate_bad_state():
|
||||||
"""Start core's evaluation of state with a GUI observer."""
|
"""Start core's evaluation of state with a GUI observer."""
|
||||||
# return coordinate_evaluation(connection_observer=connection_observer)
|
|
||||||
take_action(
|
take_action(
|
||||||
action=coordinate_evaluation,
|
action=coordinate_evaluation,
|
||||||
ui_caller=post_state_evaluation,
|
ui_caller=post_state_evaluation,
|
||||||
|
|
|
||||||
|
|
@ -346,3 +346,4 @@ def sync_now(ui_caller: Callable):
|
||||||
client_observer=client_observer,
|
client_observer=client_observer,
|
||||||
connection_observer=connection_observer
|
connection_observer=connection_observer
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -288,7 +288,8 @@ def _delete(request: dict[str, Any]) -> MenuResult:
|
||||||
|
|
||||||
def _navigate(request: dict[str, Any], emit: MenuCallback) -> MenuResult:
|
def _navigate(request: dict[str, Any], emit: MenuCallback) -> MenuResult:
|
||||||
"""Keep fast-registration and edit synchronization policy out of page signal handlers."""
|
"""Keep fast-registration and edit synchronization policy out of page signal handlers."""
|
||||||
fast = is_fast_registration_enabled(request.get("gui_config_file"))
|
fast = True
|
||||||
|
# is_fast_registration_enabled(request.get("gui_config_file"))
|
||||||
auto = is_auto_sync_enabled(request.get("gui_config_file"))
|
auto = is_auto_sync_enabled(request.get("gui_config_file"))
|
||||||
create = request["task"] == "create"
|
create = request["task"] == "create"
|
||||||
synced = request.get("is_synced", False)
|
synced = request.get("is_synced", False)
|
||||||
|
|
|
||||||
|
|
@ -300,6 +300,7 @@ class FastRegistrationPage(Page):
|
||||||
self.selected_values['location'], fallback_path, provider)
|
self.selected_values['location'], fallback_path, provider)
|
||||||
else:
|
else:
|
||||||
if locations and hasattr(locations, 'country_name'):
|
if locations and hasattr(locations, 'country_name'):
|
||||||
|
print(f'Fetching image for {locations.country_code}_{locations.code}')
|
||||||
location_image = LocationPage.create_location_button_image(
|
location_image = LocationPage.create_location_button_image(
|
||||||
f'{locations.country_code}_{locations.code}', fallback_path, provider, image_path)
|
f'{locations.country_code}_{locations.code}', fallback_path, provider, image_path)
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -566,9 +566,6 @@ class MenuPage(Page):
|
||||||
|
|
||||||
print(f"location code for mini is {location}")
|
print(f"location code for mini is {location}")
|
||||||
|
|
||||||
import time
|
|
||||||
time.sleep(20)
|
|
||||||
|
|
||||||
location_pixmap = QPixmap(os.path.join(
|
location_pixmap = QPixmap(os.path.join(
|
||||||
self.btn_path, f"icon_mini_{location}.png"))
|
self.btn_path, f"icon_mini_{location}.png"))
|
||||||
if location_pixmap.isNull():
|
if location_pixmap.isNull():
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,13 @@ from PyQt6.QtWidgets import QLabel, QPushButton
|
||||||
from PyQt6.QtGui import QPixmap
|
from PyQt6.QtGui import QPixmap
|
||||||
|
|
||||||
from core.controllers.ClientController import ClientController
|
from core.controllers.ClientController import ClientController
|
||||||
|
from core.models.Result import Result
|
||||||
|
|
||||||
|
from gui.v2.actions.menu_coordinator import sync_now
|
||||||
from gui.v2.ui.pages.Page import Page
|
from gui.v2.ui.pages.Page import Page
|
||||||
from gui.v2.workers.worker_thread import WorkerThread
|
from gui.v2.workers.worker_thread import WorkerThread
|
||||||
|
from gui.v2.infrastructure.ThreadSafetyTool import ThreadSafetyTool
|
||||||
|
mainthread = ThreadSafetyTool()
|
||||||
|
|
||||||
|
|
||||||
class SyncScreen(Page):
|
class SyncScreen(Page):
|
||||||
|
|
@ -72,9 +76,7 @@ class SyncScreen(Page):
|
||||||
self.update_status('Sync failed. Please try again later.')
|
self.update_status('Sync failed. Please try again later.')
|
||||||
return
|
return
|
||||||
|
|
||||||
self.perform_update_check()
|
self.connection_manager.set_synced(True)
|
||||||
|
|
||||||
self.update_status.update_status('Sync complete')
|
|
||||||
|
|
||||||
update_available = ClientController.can_be_updated()
|
update_available = ClientController.can_be_updated()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue