WxVanaClock 1.0.0 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -0
- data/WxVanaClock.gemspec +6 -6
- data/lib/wx_vana_clock.rb +55 -19
- data/lib/wxvc-xrc.xml +2 -2
- metadata +3 -3
data/CHANGELOG
CHANGED
data/WxVanaClock.gemspec
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
|
2
|
-
# Gem::Specification for Wxvanaclock-1.0.
|
2
|
+
# Gem::Specification for Wxvanaclock-1.0.2
|
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.
|
8
|
-
s.date = %q{2007-09-
|
7
|
+
s.version = "1.0.2"
|
8
|
+
s.date = %q{2007-09-08}
|
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/}
|
@@ -16,14 +16,14 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.authors = ["Travis Tilley"]
|
17
17
|
s.files = ["README", "Manifest", "LICENSE", "lib/wxvc-xrc.xml", "lib/wx_vana_clock.rb", "CHANGELOG", "bin/WxVanaClock", "WxVanaClock.gemspec"]
|
18
18
|
s.executables = ["WxVanaClock"]
|
19
|
-
s.add_dependency(%q<VanaTime>, [">=
|
19
|
+
s.add_dependency(%q<VanaTime>, [">= 2.0.0"])
|
20
20
|
s.add_dependency(%q<wxruby>, [">= 1.9.0"])
|
21
21
|
end
|
22
22
|
|
23
23
|
|
24
24
|
# # Original Rakefile source (requires the Echoe gem):
|
25
25
|
#
|
26
|
-
# version = "1.0.
|
26
|
+
# version = "1.0.2"
|
27
27
|
#
|
28
28
|
# ENV['RUBY_FLAGS'] = ""
|
29
29
|
#
|
@@ -39,7 +39,7 @@ end
|
|
39
39
|
# p.url = "http://vanatime.rubyforge.org/"
|
40
40
|
# p.author = 'Travis Tilley'
|
41
41
|
# p.email = "ttilley@gmail.com"
|
42
|
-
# p.dependencies = ["VanaTime >=
|
42
|
+
# p.dependencies = ["VanaTime >=2.0.0", "wxruby >=1.9.0"]
|
43
43
|
# end
|
44
44
|
#
|
45
45
|
# rescue LoadError => boom
|
data/lib/wx_vana_clock.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
|
-
gem 'VanaTime', '>=
|
1
|
+
gem 'VanaTime', '>=2.0.0'
|
2
2
|
require 'vana_time'
|
3
3
|
gem 'wxruby', '>=1.9.0'
|
4
4
|
require 'wx'
|
5
5
|
|
6
6
|
module WxVanaClock
|
7
7
|
class ClockFrame < Wx::Frame
|
8
|
+
include FFXI::Constants
|
9
|
+
|
8
10
|
def initialize(parent)
|
9
11
|
super()
|
10
12
|
$xrc.load_frame_subclass(self, nil, 'ClockFrame')
|
11
13
|
|
12
|
-
@parent = parent
|
13
|
-
|
14
14
|
# get all the text controls
|
15
15
|
@vana_day =
|
16
16
|
Wx::Window.find_window_by_id(Wx::xrcid('VanaDay'), self)
|
@@ -31,6 +31,55 @@ module WxVanaClock
|
|
31
31
|
@optimal_phase_name =
|
32
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
|
57
|
+
|
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)
|
62
|
+
|
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
|
69
|
+
|
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
|
+
|
34
83
|
# create timer object, give it ID of 9000 and set owner to self
|
35
84
|
@timer = Wx::Timer.new(self, 9000)
|
36
85
|
# register the timer as an event
|
@@ -40,24 +89,13 @@ module WxVanaClock
|
|
40
89
|
end
|
41
90
|
|
42
91
|
def notify(event)
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
@vana_day.change_value vt.day.to_s
|
47
|
-
@vana_time.change_value vt.to_s
|
48
|
-
@earth_time.change_value vt.earth_time.to_s
|
49
|
-
@moon_percent.change_value vt.moon.percent
|
50
|
-
@phase_name.change_value vt.moon.phase
|
51
|
-
@next_phase_countdown.change_value vt.moon.to_next
|
52
|
-
@next_phase_name.change_value vt.moon.next_phase
|
53
|
-
@optimal_phase_countdown.change_value vt.moon.to_optimal
|
54
|
-
@optimal_phase_name.change_value vt.moon.optimal_phase
|
92
|
+
now = Time.now
|
93
|
+
@time_manager.earth_time = now
|
94
|
+
@earth_time.change_value now.to_s
|
55
95
|
end
|
56
96
|
end
|
57
97
|
|
58
98
|
class ClockApp < Wx::App
|
59
|
-
attr_accessor :vana_time
|
60
|
-
|
61
99
|
def on_init
|
62
100
|
# create a resource handler
|
63
101
|
$xrc = Wx::XmlResource.get()
|
@@ -67,8 +105,6 @@ module WxVanaClock
|
|
67
105
|
xrc_file = File.join(File.dirname(__FILE__), 'wxvc-xrc.xml')
|
68
106
|
$xrc.load(xrc_file)
|
69
107
|
|
70
|
-
@vana_time = FFXI::VanaTime.now
|
71
|
-
|
72
108
|
# show the main frame
|
73
109
|
@clock = ClockFrame.new(self)
|
74
110
|
@clock.show(true)
|
data/lib/wxvc-xrc.xml
CHANGED
@@ -106,7 +106,7 @@
|
|
106
106
|
</object>
|
107
107
|
<object class="sizeritem">
|
108
108
|
<object class="wxTextCtrl" name="NextPhaseCountdown">
|
109
|
-
<value>
|
109
|
+
<value>moo</value>
|
110
110
|
<size>86, 22</size>
|
111
111
|
<style>wxTE_READONLY|wxTE_RIGHT</style>
|
112
112
|
</object>
|
@@ -139,7 +139,7 @@
|
|
139
139
|
</object>
|
140
140
|
<object class="sizeritem">
|
141
141
|
<object class="wxTextCtrl" name="OptimalPhaseCountdown">
|
142
|
-
<value>
|
142
|
+
<value>cows</value>
|
143
143
|
<size>86, 22</size>
|
144
144
|
<style>wxTE_READONLY|wxTE_RIGHT</style>
|
145
145
|
</object>
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
|
|
3
3
|
specification_version: 1
|
4
4
|
name: WxVanaClock
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.0.
|
7
|
-
date: 2007-09-
|
6
|
+
version: 1.0.2
|
7
|
+
date: 2007-09-08 00:00:00 -04:00
|
8
8
|
summary: WxVanaClock is a clock for Final Fantasy Online written using wxWidgets.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -57,7 +57,7 @@ dependencies:
|
|
57
57
|
requirements:
|
58
58
|
- - ">="
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version:
|
60
|
+
version: 2.0.0
|
61
61
|
version:
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
63
|
name: wxruby
|