class Glimmer::Timer
Constants
- APP_ROOT
- COMMAND_KEY
- FILE_SOUND_ALARM
- LICENSE
- VERSION
Attributes
countdown[RW]
Add options like the following to configure CustomShell by outside consumers
options :title, :background_color option :width, default: 320 option :height, default: 240
min[RW]
Add options like the following to configure CustomShell by outside consumers
options :title, :background_color option :width, default: 320 option :height, default: 240
sec[RW]
Add options like the following to configure CustomShell by outside consumers
options :title, :background_color option :width, default: 320 option :height, default: 240
Public Instance Methods
display_about_dialog()
click to toggle source
# File lib/views/glimmer/timer.rb, line 185 def display_about_dialog message_box(body_root) { text 'About' message "Glimmer - Timer #{VERSION}\n\n#{LICENSE}" }.open end
play_countdown_done_sound()
click to toggle source
# File lib/views/glimmer/timer.rb, line 202 def play_countdown_done_sound begin if FILE_SOUND_ALARM.start_with?('uri:classloader') jar_file_path = FILE_SOUND_ALARM file_path = jar_file_path.sub(/^uri\:classloader\:/, '').sub('//', '/') # the latter sub is needed for Mac object = java.lang.Object.new file_input_stream = object.java_class.resource_as_stream(file_path) file_or_stream = java.io.BufferedInputStream.new(file_input_stream) else file_or_stream = java.io.File.new(FILE_SOUND_ALARM) end audio_stream = AudioSystem.get_audio_input_stream(file_or_stream) clip = AudioSystem.clip clip.open(audio_stream) clip.start rescue => e puts e.full_message end end
start_countdown()
click to toggle source
# File lib/views/glimmer/timer.rb, line 192 def start_countdown self.countdown = true @stop_button.swt_widget.set_focus end
stop_countdown()
click to toggle source
# File lib/views/glimmer/timer.rb, line 197 def stop_countdown self.countdown = false @min_spinner.swt_widget.set_focus end