Adding support for production.
This commit is contained in:
parent
f930f6151f
commit
026538cd94
@ -25,6 +25,7 @@ has device => ( is => 'rw' );
|
|||||||
has _pay_url => ( is => 'lazy' );
|
has _pay_url => ( is => 'lazy' );
|
||||||
has _activated => ( is => 'rw' );
|
has _activated => ( is => 'rw' );
|
||||||
has _last_valid_preview_file => ( is => 'rw' );
|
has _last_valid_preview_file => ( is => 'rw' );
|
||||||
|
has _is_showing_paywall => (is => 'rw');
|
||||||
has file_format => (
|
has file_format => (
|
||||||
is => 'rw',
|
is => 'rw',
|
||||||
default => sub {
|
default => sub {
|
||||||
@ -128,7 +129,8 @@ sub start( $self, $exd_file ) {
|
|||||||
$execute_log->set_editable(0);
|
$execute_log->set_editable(0);
|
||||||
$execute_log->set_cursor_visible(0);
|
$execute_log->set_cursor_visible(0);
|
||||||
|
|
||||||
$win->set_title('Hiperthermia (Thermal Printer) ' . ($self->_exd->debug ? 'DEBUG' : '') );
|
$win->set_title( 'Hiperthermia (Thermal Printer) '
|
||||||
|
. ( $self->_exd->debug ? 'DEBUG' : '' ) );
|
||||||
$win->set_default_size( 1200, 900 );
|
$win->set_default_size( 1200, 900 );
|
||||||
|
|
||||||
$execute_log->set_hexpand(1);
|
$execute_log->set_hexpand(1);
|
||||||
@ -169,7 +171,7 @@ sub start( $self, $exd_file ) {
|
|||||||
if ( !$self->_activated ) {
|
if ( !$self->_activated ) {
|
||||||
my $uuid = $self->_exd->uuid;
|
my $uuid = $self->_exd->uuid;
|
||||||
my $instance_id = $self->instance_id;
|
my $instance_id = $self->instance_id;
|
||||||
$self->_add_timeout_paywall($overlay);
|
$self->_show_paywall($overlay);
|
||||||
$self->app->send_packet_check_if_activated( $self, $uuid );
|
$self->app->send_packet_check_if_activated( $self, $uuid );
|
||||||
}
|
}
|
||||||
$win->set_child($overlay);
|
$win->set_child($overlay);
|
||||||
@ -181,10 +183,12 @@ sub _show_about_dialog($self) {
|
|||||||
$window->set_default_size( 650, 650 );
|
$window->set_default_size( 650, 650 );
|
||||||
$window->set_transient_for( $self->window );
|
$window->set_transient_for( $self->window );
|
||||||
$window->set_title('About Hiperthermia');
|
$window->set_title('About Hiperthermia');
|
||||||
my $picture = Gtk4::Picture->new;
|
my $picture = Gtk4::Picture->new;
|
||||||
$picture->set_property('width-request', 256);
|
$picture->set_property( 'width-request', 256 );
|
||||||
$picture->set_property('height-request', 256);
|
$picture->set_property( 'height-request', 256 );
|
||||||
$picture->set_filename(path(__FILE__)->parent->parent->parent->parent->child('exd-logo.png').'');
|
$picture->set_filename(
|
||||||
|
path(__FILE__)->parent->parent->parent->parent->child('exd-logo.png')
|
||||||
|
. '' );
|
||||||
my $label = Gtk4::Label->new(undef);
|
my $label = Gtk4::Label->new(undef);
|
||||||
$label->set_markup(<<"EOF");
|
$label->set_markup(<<"EOF");
|
||||||
Welcome to Hiperthermia.
|
Welcome to Hiperthermia.
|
||||||
@ -225,6 +229,91 @@ EOF
|
|||||||
$window->present;
|
$window->present;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub _show_paywall( $self, $overlay ) {
|
||||||
|
return if $self->_is_showing_paywall;
|
||||||
|
$self->_is_showing_paywall(1);
|
||||||
|
my $box = Gtk4::Box->new( 'vertical', 10 );
|
||||||
|
$self->_transparent_avoid_input($box);
|
||||||
|
$box->set_opacity(0.7);
|
||||||
|
$box->add_css_class('avoid-main-input');
|
||||||
|
$box->set_halign('fill');
|
||||||
|
$box->set_valign('fill');
|
||||||
|
my $paywall = Gtk4::Box->new( 'vertical', 10 );
|
||||||
|
$self->_paywall($paywall);
|
||||||
|
|
||||||
|
$paywall->set_property( 'width-request', 800 );
|
||||||
|
$paywall->set_property( 'height-request', 800 );
|
||||||
|
$paywall->add_css_class('paywall');
|
||||||
|
my $inner_paywall_box = Gtk4::Box->new( 'vertical', 10 );
|
||||||
|
my $title = Gtk4::Label->new('This program is not activated');
|
||||||
|
my $activate = Gtk4::Button->new_with_label('Pay and activate');
|
||||||
|
my $about = Gtk4::Button->new_with_label('More about the program');
|
||||||
|
my $remind_me_later = Gtk4::Button->new_with_label('Remind me later');
|
||||||
|
$about->signal_connect(
|
||||||
|
clicked => sub {
|
||||||
|
$self->_show_about_dialog;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
$activate->signal_connect(
|
||||||
|
clicked => sub {
|
||||||
|
my $launcher = Gtk4::UriLauncher->new( $self->_pay_url );
|
||||||
|
$launcher->launch( $self->window, undef, undef );
|
||||||
|
}
|
||||||
|
);
|
||||||
|
$remind_me_later->signal_connect(
|
||||||
|
'clicked' => sub {
|
||||||
|
$self->_is_showing_paywall(0);
|
||||||
|
$overlay->remove_overlay($paywall);
|
||||||
|
$overlay->remove_overlay($box);
|
||||||
|
$self->_paywall(undef);
|
||||||
|
$self->_transparent_avoid_input(undef);
|
||||||
|
$self->_add_timeout_paywall($overlay);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
my $picture = Gtk4::Image->new_from_file(
|
||||||
|
path(__FILE__)->parent->parent->parent->parent->child('exd-logo.png')
|
||||||
|
. '' );
|
||||||
|
$picture->set_pixel_size(256);
|
||||||
|
$inner_paywall_box->append($picture);
|
||||||
|
$inner_paywall_box->append($title);
|
||||||
|
if ( $self->_exd->debug ) {
|
||||||
|
my $debug_message = Gtk4::Label->new(
|
||||||
|
'This is debug compilation, do not use your real payment data but a Stripe test card'
|
||||||
|
);
|
||||||
|
$inner_paywall_box->append($debug_message);
|
||||||
|
}
|
||||||
|
$inner_paywall_box->append($activate);
|
||||||
|
$inner_paywall_box->append($remind_me_later);
|
||||||
|
$inner_paywall_box->append($about);
|
||||||
|
$inner_paywall_box->set_valign('center');
|
||||||
|
$inner_paywall_box->set_vexpand(1);
|
||||||
|
$paywall->set_vexpand(1);
|
||||||
|
$inner_paywall_box->set_halign('center');
|
||||||
|
$paywall->set_halign('center');
|
||||||
|
$paywall->set_valign('fill');
|
||||||
|
$overlay->add_overlay($box);
|
||||||
|
$overlay->add_overlay($paywall);
|
||||||
|
$paywall->append($inner_paywall_box);
|
||||||
|
Glib::Timeout->add(
|
||||||
|
1_000,
|
||||||
|
sub {
|
||||||
|
return 0 if !defined $self->_transparent_avoid_input;
|
||||||
|
if ( $self->_activated ) {
|
||||||
|
if ( defined $self->_paywall ) {
|
||||||
|
$self->_overlay->remove_overlay( $self->_paywall );
|
||||||
|
}
|
||||||
|
if ( defined $self->_transparent_avoid_input ) {
|
||||||
|
$self->_overlay->remove_overlay(
|
||||||
|
$self->_transparent_avoid_input );
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
sub _add_timeout_paywall( $self, $overlay ) {
|
sub _add_timeout_paywall( $self, $overlay ) {
|
||||||
if ( $self->_activated ) {
|
if ( $self->_activated ) {
|
||||||
return 0;
|
return 0;
|
||||||
@ -233,83 +322,7 @@ sub _add_timeout_paywall( $self, $overlay ) {
|
|||||||
Glib::Timeout->add(
|
Glib::Timeout->add(
|
||||||
$self->_exd->debug ? 1_000 : 20_000,
|
$self->_exd->debug ? 1_000 : 20_000,
|
||||||
sub {
|
sub {
|
||||||
my $box = Gtk4::Box->new( 'vertical', 10 );
|
$self->_show_paywall($overlay);
|
||||||
$self->_transparent_avoid_input($box);
|
|
||||||
$box->set_opacity(0.7);
|
|
||||||
$box->add_css_class('avoid-main-input');
|
|
||||||
$box->set_halign('fill');
|
|
||||||
$box->set_valign('fill');
|
|
||||||
my $paywall = Gtk4::Box->new( 'vertical', 10 );
|
|
||||||
$self->_paywall($paywall);
|
|
||||||
|
|
||||||
$paywall->set_property( 'width-request', 800 );
|
|
||||||
$paywall->set_property( 'height-request', 800 );
|
|
||||||
$paywall->add_css_class('paywall');
|
|
||||||
my $inner_paywall_box = Gtk4::Box->new( 'vertical', 10 );
|
|
||||||
my $title = Gtk4::Label->new('This program is not activated');
|
|
||||||
my $activate = Gtk4::Button->new_with_label('Pay and activate');
|
|
||||||
my $about = Gtk4::Button->new_with_label('More about the program');
|
|
||||||
my $remind_me_later =
|
|
||||||
Gtk4::Button->new_with_label('Remind me later');
|
|
||||||
$about->signal_connect(
|
|
||||||
clicked => sub {
|
|
||||||
$self->_show_about_dialog;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
$activate->signal_connect(
|
|
||||||
clicked => sub {
|
|
||||||
my $launcher =
|
|
||||||
Gtk4::UriLauncher->new( $self->_pay_url );
|
|
||||||
$launcher->launch( $self->window, undef, undef );
|
|
||||||
}
|
|
||||||
);
|
|
||||||
$remind_me_later->signal_connect(
|
|
||||||
'clicked' => sub {
|
|
||||||
$overlay->remove_overlay($paywall);
|
|
||||||
$overlay->remove_overlay($box);
|
|
||||||
$self->_paywall(undef);
|
|
||||||
$self->_transparent_avoid_input(undef);
|
|
||||||
$self->_add_timeout_paywall($overlay);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
my $picture = Gtk4::Image->new_from_file(path(__FILE__)->parent->parent->parent->parent->child('exd-logo.png').'');
|
|
||||||
$picture->set_pixel_size(256);
|
|
||||||
$inner_paywall_box->append($picture);
|
|
||||||
$inner_paywall_box->append($title);
|
|
||||||
if ($self->_exd->debug) {
|
|
||||||
my $debug_message = Gtk4::Label->new('This is debug compilation, do not use your real payment data but a Stripe test card');
|
|
||||||
$inner_paywall_box->append($debug_message);
|
|
||||||
}
|
|
||||||
$inner_paywall_box->append($activate);
|
|
||||||
$inner_paywall_box->append($remind_me_later);
|
|
||||||
$inner_paywall_box->append($about);
|
|
||||||
$inner_paywall_box->set_valign('center');
|
|
||||||
$inner_paywall_box->set_vexpand(1);
|
|
||||||
$paywall->set_vexpand(1);
|
|
||||||
$inner_paywall_box->set_halign('center');
|
|
||||||
$paywall->set_halign('center');
|
|
||||||
$paywall->set_valign('fill');
|
|
||||||
$overlay->add_overlay($box);
|
|
||||||
$overlay->add_overlay($paywall);
|
|
||||||
$paywall->append($inner_paywall_box);
|
|
||||||
Glib::Timeout->add(
|
|
||||||
1_000,
|
|
||||||
sub {
|
|
||||||
return 0 if !defined $self->_transparent_avoid_input;
|
|
||||||
if ($self->_activated) {
|
|
||||||
if ( defined $self->_paywall ) {
|
|
||||||
$self->_overlay->remove_overlay( $self->_paywall );
|
|
||||||
}
|
|
||||||
if ( defined $self->_transparent_avoid_input ) {
|
|
||||||
$self->_overlay->remove_overlay(
|
|
||||||
$self->_transparent_avoid_input );
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -373,7 +386,7 @@ sub _create_popover_menu( $self, $box ) {
|
|||||||
$file_menu->append( 'Open', 'app.open.' . $self->instance_id );
|
$file_menu->append( 'Open', 'app.open.' . $self->instance_id );
|
||||||
$file_menu->append( 'Save', 'app.save.' . $self->instance_id );
|
$file_menu->append( 'Save', 'app.save.' . $self->instance_id );
|
||||||
$file_menu->append( 'Save as', 'app.save-as.' . $self->instance_id );
|
$file_menu->append( 'Save as', 'app.save-as.' . $self->instance_id );
|
||||||
$help_menu->append( 'About', 'app.about.' . $self->instance_id);
|
$help_menu->append( 'About', 'app.about.' . $self->instance_id );
|
||||||
$menu_model->append_submenu( 'File', $file_menu );
|
$menu_model->append_submenu( 'File', $file_menu );
|
||||||
$menu_model->append_submenu( 'Help', $help_menu );
|
$menu_model->append_submenu( 'Help', $help_menu );
|
||||||
my $popover = Gtk4::PopoverMenuBar->new_from_model($menu_model);
|
my $popover = Gtk4::PopoverMenuBar->new_from_model($menu_model);
|
||||||
@ -437,7 +450,7 @@ sub _update_editor_buffer($self) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub _populate_preview( $self, $box_editor_preview ) {
|
sub _populate_preview( $self, $box_editor_preview ) {
|
||||||
my $preview_picture = Gtk4::Picture->new;
|
my $preview_picture = Gtk4::Picture->new;
|
||||||
my $preview_scroll_window = Gtk4::ScrolledWindow->new;
|
my $preview_scroll_window = Gtk4::ScrolledWindow->new;
|
||||||
$self->_preview_widget($preview_scroll_window);
|
$self->_preview_widget($preview_scroll_window);
|
||||||
$preview_scroll_window->set_child($preview_picture);
|
$preview_scroll_window->set_child($preview_picture);
|
||||||
@ -532,11 +545,13 @@ sub _add_to_log( $self, $text ) {
|
|||||||
|
|
||||||
sub _on_preview($self) {
|
sub _on_preview($self) {
|
||||||
my $scroll = $self->_preview_widget;
|
my $scroll = $self->_preview_widget;
|
||||||
if ( -f $self->_preview_file
|
if (
|
||||||
&& (!defined $self->_last_valid_preview_file
|
-f $self->_preview_file
|
||||||
|| $self->_last_valid_preview_file ne $self->_preview_file)
|
&& ( !defined $self->_last_valid_preview_file
|
||||||
) {
|
|| $self->_last_valid_preview_file ne $self->_preview_file )
|
||||||
$self->_last_valid_preview_file($self->_preview_file);
|
)
|
||||||
|
{
|
||||||
|
$self->_last_valid_preview_file( $self->_preview_file );
|
||||||
my $preview_picture = Gtk4::Picture->new;
|
my $preview_picture = Gtk4::Picture->new;
|
||||||
$preview_picture->set_filename( '' . $self->_preview_file );
|
$preview_picture->set_filename( '' . $self->_preview_file );
|
||||||
my $image = GD::Image->new( '' . $self->_preview_file );
|
my $image = GD::Image->new( '' . $self->_preview_file );
|
||||||
@ -763,8 +778,9 @@ 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;
|
||||||
$window->set_title(
|
$window->set_title( "Hiperthermia (Thermal Printer) "
|
||||||
"Hiperthermia (Thermal Printer) " . ($self->_exd->debug ? 'DEBUG' : '') . path( $self->_save_path )->basename );
|
. ( $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) );
|
||||||
$self->_update_editor_buffer;
|
$self->_update_editor_buffer;
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,7 @@ sub print($self) {
|
|||||||
if system(
|
if system(
|
||||||
qw/magick/,
|
qw/magick/,
|
||||||
$image_file_in,
|
$image_file_in,
|
||||||
qw/-resize 384x -brightness-contrast +0.8 -dither FloydSteinberg -remap pattern:gray50/,
|
qw/-resize 384x -brightness-contrast +0.1 -dither FloydSteinberg -remap pattern:gray50/,
|
||||||
$image_file_out
|
$image_file_out
|
||||||
);
|
);
|
||||||
$image_final = Exd::Utils::get_gd_image( $image_file_out . '' );
|
$image_final = Exd::Utils::get_gd_image( $image_file_out . '' );
|
||||||
|
@ -102,6 +102,7 @@ modules:
|
|||||||
- 'cd HiperthermiaSource; perl lib/Exd/FileFormat/Fontconfig.pm'
|
- 'cd HiperthermiaSource; perl lib/Exd/FileFormat/Fontconfig.pm'
|
||||||
- 'cd HiperthermiaSource; perl -Ilib lib/Exd/Gui.pm'
|
- 'cd HiperthermiaSource; perl -Ilib lib/Exd/Gui.pm'
|
||||||
- 'cd HiperthermiaSource; chmod 755 -R _Inline/'
|
- 'cd HiperthermiaSource; chmod 755 -R _Inline/'
|
||||||
|
- 'cp HiperthermiaSource/app_config.prod.json HiperthermiaSource/app_config.json'
|
||||||
- 'cp -vr HiperthermiaSource ${FLATPAK_DEST}/Hiperthermia'
|
- 'cp -vr HiperthermiaSource ${FLATPAK_DEST}/Hiperthermia'
|
||||||
- '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'
|
||||||
|
Loading…
Reference in New Issue
Block a user