forked from Support/sp-hydra-veil-gui
Tweaks to Forced Sync Popup Style and CSS. Also enabled forced sync for relevant database situations.
This commit is contained in:
parent
91e657a06d
commit
7cedecd281
6 changed files with 48 additions and 7 deletions
|
|
@ -106,7 +106,7 @@ if is_compatable:
|
||||||
# If the user lacks a database, we want to force them to sync the new data, to avoid NoneType errors when enabling existing profiles,
|
# If the user lacks a database, we want to force them to sync the new data, to avoid NoneType errors when enabling existing profiles,
|
||||||
if reason == "no_database":
|
if reason == "no_database":
|
||||||
logger.info(f"[DB MANAGEMENT] User had no database to begin with, so now we're entering GUI with sync on..")
|
logger.info(f"[DB MANAGEMENT] User had no database to begin with, so now we're entering GUI with sync on..")
|
||||||
force_sync = False
|
force_sync = True
|
||||||
else:
|
else:
|
||||||
logger.info(f"[DB MANAGEMENT] Launcher is now passing it off to launch the main GUI window WITHOUT force sync..")
|
logger.info(f"[DB MANAGEMENT] Launcher is now passing it off to launch the main GUI window WITHOUT force sync..")
|
||||||
force_sync = False
|
force_sync = False
|
||||||
|
|
|
||||||
BIN
gui/__pycache__/__main__.cpython-312.pyc
Normal file
BIN
gui/__pycache__/__main__.cpython-312.pyc
Normal file
Binary file not shown.
BIN
gui/__pycache__/main_ui.cpython-312.pyc
Normal file
BIN
gui/__pycache__/main_ui.cpython-312.pyc
Normal file
Binary file not shown.
|
|
@ -12,7 +12,7 @@ from PyQt6.QtWidgets import (
|
||||||
QApplication, QMainWindow, QStackedWidget, QLabel, QPushButton,
|
QApplication, QMainWindow, QStackedWidget, QLabel, QPushButton,
|
||||||
QDialog, QVBoxLayout, QHBoxLayout, QMessageBox
|
QDialog, QVBoxLayout, QHBoxLayout, QMessageBox
|
||||||
)
|
)
|
||||||
from PyQt6.QtGui import QPixmap, QFont, QFontDatabase
|
from PyQt6.QtGui import QPixmap, QFont, QFontDatabase, QIcon
|
||||||
from PyQt6 import QtGui
|
from PyQt6 import QtGui
|
||||||
from PyQt6.QtCore import Qt, QTimer, QEvent
|
from PyQt6.QtCore import Qt, QTimer, QEvent
|
||||||
|
|
||||||
|
|
@ -196,21 +196,40 @@ class CustomWindow(QMainWindow):
|
||||||
if self.force_sync:
|
if self.force_sync:
|
||||||
QTimer.singleShot(0, self._prompt_force_sync)
|
QTimer.singleShot(0, self._prompt_force_sync)
|
||||||
|
|
||||||
|
|
||||||
def _prompt_force_sync(self):
|
def _prompt_force_sync(self):
|
||||||
|
"""
|
||||||
|
Popup to encourage remote database sync
|
||||||
|
|
||||||
|
Context:
|
||||||
|
Database loader in __main__ passes in the 'forced_sync' variable,
|
||||||
|
If true, this popup encourages sync to avoid NoneType errors.
|
||||||
|
"""
|
||||||
connection = ConfigurationController.get_connection()
|
connection = ConfigurationController.get_connection()
|
||||||
box = QMessageBox(self)
|
box = QMessageBox(self)
|
||||||
box.setWindowTitle("Data Update Needed")
|
box.setWindowTitle("Data Update Needed")
|
||||||
box.setText(
|
box.setText(
|
||||||
"Please download the new data to avoid errors. You have profiles that need the data to function.\n\n"
|
"Please download the new data to avoid errors. You have profiles that need the data to function.\n\n"
|
||||||
f"Connection type: {connection}")
|
f"Connection type: {connection}")
|
||||||
style_message_box(box)
|
|
||||||
sync_button = box.addButton("Sync", QMessageBox.ButtonRole.AcceptRole)
|
# Apply styling
|
||||||
mark_confirm_button(sync_button)
|
# import it inside the function to reduce load on non-display flows.
|
||||||
box.addButton("Cancel", QMessageBox.ButtonRole.RejectRole)
|
from gui.v2.ui.styles.css.main_ui_css import forced_sync_popup_style
|
||||||
|
stylesheet = forced_sync_popup_style
|
||||||
|
box.setStyleSheet(stylesheet)
|
||||||
|
|
||||||
|
# Add styled buttons
|
||||||
|
sync_button = box.addButton("Ok Fetch", QMessageBox.ButtonRole.AcceptRole)
|
||||||
|
sync_button.setCursor(Qt.CursorShape.PointingHandCursor)
|
||||||
|
cancel_button = box.addButton("Cancel", QMessageBox.ButtonRole.RejectRole)
|
||||||
|
cancel_button.setCursor(Qt.CursorShape.PointingHandCursor)
|
||||||
|
box.setMinimumWidth(450) # button size
|
||||||
box.exec()
|
box.exec()
|
||||||
|
|
||||||
if box.clickedButton() == sync_button:
|
if box.clickedButton() == sync_button:
|
||||||
self.sync()
|
self.sync()
|
||||||
|
|
||||||
|
|
||||||
def perform_update_check(self):
|
def perform_update_check(self):
|
||||||
from core.controllers.ClientController import ClientController
|
from core.controllers.ClientController import ClientController
|
||||||
update_available = ClientController.can_be_updated()
|
update_available = ClientController.can_be_updated()
|
||||||
|
|
|
||||||
|
|
@ -219,7 +219,7 @@ class MenuPage(Page):
|
||||||
|
|
||||||
protocol = profile.connection.code
|
protocol = profile.connection.code
|
||||||
|
|
||||||
# print(f"DEBUG: the type is = {type(profile.location)}, value = {profile.location}")
|
print(f"DEBUG: the type is = {type(profile.location)}, value = {profile.location}")
|
||||||
|
|
||||||
if isinstance(profile.location, dict):
|
if isinstance(profile.location, dict):
|
||||||
# Fake/missing data — show placeholders from data,
|
# Fake/missing data — show placeholders from data,
|
||||||
|
|
|
||||||
22
gui/v2/ui/styles/css/main_ui_css.py
Normal file
22
gui/v2/ui/styles/css/main_ui_css.py
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
|
||||||
|
|
||||||
|
forced_sync_popup_style = """
|
||||||
|
QPushButton {
|
||||||
|
background-color: #3498db;
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
border-radius: 5px;
|
||||||
|
padding: 8px 20px;
|
||||||
|
font-weight: bold;
|
||||||
|
min-width: 80px;
|
||||||
|
}
|
||||||
|
QPushButton:hover {
|
||||||
|
background-color: #2980b9;
|
||||||
|
}
|
||||||
|
QPushButton[text="Cancel"] {
|
||||||
|
background-color: #e74c3c;
|
||||||
|
}
|
||||||
|
QPushButton[text="Cancel"]:hover {
|
||||||
|
background-color: #c0392b;
|
||||||
|
}
|
||||||
|
"""
|
||||||
Loading…
Reference in a new issue