fix: statusbar race condition WIP

This commit is contained in:
aclist committed 2026-01-21 12:04:42 +09:00
1 parent 2f9000ee80
commit 9cc1ece0d7
9 files changed
+169 -125

No files matched your search

+3
View File
@@ -93,6 +93,9 @@ class RefreshButton(IconTextButton):
self.connect("clicked", self._on_refresh_clicked)
def _on_refresh_clicked(self, button: Self) -> None:
# TODO: get page enum
print(self.controller.mediator.notebook.get_page_by_enum())
# if .MODS, .LOG, .OPTIONS, reload in place
self.set_sensitive(False)
self.show_time(True)
GLib.timeout_add_seconds(1, self.decrement)
+3 -2
View File
@@ -26,13 +26,14 @@ class InfoEventBox(Gtk.EventBox):
self, eventbox: Gtk.EventBox, eventcrossing: Gdk.EventCrossing
) -> None:
self.icon.set_opacity(1)
self.parent.controller.set_statusbar(self.text)
self.parent.controller.set_statusbar(self.text, "Options")
def _on_leave_tooltip(
self, eventbox: Gtk.EventBox, eventcrossing: Gdk.EventCrossing
) -> None:
self.icon.set_opacity(0.8)
self.parent.controller.set_statusbar("")
#self.parent.controller.set_statusbar("", "Options")
self.parent.controller.remove_statusbar("Options")
def set_text(self, text: str) -> None:
self.text = text
+28 -6
View File
@@ -19,6 +19,7 @@ class Statusbar(Gtk.Grid):
help_text = strings.statusbar_helptext
self.context: int
self.statusbar = Gtk.Statusbar()
self.spinner = Gtk.Spinner()
@@ -31,7 +32,7 @@ class Statusbar(Gtk.Grid):
self.attach_next_to(self.spinner, self.statusbar, Gtk.PositionType.RIGHT, 3, 1)
self.attach_next_to(self.status_right_label, self.spinner, Gtk.PositionType.RIGHT, 3, 1)
self.set_text(help_text)
self.set_text(help_text, "Help")
self.players = ""
def get_text(self) -> str:
@@ -39,20 +40,41 @@ class Statusbar(Gtk.Grid):
label = area.get_children()[0]
return label.get_text()
def set_text(self, string: str) -> None:
if string is None:
return
meta = self.statusbar.get_context_id("Statusbar")
def set_text(self, string: str, context: str) -> None:
# if string is None:
# return
meta = self.statusbar.get_context_id(context)
#tv = self.controller.get_active_treeview()
#cur_context = tv.get_enum()
#cid = self.get_context_by_enum(cur_context)
#if cid != meta:
# print("requested: ", meta)
# print("current: ", cid)
# return
# TODO: substacks
# get_context_id(ServerTab)
self.statusbar.push(meta, string)
#self.set_context(meta)
# TODO: type checking
# def get_context_by_enum(self, context: "ServerTab") -> int:
# cid = self.statusbar.get_context_id(str(context))
# # TODO: substacks
# return cid
#
# def get_context(self) -> int:
# return self.context
#
# def set_context(self, context: int) -> None:
# self.context = context
def refresh(self, row: "RowType") -> None:
if row is None:
formatted = ""
else:
formatted = self.format_metadata(row)
self.set_text(formatted)
self.set_text(formatted, "Help")
def append_distance(self, dist: str) -> None:
# TODO: process strings in controller