wip: add image size

This commit is contained in:
0xMRTT 2023-05-22 21:49:35 +02:00
parent 4d2d2b49b8
commit 0dba648b48
Signed by: 0xMRTT
GPG Key ID: 910B287304120902
3 changed files with 43 additions and 1 deletions

View File

@ -89,6 +89,38 @@ template $ImaginerWindow : Adw.ApplicationWindow {
};
}
}
Adw.ActionRow image_size {
title: _("Image Size");
Gtk.Box {
orientation: horizontal;
spacing: 4;
valign: center;
Gtk.SpinButton image_width_spinbutton {
tooltip-text: _("Image Width");
adjustment: Gtk.Adjustment image_width_adjustment {
lower: 1;
upper: 8192;
step-increment: 1;
page-increment: 5;
};
value-changed => on_image_width_changed();
}
Gtk.SpinButton image_height_spinbutton {
tooltip-text: _("Image Height");
adjustment: Gtk.Adjustment image_height_adjustment {
lower: 1;
upper: 8192;
step-increment: 1;
page-increment: 5;
};
value-changed => on_image_height_changed();
}
}
}
}
Adw.PreferencesGroup {

View File

@ -84,7 +84,6 @@ class KillableThread(threading.Thread):
class ImaginerApplication(Adw.Application):
"""The main application singleton class."""
def __init__(self):
super().__init__(
application_id="page.codeberg.Imaginer.Imaginer",

View File

@ -36,6 +36,8 @@ class ImaginerWindow(Adw.ApplicationWindow):
negative_prompt = Gtk.Template.Child()
menu = Gtk.Template.Child()
label_output = Gtk.Template.Child()
image_width_spinbutton = Gtk.Template.Child()
image_height_spinbutton = Gtk.Template.Child()
def __init__(self, **kwargs):
super().__init__(**kwargs)
@ -59,3 +61,12 @@ class ImaginerWindow(Adw.ApplicationWindow):
self.settings.bind(
"is-fullscreen", self, "fullscreened", Gio.SettingsBindFlags.DEFAULT
)
@Gtk.Template.Callback()
def on_image_width_changed(self, widget):
self.app.width = self.image_width_spinbutton.get_value_as_int()
@Gtk.Template.Callback()
def on_image_height_changed(self, widget):
self.app.height = self.image_height_spinbutton.get_value_as_int()