diff --git a/src/main.py b/src/main.py index 6e38437..1f50a21 100644 --- a/src/main.py +++ b/src/main.py @@ -30,6 +30,7 @@ from .window import JadeGuiWindow, AboutDialog class Jade_guiApplication(Adw.Application): """The main application singleton class.""" + def __init__(self): super().__init__(application_id='al.getcyrst.jadegui', flags=Gio.ApplicationFlags.FLAGS_NONE) @@ -37,6 +38,9 @@ class Jade_guiApplication(Adw.Application): self.create_action('about', self.on_about_action) self.create_action('preferences', self.on_preferences_action) + def testResize(self, idk): + self.window.resize(800, 600) + def do_activate(self): """Called when the application is activated. @@ -45,7 +49,7 @@ class Jade_guiApplication(Adw.Application): """ win = self.props.active_window if not win: - win = JadeGuiWindow(application=self, window=win) + win = JadeGuiWindow(application=self) win.present() def on_about_action(self, widget, _): diff --git a/src/window.blp b/src/window.blp index 7f4f6f2..33277b8 100644 --- a/src/window.blp +++ b/src/window.blp @@ -23,45 +23,110 @@ template JadeGuiWindow : Gtk.ApplicationWindow { styles ["flat"] } Gtk.Box { - orientation: vertical; - valign: center; - halign: center; - vexpand: true; - hexpand: true; + orientation: horizontal; + vexpand: true; + hexpand: true; - Gtk.Image crystal-logo { - resource: "/al/getcyrst/jadegui/crystal-logo-minimal.png"; - pixel-size: 200; - margin-bottom: 25; - } + Adw.CarouselIndicatorDots { + carousel: carousel; + orientation: vertical; + } + Adw.Carousel carousel { + orientation: horizontal; + vexpand: true; + hexpand: true; + allow-mouse-drag: true; + allow-scroll-wheel: true; + allow-long-swipes: true; - Gtk.Label welcome { - label: "Welcome to jade"; - use-markup: true; - } + Gtk.Box { + orientation: vertical; + valign: center; + halign: center; + vexpand: true; + hexpand: true; - Gtk.Label letsstart { - label: "Ready to make your Crystal installation... ready?"; - margin-bottom: 25; - } + Gtk.Image crystal-logo { + resource: "/al/getcyrst/jadegui/crystal-logo-minimal.png"; + pixel-size: 200; + margin-bottom: 25; + } - Gtk.Box { - orientation: horizontal; - halign: center; - valign: center; - vexpand: true; - hexpand: true; + Gtk.Label welcome { + label: "Welcome to jade"; + use-markup: true; + } - Gtk.Button quitButton { - label: "No..."; - margin-end: 12; - } + Gtk.Label letsstart { + label: "Ready to make your Crystal installation... ready?"; + margin-bottom: 25; + } - Gtk.Button nextButton { - margin-start: 12; - label: "YEAH!"; - styles ["suggested-action"] - } - } + Gtk.Box { + orientation: horizontal; + halign: center; + valign: center; + vexpand: true; + hexpand: true; + + Gtk.Button quitButton { + label: "No..."; + margin-end: 12; + } + + Gtk.Button nextButton { + margin-start: 12; + label: "YEAH!"; + styles ["suggested-action"] + } + } + } + Adw.StatusPage timezone_page { + title: "Let's get started, shall we?"; + description: "What's your current timezone?"; + Gtk.Box { + orientation: vertical; + Gtk.SearchBar timezoneSearch { + Gtk.SearchEntry entry_search { + placeholder-text: "Search for a timezone..."; + } + } + Adw.PreferencesPage { + Adw.PreferencesGroup { + Gtk.ListBox list_timezones { + selection-mode: none; + styles ["boxed-list"] + Gtk.Label { + margin-top: 5; + margin-bottom: 5; + label: "test"; + } + Gtk.Label { + margin-top: 5; + margin-bottom: 5; + label: "test"; + } + Gtk.Label { + margin-top: 5; + margin-bottom: 5; + label: "test"; + } + Gtk.Label { + margin-top: 5; + margin-bottom: 5; + label: "test"; + } + Gtk.Label { + margin-top: 5; + margin-bottom: 5; + label: "test"; + } + } + } + } + } + } + } } -} \ No newline at end of file +} + diff --git a/src/window.py b/src/window.py index 6de94da..af9e96d 100644 --- a/src/window.py +++ b/src/window.py @@ -18,18 +18,33 @@ # along with this program. If not, see . from gi.repository import Gtk - +from gi.repository import Gdk +import time @Gtk.Template(resource_path='/al/getcyrst/jadegui/window.ui') class JadeGuiWindow(Gtk.ApplicationWindow): __gtype_name__ = 'JadeGuiWindow' quitButton = Gtk.Template.Child() - - def __init__(self, window, **kwargs): + nextButton = Gtk.Template.Child() + carousel = Gtk.Template.Child() + timezone_page = Gtk.Template.Child() + list_timezones = Gtk.Template.Child() + entry_search = Gtk.Template.Child() + timezone_search = Gtk.Template.Child() + event_controller = Gtk.EventControllerKey.new() + def __init__(self, **kwargs): super().__init__(**kwargs) self.quitButton.connect("clicked", self.confirmQuit) - self.window = window + #self.window = window + self.nextButton.connect("clicked", self.nextPage) + self.event_controller.connect("key-released", self.search_timezones) + self.entry_search.add_controller(self.event_controller) + self.timezone_search.set_key_capture_widget(self) + self.list_timezones.connect("row-selected", self.selected_timezone) + + def nextPage(self, idk): + self.carousel.scroll_to(self.timezonePage, True) def confirmQuit(self, idk): @@ -50,6 +65,20 @@ class JadeGuiWindow(Gtk.ApplicationWindow): dialog.connect("response", handle_response) dialog.present() + def selected_timezone(self, widget, row): + print(row.timezone) + + def search_timezones(self, *args): + term = self.entry_search.get_text() + self.list_timezones.set_filter_func(self.filter_timezones, terms) + + @staticmethod + def filter_timezones(row, terms=None): + text = row.get_title().lower() + row.get_subtitle().lower() + if terms.lower() in text: + return True + return False + class AboutDialog(Gtk.AboutDialog): def __init__(self, parent): diff --git a/src/window.ui b/src/window.ui index e9fc336..da32928 100644 --- a/src/window.ui +++ b/src/window.ui @@ -2,43 +2,178 @@ - - -
- - _Preferences - app.preferences - - - _Keyboard Shortcuts - win.show-help-overlay - - - _About jade_gui - app.about - -
-