dictionaries 0.2.177

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of dictionaries might be problematic. Click here for more details.

Files changed (44) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +103 -0
  3. data/bin/dictionaries +7 -0
  4. data/dictionaries.gemspec +85 -0
  5. data/doc/README.gen +86 -0
  6. data/lib/dictionaries.rb +1 -0
  7. data/lib/dictionaries/ask_english_word.rb +135 -0
  8. data/lib/dictionaries/ask_italian_word.rb +84 -0
  9. data/lib/dictionaries/class/ask_word_from_dictionary.rb +672 -0
  10. data/lib/dictionaries/class/colours.rb +55 -0
  11. data/lib/dictionaries/class/set_search_for_this_word.rb +143 -0
  12. data/lib/dictionaries/commandline/parse_commandline.rb +60 -0
  13. data/lib/dictionaries/constants.rb +133 -0
  14. data/lib/dictionaries/gui/gtk/dictionary.rb +216 -0
  15. data/lib/dictionaries/gui/tk/README.md +2 -0
  16. data/lib/dictionaries/gui/tk/dictionary.rb +85 -0
  17. data/lib/dictionaries/project/project_base_directory.rb +22 -0
  18. data/lib/dictionaries/project/project_yaml_directory.rb +23 -0
  19. data/lib/dictionaries/require_project/require_project.rb +10 -0
  20. data/lib/dictionaries/sinatra/app.rb +93 -0
  21. data/lib/dictionaries/sinatra/english_to_german.rb +81 -0
  22. data/lib/dictionaries/toplevel_methods/e.rb +16 -0
  23. data/lib/dictionaries/toplevel_methods/english_to_german.rb +31 -0
  24. data/lib/dictionaries/toplevel_methods/has_key.rb +32 -0
  25. data/lib/dictionaries/toplevel_methods/is_on_roebe.rb +16 -0
  26. data/lib/dictionaries/toplevel_methods/main_file.rb +88 -0
  27. data/lib/dictionaries/toplevel_methods/misc.rb +42 -0
  28. data/lib/dictionaries/toplevel_methods/module_methods.rb +9 -0
  29. data/lib/dictionaries/toplevel_methods/show_help.rb +30 -0
  30. data/lib/dictionaries/version/version.rb +17 -0
  31. data/lib/dictionaries/yaml/chinese.yml +19 -0
  32. data/lib/dictionaries/yaml/danish.yml +4 -0
  33. data/lib/dictionaries/yaml/deutsche_fremdwoerter.yml +1 -0
  34. data/lib/dictionaries/yaml/dutch.yml +3 -0
  35. data/lib/dictionaries/yaml/english.yml +2247 -0
  36. data/lib/dictionaries/yaml/farsi.yml +8 -0
  37. data/lib/dictionaries/yaml/finnish.yml +2 -0
  38. data/lib/dictionaries/yaml/italian.yml +499 -0
  39. data/lib/dictionaries/yaml/japanese.yml +15 -0
  40. data/lib/dictionaries/yaml/portugese.yml +42 -0
  41. data/lib/dictionaries/yaml/russian.yml +10 -0
  42. data/lib/dictionaries/yaml/spanish.yml +126 -0
  43. data/lib/dictionaries/yaml/swedish.yml +113 -0
  44. metadata +204 -0
