clan_vm_manager: Renamed Views to ViewStack
All checks were successful
checks / check-links (pull_request) Successful in 21s
checks / checks-impure (pull_request) Successful in 1m57s
checks / checks (pull_request) Successful in 2m22s

This commit is contained in:
Luis Hebendanz 2024-03-03 16:51:34 +07:00
parent 11c3b6f353
commit 47ae5981f6
2 changed files with 7 additions and 7 deletions

View File

@ -7,20 +7,20 @@ gi.require_version("Adw", "1")
from gi.repository import Adw
class Views:
class ViewStack:
"""
This is a singleton.
It is initialized with the first call of use()
Usage:
Views.use().set_visible()
ViewStack.use().set_visible()
Views.use() can also be called before the data is needed. e.g. to eliminate/reduce waiting time.
ViewStack.use() can also be called before the data is needed. e.g. to eliminate/reduce waiting time.
"""
_instance: "None | Views" = None
_instance: "None | ViewStack" = None
view: Adw.ViewStack
# Make sure the VMS class is used as a singleton
@ -28,7 +28,7 @@ class Views:
raise RuntimeError("Call use() instead")
@classmethod
def use(cls: Any) -> "Views":
def use(cls: Any) -> "ViewStack":
if cls._instance is None:
cls._instance = cls.__new__(cls)
cls.view = Adw.ViewStack()

View File

@ -6,7 +6,7 @@ import gi
from clan_cli.history.list import list_history
from clan_vm_manager.components.interfaces import ClanConfig
from clan_vm_manager.singletons.use_views import Views
from clan_vm_manager.singletons.use_views import ViewStack
from clan_vm_manager.singletons.use_vms import ClanStore
from clan_vm_manager.views.details import Details
from clan_vm_manager.views.list import ClanList
@ -39,7 +39,7 @@ class MainWindow(Adw.ApplicationWindow):
threading.Thread(target=self._populate_vms).start()
# Initialize all views
stack_view = Views.use().view
stack_view = ViewStack.use().view
scroll = Gtk.ScrolledWindow()
scroll.set_propagate_natural_height(True)