From 2f5c5d08a018f2f052fabd3a698f22f9fb3b93c1 Mon Sep 17 00:00:00 2001 From: Sergiotarxz Date: Tue, 29 Oct 2024 23:34:47 +0100 Subject: [PATCH] Changes trying to get open to work. --- exd-small.svg | 21 +++++++++++++++++++++ lib/Exd/FileFormat.pm | 2 ++ lib/Exd/Gui.pm | 12 +++++++----- lib/Exd/Gui/Instance.pm | 2 ++ me.sergiotarxz.Exd.desktop | 2 +- me.sergiotarxz.Exd.yml | 9 +++++---- run.pl | 13 ++++++++++++- 7 files changed, 50 insertions(+), 11 deletions(-) create mode 100644 exd-small.svg diff --git a/exd-small.svg b/exd-small.svg new file mode 100644 index 0000000..4d63b40 --- /dev/null +++ b/exd-small.svg @@ -0,0 +1,21 @@ + + + + +Created by potrace 1.16, written by Peter Selinger 2001-2019 + + + + + + + + + diff --git a/lib/Exd/FileFormat.pm b/lib/Exd/FileFormat.pm index cc0f991..e4d6e1e 100644 --- a/lib/Exd/FileFormat.pm +++ b/lib/Exd/FileFormat.pm @@ -135,8 +135,10 @@ sub to_zip($self) { sub from_zip_file( $class, $zip_file ) { my $tempdir = Path::Tiny->tempdir(); + say 'hola'; my $zip = Archive::Zip->new($zip_file); $zip->extractTree( '', $tempdir ); + say 'adios'; return $class->new( dir => $tempdir ); } diff --git a/lib/Exd/Gui.pm b/lib/Exd/Gui.pm index 5b560b6..732d40c 100644 --- a/lib/Exd/Gui.pm +++ b/lib/Exd/Gui.pm @@ -102,7 +102,7 @@ sub start($self) { Glib::IO::resources_register( Glib::IO::Resource::load( $self->_gresources_path ) ); my $app = Adw::Application->new( 'me.sergiotarxz.Exd', - [qw/default-flags handles-open/] ); + [qw/handles-open/] ); my $bus = Net::DBus->session; my $started = 0; eval { @@ -119,16 +119,17 @@ sub start($self) { ); $app->signal_connect( activate => sub { - $self->_activate; + $self->_activate(undef); } ); + my $file = shift @ARGV; $app->signal_connect( open => sub($files, $hint) { - $self->_activate($files->[0]->get_path); + warn $file; + $self->_activate($file); } ); - say @ARGV; - $app->run( \@ARGV ); + $app->run(); } sub _startup($self) { @@ -407,6 +408,7 @@ sub _activate( $self, $exd_file = undef ) { $self->_run_on_first_time_activation if $self->_first_time; $self->instances->{$instance_id} = Exd::Gui::Instance->new( instance_id => $instance_id, app => $self ); + warn $exd_file; $self->instances->{$instance_id}->start($exd_file); } diff --git a/lib/Exd/Gui/Instance.pm b/lib/Exd/Gui/Instance.pm index f30940f..f3e2d05 100644 --- a/lib/Exd/Gui/Instance.pm +++ b/lib/Exd/Gui/Instance.pm @@ -74,6 +74,7 @@ sub start( $self, $exd_file ) { $win->set_show_menubar(1); $self->window($win); if ( defined $exd_file ) { + say $exd_file; $self->_open_file($exd_file); } my $box_vertical = Gtk4::Box->new( 'vertical', 10 ); @@ -756,6 +757,7 @@ sub _open_action($self) { sub _open_file( $self, $file ) { $self->_save_path($file); my $window = $self->window; + say $self->_save_path; $window->set_title( "Hiperthermia (Thermal Printer) " . ($self->_exd->debug ? 'DEBUG' : '') . path( $self->_save_path )->basename ); $self->file_format( Exd::FileFormat->from_zip_file($file) ); diff --git a/me.sergiotarxz.Exd.desktop b/me.sergiotarxz.Exd.desktop index 9eaf138..183d67b 100644 --- a/me.sergiotarxz.Exd.desktop +++ b/me.sergiotarxz.Exd.desktop @@ -1,6 +1,6 @@ [Desktop Entry] Name=Hiperthermia -Exec=hiperthermia +Exec=hiperthermia %f Type=Application Icon=me.sergiotarxz.Exd Categories=Development diff --git a/me.sergiotarxz.Exd.yml b/me.sergiotarxz.Exd.yml index 61b28b8..89f8782 100644 --- a/me.sergiotarxz.Exd.yml +++ b/me.sergiotarxz.Exd.yml @@ -92,15 +92,16 @@ modules: - 'glib-compile-resources --sourcedir=${FLATPAK_DEST}/Hiperthermia ${FLATPAK_DEST}/Hiperthermia/resources.xml' - 'install -Dm644 HiperthermiaSource/me.sergiotarxz.Exd.desktop /app/share/applications/me.sergiotarxz.Exd.desktop' - 'install -Dm644 HiperthermiaSource/me.sergiotarxz.Exd.mime.xml /app/share/mime/packages/me.sergiotarxz.Exd.mime.xml' - - 'install -Dm644 HiperthermiaSource/exd.svg /app/share/icons/hicolor/scalable/mimetypes/me.sergiotarxz.Exd.application-exd.svg' + - 'install -Dm644 HiperthermiaSource/exd-small.svg /app/share/icons/hicolor/scalable/mimetypes/me.sergiotarxz.Exd.application-exd.svg' - 'install -Dm755 HiperthermiaSource/run.pl /app/bin/hiperthermia' - 'install -Dm644 HiperthermiaSource/exd-logo.png /app/share/icons/hicolor/256x256/apps/me.sergiotarxz.Exd.png' - 'update-mime-database /app/share/mime' # - 'install -Dm644 HiperthermiaSource/me.sergiotarxz.Exd.metainfo.xml -t /app/share/metainfo/' sources: - - type: "git" - url: 'https://git.owlcode.tech/sergiotarxz/Exd' - commit: 'main' + - type: "dir" + path: . +# url: 'https://git.owlcode.tech/sergiotarxz/Exd' +# commit: 'main' # tag: "v0.26" dest: 'HiperthermiaSource' diff --git a/run.pl b/run.pl index bca99f9..b94eb9f 100755 --- a/run.pl +++ b/run.pl @@ -1,6 +1,17 @@ #!/usr/bin/env perl +use v5.40.0; +use strict; +use warnings; + +use File::Basename qw/dirname/; + BEGIN { chdir '/app/Hiperthermia'; - require '/app/Hiperthermia/scripts/main.pl'; }; + +use lib '/app/Hiperthermia/lib'; + +use Exd::Gui; + +Exd::Gui->new->start();