Commit 9d8e857d authored by Christian Fibich's avatar Christian Fibich Committed by Stefan Tauner
Browse files

vecs/fiji#60: Allow renaming of FIUs

parent 0fcd1807
......@@ -732,6 +732,12 @@ my %fiumap;
BEGIN {
%fiumap = (
FIU_NAME => {
ini_name => "NAME",
default => "",
help => "Display name for this FIU",
phases_opt => [qw(setup instrument download)]
},
FIU_NET_NAME => {
ini_name => "NET_NAME",
default => "",
......
......@@ -983,7 +983,10 @@ sub _add_fiu ($$) {
push(@{$self->{'settings'}->{'fius'}}, $fiu);
}
my $fr_fiu = $self->{'fr_fius'}->LabFrame('-label' => "FIU$i", -'labelside' => 'acrosstop');
my $name_str = "FIU$i";
$name_str .= ": ".$fiu->{'FIU_NAME'} if (! $fiu->{'FIU_NAME'} =~ /^[ ]*$/);
my $fr_fiu = $self->{'fr_fius'}->LabFrame('-label' => $name_str, -'labelside' => 'acrosstop');
$fr_fiu->gridColumnconfigure(2, -weight => 1);
# forward declarations of widgets used in callbacks:
......@@ -1159,6 +1162,14 @@ sub _add_fiu ($$) {
-msg => "Move FIU $i down."
);
# Button to rename the FIU
my $rename_button = $fr_fiu->Button(
#-text => 'Rename',
-image => Tk::FIJIUtils::rename_image($self->{'mw'}),
-command => [\&_rename_fiu_dialog, $self, $i, $fr_fiu],
);
# Button to delete the FIU
my $del_button = $fr_fiu->Button(
......@@ -1190,8 +1201,12 @@ sub _add_fiu ($$) {
);
# separator line
my $divider = $fr_fiu->Frame(-borderwidth=>1,-relief=>'sunken');
$divider->GeometryRequest(2,0);
my @dividers;
foreach (0..1) {
my $d = $fr_fiu->Frame(-borderwidth=>1,-relief=>'sunken');
$d->GeometryRequest(2,0);
push @dividers, $d;
}
#$lbl->grid(-row=>$r,-column=>0,-rowspan=>2,-sticky=>'w');
$nlbl->grid(-row => 0, -column => 1, -padx => 5, -sticky => 'e');
......@@ -1204,10 +1219,12 @@ sub _add_fiu ($$) {
$model_menu->grid(-row => 0, -column => 5, -sticky => 'ew');
$llbl->grid(-row => 1, -column => 4, -padx => 5, -sticky => 'e');
$mask_entry->grid(-row => 1, -column => 5, -sticky => 'ew');
$divider->grid(-row=> 0, -column => 6, -rowspan => 2, -sticky => 'nsew',-pady=>3,-padx=>5);
$del_button->grid(-row => 0, -column => 7, -rowspan => 2, -padx => 2, -sticky => '');
$up_button->grid(-row => 0, -column => 8, -sticky => 'w',-padx => 3);
$down_button->grid(-row => 1, -column => 8, -sticky => 'w',-padx => 3);
$dividers[0]->grid(-row=> 0, -column => 6, -rowspan => 2, -sticky => 'nsew',-pady=>3,-padx=>5);
$rename_button->grid(-row => 0, -column => 7, -rowspan => 2, -padx => 2, -sticky => '');
$dividers[1]->grid(-row=> 0, -column => 8, -rowspan => 2, -sticky => 'nsew',-pady=>3,-padx=>5);
$del_button->grid(-row => 0, -column => 9, -rowspan => 2, -padx => 2, -sticky => '');
$up_button->grid(-row => 0, -column => 10, -sticky => 'w',-padx => 3);
$down_button->grid(-row => 1, -column => 10, -sticky => 'w',-padx => 3);
$fr_fiu->pack(-side => 'top', -expand => 0, -fill => 'both');
......@@ -1245,6 +1262,29 @@ sub _add_fiu ($$) {
$self->{'settings_canvas'}->update() if defined $self->{'settings_canvas'};
}
sub _rename_fiu_dialog {
my ($self, $i, $labframe) = @_;
my $rename_dialog = $self->{'mw'}->FIJIModalDialog(
-wraplength => $labframe->screenwidth,
-title => "Name for FIU $i",
-buttons => [qw(OK Cancel)]
);
my $e = $rename_dialog->Entry(-text=>@{$self->{settings}->{fius}}[$i]->{'FIU_NAME'});
$e->pack(-side=>'bottom');
my $rv = $rename_dialog->Show();
if ($rv eq "OK" && (!$e->get() =~ /^[ ]*$/)) {
my $name_str = "FIU$i";
$name_str .= ": ".$e->get();
@{$self->{settings}->{fius}}[$i]->{'FIU_NAME'} = $e->get();
$labframe->configure(-label => $name_str);
$self->_check_change();
$self->{'settings_canvas'}->update() if defined $self->{'settings_canvas'};
}
}
sub _update_fields {
my (
$self,
......
......@@ -95,6 +95,16 @@ sub alert_image {
return $alert_image;
}
sub rename_image {
my $rename_image;
if (!defined($rename_image)) {
my $mw = shift;
$rename_image = $mw->Photo(-file => File::Spec->catfile(FIJI_MEDIA_PATH, 'label_edit_48x48.xpm'), -format => 'XPM');
}
return $rename_image;
}
sub save_image {
my $save_image;
if (!defined($save_image)) {
......
/* XPM */
static char * label_edit_48x48_xpm[] = {
"48 48 126 2",
" c None",
". c #575751",
"+ c #555853",
"@ c #888A87",
"# c #DCDCDB",
"$ c #818180",
"% c #555753",
"& c #DDDDDD",
"* c #878886",
"= c #5C5D5A",
"- c #646662",
"; c #555555",
"> c #838482",
", c #616360",
"' c #ABADAB",
") c #565752",
"! c #D7D7D7",
"~ c #565854",
"{ c #E1E1E1",
"] c #B8B8B6",
"^ c #7F817D",
"/ c #DCDDDC",
"( c #8A8B88",
"_ c #E0E1E0",
": c #D0D1D0",
"< c #8A8C89",
"[ c #858684",
"} c #787A77",
"| c #E2E2E1",
"1 c #848683",
"2 c #DBDBDB",
"3 c #555654",
"4 c #545853",
"5 c #CACBCA",
"6 c #90928F",
"7 c #D6D7D6",
"8 c #888986",
"9 c #565652",
"0 c #71736F",
"a c #E6E7E6",
"b c #585A56",
"c c #E0E0DF",
"d c #555852",
"e c #545653",
"f c #C4C4C3",
"g c #969895",
"h c #D1D2D0",
"i c #8E8F8C",
"j c #555951",
"k c #6C6E6B",
"l c #EAEAE9",
"m c #595B57",
"n c #767875",
"o c #E4E5E4",
"p c #BDBEBC",
"q c #9D9E9C",
"r c #949693",
"s c #565653",
"t c #686A67",
"u c #ECEDEC",
"v c #5B5D59",
"w c #727370",
"x c #535953",
"y c #B6B7B5",
"z c #A6A7A5",
"A c #C5C6C4",
"B c #9A9C99",
"C c #545754",
"D c #555653",
"E c #5C5E5A",
"F c #646663",
"G c #F0F0EF",
"H c #60625E",
"I c #6D6F6B",
"J c #EDEDED",
"K c #5A5C58",
"L c #555754",
"M c #70726E",
"N c #7C7E7A",
"O c #9C9D9A",
"P c #D8D9D8",
"Q c #BFC0BE",
"R c #A2A3A1",
"S c #545854",
"T c #6F716D",
"U c #D0D0CF",
"V c #FFFFFF",
"W c #FEFEFE",
"X c #C6C7C6",
"Y c #696B67",
"Z c #5E605C",
"` c #565853",
" . c #C8C8C7",
".. c #FDFDFD",
"+. c #777975",
"@. c #AAABA9",
"#. c #545652",
"$. c #5F615E",
"%. c #C0C0BF",
"&. c #747572",
"*. c #595B56",
"=. c #B3B4B2",
"-. c #B8B9B7",
";. c #A3A4A2",
">. c #61625F",
",. c #535853",
"'. c #6E706C",
"). c #D5D5D5",
"!. c #C3C3C2",
"~. c #626460",
"{. c #5F5F5C",
"]. c #777875",
"^. c #CCCDCC",
"/. c #F4F4F4",
"(. c #8C8D8B",
"_. c #636460",
":. c #575752",
"<. c #505A50",
"[. c #6C6E6A",
"}. c #AFB0AE",
"|. c #656764",
"1. c #5C5E59",
"2. c #595A57",
"3. c #545753",
"4. c #545752",
"5. c #565753",
" ",
" ",
" ",
" ",
" . + + @ # $ ",
" % % % & * % = - ",
" ; % % > # % % % % , ' ",
" ) % % ! * % % % % ~ { ] ",
" % % ^ / % % % % % ( _ ~ . ",
" % % % : < % % % % % # [ % + ",
" % % } | ~ % % % % 1 2 ~ % 3 ",
" 4 % % 5 6 % % % % % 7 8 % % 9 ",
" % % 0 a b % % % % ^ c ~ % d ",
" e % % f g % % % % % h i % % j ",
" ~ % k l m % % % % n o ~ % % ",
" ; % % % % % % % % d ~ % % p q % % % % % 5 r % % s ",
" ; % % + + + + + + s % + b % t u v % % % % w l b % % ",
" x % 3 % % v % % y z % % % % % A B % % C ",
" x D 3 % % E % F G H % % % % I J K % % ",
" L 3 % % M N O P Q % % % % % Q R % % s ",
" S % d % % % ; % % T U V V W X T % % Y G Z % ` ",
" s % ~ 3 % % C % % % F .V V V V ..A +.p @.% % C ",
" 4 + s % #.D % D % % % C % $.%.V V V V V V V V &.% K ",
" 3 % % % % % x ; % % 4 % % *.=.V V V V V V V V -.% m ",
" C % % % e % % % j s ;.V V V V V V V V a >. ",
" C % ,.s 9 '.).V V V V V V !.~.{. ",
" s % x % % ].^.W V /.(._. ",
" :.% ~ % <.% % % % [.}.|.1. ",
" % % % e % ,.% % % % % 2.3. ",
" 4.% ~ #.% j % % % % ~ % % ",
" #.% % % % j 5.% % % % ",
" #.% % % % S 5.+ x % % ",
" #.% % #.% 9 . % % % % . ",
" #.% % C 9 ; L 3 % D . ",
" ~ % % ; L 3 % D . ",
" ~ % ` L 3 % D . ",
" #.% #. s % D . ",
" % % % d D . ",
" 4.% #. % D ; ",
" s % ~ % D . ",
" C % #. d L x ",
" C % e % L x ",
" 4.% L L ",
" % % ",
" ",
" ",
" ",
" "};
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment