Class: Gtk2AppLib::Dialogs
- Inherits:
-
Object
- Object
- Gtk2AppLib::Dialogs
- Includes:
- Missing
- Defined in:
- lib/gtk2applib.rb,
lib/gtk2applib/dialogs/core.rb,
lib/gtk2applib/dialogs/auth.rb,
lib/gtk2applib/dialogs/entry.rb,
lib/gtk2applib/dialogs/login.rb,
lib/gtk2applib/dialogs/question.rb,
lib/gtk2applib/dialogs/get_date.rb,
lib/gtk2applib/dialogs/pick_one.rb,
lib/gtk2applib/dialogs/text_view.rb,
lib/gtk2applib/dialogs/show_image.rb,
lib/gtk2applib/dialogs/choose_tags.rb,
lib/gtk2applib/dialogs/quick_message.rb
Overview
reeks in here!
Defined Under Namespace
Classes: Auth, ChooseTags, Entry, GetDate, PickOne, Question, QuickMessage, ShowImage, TextView
Constant Summary
- DIALOG =
Hash.new { nil }
Constants included from Missing
Class Method Summary (collapse)
Instance Method Summary (collapse)
-
- ((String,String)?) auth(*options)
Returns the username and password.
-
- (Array of String, Nil) choose_tags(*options)
Displays a list (words) of labeled toggle-buttons one can toggle.
-
- (String, Nil) entry(*options)
Edits message in a text view.
-
- (Date, Nil) get_date(*options)
Display a calendar from which one can select a date.
-
- (Dialogs) initialize(options = Constants::HNIL)
constructor
A new instance of Dialogs.
-
- (Object) login(*options)
Session.
- - (Object) method_missing(missing, *arguments, &block)
-
- (String, Nil) pick_one(*options)
Displays a combo-box from which on can select an item from list and/or entry.
-
- (Boolean) question?(*options)
A dialog with a quick question, returning a yes or no answer (true or false (or nil if the window is closed)).
-
- (Object) quick_message(*options)
Function to open a dialog box displaying the message provided.
-
- (Object) show_image(*parameters)
Function to open a dialog box displaying the message provided.
-
- (Object) text_view(*options)
Edits message in a text view.
Methods included from Missing
Constructor Details
- (Dialogs) initialize(options = Constants::HNIL)
A new instance of Dialogs
136 137 138 |
# File 'lib/gtk2applib.rb', line 136 def initialize(=Constants::HNIL) @options = KeyValues.new(, DIALOG[:dialogs]) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
- (Object) method_missing(missing, *arguments, &block)
140 141 142 |
# File 'lib/gtk2applib.rb', line 140 def method_missing(missing, *arguments, &block) Missing.missing(missing, self, arguments, block) { super } end |
Class Method Details
+ (Object) bless(key, value = {})
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/gtk2applib/dialogs/core.rb', line 7 def self.bless(key, value = {}) dialog_key = DIALOG[key] if dialog_key.nil? then dialog_key = KeyValues.new(value) dialog_key.default = Constants::HNIL DIALOG[key] = dialog_key else # using supplement because # we don't want to over-ride user configured defaults. dialog_key.supplement(value) end end |
+ (Object) dialogs
132 133 134 |
# File 'lib/gtk2applib.rb', line 132 def self.dialogs require 'gtk2applib/dialogs/core' end |
Instance Method Details
- ((String,String)?) auth(*options)
Returns the username and password
47 48 49 50 51 |
# File 'lib/gtk2applib/dialogs/auth.rb', line 47 def auth(*) username, password, * = Parameters.map() .push(DIALOG[:auth]) Auth.new(username, password, @options.dup(*)).run end |
- (Array of String, Nil) choose_tags(*options)
Displays a list (words) of labeled toggle-buttons one can toggle. If a label for a toggle-button is in tags, the button will be "on". One can also add labels in an entry box. Returns a list of selected labels, including those entered in the entry box.
77 78 79 80 81 |
# File 'lib/gtk2applib/dialogs/choose_tags.rb', line 77 def (*) , = Parameters.map() .push(DIALOG[:choose_tags]) ChooseTags.new(, @options.dup(*)).run end |
- (String, Nil) entry(*options)
Edits message in a text view
31 32 33 34 35 |
# File 'lib/gtk2applib/dialogs/entry.rb', line 31 def entry(*) prompt, * = Parameters.map() .push(DIALOG[:entry]) Entry.new(prompt, @options.dup(*)).run end |
- (Date, Nil) get_date(*options)
Display a calendar from which one can select a date.
38 39 40 41 42 |
# File 'lib/gtk2applib/dialogs/get_date.rb', line 38 def get_date(*) date, * = Parameters.map() .push(DIALOG[:get_date]) GetDate.new(date, @options.dup(*)).run end |
- (Object) login(*options)
Session
8 9 10 11 12 13 14 15 16 |
# File 'lib/gtk2applib/dialogs/login.rb', line 8 def login(*) username, password, * = Parameters.map() session = nil while !session do username, password = self.auth(username, password, *) session = yield(username, password, *) end return session end |
- (String, Nil) pick_one(*options)
Displays a combo-box from which on can select an item from list and/or entry.
43 44 45 46 47 |
# File 'lib/gtk2applib/dialogs/pick_one.rb', line 43 def pick_one(*) list, * = Parameters.map(*) .push(DIALOG[:pick_one]) PickOne.new(list, @options.dup(*)).run end |
- (Boolean) question?(*options)
A dialog with a quick question, returning a yes or no answer (true or false (or nil if the window is closed)).
30 31 32 33 34 |
# File 'lib/gtk2applib/dialogs/question.rb', line 30 def question?(*) question, * = Parameters.map() .push(DIALOG[:question]) Question.new(question, @options.dup(*)).run end |
- (Object) quick_message(*options)
Function to open a dialog box displaying the message provided.
35 36 37 38 39 |
# File 'lib/gtk2applib/dialogs/quick_message.rb', line 35 def (*) , * = Parameters.map() .push(DIALOG[:quick_message]) QuickMessage.new(@options.dup(*)).run() end |
- (Object) show_image(*parameters)
Function to open a dialog box displaying the message provided.
34 35 36 37 38 39 |
# File 'lib/gtk2applib/dialogs/show_image.rb', line 34 def show_image(*parameters) uri, cache_directory, * = Parameters.map(*parameters) raise "Need cache_directory" if cache_directory.nil? .push(DIALOG[:show_image]) ShowImage.new(uri, cache_directory, @options.dup(*)).run end |
- (Object) text_view(*options)
Edits message in a text view
29 30 31 32 33 |
# File 'lib/gtk2applib/dialogs/text_view.rb', line 29 def text_view(*) , * = Parameters.map() .push(DIALOG[:text_view]) TextView.new(, @options.dup(*)).run end |