Class: Bioroebe::GUI::Tk::ThreeToOne
- Inherits:
-
Object
- Object
- Bioroebe::GUI::Tk::ThreeToOne
- Includes:
- Colours, Tk
- Defined in:
- lib/bioroebe/gui/tk/three_to_one/three_to_one.rb
Overview
< Base # === Bioroebe::GUI::Tk::ThreeToOne
Constant Summary collapse
- NAMESPACE =
#
NAMESPACE
#
inspect
- TITLE =
#
TITLE
#
Bioroebe::GUI::Gtk::ThreeToOneModule::TITLE
- MAIN_FONT =
#
MAIN_FONT
#
TkFont.new( family: 'Helvetica', size: 20, weight: 'bold' )
- PADDING_TO_USE =
#
PADDING_TO_USE
#
{ padx: 10, pady: 10 }
Class Method Summary collapse
-
.[](i = '') ⇒ Object
# === Bioroebe::GUI::Tk::ThreeToOne[] ========================================================================= #.
Instance Method Summary collapse
-
#commandline_arguments? ⇒ Boolean
# === commandline_arguments? ========================================================================= #.
-
#do_convert ⇒ Object
(also: #do_trigger_the_conversion)
# === do_convert ========================================================================= #.
-
#first_argument? ⇒ Boolean
(also: #first?)
# === first_argument? ========================================================================= #.
-
#initialize(commandline_arguments = nil, run_already = true) ⇒ ThreeToOne
constructor
# === initialize ========================================================================= #.
-
#reset ⇒ Object
# === reset (reset tag) ========================================================================= #.
-
#run ⇒ Object
# === run (run tag) ========================================================================= #.
-
#set_commandline_arguments(i = '') ⇒ Object
# === set_commandline_arguments ========================================================================= #.
Constructor Details
#initialize(commandline_arguments = nil, run_already = true) ⇒ ThreeToOne
#
initialize
#
64 65 66 67 68 69 70 71 72 73 |
# File 'lib/bioroebe/gui/tk/three_to_one/three_to_one.rb', line 64 def initialize( commandline_arguments = nil, run_already = true ) reset set_commandline_arguments( commandline_arguments ) run if run_already end |
Class Method Details
.[](i = '') ⇒ Object
#
Bioroebe::GUI::Tk::ThreeToOne[]
#
191 192 193 |
# File 'lib/bioroebe/gui/tk/three_to_one/three_to_one.rb', line 191 def self.[](i = '') new(i) end |
Instance Method Details
#commandline_arguments? ⇒ Boolean
#
commandline_arguments?
#
93 94 95 |
# File 'lib/bioroebe/gui/tk/three_to_one/three_to_one.rb', line 93 def commandline_arguments? @commandline_arguments end |
#do_convert ⇒ Object Also known as: do_trigger_the_conversion
#
do_convert
#
182 183 184 185 186 |
# File 'lib/bioroebe/gui/tk/three_to_one/three_to_one.rb', line 182 def do_convert _ = @text1.value converted = Bioroebe.three_to_one(_).to_s @text2.value = converted end |
#first_argument? ⇒ Boolean Also known as: first?
#
first_argument?
#
100 101 102 |
# File 'lib/bioroebe/gui/tk/three_to_one/three_to_one.rb', line 100 def first_argument? @commandline_arguments.first end |
#reset ⇒ Object
#
reset (reset tag)
#
78 79 80 |
# File 'lib/bioroebe/gui/tk/three_to_one/three_to_one.rb', line 78 def reset # super() end |
#run ⇒ Object
#
run (run tag)
#
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
# File 'lib/bioroebe/gui/tk/three_to_one/three_to_one.rb', line 107 def run root = TkRoot.new { title TITLE } root.geometry('800x500+0+0') # ======================================================================= # # Add a frame for the whole application. # ======================================================================= # outermost_frame = TkFrame.new(root) label = ::TkLabel.new(outermost_frame) { font(MAIN_FONT) text 'Input sequence:' pack(side: 'top', padx: 10, pady: 10) } @text1 = TkVariable.new @entry1 = TkEntry.new(outermost_frame, textvariable: @text1) { font(MAIN_FONT) } @entry1.pack(outermost_frame) @text2 = TkVariable.new @entry2 = TkEntry.new(outermost_frame, textvariable: @text2) { font(MAIN_FONT) } @entry2.pack(outermost_frame) callback_do_convert = proc { do_convert } # ======================================================================= # # === The convert-button with its special frame # ======================================================================= # = TkFrame.new( outermost_frame, highlightbackground: 'black', highlightthickness: 2, bd: 0, borderwidth: 2 ) .pack = TkButton.new() { text 'Convert' font(MAIN_FONT) relief :flat command callback_do_convert pack borderwidth 5 } # ======================================================================= # # === The quit-button and its special frame # ======================================================================= # = TkFrame.new( outermost_frame, highlightbackground: 'black', highlightthickness: 2, bd: 0, borderwidth: 2 ) .pack = ::TkButton.new(, text: 'Quit') { font(MAIN_FONT) relief :flat command proc { exit } pack borderwidth 5 } ::Tk.run end |
#set_commandline_arguments(i = '') ⇒ Object
#
set_commandline_arguments
#
85 86 87 88 |
# File 'lib/bioroebe/gui/tk/three_to_one/three_to_one.rb', line 85 def set_commandline_arguments(i = '') i = [i].flatten.compact @commandline_arguments = i end |