Merge import buttons into single popover menu, add PyYAML to Flatpak

This commit is contained in:
Pavel Baksy 2026-05-12 23:17:58 +02:00
parent fef8dec193
commit 45100d3d44
3 changed files with 40 additions and 18 deletions

View File

@ -1,7 +1,7 @@
{
"id" : "cz.bugsy.roster",
"runtime" : "org.gnome.Platform",
"runtime-version" : "49",
"runtime-version" : "50",
"sdk" : "org.gnome.Sdk",
"command" : "roster",
"finish-args" : [
@ -28,6 +28,20 @@
]
},
"modules" : [
{
"name" : "python3-pyyaml",
"buildsystem" : "simple",
"build-commands" : [
"pip3 install --no-deps --prefix=/app pyyaml-6.0.3.tar.gz"
],
"sources" : [
{
"type" : "file",
"url" : "https://files.pythonhosted.org/packages/source/P/PyYAML/pyyaml-6.0.3.tar.gz",
"sha256" : "d76623373421df22fb4cf8817020cbb7ef15c725b9d5e45f17e189bfc384190f"
}
]
},
{
"name" : "roster",
"builddir" : true,

View File

@ -3,6 +3,19 @@
<requires lib="gtk" version="4.0"/>
<requires lib="Adw" version="1.0"/>
<menu id="import_menu">
<section>
<item>
<attribute name="label">Import from OpenAPI / Swagger</attribute>
<attribute name="action">win.import-openapi</attribute>
</item>
<item>
<attribute name="label">Import from WSDL</attribute>
<attribute name="action">win.import-wsdl</attribute>
</item>
</section>
</menu>
<template class="RosterWindow" parent="AdwApplicationWindow">
<property name="default-width">1200</property>
<property name="default-height">800</property>
@ -49,20 +62,10 @@
</object>
</child>
<child type="end">
<object class="GtkButton" id="import_wsdl_button">
<object class="GtkMenuButton" id="import_menu_button">
<property name="icon-name">papyrus-vertical-symbolic</property>
<property name="tooltip-text">Import from WSDL</property>
<signal name="clicked" handler="on_import_wsdl_clicked"/>
<style>
<class name="flat"/>
</style>
</object>
</child>
<child type="end">
<object class="GtkButton" id="import_openapi_button">
<property name="icon-name">openapi-import-symbolic</property>
<property name="tooltip-text">Import from OpenAPI / Swagger</property>
<signal name="clicked" handler="on_import_openapi_clicked"/>
<property name="tooltip-text">Import</property>
<property name="menu-model">import_menu</property>
<style>
<class name="flat"/>
</style>

View File

@ -69,8 +69,7 @@ class RosterWindow(Adw.ApplicationWindow):
projects_listbox = Gtk.Template.Child()
add_project_button = Gtk.Template.Child()
import_wsdl_button = Gtk.Template.Child()
import_openapi_button = Gtk.Template.Child()
import_menu_button = Gtk.Template.Child()
# History (hidden but kept for compatibility)
history_listbox = Gtk.Template.Child()
@ -496,6 +495,14 @@ class RosterWindow(Adw.ApplicationWindow):
self.add_action(action)
self.get_application().set_accels_for_action("win.send-request", ["<Control>Return"])
action = Gio.SimpleAction.new("import-openapi", None)
action.connect("activate", lambda a, p: self.on_import_openapi_clicked(None))
self.add_action(action)
action = Gio.SimpleAction.new("import-wsdl", None)
action.connect("activate", lambda a, p: self.on_import_wsdl_clicked(None))
self.add_action(action)
def _on_send_clicked(self, widget):
"""Handle Send button click from a tab widget."""
# Clear previous preprocessing results
@ -1415,7 +1422,6 @@ class RosterWindow(Adw.ApplicationWindow):
widget.original_request = None
widget.modified = True
@Gtk.Template.Callback()
def on_import_wsdl_clicked(self, button):
"""Open the WSDL import dialog."""
projects = self.project_manager.load_projects()
@ -1423,7 +1429,6 @@ class RosterWindow(Adw.ApplicationWindow):
dialog.connect('import-completed', self._on_wsdl_import_completed)
dialog.present(self)
@Gtk.Template.Callback()
def on_import_openapi_clicked(self, button):
"""Open the OpenAPI import dialog."""
projects = self.project_manager.load_projects()