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, _):

@ -23,45 +23,110 @@ template JadeGuiWindow : Gtk.ApplicationWindow {
styles ["flat"] styles ["flat"]
} }
Gtk.Box { Gtk.Box {
orientation: vertical; orientation: horizontal;
valign: center; vexpand: true;
halign: center; hexpand: true;
vexpand: true;
hexpand: true;
Gtk.Image crystal-logo { Adw.CarouselIndicatorDots {
resource: "/al/getcyrst/jadegui/crystal-logo-minimal.png"; carousel: carousel;
pixel-size: 200; orientation: vertical;
margin-bottom: 25; }
} Adw.Carousel carousel {
orientation: horizontal;
vexpand: true;
hexpand: true;
allow-mouse-drag: true;
allow-scroll-wheel: true;
allow-long-swipes: true;
Gtk.Label welcome { Gtk.Box {
label: "<span font_weight='bold' font_size='20pt'>Welcome to jade</span>"; orientation: vertical;
use-markup: true; valign: center;
} halign: center;
vexpand: true;
hexpand: true;
Gtk.Label letsstart { Gtk.Image crystal-logo {
label: "Ready to make your Crystal installation... ready?"; resource: "/al/getcyrst/jadegui/crystal-logo-minimal.png";
margin-bottom: 25; pixel-size: 200;
} margin-bottom: 25;
}
Gtk.Box { Gtk.Label welcome {
orientation: horizontal; label: "<span font_weight='bold' font_size='20pt'>Welcome to jade</span>";
halign: center; use-markup: true;
valign: center; }
vexpand: true;
hexpand: true;
Gtk.Button quitButton { Gtk.Label letsstart {
label: "No..."; label: "Ready to make your Crystal installation... ready?";
margin-end: 12; margin-bottom: 25;
} }
Gtk.Button nextButton { Gtk.Box {
margin-start: 12; orientation: horizontal;
label: "YEAH!"; halign: center;
styles ["suggested-action"] 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";
}
}
}
}
}
}
}
} }
} }

@ -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> </object>
</child> </property>
<style>
<class name="flat"/>
</style>
</object> </object>
</child> </child>
<child> <child>
<object class="GtkLabel" id="label"> <object class="GtkBox">
<property name="label">Hello, World!</property> <property name="orientation">horizontal</property>
<attributes> <property name="vexpand">true</property>
<attribute name="weight" value="bold"/> <property name="hexpand">true</property>
<attribute name="scale" value="2"/> <child>
</attributes> <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>
</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>
</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