src: add window
This commit is contained in:
parent
a037818ea5
commit
eb61483fe4
148
src/window.blp
Normal file
148
src/window.blp
Normal file
@ -0,0 +1,148 @@
|
||||
using Gtk 4.0;
|
||||
using Adw 1;
|
||||
|
||||
template ImaginerWindow : Adw.ApplicationWindow {
|
||||
default-width: 700;
|
||||
default-height: 600;
|
||||
width-request: 300;
|
||||
height-request: 300;
|
||||
title: _("Imaginer");
|
||||
|
||||
Box {
|
||||
orientation: vertical;
|
||||
|
||||
Adw.HeaderBar {
|
||||
[end]
|
||||
MenuButton {
|
||||
icon-name: "open-menu-symbolic";
|
||||
menu-model: main_menu;
|
||||
tooltip-text: _("Main Menu");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Adw.Banner banner {
|
||||
title: _("Error while querying the API");
|
||||
revealed: false;
|
||||
}
|
||||
|
||||
Adw.ToastOverlay toast {
|
||||
Stack stack_imaginer {
|
||||
transition-type: crossfade;
|
||||
|
||||
|
||||
|
||||
StackPage {
|
||||
name: "stack_imagine";
|
||||
child:
|
||||
Adw.PreferencesPage {
|
||||
Adw.PreferencesGroup {
|
||||
Picture image {}
|
||||
height-request: 192;
|
||||
}
|
||||
|
||||
Adw.PreferencesGroup {
|
||||
|
||||
Adw.EntryRow prompt {
|
||||
title: _("Prompt");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Adw.PreferencesGroup {
|
||||
title: _("Options");
|
||||
|
||||
Adw.ActionRow {
|
||||
title: _("Save Location");
|
||||
activatable-widget: button_output;
|
||||
|
||||
|
||||
Button button_output {
|
||||
valign: center;
|
||||
action-name: "app.choose_output";
|
||||
|
||||
Box {
|
||||
spacing: 6;
|
||||
|
||||
Image {
|
||||
icon-name: "document-open-symbolic";
|
||||
}
|
||||
|
||||
Label label_output {
|
||||
label: _("(None)");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Adw.ComboRow provider {
|
||||
title: _("Provider");
|
||||
model: provider_model;
|
||||
}
|
||||
|
||||
Adw.PasswordEntryRow token {
|
||||
title: _("Token");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Adw.PreferencesGroup {
|
||||
Button button_imagine {
|
||||
valign: center;
|
||||
halign: center;
|
||||
label: _("_Imagine");
|
||||
tooltip-text: _("Save location is missing.");
|
||||
use-underline: true;
|
||||
sensitive: false;
|
||||
action-name: "app.imagine";
|
||||
|
||||
styles [
|
||||
"suggested-action",
|
||||
"pill",
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
;
|
||||
}
|
||||
|
||||
StackPage {
|
||||
name: "stack_loading";
|
||||
child:
|
||||
Adw.StatusPage {
|
||||
Spinner spinner_loading {
|
||||
valign: center;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
menu main_menu {
|
||||
section {
|
||||
item {
|
||||
label: _("New Window");
|
||||
action: "app.new_window";
|
||||
}
|
||||
}
|
||||
|
||||
section {
|
||||
item {
|
||||
label: _("Keyboard Shortcuts");
|
||||
action: "win.show-help-overlay";
|
||||
}
|
||||
|
||||
item {
|
||||
label: _("About Imaginer");
|
||||
action: "app.about";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Gtk.StringList provider_model{
|
||||
strings [_("Stable Diffusion"), _("OpenAI"), _("Waifu Diffusion"), _("Open Journey"), _("Nitro Diffusion"), _("Analog Diffusion"), _("Portrait Plus")]
|
||||
}
|
40
src/window.py
Normal file
40
src/window.py
Normal file
@ -0,0 +1,40 @@
|
||||
# window.py
|
||||
#
|
||||
# Copyright 2023 Me
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
from gi.repository import Adw
|
||||
from gi.repository import Gtk
|
||||
|
||||
@Gtk.Template(resource_path='/io/github/ImaginerApp/Imaginer/window.ui')
|
||||
class ImaginerWindow(Adw.ApplicationWindow):
|
||||
__gtype_name__ = 'ImaginerWindow'
|
||||
|
||||
toast = Gtk.Template.Child()
|
||||
stack_imaginer = Gtk.Template.Child()
|
||||
spinner_loading = Gtk.Template.Child()
|
||||
image = Gtk.Template.Child()
|
||||
button_output = Gtk.Template.Child()
|
||||
button_imagine = Gtk.Template.Child()
|
||||
label_output = Gtk.Template.Child()
|
||||
banner = Gtk.Template.Child()
|
||||
prompt = Gtk.Template.Child()
|
||||
token = Gtk.Template.Child()
|
||||
provider = Gtk.Template.Child()
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(**kwargs)
|
Loading…
Reference in New Issue
Block a user