Change species + dropdown + functional search.

This commit is contained in:
sergiotarxz 2024-03-09 17:05:35 +01:00
parent e40869769c
commit 4e15773d3d
3 changed files with 26 additions and 7 deletions

View File

@ -14,9 +14,12 @@ has _pokemon => ( is => 'rw', );
sub species {
my $self = shift;
my $arg = shift;
my $pokemon = $self->_pokemon;
my $substruct_0 =
Rsaves::find_pokemon_substruct( $pokemon->{substructures}, 0 );
my $substruct_0 = $pokemon->{substructures}[0];
if (defined $arg) {
$substruct_0->{species} = $arg;
}
return $substruct_0->{species};
}

View File

@ -64,10 +64,6 @@ sub start {
sub activate {
my $self = shift;
my $display = Gdk::Display::get_default();
my $icon_theme = Gtk4::IconTheme::get_for_display($display);
$icon_theme->set_search_path(
path(__FILE__)->parent->parent->child('resources/icons')->absolute );
Gtk4::Window::set_default_icon_name('gemetool');
my $menu = Glib::IO::Menu->new;
my $about = Glib::IO::SimpleAction->new( 'about', undef );

View File

@ -8,6 +8,7 @@ use utf8;
use Cairo::GObject;
use Glib;
use Glib::Object::Introspection;
use Glib::IO;
use Path::Tiny;
use Math::Trig;
@ -15,6 +16,8 @@ use Rsaves;
use Moo;
use GEmeTool::View::PokemonEditorWindow;
Glib::Object::Introspection->setup(
basename => 'Gtk',
version => '4.0',
@ -64,7 +67,14 @@ sub start {
my $box = $pc->get_box(0);
my $headerbar = Gtk4::HeaderBar->new;
$headerbar->set_decoration_layout('');
$headerbar->set_title_widget(Gtk4::Label->new('Pokémon Storage System'));
my $title_grid = Gtk4::Grid->new;
$title_grid->attach(Gtk4::Label->new('Pokémon Storage System'), 0, 0, 12, 1);
my $save_button = Gtk4::Button->new_with_label('Save');
$save_button->signal_connect(clicked => sub {
$self->_save->get_pc_system->save;
});
$title_grid->attach($save_button, 0, 1, 2, 1);
$headerbar->set_title_widget($title_grid);
$gtk_window->set_titlebar($headerbar);
$controller_gesture->set_button(1);
$self->_current_box($box);
@ -141,6 +151,16 @@ sub _on_primary_click {
my ( $gesture, $n_press, $x, $y ) = @_;
return if $self->_check_click_next_prev_box( $gesture, $n_press, $x, $y );
return if $self->_check_click_close_box($gesture, $n_press, $x, $y);
return if $self->_check_selected_pokemon;
}
sub _check_selected_pokemon {
my $self = shift;
if (defined $self->get_selected_pokemon) {
my $editor = GEmeTool::View::PokemonEditorWindow->new(pokemon => $self->get_selected_pokemon);
$editor->start;
}
return 1;
}
sub _check_click_close_box {