chore: use statusbar internal methods

This commit is contained in:
aclist 2026-05-01 20:45:22 +09:00
parent 63d85b03c1
commit 7a9f0dc096
2 changed files with 8 additions and 17 deletions

View File

@ -18,7 +18,6 @@ from dzgui.const.enum import (
from dzgui.config.userprefs import UserPrefs
from dzgui.const.constants import APP_NAME
from dzgui.controllers.emitter import Emitter
from dzgui.managers.log import LogManager
from dzgui.managers.config import ConfigManager
from dzgui.managers.connection import ConnectionManager
from dzgui.managers.contextmenu import ContextMenuManager
@ -145,18 +144,11 @@ class Controller(GObject.GObject):
window = self.get_window()
self.config_man.save_res_and_quit(treeview, window)
## START STATUSBAR LOGIC
@deprecated("use statusbar internal contexts")
def remove_statusbar(self, context: str) -> None:
c = self.mediator.statusbar.statusbar.get_context_id(context)
self.mediator.statusbar.statusbar.pop(c)
def set_statusbar(self, enum: "NotebookPage | ServerTab", text: str) -> None:
self.mediator.statusbar.set_by_context(enum, text)
# TODO: refactor any modules using this
# cf. eventbox.py
@deprecated("use set_by_context")
def set_statusbar(self, text: str, context: str) -> int:
msg_id = self.mediator.statusbar.set_text(text, context)
return msg_id
def remove_statusbar(self, context: "NotebookPage | ServerTab") -> None:
self.mediator.statusbar.pop(context)
# TODO: StatusBarManager, move out of here
def set_statusbar_dist(self, haversine: "Haversine", enum: "ServerTab") -> None:
@ -188,8 +180,6 @@ class Controller(GObject.GObject):
self.emitter.emit("distcalc_ended", dist, context)
## END STATUSBAR LOGIC
def toggle_config(self, key: Preferences) -> None:
# NOTE: Preferences.DIST is dynamic
if key == Preferences.DIST:

View File

@ -1,4 +1,6 @@
from typing import TYPE_CHECKING
from dzgui.const.enum import NotebookPage
from dzgui.const.constants import HELP_BUBBLE
import gi
@ -32,14 +34,13 @@ class InfoEventBox(Gtk.EventBox):
self, eventbox: Gtk.EventBox, eventcrossing: Gdk.EventCrossing
) -> None:
self.icon.set_opacity(1)
self.controller.set_statusbar(self.text, "Options")
self.controller.set_statusbar(NotebookPage.OPTIONS, self.text)
def _on_leave_tooltip(
self, eventbox: Gtk.EventBox, eventcrossing: Gdk.EventCrossing
) -> None:
self.icon.set_opacity(0.8)
# self.parent.controller.set_statusbar("", "Options")
self.controller.remove_statusbar("Options")
self.controller.remove_statusbar(NotebookPage.OPTIONS)
def set_text(self, text: str) -> None:
self.text = text