Merge pull request #414 from aclist/feat/offline-eventbox

feat: offline eventbox
This commit is contained in:
aclist 2026-07-27 20:07:38 +09:00 committed by GitHub
commit 380f6f82a1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 20 additions and 4 deletions

View File

@ -1,4 +1,7 @@
heading = "Play offline"
heading_disclaimer = (
"Not all mod combinations will function offline. Use at your own discretion."
)
mission_button = "Select mission folder"
mission_frame = "Mission"

View File

@ -30,6 +30,9 @@ class InfoEventBox(Gtk.EventBox):
self.connect("leave-notify-event", self._on_leave_tooltip)
self.add(box)
def set_icon_yalign(self, offset: float) -> None:
self.icon.set_property("yalign", offset)
def _on_enter_tooltip(
self, eventbox: Gtk.EventBox, eventcrossing: Gdk.EventCrossing
) -> None:

View File

@ -41,9 +41,18 @@ class FolderError(Enum):
FOLDER_CHANGED = 3
class PageHeading(Gtk.Label):
def __init__(self, label: str) -> None:
super().__init__(label=label, halign=Gtk.Align.CENTER)
class PageHeading(Gtk.Box):
def __init__(self, label: str, controller: "Controller") -> None:
super().__init__(
halign=Gtk.Align.CENTER, orientation=Gtk.Orientation.HORIZONTAL
)
self.label = Gtk.Label(label=label)
self.eb = InfoEventBox(offline.heading_disclaimer, controller)
self.eb.set_icon_yalign(0.7)
for el in self.label, self.eb:
self.add(el)
css.add_class(self, "page-heading")
@ -434,7 +443,8 @@ class OfflineLoader(Gtk.Box):
self.emitter = controller.get_emitter()
self.offline_man = OfflineManager(controller)
self.add(PageHeading(offline.heading))
heading = PageHeading(offline.heading, controller)
self.add(heading)
self.local_frame = ModFrame(self, controller, offline.local_frame)
self.custom_frame = CustomModFrame(self, controller, offline.custom_frame)