mirror of
https://github.com/aclist/dztui.git
synced 2026-11-01 15:42:51 +01:00
chore: use statusbar internal methods
This commit is contained in:
1 parent
63d85b03c1
commit
7a9f0dc096
2 files changed
+8
-17
No files matched your search
+4
-14
@@ -18,7 +18,6 @@ from dzgui.const.enum import (
|
|||||||
from dzgui.config.userprefs import UserPrefs
|
from dzgui.config.userprefs import UserPrefs
|
||||||
from dzgui.const.constants import APP_NAME
|
from dzgui.const.constants import APP_NAME
|
||||||
from dzgui.controllers.emitter import Emitter
|
from dzgui.controllers.emitter import Emitter
|
||||||
from dzgui.managers.log import LogManager
|
|
||||||
from dzgui.managers.config import ConfigManager
|
from dzgui.managers.config import ConfigManager
|
||||||
from dzgui.managers.connection import ConnectionManager
|
from dzgui.managers.connection import ConnectionManager
|
||||||
from dzgui.managers.contextmenu import ContextMenuManager
|
from dzgui.managers.contextmenu import ContextMenuManager
|
||||||
@@ -145,18 +144,11 @@ class Controller(GObject.GObject):
|
|||||||
window = self.get_window()
|
window = self.get_window()
|
||||||
self.config_man.save_res_and_quit(treeview, window)
|
self.config_man.save_res_and_quit(treeview, window)
|
||||||
|
|
||||||
## START STATUSBAR LOGIC
|
def set_statusbar(self, enum: "NotebookPage | ServerTab", text: str) -> None:
|
||||||
@deprecated("use statusbar internal contexts")
|
self.mediator.statusbar.set_by_context(enum, text)
|
||||||
def remove_statusbar(self, context: str) -> None:
|
|
||||||
c = self.mediator.statusbar.statusbar.get_context_id(context)
|
|
||||||
self.mediator.statusbar.statusbar.pop(c)
|
|
||||||
|
|
||||||
# TODO: refactor any modules using this
|
def remove_statusbar(self, context: "NotebookPage | ServerTab") -> None:
|
||||||
# cf. eventbox.py
|
self.mediator.statusbar.pop(context)
|
||||||
@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
|
|
||||||
|
|
||||||
# TODO: StatusBarManager, move out of here
|
# TODO: StatusBarManager, move out of here
|
||||||
def set_statusbar_dist(self, haversine: "Haversine", enum: "ServerTab") -> None:
|
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)
|
self.emitter.emit("distcalc_ended", dist, context)
|
||||||
|
|
||||||
## END STATUSBAR LOGIC
|
|
||||||
|
|
||||||
def toggle_config(self, key: Preferences) -> None:
|
def toggle_config(self, key: Preferences) -> None:
|
||||||
# NOTE: Preferences.DIST is dynamic
|
# NOTE: Preferences.DIST is dynamic
|
||||||
if key == Preferences.DIST:
|
if key == Preferences.DIST:
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
from dzgui.const.enum import NotebookPage
|
||||||
from dzgui.const.constants import HELP_BUBBLE
|
from dzgui.const.constants import HELP_BUBBLE
|
||||||
|
|
||||||
import gi
|
import gi
|
||||||
@@ -32,14 +34,13 @@ class InfoEventBox(Gtk.EventBox):
|
|||||||
self, eventbox: Gtk.EventBox, eventcrossing: Gdk.EventCrossing
|
self, eventbox: Gtk.EventBox, eventcrossing: Gdk.EventCrossing
|
||||||
) -> None:
|
) -> None:
|
||||||
self.icon.set_opacity(1)
|
self.icon.set_opacity(1)
|
||||||
self.controller.set_statusbar(self.text, "Options")
|
self.controller.set_statusbar(NotebookPage.OPTIONS, self.text)
|
||||||
|
|
||||||
def _on_leave_tooltip(
|
def _on_leave_tooltip(
|
||||||
self, eventbox: Gtk.EventBox, eventcrossing: Gdk.EventCrossing
|
self, eventbox: Gtk.EventBox, eventcrossing: Gdk.EventCrossing
|
||||||
) -> None:
|
) -> None:
|
||||||
self.icon.set_opacity(0.8)
|
self.icon.set_opacity(0.8)
|
||||||
# self.parent.controller.set_statusbar("", "Options")
|
self.controller.remove_statusbar(NotebookPage.OPTIONS)
|
||||||
self.controller.remove_statusbar("Options")
|
|
||||||
|
|
||||||
def set_text(self, text: str) -> None:
|
def set_text(self, text: str) -> None:
|
||||||
self.text = text
|
self.text = text
|
||||||
Reference in new issue
Block a user