use python

pull/6/head
axtlos 2 years ago
parent ffc593ead8
commit b152fd5014

@ -1,20 +0,0 @@
<p align="center">
<a href="https://github.com/crystal-linux/todo/">
<img src="https://github.com/crystal-linux/branding/blob/main/logos/crystal-logo-minimal.png?raw=true" alt="Logo" width="150" height="150">
</a>
</p>
<h2 align="center">Jade</h2>
<p align="center">
<a href="https://discord.gg/yp4xpZeAgW"><img alt="Discord" src="https://img.shields.io/discord/825473796227858482?color=blue&label=Discord&logo=Discord&logoColor=white"?link=https://discord.gg/yp4xpZeAgW&link=https://discord.gg/yp4xpZeAgW> </a>
<img href="https://stopthemingmy.app" src="https://stopthemingmy.app/badge.svg" alt="Please don't theme this app">
</p>
<p align="center"> The libadwaita/gtk based gui installer using jade as the backend
</p>
[The jade gui mockups](https://github.com/crystal-linux/demos-mockups/blob/main/preview.pdf)
![](main-page-screenshot.png)

@ -1,9 +1,9 @@
{
"app-id" : "al.getcryst.jadegui",
"app-id" : "al.getcyrst.jadegui",
"runtime" : "org.gnome.Platform",
"runtime-version" : "42",
"runtime-version" : "master",
"sdk" : "org.gnome.Sdk",
"command" : "al.getcryst.jadegui",
"command" : "jade_gui",
"finish-args" : [
"--share=network",
"--share=ipc",

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop">
<id>al.getcryst.jadegui.desktop</id>
<id>al.getcyrst.jadegui.desktop</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-3.0-or-later</project_license>
<description>

@ -1,7 +1,10 @@
[Desktop Entry]
Name=jade_gui
Exec=al.getcryst.jadegui
Icon=al.getcryst.jadegui
Exec=jade_gui
Icon=al.getcyrst.jadegui
Terminal=false
Type=Application
Categories=GTK;

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<schemalist gettext-domain="jade_gui">
<schema id="al.getcryst.jadegui" path="/al/getcryst/jadegui/">
<schema id="al.getcyrst.jadegui" path="/al/getcyrst/jadegui/">
</schema>
</schemalist>

@ -1,4 +1,4 @@
application_id = 'al.getcryst.jadegui'
application_id = 'al.getcyrst.jadegui'
scalable_dir = join_paths('hicolor', 'scalable', 'apps')
install_data(

@ -1,6 +1,6 @@
desktop_file = i18n.merge_file(
input: 'al.getcryst.jadegui.desktop.in',
output: 'al.getcryst.jadegui.desktop',
input: 'al.getcyrst.jadegui.desktop.in',
output: 'al.getcyrst.jadegui.desktop',
type: 'desktop',
po_dir: '../po',
install: true,
@ -15,8 +15,8 @@ if desktop_utils.found()
endif
appstream_file = i18n.merge_file(
input: 'al.getcryst.jadegui.appdata.xml.in',
output: 'al.getcryst.jadegui.appdata.xml',
input: 'al.getcyrst.jadegui.appdata.xml.in',
output: 'al.getcyrst.jadegui.appdata.xml',
po_dir: '../po',
install: true,
install_dir: join_paths(get_option('datadir'), 'appdata')
@ -29,7 +29,7 @@ if appstream_util.found()
)
endif
install_data('al.getcryst.jadegui.gschema.xml',
install_data('al.getcyrst.jadegui.gschema.xml',
install_dir: join_paths(get_option('datadir'), 'glib-2.0/schemas')
)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

@ -1,7 +1,8 @@
data/al.getcryst.jadegui.desktop.in
data/al.getcryst.jadegui.appdata.xml.in
data/al.getcryst.jadegui.gschema.xml
data/al.getcyrst.jadegui.desktop.in
data/al.getcyrst.jadegui.appdata.xml.in
data/al.getcyrst.jadegui.gschema.xml
src/window.ui
src/main.js
src/window.js
src/main.py
src/window.py

@ -1,11 +0,0 @@
#!@GJS@
imports.package.init({
name: "@PACKAGE_NAME@",
version: "@PACKAGE_VERSION@",
prefix: "@prefix@",
libdir: "@libdir@",
datadir: "@datadir@",
});
import("resource://@resource_path@/js/main.js")
.then((main) => imports.package.run(main))
.catch(logError);

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/al/getcryst/jadegui/js">
<file>main.js</file>
<file>window.js</file>
</gresource>
</gresources>

@ -1,30 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk" version="4.0"/>
<object class="GtkShortcutsWindow" id="help_overlay">
<property name="modal">true</property>
<child>
<object class="GtkShortcutsSection">
<property name="section-name">shortcuts</property>
<property name="max-height">10</property>
<child>
<object class="GtkShortcutsGroup">
<property name="title" translatable="true" context="shortcut window">General</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="title" translatable="true" context="shortcut window">Show Shortcuts</property>
<property name="action-name">win.show-help-overlay</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="title" translatable="true" context="shortcut window">Quit</property>
<property name="action-name">app.quit</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</interface>

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/al/getcryst/jadegui">
<gresource prefix="/al/getcyrst/jadegui">
<file>window.ui</file>
<file>gtk/help-overlay.ui</file>
<file>crystal-logo-minimal.png</file>

@ -0,0 +1,46 @@
#!@PYTHON@
# jade_gui.in
#
# Copyright 2022 user
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
import sys
import signal
import locale
import gettext
VERSION = '@VERSION@'
pkgdatadir = '@pkgdatadir@'
localedir = '@localedir@'
sys.path.insert(1, pkgdatadir)
signal.signal(signal.SIGINT, signal.SIG_DFL)
locale.bindtextdomain('jade_gui', localedir)
locale.textdomain('jade_gui')
gettext.install('jade_gui', localedir)
if __name__ == '__main__':
import gi
from gi.repository import Gio
resource = Gio.Resource.load(os.path.join(pkgdatadir, 'jade_gui.gresource'))
resource._register()
from jade_gui import main
sys.exit(main.main(VERSION))

@ -1,72 +0,0 @@
/* main.js
*
* Copyright 2022 user
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import GObject from 'gi://GObject';
import Gio from 'gi://Gio';
import Gtk from 'gi://Gtk?version=4.0';
import Adw from 'gi://Adw?version=1';
import { JadeGuiWindow } from './window.js';
pkg.initGettext();
pkg.initFormat();
export const JadeGuiApplication = GObject.registerClass(
class JadeGuiApplication extends Adw.Application {
constructor() {
super({application_id: 'al.getcryst.jadegui', flags: Gio.ApplicationFlags.FLAGS_NONE});
const quit_action = new Gio.SimpleAction({name: 'quit'});
quit_action.connect('activate', action => {
this.quit();
});
this.add_action(quit_action);
this.set_accels_for_action('app.quit', ['<primary>q']);
const show_about_action = new Gio.SimpleAction({name: 'about'});
show_about_action.connect('activate', action => {
let aboutParams = {
authors: [
'user'
],
version: '0.1.0',
program_name: 'jade_gui',
transient_for: this.active_window,
modal: true,
};
const aboutDialog = new Gtk.AboutDialog(aboutParams);
aboutDialog.present();
});
this.add_action(show_about_action);
}
vfunc_activate() {
let {active_window} = this;
if (!active_window)
active_window = new JadeGuiWindow(this);
active_window.present();
}
}
);
export function main(argv) {
const application = new JadeGuiApplication();
return application.run(argv);
}

@ -0,0 +1,79 @@
# main.py
#
# Copyright 2022 user
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import sys
import gi
gi.require_version('Gtk', '4.0')
gi.require_version('Adw', '1')
from gi.repository import Gtk, Gio, Adw
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)
self.create_action('quit', self.quit, ['<primary>q'])
self.create_action('about', self.on_about_action)
self.create_action('preferences', self.on_preferences_action)
def do_activate(self):
"""Called when the application is activated.
We raise the application's main window, creating it if
necessary.
"""
win = self.props.active_window
if not win:
win = JadeGuiWindow(application=self, window=win)
win.present()
def on_about_action(self, widget, _):
"""Callback for the app.about action."""
about = AboutDialog(self.props.active_window)
about.present()
def on_preferences_action(self, widget, _):
"""Callback for the app.preferences action."""
print('app.preferences action activated')
def create_action(self, name, callback, shortcuts=None):
"""Add an application action.
Args:
name: the name of the action
callback: the function to be called when the action is
activated
shortcuts: an optional list of accelerators
"""
action = Gio.SimpleAction.new(name, None)
action.connect("activate", callback)
self.add_action(action)
if shortcuts:
self.set_accels_for_action(f"app.{name}", shortcuts)
def main(version):
"""The application's entry point."""
app = Jade_guiApplication()
return app.run(sys.argv)

@ -1,43 +1,46 @@
pkgdatadir = join_paths(get_option('datadir'), meson.project_name())
pkgdatadir = join_paths(get_option('prefix'), get_option('datadir'), meson.project_name())
moduledir = join_paths(pkgdatadir, 'jade_gui')
gnome = import('gnome')
blueprints = custom_target('blueprints',
input: files(
'gtk/help-overlay.blp',
'window.blp',
),
output: '.',
command: [find_program('blueprint-compiler'), 'batch-compile', '@OUTPUT@', '@CURRENT_SOURCE_DIR@', '@INPUT@'],
)
src_res = gnome.compile_resources('al.getcryst.jadegui.src',
'al.getcryst.jadegui.src.gresource.xml',
gnome.compile_resources('jade_gui',
'jade_gui.gresource.xml',
dependencies: blueprints,
gresource_bundle: true,
install: true,
install_dir: pkgdatadir,
)
data_res = gnome.compile_resources('al.getcryst.jadegui.data',
'al.getcryst.jadegui.data.gresource.xml',
gresource_bundle: true,
install: true,
install_dir: pkgdatadir,
)
python = import('python')
bin_conf = configuration_data()
bin_conf.set('GJS', find_program('gjs').full_path())
bin_conf.set('PACKAGE_VERSION', meson.project_version())
bin_conf.set('PACKAGE_NAME', meson.project_name())
bin_conf.set('prefix', get_option('prefix'))
bin_conf.set('libdir', join_paths(get_option('prefix'), get_option('libdir')))
bin_conf.set('datadir', join_paths(get_option('prefix'), get_option('datadir')))
bin_conf.set('resource_path', '/al/getcryst/jadegui')
conf = configuration_data()
conf.set('PYTHON', python.find_installation('python3').path())
conf.set('VERSION', meson.project_version())
conf.set('localedir', join_paths(get_option('prefix'), get_option('localedir')))
conf.set('pkgdatadir', pkgdatadir)
configure_file(
input: 'al.getcryst.jadegui.in',
output: 'al.getcryst.jadegui',
configuration: bin_conf,
input: 'jade_gui.in',
output: 'jade_gui',
configuration: conf,
install: true,
install_dir: get_option('bindir')
)
jade_gui_sources = [
'__init__.py',
'main.py',
'window.py',
]
install_data(jade_gui_sources, install_dir: moduledir)

@ -11,7 +11,7 @@ template JadeGuiWindow : Gtk.ApplicationWindow {
Adw.HeaderBar header_bar {
title-widget: Gtk.Box {
Gtk.Image {
resource: "/al/getcryst/jadegui/crystal-logo-minimal.png";
resource: "/al/getcyrst/jadegui/crystal-logo-minimal.png";
}
Gtk.Label {
margin-start: 2;
@ -30,7 +30,7 @@ template JadeGuiWindow : Gtk.ApplicationWindow {
hexpand: true;
Gtk.Image crystal-logo {
resource: "/al/getcryst/jadegui/crystal-logo-minimal.png";
resource: "/al/getcyrst/jadegui/crystal-logo-minimal.png";
pixel-size: 200;
margin-bottom: 25;
}

@ -1,51 +0,0 @@
/* window.js
*
* Copyright 2022 crystal linux
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import GObject from 'gi://GObject';
import Gtk from 'gi://Gtk';
import Adw from 'gi://Adw';
export const JadeGuiWindow = GObject.registerClass({
GTypeName: 'JadeGuiWindow',
Template: 'resource:///al/getcryst/jadegui/window.ui',
InternalChildren: ['label', 'quitButton', 'nextButton', 'crystal-logo'],
}, class JadeGuiWindow extends Gtk.ApplicationWindow {
_init(application) {
super._init({ application });
this._quitButton.connect('clicked', () => {
confirm_quit();
});
}
});
function confirm_quit() {
const quitDialog = new Gtk.MessageDialog({
text: "Do you want to try\nCrystal without installing?",
transient_for: JadeGuiWindow,
modal: true,
buttons: Gtk.ButtonsType.Ok,
});
quitDialog.connect("response", () => {
quitDialog.close();
});
quitDialog.present();
}

@ -0,0 +1,63 @@
# window.py
#
# Copyright 2022 user
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from gi.repository import Gtk
@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):
super().__init__(**kwargs)
self.quitButton.connect("clicked", self.confirmQuit)
self.window = window
def confirmQuit(self, idk):
def handle_response(_widget, response_id):
if response_id == Gtk.ResponseType.YES:
_widget.destroy()
self.destroy()
elif response_id == Gtk.ResponseType.NO:
_widget.destroy()
dialog = Gtk.MessageDialog(
transient_for=self,
modal=True,
parent=self,
text=_("Do you want to try\nCrystal without installing?"),
buttons=Gtk.ButtonsType.YES_NO
)
dialog.connect("response", handle_response)
dialog.present()
class AboutDialog(Gtk.AboutDialog):
def __init__(self, parent):
Gtk.AboutDialog.__init__(self)
self.props.program_name = 'jade_gui'
self.props.version = "0.1.0"
self.props.authors = ['user']
self.props.copyright = '2022 user'
self.props.logo_icon_name = 'al.getcyrst.jadegui'
self.props.modal = True
self.set_transient_for(parent)

@ -2,98 +2,41 @@
<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">600</property>
<property name="resizable">false</property>
<property name="default-height">300</property>
<child type="titlebar">
<object class="AdwHeaderBar" id="header_bar">
<property name="title-widget">
<object class="GtkBox">
<child>
<object class="GtkImage">
<property name="resource">/al/getcryst/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">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/getcryst/jadegui/crystal-logo-minimal.png</property>
<property name="pixel-size">200</property>
<property name="margin-bottom">25</property>
<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>
</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="quitButton">
<property name="label">No...</property>
<property name="margin-end">12</property>
</object>
</child>
<child>
<object class="GtkButton" id="nextButton">
<property name="margin-start">12</property>
<property name="label">YEAH!</property>
<style>
<class name="suggested-action"/>
</style>
</object>
</child>
</object>
</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>
</child>
</template>
<menu id="primary_menu">
<section>
<item>
<attribute name="label">Prefrences</attribute>
<attribute name="action">app.prefrences</attribute>
<attribute name="label" translatable="yes">_Preferences</attribute>
<attribute name="action">app.preferences</attribute>
</item>
<item>
<attribute name="label">Keyboard Shortcuts</attribute>
<attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute>
<attribute name="action">win.show-help-overlay</attribute>
</item>
<item>
<attribute name="label">About jade_gui</attribute>
<attribute name="label" translatable="yes">_About jade_gui</attribute>
<attribute name="action">app.about</attribute>
</item>
</section>

Loading…
Cancel
Save