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

@ -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: "<span font_weight='bold' font_size='20pt'>Welcome to jade</span>";
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: "<span font_weight='bold' font_size='20pt'>Welcome to jade</span>";
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";
}
}
}
}
}
}
}
}
}

@ -18,18 +18,33 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
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):

@ -2,43 +2,178 @@
<interface>
<requires lib="gtk" version="4.0"/>
<template class="JadeGuiWindow" parent="GtkApplicationWindow">
<property name="title">Jade</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">
<object class="GtkHeaderBar" id="header_bar">
<child type="end">
<object class="GtkMenuButton">
<property name="icon-name">open-menu-symbolic</property>
<property name="menu-model">primary_menu</property>
<object class="AdwHeaderBar" id="header_bar">
<property name="title-widget">
<object class="GtkBox">
<child>
<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>
</child>
</property>
<style>
<class name="flat"/>
</style>
</object>
</child>
<child>
<object class="GtkLabel" id="label">
<property name="label">Hello, World!</property>
<attributes>
<attribute name="weight" value="bold"/>
<attribute name="scale" value="2"/>
</attributes>
<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>
</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>
</child>
</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>

Loading…
Cancel
Save