Module: Tkri
- Defined in:
- lib/tkri.rb
Defined Under Namespace
Modules: DefaultSettings, Settings Classes: App, History, HistoryEntry, Tab, Tabs, Tabsbar
Class Attribute Summary collapse
-
.the_application ⇒ Object
Returns the value of attribute the_application.
Class Method Summary collapse
-
.attach_bindings(widget, widget_id_string) ⇒ Object
Attachs Settings::BINDINGS to a certain widget.
-
.get_rc_file_path ⇒ Object
Returns the pathname of the ‘rc’ file.
Class Attribute Details
.the_application ⇒ Object
Returns the value of attribute the_application.
156 157 158 |
# File 'lib/tkri.rb', line 156 def the_application @the_application end |
Class Method Details
.attach_bindings(widget, widget_id_string) ⇒ Object
Attachs Settings::BINDINGS to a certain widget.
Ideally this should be a method of TkWidget, but for some reason widgets don’t seem to inherit methods I define on TkWidget.
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 |
# File 'lib/tkri.rb', line 249 def self.attach_bindings(, ) Tkri::Settings::BINDINGS.each_pair { |ignored_key, b| if (b[:source] == ) keys = Array(b[:key]) if b[:key] == 'Key-Return' keys.push 'Key-KP_Enter' end keys.each { |key| .bind(key) { |event| skip = (b[:when_not_tkentry] and event..class == TkEntry) if !skip if b[:command] # Sometimes we're only interested in :cancel_default. Tkri.the_application.invoke_command(b[:command], event) end end break if b[:cancel_default] } } end } end |
.get_rc_file_path ⇒ Object
Returns the pathname of the ‘rc’ file.
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/tkri.rb', line 14 def self.get_rc_file_path basename = RUBY_PLATFORM.index('mswin') ? '_tkrirc' : '.tkrirc' if ENV['HOME'] File.join(ENV['HOME'], basename) else # Probably Windows with no $HOME set. Dir.pwd sucks but is there # anything better to do? At least the "Help :: About the RC file" # screen displays this value, so the user won't be completely clueless... File.join(Dir.pwd, basename) end end |