Class: GTK::SearchLyricsDialog
- Inherits:
-
BaseDialog
- Object
- Gtk::Window
- BaseDialog
- GTK::SearchLyricsDialog
- Defined in:
- lib/wiki_lyrics/gui/gui-gtk.rb
Instance Attribute Summary
Attributes inherited from BaseDialog
Instance Method Summary collapse
- #accept ⇒ Object
-
#initialize(values) ⇒ SearchLyricsDialog
constructor
A new instance of SearchLyricsDialog.
Methods inherited from BaseDialog
Constructor Details
#initialize(values) ⇒ SearchLyricsDialog
Returns a new instance of SearchLyricsDialog.
848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 |
# File 'lib/wiki_lyrics/gui/gui-gtk.rb', line 848 def initialize( values ) super( values ) set_border_width( 5 ) set_resizable( true ) set_default_size( 300, 50 ) set_title( I18n.get( "gui.searchlyrics.title" ) ) group = Gtk::Frame.new( I18n.get( "gui.searchlyrics.search" ) ) artist_label = Gtk::Label.new( I18n.get( "gui.common.artist" ) ) artist_label.set_xalign( 0 ) @artist_lineedit = Gtk::Entry.new() @artist_lineedit.set_text( values["artist"] ) title_label = Gtk::Label.new( I18n.get( "gui.common.song" ) ) title_label.set_xalign( 0 ) @title_lineedit = Gtk::Entry.new() @title_lineedit.set_text( values["title"] ) album_label = Gtk::Label.new( I18n.get( "gui.common.album" ) ); album_label.set_xalign( 0 ) @album_lineedit = Gtk::Entry.new() @album_lineedit.set_text( values["album"] ) year_label = Gtk::Label.new( I18n.get( "gui.common.year" ) ); year_label.set_xalign( 0 ) @year_spinbox = Gtk::SpinButton.new( Gtk::Adjustment.new( values["year"], 1900, Date.today().year, 1, 10, 0 ) ) @year_spinbox.set_numeric( true ) = () grid = Gtk::Table.new( 4, 4, false ) grid.set_row_spacings( 3 ) grid.set_column_spacings( 3 ) grid.attach( artist_label, 0, 1, 0, 1, Gtk::SHRINK|Gtk::FILL, 0, 5 ) grid.attach( @artist_lineedit, 1, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, 0 ) grid.attach( title_label, 0, 1, 1, 2, Gtk::SHRINK|Gtk::FILL, 0, 5 ) grid.attach( @title_lineedit, 1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, 0 ) grid.attach( album_label, 0, 1, 2, 3, Gtk::SHRINK|Gtk::FILL, 0, 5 ) grid.attach( @album_lineedit, 1, 2, 2, 3, Gtk::EXPAND|Gtk::FILL, 0 ) grid.attach( year_label, 0, 1, 3, 4, Gtk::SHRINK|Gtk::FILL, 0, 5 ) grid.attach( @year_spinbox, 1, 2, 3, 4, Gtk::EXPAND|Gtk::FILL, 0 ) group.add( grid ) vbox = Gtk::VBox.new( false, 3 ); vbox.add( group ) vbox.add( ) add( vbox ) end |
Instance Method Details
#accept ⇒ Object
901 902 903 904 905 906 907 908 909 |
# File 'lib/wiki_lyrics/gui/gui-gtk.rb', line 901 def accept() @values = { "artist" => @artist_lineedit.text(), "title" => @title_lineedit.text(), "album" => @album_lineedit.text(), "year" => @year_spinbox.value().to_i(), } super() end |