Improving the promoted products and adding some new screenshots.

This commit is contained in:
Sergiotarxz 2024-11-09 02:34:00 +01:00
parent 04dc171c25
commit 997259004e
13 changed files with 64 additions and 44 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 375 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 181 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

BIN
images/roll-4.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

View File

@ -436,9 +436,12 @@ sub _create_popover_menu( $self, $box ) {
$file_menu->append( 'Open', 'app.open.' . $self->instance_id );
$file_menu->append( 'Save', 'app.save.' . $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( 'Recommended printers and supplies',
'app.good-printers.' . $self->instance_id );
$help_menu->append(
'Recommended printers and supplies',
'app.good-printers.' . $self->instance_id
);
$help_menu->append( 'About and contact',
'app.about.' . $self->instance_id );
$menu_model->append_submenu( 'File', $file_menu );
$menu_model->append_submenu( 'Help', $help_menu );
my $popover = Gtk4::PopoverMenuBar->new_from_model($menu_model);
@ -448,97 +451,114 @@ sub _create_popover_menu( $self, $box ) {
sub _show_recommended_printers($self) {
my $win = Gtk4::Window->new;
$win->set_title('Recommended printers and supplies');
$win->set_default_size(1000, 700);
$win->set_default_size( 1000, 700 );
my $scroll = Gtk4::ScrolledWindow->new;
my $box = Gtk4::Box->new('vertical', 1);
my $box = Gtk4::Box->new( 'vertical', 1 );
$scroll->set_child($box);
my $explain = Gtk4::Label->new(undef);
my $explain = Gtk4::Label->new(undef);
my @products = (
{
url => 'https://amzn.to/3V7oV7p',
country => 'USA',
description => 'Tested printer, uses standard protocol, advertised as only working by bluetooth but the model I got works by usb too. Perfectly supported',
url => 'https://amzn.to/3V7oV7p',
country => 'USA',
description =>
'Tested printer, uses standard protocol, advertised as only working by bluetooth but the model I got works by usb too. Perfectly supported',
image => 'images/printer-1.jpg',
},
{
url => 'https://amzn.to/3ULFuFz',
country => 'USA',
url => 'https://amzn.to/3ULFuFz',
country => 'USA',
description => 'Rolls of normal thermal papel',
image => 'images/roll-3.jpg',
image => 'images/roll-3.jpg',
},
{
url => 'https://amzn.to/3O3DGEd',
country => 'Europe',
description => 'Advertised as having bluetooth and usb support, works fine, Perfectly supported',
url => 'https://amzn.to/3YHWT2Z',
country => 'USA',
description => 'Rolls of thermal stickers',
image => 'images/roll-4.jpg',
},
{
url => 'https://amzn.to/48J48fR',
country => 'Europe',
description =>
'Advertised as having bluetooth and usb support, works fine, Perfectly supported',
image => 'images/printer-2.jpg',
},
{
url => 'https://amzn.to/3YXWjj1',
country => 'Europe',
description => 'Tested printer, uses standard protocol, advertised as only working by bluetooth but the model I got works by usb too. Perfectly supported',
url => 'https://amzn.to/3YXWjj1',
country => 'Europe',
description =>
'Tested printer, uses standard protocol, advertised as only working by bluetooth but the model I got works by usb too. Perfectly supported',
image => 'images/printer-1.jpg',
},
{
url => 'https://amzn.to/4elBYZC',
country => 'Europe',
url => 'https://amzn.to/4elBYZC',
country => 'Europe',
description => 'Rolls of normal thermal papel',
image => 'images/roll-1.jpg',
image => 'images/roll-1.jpg',
},
{
url => 'https://amzn.to/4eno7BK',
country => 'Europe',
description => 'Rolls of sticker thermal papel',
image => 'images/roll-2.jpg',
url => 'https://amzn.to/4eno7BK',
country => 'Europe',
description => 'Rolls of thermal stickers',
image => 'images/roll-2.jpg',
},
);
$explain->set_markup(
'<b><big>Recommended products:</big></b>
I get a comission each time you buy one of those using these links.'
<small>[PROMOTED CONTENT] I get a comission each time you buy one of those products using these links.</small>'
);
$explain->set_halign('start');
$box->append($explain);
for my $product (@products) {
my $product_box = Gtk4::Box->new('horizontal', 10);
my $image_file = path(__FILE__)->parent->parent->parent->parent->child($product->{image});
my $product_box = Gtk4::Box->new( 'horizontal', 10 );
my $image_file = path(__FILE__)
->parent->parent->parent->parent->child( $product->{image} );
my $image = Gtk4::Image->new_from_file($image_file);
$image->set_pixel_size(256);
$product_box->append($image);
my $right_side_product_box = Gtk4::Box->new('vertical', 10);
my $label_available_in = Gtk4::Label->new(undef);
my $right_side_product_box = Gtk4::Box->new( 'vertical', 10 );
my $label_available_in = Gtk4::Label->new(undef);
$label_available_in->set_halign('start');
$label_available_in->set_markup('<small>Available in: '.$product->{country}.'</small>');
$label_available_in->set_markup(
'<small>Available in: ' . $product->{country} . '</small>' );
$right_side_product_box->append($label_available_in);
my @lines = split /\n/, $product->{description};
for (my $i = 0; 1 ; $i++) {
if (!($i < scalar @lines)) {
for ( my $i = 0 ; 1 ; $i++ ) {
if ( !( $i < scalar @lines ) ) {
last;
}
my $line = $lines[$i];
my $size_line = 60;
if (length $line > $size_line) {
splice @lines, $i, 1, substr($line, 0, $size_line), substr($line, $size_line);
my $line = $lines[$i];
my $size_line = 85;
if ( length $line > $size_line ) {
splice @lines, $i, 1, substr( $line, 0, $size_line ),
substr( $line, $size_line );
}
}
$product->{description} = join "\n", @lines;
my $label_description = Gtk4::Label->new($product->{description});
my $label_description = Gtk4::Label->new( $product->{description} );
$label_description->set_halign('start');
$right_side_product_box->append($label_description);
my $buy_button = Gtk4::Button->new_with_label('Buy now');
$buy_button->set_margin_end(60);
$buy_button->set_halign('end');
$buy_button->signal_connect(clicked => sub{
my $launcher = Gtk4::UriLauncher->new( $product->{url} );
$launcher->launch( $self->window, undef, undef );
});
$buy_button->signal_connect(
clicked => sub {
my $launcher = Gtk4::UriLauncher->new( $product->{url} );
$launcher->launch( $self->window, undef, undef );
}
);
$buy_button->set_hexpand(1);
$right_side_product_box->append($buy_button);
$product_box->append($right_side_product_box);
$box->append($product_box);
}
$win->set_child($scroll);
$win->set_transient_for( $self->window );
$win->present;

View File

@ -30,7 +30,7 @@
<releases>
<release version="v1.0.7" date="2024-11-08">
<release version="v1.0.8" date="2024-11-08">
<description>
<p>Adding recommended products to use with the IDE</p>
</description>