Class: TK::SearchLyricsDialog

Inherits:
BaseDialog show all
Defined in:
lib/wiki_lyrics/gui/gui-tk.rb

Instance Attribute Summary

Attributes inherited from BaseDialog

#accepted, #values

Instance Method Summary collapse

Methods inherited from BaseDialog

#destroy, #exec, #get_position, get_screen_size, #get_size, #set_position, #set_size

Constructor Details

#initialize(values) ⇒ SearchLyricsDialog

Returns a new instance of SearchLyricsDialog.



1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
# File 'lib/wiki_lyrics/gui/gui-tk.rb', line 1025

def initialize( values )
	super( values )

	set_size( 300, 140 )

	@shell.title( I18n.get( "gui.searchlyrics.title" ) )

	label = Label.new( @shell, I18n.get( "gui.searchlyrics.search" ) )
	label.grid( "row"=>1, "column"=>1, "columnspan"=>2, "sticky"=>"w" )

	label = Label.new( @shell, I18n.get( "gui.common.artist" ) )
	label.grid( "row"=>2, "column"=>1 )

	@artist_lineedit = TextEdit.new( @shell, @values["artist"] )
	@artist_lineedit.grid( "row"=>2, "column"=>2, "columnspan"=>2, "sticky"=>"ew" )

	label = Label.new( @shell, I18n.get( "gui.common.song" ) )
	label.grid( "row"=>3, "column"=>1 )
	@title_lineedit = TextEdit.new( @shell, @values["title"] )
	@title_lineedit.grid( "row"=>3, "column"=>2, "columnspan"=>2, "sticky"=>"ew" )

	label = Label.new( @shell, I18n.get( "gui.common.album" ) )
	label.grid( "row"=>4, "column"=>1 )
	@album_lineedit = TextEdit.new( @shell, @values["album"] )
	@album_lineedit.grid( "row"=>4, "column"=>2, "columnspan"=>2, "sticky"=>"ew" )

	label = Label.new( @shell, I18n.get( "gui.common.year" ) )
	label.grid( "row"=>5, "column"=>1 )
	@year_spinbox = SpinBox.new( @shell, values["year"] )
	@year_spinbox.set_range( 1900, Date.today().year )
	@year_spinbox.grid( "row"=>5, "column"=>2, "columnspan"=>2, "sticky"=>"ew" )

	buttons = create_action_buttons()
	buttons.grid( "row"=>7, "column"=>1, "columnspan"=>4, "sticky"=>"ew" )

	@shell.grid_rowconfigure( 6, "weight"=>1 )
	@shell.grid_columnconfigure( 2, "weight"=>1 )
	@shell.grid_columnconfigure( 3, "weight"=>1 )
end

Instance Method Details

#acceptObject



1065
1066
1067
1068
1069
1070
1071
1072
1073
# File 'lib/wiki_lyrics/gui/gui-tk.rb', line 1065

def accept()
	@values = {
		"artist"	=> @artist_lineedit.text(),
		"title"		=> @title_lineedit.text(),
		"album"		=> @album_lineedit.text(),
		"year"		=> @year_spinbox.value(),
	}
	super()
end