WxVanaClock 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/WxVanaClock.gemspec +5 -5
  2. data/lib/wx_vana_clock.rb +89 -95
  3. metadata +44 -49
data/WxVanaClock.gemspec CHANGED
@@ -1,11 +1,11 @@
1
1
 
2
- # Gem::Specification for Wxvanaclock-1.0.2
2
+ # Gem::Specification for Wxvanaclock-1.0.3
3
3
  # Originally generated by Echoe
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = %q{WxVanaClock}
7
- s.version = "1.0.2"
8
- s.date = %q{2007-09-08}
7
+ s.version = "1.0.3"
8
+ s.date = %q{2007-09-21}
9
9
  s.summary = %q{WxVanaClock is a clock for Final Fantasy Online written using wxWidgets.}
10
10
  s.email = %q{ttilley@gmail.com}
11
11
  s.homepage = %q{http://vanatime.rubyforge.org/}
@@ -23,13 +23,13 @@ end
23
23
 
24
24
  # # Original Rakefile source (requires the Echoe gem):
25
25
  #
26
- # version = "1.0.2"
26
+ # version = "1.0.3"
27
27
  #
28
28
  # ENV['RUBY_FLAGS'] = ""
29
29
  #
30
30
  # begin
31
31
  # require 'rubygems'
32
- # gem 'echoe', '=2.3'
32
+ # gem 'echoe', '=2.4'
33
33
  # require 'echoe'
34
34
  #
35
35
  # Echoe.new('WxVanaClock', version) do |p|
data/lib/wx_vana_clock.rb CHANGED
@@ -1,113 +1,107 @@
1
- gem 'VanaTime', '>=2.0.0'
1
+ gem 'VanaTime', '>=2.1.1'
2
2
  require 'vana_time'
3
3
  gem 'wxruby', '>=1.9.0'
4
4
  require 'wx'
5
5
 
6
6
  module WxVanaClock
7
- class ClockFrame < Wx::Frame
8
- include FFXI::Constants
7
+ class ClockFrame < Wx::Frame
8
+ include FFXI::Constants
9
9
 
10
- def initialize(parent)
11
- super()
12
- $xrc.load_frame_subclass(self, nil, 'ClockFrame')
10
+ def initialize(parent)
11
+ super()
12
+ $xrc.load_frame_subclass(self, nil, 'ClockFrame')
13
13
 
14
- # get all the text controls
15
- @vana_day =
16
- Wx::Window.find_window_by_id(Wx::xrcid('VanaDay'), self)
17
- @vana_time =
18
- Wx::Window.find_window_by_id(Wx::xrcid('VanaTime'), self)
19
- @earth_time =
20
- Wx::Window.find_window_by_id(Wx::xrcid('EarthTime'), self)
21
- @moon_percent =
22
- Wx::Window.find_window_by_id(Wx::xrcid('MoonPercent'), self)
23
- @phase_name =
24
- Wx::Window.find_window_by_id(Wx::xrcid('PhaseName'), self)
25
- @next_phase_countdown =
26
- Wx::Window.find_window_by_id(Wx::xrcid('NextPhaseCountdown'), self)
27
- @next_phase_name =
28
- Wx::Window.find_window_by_id(Wx::xrcid('NextPhaseName'), self)
29
- @optimal_phase_countdown =
30
- Wx::Window.find_window_by_id(Wx::xrcid('OptimalPhaseCountdown'), self)
31
- @optimal_phase_name =
32
- Wx::Window.find_window_by_id(Wx::xrcid('OptimalPhaseName'), self)
14
+ # get all the text controls
15
+ @vana_day =
16
+ Wx::Window.find_window_by_id(Wx::xrcid('VanaDay'), self)
17
+ @vana_time =
18
+ Wx::Window.find_window_by_id(Wx::xrcid('VanaTime'), self)
19
+ @earth_time =
20
+ Wx::Window.find_window_by_id(Wx::xrcid('EarthTime'), self)
21
+ @moon_percent =
22
+ Wx::Window.find_window_by_id(Wx::xrcid('MoonPercent'), self)
23
+ @phase_name =
24
+ Wx::Window.find_window_by_id(Wx::xrcid('PhaseName'), self)
25
+ @next_phase_countdown =
26
+ Wx::Window.find_window_by_id(Wx::xrcid('NextPhaseCountdown'), self)
27
+ @next_phase_name =
28
+ Wx::Window.find_window_by_id(Wx::xrcid('NextPhaseName'), self)
29
+ @optimal_phase_countdown =
30
+ Wx::Window.find_window_by_id(Wx::xrcid('OptimalPhaseCountdown'), self)
31
+ @optimal_phase_name =
32
+ Wx::Window.find_window_by_id(Wx::xrcid('OptimalPhaseName'), self)
33
33
 
34
- # create the procs that update UI elements
35
- on_second = lambda do |time|
36
- @vana_time.change_value time.to_s
37
- end
38
- on_day = lambda do |day|
39
- @vana_day.change_value day.to_s
40
- end
41
- on_moon_percent = lambda do |moon|
42
- @moon_percent.change_value moon.percent
43
- end
44
- on_moon_phase = lambda do |moon|
45
- @phase_name.change_value moon.phase
46
- @next_phase_name.change_value moon.next_phase
47
- end
48
- on_optimal_phase = lambda do |moon|
49
- @optimal_phase_name.change_value moon.optimal_phase
50
- end
51
- on_phase_count = lambda do |countdown|
52
- @next_phase_countdown.change_value countdown.to_next
53
- end
54
- on_optimal_count = lambda do |countdown|
55
- @optimal_phase_countdown.change_value countdown.to_optimal
56
- end
34
+ # create the procs that update UI elements
35
+ on_time_string = lambda do |m,o,n|
36
+ @vana_time.change_value "#{m.time.date_string} #{n}"
37
+ end
38
+ on_earth_time = lambda do |m,o,n|
39
+ @earth_time.change_value n.to_s
40
+ end
41
+ on_day_string = lambda do |m,o,n|
42
+ @vana_day.change_value n
43
+ end
44
+ on_moon_percent_string = lambda do |m,o,n|
45
+ @moon_percent.change_value n
46
+ end
47
+ on_moon_phase_name = lambda do |m,o,n|
48
+ @phase_name.change_value n
49
+ end
50
+ on_next_phase_name = lambda do |m,o,n|
51
+ @next_phase_name.change_value n
52
+ end
53
+ on_optimal_phase = lambda do |m,o,n|
54
+ @optimal_phase_name.change_value n
55
+ end
56
+ on_phase_count = lambda do |m,o,n|
57
+ @next_phase_countdown.change_value n
58
+ end
59
+ on_optimal_count = lambda do |m,o,n|
60
+ @optimal_phase_countdown.change_value n
61
+ end
57
62
 
58
- # create time, day, and moon objects
59
- vt = FFXI::VanaTime.now
60
- vd = FFXI::VanaDay.new(vt)
61
- vm = FFXI::VanaMoon.new(vt.earth_time)
63
+ # set up the time manager
64
+ @time_manager = FFXI::TimeManager.new
65
+ @time_manager.callback(:time_string, on_time_string)
66
+ @time_manager.callback(:earth_time_string, on_earth_time)
67
+ @time_manager.callback(:day_string, on_day_string)
68
+ @time_manager.callback(:moon_percent_string, on_moon_percent_string)
69
+ @time_manager.callback(:moon_phase_name, on_moon_phase_name)
70
+ @time_manager.callback(:next_phase_name, on_next_phase_name)
71
+ @time_manager.callback(:optimal_phase_name, on_optimal_phase)
72
+ @time_manager.callback(:next_phase_countdown_string, on_phase_count)
73
+ @time_manager.callback(:optimal_phase_countdown_string,
74
+ on_optimal_count)
62
75
 
63
- # draw the UI
64
- on_second.call vt
65
- on_day.call vd
66
- on_moon_percent.call vm
67
- on_moon_phase.call vm
68
- on_optimal_phase.call vm
76
+ # enable cascading updates and do the first update
77
+ @time_manager.enable_cascading_updates(Time.now)
69
78
 
70
- # manage the above
71
- @time_manager = FFXI::TimeManager.new
72
- @time_manager.manage(vt, vd, vm)
73
-
74
- # register callbacks
75
- @time_manager.callback_proc(MS_SECOND, on_second)
76
- @time_manager.callback_proc("day", on_day)
77
- @time_manager.callback_proc("moon_percent", on_moon_percent)
78
- @time_manager.callback_proc("moon_phase", on_moon_phase)
79
- @time_manager.callback_proc("next_optimal_phase", on_optimal_phase)
80
- @time_manager.callback_proc("next_phase_countdown", on_phase_count)
81
- @time_manager.callback_proc("optimal_phase_countdown", on_optimal_count)
82
-
83
- # create timer object, give it ID of 9000 and set owner to self
84
- @timer = Wx::Timer.new(self, 9000)
85
- # register the timer as an event
86
- evt_timer(9000) {|event| notify(event)}
87
- # set the timer to fire off every 35 milliseconds
88
- @timer.start(35)
89
- end
79
+ # create timer object, give it ID of 9000 and set owner to self
80
+ @timer = Wx::Timer.new(self, 9000)
81
+ # register the timer as an event
82
+ evt_timer(9000) {|event| notify(event)}
83
+ # set the timer to fire off every 35 milliseconds
84
+ @timer.start(35)
85
+ end
90
86
 
91
- def notify(event)
92
- now = Time.now
93
- @time_manager.earth_time = now
94
- @earth_time.change_value now.to_s
95
- end
87
+ def notify(event)
88
+ @time_manager.update_earth_time Time.now
96
89
  end
90
+ end
97
91
 
98
- class ClockApp < Wx::App
99
- def on_init
100
- # create a resource handler
101
- $xrc = Wx::XmlResource.get()
102
- $xrc.init_all_handlers()
92
+ class ClockApp < Wx::App
93
+ def on_init
94
+ # create a resource handler
95
+ $xrc = Wx::XmlResource.get()
96
+ $xrc.init_all_handlers()
103
97
 
104
- # load resource file
105
- xrc_file = File.join(File.dirname(__FILE__), 'wxvc-xrc.xml')
106
- $xrc.load(xrc_file)
98
+ # load resource file
99
+ xrc_file = File.join(File.dirname(__FILE__), 'wxvc-xrc.xml')
100
+ $xrc.load(xrc_file)
107
101
 
108
- # show the main frame
109
- @clock = ClockFrame.new(self)
110
- @clock.show(true)
111
- end
102
+ # show the main frame
103
+ @clock = ClockFrame.new(self)
104
+ @clock.show(true)
112
105
  end
106
+ end
113
107
  end
metadata CHANGED
@@ -1,33 +1,12 @@
1
- --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.4
3
- specification_version: 1
4
- name: WxVanaClock
5
- version: !ruby/object:Gem::Version
6
- version: 1.0.2
7
- date: 2007-09-08 00:00:00 -04:00
8
- summary: WxVanaClock is a clock for Final Fantasy Online written using wxWidgets.
9
- require_paths:
10
- - lib
11
- email: ttilley@gmail.com
1
+ --- !ruby/object:Gem::Specification
12
2
  homepage: http://vanatime.rubyforge.org/
13
- rubyforge_project: vanatime
14
- description: WxVanaClock is a clock for Final Fantasy Online written using wxWidgets.
15
- autorequire:
16
- default_executable:
17
- bindir: bin
18
- has_rdoc: true
19
- required_ruby_version: !ruby/object:Gem::Version::Requirement
20
- requirements:
21
- - - ">"
22
- - !ruby/object:Gem::Version
23
- version: 0.0.0
24
- version:
25
- platform: ruby
26
- signing_key:
27
- cert_chain:
3
+ extensions: []
4
+ executables:
5
+ - WxVanaClock
6
+ version: !ruby/object:Gem::Version
7
+ version: 1.0.3
28
8
  post_install_message:
29
- authors:
30
- - Travis Tilley
9
+ date: 2007-09-21 04:00:00 +00:00
31
10
  files:
32
11
  - README
33
12
  - Manifest
@@ -37,34 +16,50 @@ files:
37
16
  - CHANGELOG
38
17
  - bin/WxVanaClock
39
18
  - WxVanaClock.gemspec
40
- test_files: []
41
-
19
+ rubygems_version: 0.9.4
42
20
  rdoc_options: []
43
-
44
- extra_rdoc_files: []
45
-
46
- executables:
47
- - WxVanaClock
48
- extensions: []
49
-
50
- requirements: []
51
-
21
+ signing_key:
22
+ cert_chain:
23
+ name: WxVanaClock
24
+ has_rdoc: true
25
+ platform: ruby
26
+ summary: WxVanaClock is a clock for Final Fantasy Online written using wxWidgets.
27
+ default_executable:
28
+ bindir: bin
29
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
30
+ version:
31
+ requirements:
32
+ - - '>'
33
+ - !ruby/object:Gem::Version
34
+ version: 0.0.0
35
+ require_paths:
36
+ - lib
37
+ specification_version: 1
38
+ test_files: []
52
39
  dependencies:
53
- - !ruby/object:Gem::Dependency
40
+ - !ruby/object:Gem::Dependency
54
41
  name: VanaTime
55
42
  version_requirement:
56
- version_requirements: !ruby/object:Gem::Version::Requirement
43
+ version_requirements: !ruby/object:Gem::Version::Requirement
44
+ version:
57
45
  requirements:
58
- - - ">="
59
- - !ruby/object:Gem::Version
46
+ - - '>='
47
+ - !ruby/object:Gem::Version
60
48
  version: 2.0.0
61
- version:
62
- - !ruby/object:Gem::Dependency
49
+ - !ruby/object:Gem::Dependency
63
50
  name: wxruby
64
51
  version_requirement:
65
- version_requirements: !ruby/object:Gem::Version::Requirement
52
+ version_requirements: !ruby/object:Gem::Version::Requirement
53
+ version:
66
54
  requirements:
67
- - - ">="
68
- - !ruby/object:Gem::Version
55
+ - - '>='
56
+ - !ruby/object:Gem::Version
69
57
  version: 1.9.0
70
- version:
58
+ description: WxVanaClock is a clock for Final Fantasy Online written using wxWidgets.
59
+ authors:
60
+ - Travis Tilley
61
+ email: ttilley@gmail.com
62
+ extra_rdoc_files: []
63
+ requirements: []
64
+ rubyforge_project: vanatime
65
+ autorequire: