513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
|
# File 'lib/wiki_lyrics/gui/gui-gtk.rb', line 513
def initialize( values )
super( values )
set_border_width( 5 )
set_resizable( true )
set_default_size( 600, 400 )
resize( 600, 400 )
set_title( I18n.get( "gui.submitalbum.title", values["site_name"] ) )
artist_label = Gtk::Label.new( "<b>#{I18n.get( "gui.common.artist" )}</b>" );
artist_label.set_xalign( 0.9 )
artist_label.set_use_markup( true )
@artist_lineedit = Gtk::Entry.new()
@artist_lineedit.set_text( values["artist"] )
album_label = Gtk::Label.new( "<b>#{I18n.get( "gui.common.album" )}</b>" );
album_label.set_xalign( 0.9 )
album_label.set_use_markup( true )
@album_lineedit = Gtk::Entry.new()
@album_lineedit.set_text( values["album"] )
year_label = Gtk::Label.new( "<b>#{I18n.get( "gui.common.year" )}</b>" );
year_label.set_xalign( 0.9 )
year_label.set_use_markup( true )
@year_spinbox = Gtk::SpinButton.new( Gtk::Adjustment.new( values["year"].to_i(), 1900, Date.today().year, 1, 10, 0 ) )
@year_spinbox.set_numeric( true )
month_label = Gtk::Label.new( "<b>#{I18n.get( "gui.common.month" )}</b>" );
month_label.set_xalign( 0.9 )
month_label.set_use_markup( true )
@month_spinbox = Gtk::SpinButton.new( Gtk::Adjustment.new( values["month"].to_i(), 0, 12, 1, 1, 0 ) )
@month_spinbox.set_numeric( true )
day_label = Gtk::Label.new( "<b>#{I18n.get( "gui.common.day" )}</b>" );
day_label.set_xalign( 0.9 )
day_label.set_use_markup( true )
@day_spinbox = Gtk::SpinButton.new( Gtk::Adjustment.new( values["day"].to_i(), 0, 31, 1, 1, 0 ) )
@day_spinbox.set_numeric( true )
image_label = Gtk::Label.new( "<b>#{I18n.get( "gui.common.image" )}</b>" );
image_label.set_xalign( 0.9 )
image_label.set_use_markup( true )
@image_path_lineedit = Gtk::Entry.new()
if values.include?( "image_path" )
@image_path_lineedit.set_text( values["image_path"] )
@image_button = Gtk::Button.new( "..." )
@image_button.signal_connect( "clicked" ) { browse_image() }
else
@image_path_lineedit.set_text( I18n.get( "gui.submitalbum.coverfound" ) )
@image_path_lineedit.set_sensitive( false )
end
tracks_scrolled_window = Gtk::ScrolledWindow.new()
tracks_scrolled_window.set_policy( Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC )
@tracks_text_buffer = GTK::TextBuffer.new()
@tracks_text_buffer.set_text( values["tracks"] )
@tracks_text = GTK::TextView.new()
@tracks_text.set_indent( 2 )
@tracks_text.set_buffer( @tracks_text_buffer )
tracks_scrolled_window.add( @tracks_text )
@reviewed_checkbox = Gtk::CheckButton.new( I18n.get( "gui.common.reviewed" ) )
@reviewed_checkbox.set_active( false )
buttons = create_action_buttons( "split", I18n.get( "gui.common.submit" ) )
image_hbox = Gtk::HBox.new();
image_hbox.pack_start( @image_path_lineedit, true, true )
image_hbox.pack_start( @image_button, false, true ) if values.include?( "image_path" )
tracks_frame = Gtk::Frame.new()
tracks_frame.add( tracks_scrolled_window )
tracks_frame.set_shadow_type( Gtk::SHADOW_IN )
grid = Gtk::Table.new( 9, 4, false )
grid.set_row_spacings( 3 )
grid.attach( artist_label, 0, 1, 0, 1, Gtk::SHRINK|Gtk::FILL, 0, 5 )
grid.attach( @artist_lineedit, 1, 6, 0, 1, Gtk::EXPAND|Gtk::FILL, 0 )
grid.attach( album_label, 0, 1, 1, 2, Gtk::SHRINK|Gtk::FILL, 0, 5 )
grid.attach( @album_lineedit, 1, 6, 1, 2, Gtk::EXPAND|Gtk::FILL, 0 )
grid.attach( year_label, 0, 1, 2, 3, Gtk::SHRINK|Gtk::FILL, 0, 5 )
grid.attach( @year_spinbox, 1, 2, 2, 3, Gtk::EXPAND|Gtk::FILL, 0 )
grid.attach( month_label, 2, 3, 2, 3, Gtk::SHRINK|Gtk::FILL, 0, 5 )
grid.attach( @month_spinbox, 3, 4, 2, 3, Gtk::EXPAND|Gtk::FILL, 0 )
grid.attach( day_label, 4, 5, 2, 3, Gtk::SHRINK|Gtk::FILL, 0, 5 )
grid.attach( @day_spinbox, 5, 6, 2, 3, Gtk::EXPAND|Gtk::FILL, 0 )
grid.attach( image_label, 0, 1, 3, 4, Gtk::SHRINK|Gtk::FILL, 0, 5 )
grid.attach( image_hbox, 1, 6, 3, 4, Gtk::EXPAND|Gtk::FILL, 0 )
grid.attach( tracks_frame, 0, 6, 4, 5, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL )
grid.attach( @reviewed_checkbox, 0, 6, 5, 6, Gtk::EXPAND|Gtk::FILL, 0 )
grid.attach( buttons, 0, 6, 6, 7, Gtk::EXPAND|Gtk::FILL, 0 )
add( grid )
end
|