@@ -0,0 +1,55 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ begin
6
+ require 'colours'
7
+ rescue LoadError; end
8
+
9
+ module Dictionaries
10
+
11
+ class AskWordFromDictionary
12
+
13
+ # ========================================================================= #
14
+ # === green
15
+ # ========================================================================= #
16
+ def green
17
+ Colours::GREEN
18
+ end
19
+
20
+ # ========================================================================= #
21
+ # === brown
22
+ # ========================================================================= #
23
+ def brown(i = '')
24
+ "#{Colours::BROWN}#{i}#{Colours.revert}"
25
+ end
26
+
27
+ # ========================================================================= #
28
+ # === sfancy
29
+ # ========================================================================= #
30
+ def sfancy(i)
31
+ ::Colours.sfancy(i)
32
+ end
33
+
34
+ # ========================================================================= #
35
+ # === simp
36
+ # ========================================================================= #
37
+ def simp(i)
38
+ ::Colours.simp(i)
39
+ end; alias simportant simp # === simportant
40
+
41
+ # ========================================================================= #
42
+ # === sfile
43
+ # ========================================================================= #
44
+ def sfile(i)
45
+ ::Colours.sfile(i)
46
+ end
47
+
48
+ # ========================================================================= #
49
+ # === sdir
50
+ # ========================================================================= #
51
+ def sdir(i)
52
+ ::Colours.sdir(i)
53
+ end
54
+
55
+ end; end
@@ -0,0 +1,143 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'dictionaries/class/set_search_for_this_word.rb'
6
+ # =========================================================================== #
7
+ module Dictionaries
8
+
9
+ class AskWordFromDictionary
10
+
11
+ # ========================================================================= #
12
+ # === set_search_for_this_word (menu tag)
13
+ #
14
+ # This method will also have the menu-functionality of the class.
15
+ # ========================================================================= #
16
+ def set_search_for_this_word(i = :rand)
17
+ i = i.join(' ').strip if i.is_a? Array # This will also handle empty ARGV passed to us.
18
+ i = :rand if i.nil?
19
+ case i
20
+ when :rand, 'rand' # We want a random word here.
21
+ i = return_random_word if @words
22
+ end
23
+ # ======================================================================= #
24
+ # We want a String past this point.
25
+ # ======================================================================= #
26
+ i = i.to_s.dup
27
+ # ======================================================================= #
28
+ # We can not downcase the input since we also try to have it match
29
+ # towards regular english letters. It is a dictionary after all.
30
+ # ======================================================================= #
31
+ # === Chop off last char if it is a question mark.
32
+ # ======================================================================= #
33
+ i.chop! if i.end_with? '?'
34
+ case i # case tag
35
+ # ======================================================================= #
36
+ # === askeng --delay?
37
+ # ======================================================================= #
38
+ when /^-?-?delay\??$/i
39
+ feedback_delay
40
+ # ======================================================================= #
41
+ # === askeng --openall
42
+ # ======================================================================= #
43
+ when 'OPEN','OPE','OP','O','EDIT','OPEN_ALL',/open/,
44
+ 'OPENALL','--openall'
45
+ open_this_file_here(true) # true for "be verbose".
46
+ open_yaml_file_in_main_editor
47
+ exit
48
+ # ======================================================================= #
49
+ # === askeng --n-entries
50
+ # ======================================================================= #
51
+ when 'TOTAL','KEYS','KEYSTATS','--n-entries','--nentries','keys?',
52
+ 'nkeys',/-?-?nwords\??/
53
+ feedback_total_amount_of_keys
54
+ # ======================================================================= #
55
+ # === askeng --stats
56
+ # ======================================================================= #
57
+ when '--stats','--statistics','STATS','STATISTICS','STATS?','--stats?'
58
+ feedback_statistics; exit
59
+ # ======================================================================= #
60
+ # === askeng --help
61
+ # ======================================================================= #
62
+ when 'HELP','--help','show_help','--HELP'
63
+ feedback_help_options # This will also exit.
64
+ # ======================================================================= #
65
+ # === askeng --every_word
66
+ # ======================================================================= #
67
+ when 'SHOW','--show-every-word','--every_word'
68
+ show_every_word
69
+ exit
70
+ # ======================================================================= #
71
+ # === askeng --generate-tab
72
+ # ======================================================================= #
73
+ when 'GENERATE','TAB','GENERATE_COMPLETION','TABCOMPLETION',
74
+ 'COMPLETION','--generate-tab'
75
+ generate_tab_completion
76
+ exit
77
+ # ======================================================================= #
78
+ # === askeng --open-in-browser
79
+ # ======================================================================= #
80
+ when 'OPEN_BROWSER','--open-in-browser'
81
+ open_in_browser
82
+ # ======================================================================= #
83
+ # === askeng --solved
84
+ # ======================================================================= #
85
+ when 'SOLVED',/-?-?solved/
86
+ set_last_word_solved
87
+ # ======================================================================= #
88
+ # === askeng --yaml-file?
89
+ # ======================================================================= #
90
+ when 'FILE?','YAML_FILE?','--yaml-file?'
91
+ feedback_yaml_file
92
+ exit
93
+ # ======================================================================= #
94
+ # === askeng --open-dictionary
95
+ # ======================================================================= #
96
+ when 'OPEN_DICTIONARY','OPEN_DICT','--open-dictionary'
97
+ open_main_yaml_file_in_main_editor
98
+ exit
99
+ # ======================================================================= #
100
+ # === askeng --repeat
101
+ # ======================================================================= #
102
+ when 'REPEAT','--repeat'
103
+ _ = STORE_LAST_QUESTION_ASKED_HERE
104
+ if File.exist? _
105
+ i = File.read(_)
106
+ else
107
+ opnn; e 'The file `'+sfile(_)+'` was not found, thus we can'
108
+ opnn; e 'not read in anything.'
109
+ exit
110
+ end
111
+ # ======================================================================= #
112
+ # === askeng --url
113
+ # ======================================================================= #
114
+ when '--url','URL'
115
+ feedback_url
116
+ # ======================================================================= #
117
+ # === askeng --random
118
+ # ======================================================================= #
119
+ when 'RANDOM','RAND','rand','--random' # Pass through here.
120
+ i = return_random_word if available_keys?
121
+ # else tag
122
+ else # Handle assignment cases next.
123
+ if i.include?('=') and i.downcase.include? 'delay'
124
+ new_delay = i.split('=').last.strip
125
+ e 'It seems as if you may want to assign a new delay.'
126
+ e 'We will thus set the last line of this file here'
127
+ e 'with the new delay of:'
128
+ e ' '+sfancy(new_delay)
129
+ what = File.readlines(Dictionaries::AskEnglishWord.main_file?)
130
+ what[-1,1] = new_delay # Set the new entry here.
131
+ SaveFile.write_what_into(what.join, Dictionaries::AskEnglishWord.main_file?)
132
+ exit
133
+ end
134
+ end
135
+ i = i.to_s.dup
136
+ i = i.downcase if SHALL_WE_DOWNCASE
137
+ if i.size == 1 # We assume that the user wants to get a category.
138
+ i = find_all_matches_for(i).sample
139
+ end
140
+ @search_for_this_word = i # We will search for this word here.
141
+ end
142
+
143
+ end; end
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'dictionaries/commandline/parse_commandline.rb'
6
+ # =========================================================================== #
7
+ require 'dictionaries/toplevel_methods/show_help.rb'
8
+ require 'dictionaries/class/ask_word_from_dictionary.rb'
9
+
10
+ module Dictionaries
11
+
12
+ # ========================================================================= #
13
+ # === Dictionaries.start_gtk_component
14
+ #
15
+ # This module-method will start the GTK component.
16
+ # ========================================================================= #
17
+ def self.start_gtk_component
18
+ require 'dictionaries/gui/gtk/dictionary.rb'
19
+ Dictionaries::GUI::Gtk::Dictionary.run
20
+ end
21
+
22
+ # ========================================================================= #
23
+ # === Dictionaries.parse_commandline
24
+ # ========================================================================= #
25
+ def self.parse_commandline(
26
+ i = ARGV
27
+ )
28
+ if i.is_a? Array
29
+ i.each {|entry| parse_commandline(entry) }
30
+ else
31
+ case i # case tag
32
+ # ===================================================================== #
33
+ # === dictionaries --sinatra
34
+ # ===================================================================== #
35
+ when /^-?-?sinatra$/i
36
+ require 'dictionaries/sinatra/app.rb'
37
+ Dictionaries.start_sinatra_interface
38
+ # ===================================================================== #
39
+ # === dictionaries --n-words?
40
+ # ===================================================================== #
41
+ when /^-?-?n(_|-)?words\??$/i
42
+ e "#{Colours.sfancy(Dictionaries.n_entries?)} english-to-german "\
43
+ "translations are presently registered in this project."
44
+ # ===================================================================== #
45
+ # === dictionaries --gui
46
+ # ===================================================================== #
47
+ when /^-?-?gui$/i,
48
+ /^-?-?gtk$/i,
49
+ /^-?-?start(-|_)?gtk$/i
50
+ start_gtk_component
51
+ # ===================================================================== #
52
+ # === dictionaries --help
53
+ # ===================================================================== #
54
+ when /help/
55
+ show_help
56
+ end
57
+ end
58
+ end
59
+
60
+ end
@@ -0,0 +1,133 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'dictionaries/constants.rb'
6
+ # =========================================================================== #
7
+ require 'dictionaries/project/project_yaml_directory.rb'
8
+ require 'dictionaries/version/version.rb'
9
+
10
+ module Dictionaries
11
+
12
+ # ========================================================================= #
13
+ # === Dictionaries::N
14
+ # ========================================================================= #
15
+ N = "\n"
16
+
17
+ # ========================================================================= #
18
+ # === Dictionaries::URL_FOR_DICT_LEO
19
+ # ========================================================================= #
20
+ URL_FOR_DICT_LEO = 'http://dict.leo.org/'
21
+
22
+ # ========================================================================= #
23
+ # === URL_FOR_ITALIAN_DICTIONARY
24
+ # ========================================================================= #
25
+ URL_FOR_ITALIAN_DICTIONARY = 'http://www.wordreference.com/iten/'
26
+
27
+ # ========================================================================= #
28
+ # === LPAD
29
+ # ========================================================================= #
30
+ LPAD = ' '
31
+
32
+ # ========================================================================= #
33
+ # === RUBY_SRC
34
+ # ========================================================================= #
35
+ if ENV['RUBY_SRC']
36
+ RUBY_SRC = ENV['RUBY_SRC'].to_s.dup+'/'
37
+ else # else we just hardcode it anyway.
38
+ RUBY_SRC = '/Users/x/DATA/PROGRAMMING_LANGUAGES/RUBY/src/'
39
+ end
40
+
41
+ # ========================================================================= #
42
+ # === MY_DICTIONARIES
43
+ #
44
+ # This constant is only valid for my own system.
45
+ # ========================================================================= #
46
+ MY_DICTIONARIES = RUBY_SRC+'dictionaries/lib/dictionaries/yaml/'
47
+
48
+ # ========================================================================= #
49
+ # === SCIENCE_DIR
50
+ # ========================================================================= #
51
+ SCIENCE_DIR = ENV['SCIENCE'].to_s+'/'
52
+
53
+ # ========================================================================= #
54
+ # === DEPOT_INFORMATION_DIR
55
+ # ========================================================================= #
56
+ DEPOT_INFORMATION_DIR = '/Depot/Information/'
57
+
58
+ # ========================================================================= #
59
+ # === DICTIONARIES_DIR
60
+ #
61
+ # This constant will point at a path such as this one here:
62
+ #
63
+ # /Programs/Ruby/2.6.3/lib/ruby/site_ruby/2.6.0/dictionaries/yaml/
64
+ #
65
+ # ========================================================================= #
66
+ DICTIONARIES_DIR = Dictionaries.dictionary_directory?
67
+
68
+ # ========================================================================= #
69
+ # === ENGLISH_WORDS
70
+ #
71
+ # This constant is no longer that important because we can now
72
+ # automatically infer the name of the .yml file.
73
+ # ========================================================================= #
74
+ ENGLISH_WORDS = DICTIONARIES_DIR+'english.yml'
75
+ ENGLISH_YAML_FILE = ENGLISH_WORDS # === ENGLISH_YAML_FILE
76
+ FILE_ENGLISH_WORDS = ENGLISH_WORDS # === FILE_ENGLISH_WORDS
77
+ FILE_ENGLISH_DICTIONARY = ENGLISH_YAML_FILE
78
+
79
+ # ========================================================================= #
80
+ # === Dictionaries.file_english
81
+ # ========================================================================= #
82
+ def self.file_english
83
+ FILE_ENGLISH_DICTIONARY
84
+ end
85
+
86
+ # ========================================================================= #
87
+ # === ITALIAN_WORDS
88
+ #
89
+ # This constant is no longer that important because we can now
90
+ # automatically infer the name of the .yml file.
91
+ # ========================================================================= #
92
+ ITALIAN_WORDS = DICTIONARIES_DIR+'italian.yml'
93
+ ITALIAN_YAML_FILE = ITALIAN_WORDS
94
+ FILE_ITALIAN_DICTIONARY = ITALIAN_YAML_FILE
95
+
96
+ # ========================================================================= #
97
+ # === STORE_LINE_NUMBER_HERE
98
+ # ========================================================================= #
99
+ STORE_LINE_NUMBER_HERE = DEPOT_INFORMATION_DIR+'line_number_of_the_last_word'
100
+
101
+ # ========================================================================= #
102
+ # === STORE_LAST_ENGLISH_QUESTION_ASKED_HERE
103
+ # ========================================================================= #
104
+ STORE_LAST_ENGLISH_QUESTION_ASKED_HERE =
105
+ DEPOT_INFORMATION_DIR+'last_english_question_asked' # cat $MY_TEMP/last_english_question_asked
106
+
107
+ # ========================================================================= #
108
+ # === STORE_LAST_ITALIAN_QUESTION_ASKED_HERE
109
+ # ========================================================================= #
110
+ STORE_LAST_ITALIAN_QUESTION_ASKED_HERE =
111
+ DEPOT_INFORMATION_DIR+'last_italian_question_asked' # cat $MY_TEMP/last_italian_question_asked
112
+
113
+ # ========================================================================= #
114
+ # === SHALL_WE_DOWNCASE
115
+ # ========================================================================= #
116
+ SHALL_WE_DOWNCASE = true
117
+
118
+ # ========================================================================= #
119
+ # === USE_THIS_ENCODING
120
+ #
121
+ # This is the main encoding to use.
122
+ # ========================================================================= #
123
+ USE_THIS_ENCODING = 'ISO-8859-1'
124
+ MAIN_ENCODING = USE_THIS_ENCODING
125
+
126
+ # ========================================================================= #
127
+ # === DEFAULT_DELAY
128
+ #
129
+ # Specify how long to wait before revealing the translated word.
130
+ # ========================================================================= #
131
+ DEFAULT_DELAY = 1.6
132
+
133
+ end
@@ -0,0 +1,216 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # === Dictionaries::GUI::Gtk::Dictionary
6
+ #
7
+ # This is a small GUI-wrapper.
8
+ # =========================================================================== #
9
+ # require 'dictionaries/gui/gtk/dictionary.rb'
10
+ # Dictionaries.gtk_widget
11
+ # =========================================================================== #
12
+ begin
13
+ require 'gtk_paradise'
14
+ rescue LoadError
15
+ puts 'error: gtk_paradise has a problem.'
16
+ end
17
+ require 'dictionaries/class/ask_word_from_dictionary.rb'
18
+ require 'dictionaries/toplevel_methods/e.rb'
19
+
20
+ module Dictionaries
21
+
22
+ module GUI
23
+
24
+ module Gtk
25
+
26
+ class Dictionary < ::Gtk::VBox
27
+
28
+ include ::Gtk::BaseModule
29
+ include ::Colours
30
+
31
+ # ========================================================================= #
32
+ # === USE_THIS_WIDTH
33
+ # ========================================================================= #
34
+ USE_THIS_WIDTH = 1080
35
+
36
+ # ========================================================================= #
37
+ # === initialize
38
+ # ========================================================================= #
39
+ def initialize(
40
+ run_already = true
41
+ )
42
+ super()
43
+ reset
44
+ run if run_already
45
+ end
46
+
47
+ # ========================================================================= #
48
+ # === reset
49
+ # ========================================================================= #
50
+ def reset
51
+ # === @dictionaries
52
+ @dictionaries = Dictionaries.new(:do_not_run_yet)
53
+ @dictionaries.load_the_english_file
54
+ set_gtk_font_size :default
55
+ end
56
+
57
+ # ========================================================================= #
58
+ # === e
59
+ # ========================================================================= #
60
+ def e(i = '')
61
+ ::Dictionaries.e(i)
62
+ end
63
+
64
+ # ========================================================================= #
65
+ # === add_ask_the_question_button
66
+ # ========================================================================= #
67
+ def add_ask_the_question_button
68
+ button = gtk_button('Translate into german')
69
+ button.make_bold
70
+ button.tooltip(
71
+ 'Click this button in order to translate the english '\
72
+ 'word into the german equivalent word.'
73
+ )
74
+ button.signal_connect(:clicked) {
75
+ button_pressed_so_try_to_convert_the_input
76
+ }
77
+ button.modify_bg(
78
+ ::Gtk::StateType::NORMAL, Gdk::Color.parse('whitesmoke')
79
+ ) # ^^^ default colour
80
+ button.modify_bg(
81
+ ::Gtk::StateType::PRELIGHT, Gdk::Color.parse('paleturquoise')
82
+ ) # ^^^ mouse-on-over
83
+ button.modify_bg(
84
+ ::Gtk::StateType::ACTIVE, Gdk::Color.parse('slategray')
85
+ ) # ^^^ colour on mouse-press-event
86
+ pack_start(button, false, true, 0)
87
+ end
88
+
89
+ # ========================================================================= #
90
+ # === create_answer_field
91
+ # ========================================================================= #
92
+ def create_answer_field
93
+ @answer_field = gtk_input_field
94
+ @answer_field.center
95
+ end
96
+
97
+ # ========================================================================= #
98
+ # === create_input_field_on_top
99
+ #
100
+ # This is the main widget for user input. The user types in some
101
+ # words, and then hits the main button on the bottom, in order
102
+ # to translate the (english) word to german.
103
+ # ========================================================================= #
104
+ def create_input_field_on_top
105
+ text_for_the_label = 'Input an english word in the field below:'
106
+ text = gtk_label(text_for_the_label)
107
+ text.set_markup(
108
+ '<span size="x-large" weight="bold">'+text_for_the_label+'</span>', true
109
+ )
110
+ # ======================================================================= #
111
+ # Add the "input field" next for the english word that is to
112
+ # be translated.
113
+ # ======================================================================= #
114
+ @input_field = gtk_input_field
115
+ completion = gtk_entry_completion
116
+ @input_field.completion = completion
117
+ completion_model = ::Gtk::ListStore.new(String)
118
+ @dictionaries.array.each { |word|
119
+ iter = completion_model.append
120
+ iter[0] = word
121
+ }
122
+ completion.model = completion_model
123
+ # ======================================================================= #
124
+ # Use model column 0 as the text column
125
+ # ======================================================================= #
126
+ completion.text_column = 0
127
+ @input_field.center
128
+ @input_field.signal_connect(:key_press_event) { |widget, event|
129
+ if Gdk::Keyval.to_name(event.keyval) == 'Return'
130
+ button_pressed_so_try_to_convert_the_input
131
+ end
132
+ }
133
+ hbox_holding_label_and_input_field = gtk_vbox(
134
+ text, @input_field
135
+ )
136
+ pack_start(hbox_holding_label_and_input_field, false, false, 4)
137
+ end
138
+
139
+ # ========================================================================= #
140
+ # === button_pressed_so_try_to_convert_the_input (click tag)
141
+ # ========================================================================= #
142
+ def button_pressed_so_try_to_convert_the_input
143
+ user_input = @input_field.return_input
144
+ translated_word = @dictionaries.translate(user_input)
145
+ e sfancy(user_input)+' → '+simp(translated_word)
146
+ # ===================================================================== #
147
+ # We need ISO encoding there.
148
+ # ===================================================================== #
149
+ translated_word = GLib.convert(
150
+ translated_word, 'utf-8', 'iso-8859-1'
151
+ )
152
+ @answer_field.set_text(translated_word)
153
+ end
154
+
155
+ # ========================================================================= #
156
+ # === width?
157
+ # ========================================================================= #
158
+ def width?
159
+ 480 # Return the default width for our widget.
160
+ end
161
+
162
+ # ========================================================================= #
163
+ # === height?
164
+ # ========================================================================= #
165
+ def height?
166
+ 300 # Return the default height for our widget.
167
+ end
168
+
169
+ # ========================================================================= #
170
+ # === run
171
+ # ========================================================================= #
172
+ def run
173
+ create_input_field_on_top
174
+ create_answer_field
175
+ pack_start(@answer_field, false) # <- Translation appears here.
176
+ add_ask_the_question_button
177
+ show_all
178
+ end
179
+
180
+ # ========================================================================= #
181
+ # === Dictionaries::GUI::Gtk::Dictionary.run
182
+ #
183
+ # Use this method if you wish to start a new gtk-application window.
184
+ # ========================================================================= #
185
+ def self.run
186
+ dictionary = new
187
+ runner = ::Gtk::Runner.new
188
+ runner.width = USE_THIS_WIDTH
189
+ runner.set_size_request(
190
+ dictionary.width?,
191
+ dictionary.height?
192
+ )
193
+ runner.title = 'Dictionary'
194
+ runner.border_width = 10
195
+ runner << dictionary
196
+ runner.top_left_then_run
197
+ end
198
+
199
+ end; end; end
200
+
201
+ # =========================================================================== #
202
+ # === Dictionaries.gtk_widget
203
+ #
204
+ # This toplevel-method can be used to return the gtk-widget, which
205
+ # can then be embedded by other ruby-gtk applications, in particular
206
+ # admin_panel.rb of the gtk_paradise project.
207
+ # =========================================================================== #
208
+ def self.gtk_widget
209
+ Dictionaries::GUI::Gtk::Dictionary.new
210
+ end
211
+
212
+ end
213
+
214
+ if __FILE__ == $PROGRAM_NAME
215
+ Dictionaries::GUI::Gtk::Dictionary.run
216
+ end