Changes trying to get open to work.

This commit is contained in:
Sergiotarxz 2024-10-29 23:34:47 +01:00
parent 6e38cd5b94
commit 2f5c5d08a0
7 changed files with 50 additions and 11 deletions

21
exd-small.svg Normal file
View File

@ -0,0 +1,21 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
width="48.000000pt" height="48.000000pt" viewBox="0 0 48.000000 48.000000"
preserveAspectRatio="xMidYMid meet">
<metadata>
Created by potrace 1.16, written by Peter Selinger 2001-2019
</metadata>
<g transform="translate(0.000000,48.000000) scale(0.100000,-0.100000)"
fill="#000000" stroke="none">
<path d="M137 334 c-4 -4 -7 -14 -7 -22 0 -12 4 -12 20 3 19 17 21 17 41 -1
21 -19 21 -19 18 1 -3 14 -13 21 -34 23 -17 2 -34 0 -38 -4z"/>
<path d="M282 328 c-20 -20 -13 -32 8 -13 20 18 50 15 50 -5 0 -6 5 -8 10 -5
16 10 -8 35 -34 35 -12 0 -27 -5 -34 -12z"/>
<path d="M208 243 c17 -2 47 -2 65 0 17 2 3 4 -33 4 -36 0 -50 -2 -32 -4z"/>
<path d="M140 203 c0 -13 3 -14 8 -6 5 8 43 13 102 16 l95 3 -102 2 c-92 2
-103 0 -103 -15z"/>
<path d="M65 60 c-3 -6 0 -12 7 -15 25 -10 338 0 338 10 0 14 -336 19 -345 5z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1018 B

View File

@ -135,8 +135,10 @@ sub to_zip($self) {
sub from_zip_file( $class, $zip_file ) { sub from_zip_file( $class, $zip_file ) {
my $tempdir = Path::Tiny->tempdir(); my $tempdir = Path::Tiny->tempdir();
say 'hola';
my $zip = Archive::Zip->new($zip_file); my $zip = Archive::Zip->new($zip_file);
$zip->extractTree( '', $tempdir ); $zip->extractTree( '', $tempdir );
say 'adios';
return $class->new( dir => $tempdir ); return $class->new( dir => $tempdir );
} }

View File

@ -102,7 +102,7 @@ sub start($self) {
Glib::IO::resources_register( Glib::IO::resources_register(
Glib::IO::Resource::load( $self->_gresources_path ) ); Glib::IO::Resource::load( $self->_gresources_path ) );
my $app = Adw::Application->new( 'me.sergiotarxz.Exd', my $app = Adw::Application->new( 'me.sergiotarxz.Exd',
[qw/default-flags handles-open/] ); [qw/handles-open/] );
my $bus = Net::DBus->session; my $bus = Net::DBus->session;
my $started = 0; my $started = 0;
eval { eval {
@ -119,16 +119,17 @@ sub start($self) {
); );
$app->signal_connect( $app->signal_connect(
activate => sub { activate => sub {
$self->_activate; $self->_activate(undef);
} }
); );
my $file = shift @ARGV;
$app->signal_connect( $app->signal_connect(
open => sub($files, $hint) { open => sub($files, $hint) {
$self->_activate($files->[0]->get_path); warn $file;
$self->_activate($file);
} }
); );
say @ARGV; $app->run();
$app->run( \@ARGV );
} }
sub _startup($self) { sub _startup($self) {
@ -407,6 +408,7 @@ sub _activate( $self, $exd_file = undef ) {
$self->_run_on_first_time_activation if $self->_first_time; $self->_run_on_first_time_activation if $self->_first_time;
$self->instances->{$instance_id} = $self->instances->{$instance_id} =
Exd::Gui::Instance->new( instance_id => $instance_id, app => $self ); Exd::Gui::Instance->new( instance_id => $instance_id, app => $self );
warn $exd_file;
$self->instances->{$instance_id}->start($exd_file); $self->instances->{$instance_id}->start($exd_file);
} }

View File

@ -74,6 +74,7 @@ sub start( $self, $exd_file ) {
$win->set_show_menubar(1); $win->set_show_menubar(1);
$self->window($win); $self->window($win);
if ( defined $exd_file ) { if ( defined $exd_file ) {
say $exd_file;
$self->_open_file($exd_file); $self->_open_file($exd_file);
} }
my $box_vertical = Gtk4::Box->new( 'vertical', 10 ); my $box_vertical = Gtk4::Box->new( 'vertical', 10 );
@ -756,6 +757,7 @@ sub _open_action($self) {
sub _open_file( $self, $file ) { sub _open_file( $self, $file ) {
$self->_save_path($file); $self->_save_path($file);
my $window = $self->window; my $window = $self->window;
say $self->_save_path;
$window->set_title( $window->set_title(
"Hiperthermia (Thermal Printer) " . ($self->_exd->debug ? 'DEBUG' : '') . path( $self->_save_path )->basename ); "Hiperthermia (Thermal Printer) " . ($self->_exd->debug ? 'DEBUG' : '') . path( $self->_save_path )->basename );
$self->file_format( Exd::FileFormat->from_zip_file($file) ); $self->file_format( Exd::FileFormat->from_zip_file($file) );

View File

@ -1,6 +1,6 @@
[Desktop Entry] [Desktop Entry]
Name=Hiperthermia Name=Hiperthermia
Exec=hiperthermia Exec=hiperthermia %f
Type=Application Type=Application
Icon=me.sergiotarxz.Exd Icon=me.sergiotarxz.Exd
Categories=Development Categories=Development

View File

@ -92,15 +92,16 @@ modules:
- 'glib-compile-resources --sourcedir=${FLATPAK_DEST}/Hiperthermia ${FLATPAK_DEST}/Hiperthermia/resources.xml' - '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.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/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 -Dm755 HiperthermiaSource/run.pl /app/bin/hiperthermia'
- 'install -Dm644 HiperthermiaSource/exd-logo.png /app/share/icons/hicolor/256x256/apps/me.sergiotarxz.Exd.png' - 'install -Dm644 HiperthermiaSource/exd-logo.png /app/share/icons/hicolor/256x256/apps/me.sergiotarxz.Exd.png'
- 'update-mime-database /app/share/mime' - 'update-mime-database /app/share/mime'
# - 'install -Dm644 HiperthermiaSource/me.sergiotarxz.Exd.metainfo.xml -t /app/share/metainfo/' # - 'install -Dm644 HiperthermiaSource/me.sergiotarxz.Exd.metainfo.xml -t /app/share/metainfo/'
sources: sources:
- type: "git" - type: "dir"
url: 'https://git.owlcode.tech/sergiotarxz/Exd' path: .
commit: 'main' # url: 'https://git.owlcode.tech/sergiotarxz/Exd'
# commit: 'main'
# tag: "v0.26" # tag: "v0.26"
dest: 'HiperthermiaSource' dest: 'HiperthermiaSource'

13
run.pl
View File

@ -1,6 +1,17 @@
#!/usr/bin/env perl #!/usr/bin/env perl
use v5.40.0;
use strict;
use warnings;
use File::Basename qw/dirname/;
BEGIN { BEGIN {
chdir '/app/Hiperthermia'; chdir '/app/Hiperthermia';
require '/app/Hiperthermia/scripts/main.pl';
}; };
use lib '/app/Hiperthermia/lib';
use Exd::Gui;
Exd::Gui->new->start();