honestly i don't even know, it kinda shows the window

pull/6/head
axtlos 2 years ago
parent 6cd8b95ea9
commit 3327f5c606

@ -30,6 +30,7 @@ from .window import JadeGuiWindow, AboutDialog
class Jade_guiApplication(Adw.Application): class Jade_guiApplication(Adw.Application):
"""The main application singleton class.""" """The main application singleton class."""
def __init__(self): def __init__(self):
super().__init__(application_id='al.getcyrst.jadegui', super().__init__(application_id='al.getcyrst.jadegui',
flags=Gio.ApplicationFlags.FLAGS_NONE) 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('about', self.on_about_action)
self.create_action('preferences', self.on_preferences_action) self.create_action('preferences', self.on_preferences_action)
def testResize(self, idk):
self.window.resize(800, 600)
def do_activate(self): def do_activate(self):
"""Called when the application is activated. """Called when the application is activated.
@ -45,7 +49,7 @@ class Jade_guiApplication(Adw.Application):
""" """
win = self.props.active_window win = self.props.active_window
if not win: if not win:
win = JadeGuiWindow(application=self, window=win) win = JadeGuiWindow(application=self)
win.present() win.present()
def on_about_action(self, widget, _): def on_about_action(self, widget, _):

@ -22,6 +22,23 @@ template JadeGuiWindow : Gtk.ApplicationWindow {
styles ["flat"] styles ["flat"]
} }
Gtk.Box {
orientation: horizontal;
vexpand: true;
hexpand: true;
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.Box { Gtk.Box {
orientation: vertical; orientation: vertical;
valign: center; valign: center;
@ -64,4 +81,52 @@ template JadeGuiWindow : Gtk.ApplicationWindow {
} }
} }
} }
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";
}
}
}
}
}
}
}
}
}

@ -18,18 +18,33 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from gi.repository import Gtk from gi.repository import Gtk
from gi.repository import Gdk
import time
@Gtk.Template(resource_path='/al/getcyrst/jadegui/window.ui') @Gtk.Template(resource_path='/al/getcyrst/jadegui/window.ui')
class JadeGuiWindow(Gtk.ApplicationWindow): class JadeGuiWindow(Gtk.ApplicationWindow):
__gtype_name__ = 'JadeGuiWindow' __gtype_name__ = 'JadeGuiWindow'
quitButton = Gtk.Template.Child() quitButton = Gtk.Template.Child()
nextButton = Gtk.Template.Child()
def __init__(self, window, **kwargs): 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) super().__init__(**kwargs)
self.quitButton.connect("clicked", self.confirmQuit) 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): def confirmQuit(self, idk):
@ -50,6 +65,20 @@ class JadeGuiWindow(Gtk.ApplicationWindow):
dialog.connect("response", handle_response) dialog.connect("response", handle_response)
dialog.present() 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): class AboutDialog(Gtk.AboutDialog):
def __init__(self, parent): def __init__(self, parent):

@ -2,43 +2,178 @@
<interface> <interface>
<requires lib="gtk" version="4.0"/> <requires lib="gtk" version="4.0"/>
<template class="JadeGuiWindow" parent="GtkApplicationWindow"> <template class="JadeGuiWindow" parent="GtkApplicationWindow">
<property name="title">Jade</property>
<property name="default-width">600</property> <property name="default-width">600</property>
<property name="default-height">300</property> <property name="default-height">600</property>
<property name="resizable">false</property>
<child type="titlebar"> <child type="titlebar">
<object class="GtkHeaderBar" id="header_bar"> <object class="AdwHeaderBar" id="header_bar">
<child type="end"> <property name="title-widget">
<object class="GtkMenuButton"> <object class="GtkBox">
<property name="icon-name">open-menu-symbolic</property> <child>
<property name="menu-model">primary_menu</property> <object class="GtkImage">
<property name="resource">/al/getcyrst/jadegui/crystal-logo-minimal.png</property>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="margin-start">2</property>
<property name="label">&lt;span font_weight='bold'&gt;Jade&lt;/span&gt;</property>
<property name="use-markup">true</property>
</object>
</child>
</object>
</property>
<style>
<class name="flat"/>
</style>
</object>
</child>
<child>
<object class="GtkBox">
<property name="orientation">horizontal</property>
<property name="vexpand">true</property>
<property name="hexpand">true</property>
<child>
<object class="AdwCarouselIndicatorDots">
<property name="carousel">carousel</property>
<property name="orientation">vertical</property>
</object>
</child>
<child>
<object class="AdwCarousel" id="carousel">
<property name="orientation">horizontal</property>
<property name="vexpand">true</property>
<property name="hexpand">true</property>
<property name="allow-mouse-drag">true</property>
<property name="allow-scroll-wheel">true</property>
<property name="allow-long-swipes">true</property>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="valign">center</property>
<property name="halign">center</property>
<property name="vexpand">true</property>
<property name="hexpand">true</property>
<child>
<object class="GtkImage" id="crystal-logo">
<property name="resource">/al/getcyrst/jadegui/crystal-logo-minimal.png</property>
<property name="pixel-size">200</property>
<property name="margin-bottom">25</property>
</object>
</child>
<child>
<object class="GtkLabel" id="welcome">
<property name="label">&lt;span font_weight='bold' font_size='20pt'&gt;Welcome to jade&lt;/span&gt;</property>
<property name="use-markup">true</property>
</object>
</child>
<child>
<object class="GtkLabel" id="letsstart">
<property name="label">Ready to make your Crystal installation... ready?</property>
<property name="margin-bottom">25</property>
</object>
</child>
<child>
<object class="GtkBox">
<property name="orientation">horizontal</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="vexpand">true</property>
<property name="hexpand">true</property>
<child>
<object class="GtkButton" id="quit_button">
<property name="label">No...</property>
<property name="margin-end">12</property>
</object>
</child>
<child>
<object class="GtkButton" id="next_button">
<property name="margin-start">12</property>
<property name="label">YEAH!</property>
<style>
<class name="suggested-action"/>
</style>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="AdwStatusPage" id="timezone_page">
<property name="title">Let's get started, shall we?</property>
<property name="description">What's your current timezone?</property>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkSearchBar" id="timezoneSearch">
<child>
<object class="GtkSearchEntry" id="entry_search">
<property name="placeholder-text">Search for a timezone...</property>
</object>
</child>
</object>
</child>
<child>
<object class="AdwPreferencesPage">
<child>
<object class="AdwPreferencesGroup">
<child>
<object class="GtkListBox" id="list_timezones">
<property name="selection-mode">none</property>
<style>
<class name="boxed-list"/>
</style>
<child>
<object class="GtkLabel">
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="label">test</property>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="label">test</property>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="label">test</property>
</object> </object>
</child> </child>
<child>
<object class="GtkLabel">
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="label">test</property>
</object> </object>
</child> </child>
<child> <child>
<object class="GtkLabel" id="label"> <object class="GtkLabel">
<property name="label">Hello, World!</property> <property name="margin-top">5</property>
<attributes> <property name="margin-bottom">5</property>
<attribute name="weight" value="bold"/> <property name="label">test</property>
<attribute name="scale" value="2"/> </object>
</attributes> </child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object> </object>
</child> </child>
</template> </template>
<menu id="primary_menu">
<section>
<item>
<attribute name="label" translatable="yes">_Preferences</attribute>
<attribute name="action">app.preferences</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute>
<attribute name="action">win.show-help-overlay</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_About jade_gui</attribute>
<attribute name="action">app.about</attribute>
</item>
</section>
</menu>
</interface> </interface>

Loading…
Cancel
Save