commit 3d489574f0be210bfb9dadd40477b445d4f5ed60
parent 45604d64dfd6d28c9ca279f194836e556ff28995
Author: lumidify <nobody@lumidify.org>
Date: Mon, 15 Mar 2021 09:00:23 +0100
Add mnemonics to word choice window
Diffstat:
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/transliterate.pl b/transliterate.pl
@@ -347,14 +347,14 @@ sub prompt_choose_word {
$wordlabel->set_alignment(0.0, 0.0);
$vbox->pack_start($wordlabel, FALSE, FALSE, 0);
- my $undo = Gtk3::Button->new("Undo");
+ my $undo = Gtk3::Button->new("_Undo");
$vbox->pack_start($undo, FALSE, FALSE, 0);
$undo->set_sensitive(FALSE);
my $button_vbox = Gtk3::VBox->new(FALSE, 0);
$vbox->pack_start($button_vbox, FALSE, FALSE, 0);
- my $accept = Gtk3::Button->new("Accept changes?");
+ my $accept = Gtk3::Button->new("_Accept changes?");
$vbox->pack_start($accept, FALSE, FALSE, 0);
my $hbox = Gtk3::HBox->new(FALSE, 0);
@@ -369,11 +369,11 @@ sub prompt_choose_word {
$vbox->pack_start($hbox, FALSE, FALSE, 10);
$hbox = Gtk3::HBox->new(FALSE, 5);
- my $skip_button = Gtk3::Button->new("Skip word");
+ my $skip_button = Gtk3::Button->new("Sk_ip word");
$hbox->pack_start($skip_button, FALSE, FALSE, 0);
- my $unknown_button = Gtk3::Button->new("Open in unknown word window");
+ my $unknown_button = Gtk3::Button->new("_Open in unknown word window");
$hbox->pack_start($unknown_button, FALSE, FALSE, 0);
- my $stop_button = Gtk3::Button->new("Stop processing");
+ my $stop_button = Gtk3::Button->new("_Stop processing");
$hbox->pack_start($stop_button, FALSE, FALSE, 0);
$vbox->pack_start($hbox, FALSE, FALSE, 0);
@@ -454,8 +454,11 @@ sub prompt_choose_word {
}
@choices = sort {$choice_nums{$b} <=> $choice_nums{$a}} @choices;
}
+ my $cur_num = 1;
foreach my $word_choice (@choices) {
- my $button = Gtk3::Button->new($word_choice);
+ # the mnemonics don't make sense when the number has more than one digit
+ my $choice_label = $cur_num <= 9 ? "_$cur_num: $word_choice" : $word_choice;
+ my $button = Gtk3::Button->new($choice_label);
$button->signal_connect(
clicked => sub {
$replacements[$cur_replacement]->[1] = $word_choice;
@@ -463,6 +466,7 @@ sub prompt_choose_word {
}, $window);
$button_vbox->pack_start($button, FALSE, FALSE, 0);
$button->show;
+ $cur_num++;
}
};