arcadia 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +132 -134
- data/bin/arcadia +13 -0
- data/conf/arcadia.conf +196 -3
- data/conf/arcadia.init.rb +27 -6
- data/conf/arcadia.res.rb +10 -0
- data/ext/ae-complete-code/ae-complete-code.rb +76 -82
- data/ext/ae-doc-code/ae-doc-code.rb +295 -291
- data/ext/ae-editor/ae-editor.conf +88 -67
- data/ext/ae-editor/ae-editor.rb +400 -202
- data/ext/ae-editor/langs/conf.lang +16 -5
- data/ext/ae-editor/langs/lang.lang.bind +1 -1
- data/ext/ae-editor/langs/rb.lang +77 -41
- data/ext/ae-editor/langs/rbw.lang.bind +1 -1
- data/ext/ae-event-log/ae-event-log.rb +46 -45
- data/ext/ae-file-history/ae-file-history.conf +1 -1
- data/ext/ae-file-history/ae-file-history.rb +373 -298
- data/ext/ae-output/ae-output.conf +2 -0
- data/ext/ae-output/ae-output.rb +200 -202
- data/ext/ae-rad/ae-rad-inspector.rb +64 -70
- data/ext/ae-rad/ae-rad-palette.rb +14 -14
- data/ext/ae-rad/ae-rad.conf +2 -0
- data/ext/ae-rad/lib/tk/al-tk.rb +2991 -2987
- data/ext/ae-rad/lib/tk/al-tkarcadia.rb +26 -26
- data/ext/ae-ruby-debug/ae-ruby-debug.conf +8 -8
- data/ext/ae-ruby-debug/ae-ruby-debug.rb +1566 -1465
- data/ext/ae-search-in-files/ae-search-in-files.rb +294 -284
- data/ext/ae-shell/ae-shell.rb +20 -11
- data/{base → lib}/a-commons.rb +291 -80
- data/{base → lib}/a-contracts.rb +40 -18
- data/{arcadia.rb → lib/a-core.rb} +238 -148
- data/{base → lib}/a-tkcommons.rb +81 -63
- metadata +64 -65
- data/ext/ae-action-dispatcher/ae-action-dispatcher.conf +0 -6
- data/ext/ae-action-dispatcher/ae-action-dispatcher.rb +0 -22
- data/ext/ae-inspector/ae-inspector.conf +0 -7
- data/ext/ae-inspector/ae-inspector.rb +0 -1519
- data/ext/ae-palette/ae-palette.conf +0 -7
- data/ext/ae-palette/ae-palette.rb +0 -265
data/ext/ae-shell/ae-shell.rb
CHANGED
@@ -9,8 +9,8 @@ require "tk"
|
|
9
9
|
class Shell < ArcadiaExt
|
10
10
|
|
11
11
|
def on_before_build(_event)
|
12
|
-
Arcadia.
|
13
|
-
Arcadia.
|
12
|
+
Arcadia.attach_listener(self, SystemExecEvent)
|
13
|
+
Arcadia.attach_listener(self, RunRubyFileEvent)
|
14
14
|
end
|
15
15
|
|
16
16
|
def on_build(_event)
|
@@ -32,13 +32,14 @@ class Shell < ArcadiaExt
|
|
32
32
|
else
|
33
33
|
Process.fork{
|
34
34
|
open(_cmd_,"r"){|f|
|
35
|
-
Arcadia.
|
35
|
+
Arcadia.console(self,'msg'=>f.read, 'level'=>'debug')
|
36
36
|
#Arcadia.new_debug_msg(self, f.read)
|
37
37
|
}
|
38
38
|
}
|
39
39
|
end
|
40
40
|
rescue Exception => e
|
41
|
-
Arcadia.
|
41
|
+
Arcadia.console(self,'msg'=>e, 'level'=>'debug')
|
42
|
+
#Arcadia.new_debug_msg(self, e)
|
42
43
|
end
|
43
44
|
|
44
45
|
end
|
@@ -52,11 +53,13 @@ class Shell < ArcadiaExt
|
|
52
53
|
_cmd_ = "|"+@arcadia['conf']['shell.ruby']+" "+_filename+" 2>&1"
|
53
54
|
open(_cmd_,"r"){|f|
|
54
55
|
_readed = f.read
|
55
|
-
Arcadia.
|
56
|
+
Arcadia.console(self,'msg'=>_readed, 'level'=>'debug')
|
57
|
+
#Arcadia.new_debug_msg(self, _readed)
|
56
58
|
_event.add_result(self, 'output'=>_readed)
|
57
59
|
}
|
58
60
|
rescue Exception => e
|
59
|
-
Arcadia.
|
61
|
+
Arcadia.console(self,'msg'=>e, 'level'=>'debug')
|
62
|
+
#Arcadia.new_debug_msg(self, e)
|
60
63
|
end
|
61
64
|
end
|
62
65
|
end
|
@@ -66,19 +69,23 @@ class Shell < ArcadiaExt
|
|
66
69
|
(RUBY_PLATFORM.include?('mswin32'))?_cmd="cmd":_cmd='sh'
|
67
70
|
if is_windows?
|
68
71
|
Thread.new{
|
69
|
-
Arcadia.
|
72
|
+
Arcadia.console(self,'msg'=>'begin', 'level'=>'debug')
|
73
|
+
#Arcadia.new_debug_msg(self, 'inizio')
|
70
74
|
@io = IO.popen(_cmd,'r+')
|
71
75
|
@io.puts(command)
|
72
76
|
result = ''
|
73
77
|
while line = @io.gets
|
74
78
|
result << line
|
75
79
|
end
|
76
|
-
Arcadia.new_debug_msg(self, result)
|
80
|
+
#Arcadia.new_debug_msg(self, result)
|
81
|
+
Arcadia.console(self,'msg'=>result, 'level'=>'debug')
|
82
|
+
|
77
83
|
}
|
78
84
|
else
|
79
85
|
Process.fork{
|
80
86
|
open(_cmd_,"r"){|f|
|
81
|
-
Arcadia.
|
87
|
+
Arcadia.console(self,'msg'=>f.read, 'level'=>'debug')
|
88
|
+
#Arcadia.new_debug_msg(self, f.read)
|
82
89
|
}
|
83
90
|
}
|
84
91
|
end
|
@@ -118,11 +125,13 @@ class Shell < ArcadiaExt
|
|
118
125
|
_cmd_ = "|"+$arcadia['conf']['shell.ruby']+" "+_filename+" 2>&1"
|
119
126
|
# Arcadia.new_debug_msg(self, _cmd_)
|
120
127
|
@cmd = open(_cmd_,"r"){|f|
|
121
|
-
Arcadia.
|
128
|
+
Arcadia.console(self, 'msg'=>f.read ,'level'=>'debug')
|
129
|
+
#Arcadia.new_debug_msg(self, f.read)
|
122
130
|
}
|
123
131
|
end
|
124
132
|
rescue Exception => e
|
125
|
-
Arcadia.
|
133
|
+
Arcadia.console(self, 'msg'=>e ,'level'=>'debug')
|
134
|
+
#Arcadia.new_debug_msg(self, e)
|
126
135
|
end
|
127
136
|
end
|
128
137
|
end
|
data/{base → lib}/a-commons.rb
RENAMED
@@ -10,32 +10,176 @@ require 'singleton'
|
|
10
10
|
# Extension
|
11
11
|
# +------------------------------------------+
|
12
12
|
|
13
|
+
|
14
|
+
class AbstractFrameWrapper
|
15
|
+
# def AbstractFrameWrapper.inherited(sub)
|
16
|
+
# unless sub.respond_to? :hinner_frame
|
17
|
+
# raise NoMethodError, "#{sub} needs to respond to `:hinner_frame'"
|
18
|
+
# end
|
19
|
+
# unless sub.respond_to? :title
|
20
|
+
# raise NoMethodError, "#{sub} needs to respond to `:title'"
|
21
|
+
# end
|
22
|
+
#
|
23
|
+
# unless sub.respond_to? :show
|
24
|
+
# raise NoMethodError, "#{sub} needs to respond to `:show'"
|
25
|
+
# end
|
26
|
+
#
|
27
|
+
# unless sub.respond_to? :hide
|
28
|
+
# raise NoMethodError, "#{sub} needs to respond to `:hide'"
|
29
|
+
# end
|
30
|
+
#
|
31
|
+
# unless sub.respond_to? :free
|
32
|
+
# raise NoMethodError, "#{sub} needs to respond to `:free'"
|
33
|
+
# end
|
34
|
+
# end
|
35
|
+
|
36
|
+
def initialize
|
37
|
+
unless sub.respond_to? :hinner_frame
|
38
|
+
raise NoMethodError, "#{sub} needs to respond to `:hinner_frame'"
|
39
|
+
end
|
40
|
+
unless sub.respond_to? :title
|
41
|
+
raise NoMethodError, "#{sub} needs to respond to `:title'"
|
42
|
+
end
|
43
|
+
|
44
|
+
unless sub.respond_to? :show
|
45
|
+
raise NoMethodError, "#{sub} needs to respond to `:show'"
|
46
|
+
end
|
47
|
+
|
48
|
+
unless sub.respond_to? :hide
|
49
|
+
raise NoMethodError, "#{sub} needs to respond to `:hide'"
|
50
|
+
end
|
51
|
+
|
52
|
+
unless sub.respond_to? :free
|
53
|
+
raise NoMethodError, "#{sub} needs to respond to `:free'"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
#module AbstractFrameWrapper
|
60
|
+
# def hinner_frame
|
61
|
+
# raise NoMethodError, "#{self} needs to respond to `:hinner_frame'"
|
62
|
+
# end
|
63
|
+
#end
|
64
|
+
|
65
|
+
class FixedFrameWrapper < AbstractFrameWrapper
|
66
|
+
# include AbstractFrameWrapper
|
67
|
+
def initialize(_arcadia, _point, _name, _title='')
|
68
|
+
@arcadia = _arcadia
|
69
|
+
@point =_point
|
70
|
+
@name = _name
|
71
|
+
@title = _title
|
72
|
+
fixed_frame_forge
|
73
|
+
end
|
74
|
+
|
75
|
+
def fixed_frame_forge
|
76
|
+
@fixed_frame = @arcadia.layout.register_panel(@point, @name, @title) if @fixed_frame.nil?
|
77
|
+
end
|
78
|
+
private :fixed_frame_forge
|
79
|
+
|
80
|
+
def hinner_frame
|
81
|
+
fixed_frame_forge
|
82
|
+
@fixed_frame
|
83
|
+
end
|
84
|
+
|
85
|
+
def title(_title=nil)
|
86
|
+
fixed_frame_forge
|
87
|
+
@arcadia.layout.domain(@point)['root'].top_text(_title)
|
88
|
+
end
|
89
|
+
|
90
|
+
def show
|
91
|
+
fixed_frame_forge
|
92
|
+
@arcadia.layout.raise_panel(@point, @name)
|
93
|
+
end
|
94
|
+
|
95
|
+
def hide
|
96
|
+
end
|
97
|
+
|
98
|
+
def free
|
99
|
+
@arcadia.layout.unregister_panel(@point, @name)
|
100
|
+
@fixed_frame = nil
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
|
105
|
+
class FloatFrameWrapper < AbstractFrameWrapper
|
106
|
+
# include AbstractFrameWrapper
|
107
|
+
def initialize(_arcadia, _geometry=nil, _title=nil)
|
108
|
+
@arcadia = _arcadia
|
109
|
+
@geometry = _geometry
|
110
|
+
@title= _title
|
111
|
+
float_frame_forge
|
112
|
+
end
|
113
|
+
|
114
|
+
def float_frame_forge
|
115
|
+
if @obj.nil?
|
116
|
+
a = @geometry.scan(/[+-]*\d\d*%*/)
|
117
|
+
p_height = TkWinfo.screenheight(@arcadia.layout.root)
|
118
|
+
p_width = TkWinfo.screenwidth(@arcadia.layout.root)
|
119
|
+
if a[0][-1..-1]=='%'
|
120
|
+
n = a[0][0..-2].to_i.abs
|
121
|
+
a[0] = (p_width/100*n).to_i
|
122
|
+
end
|
123
|
+
if a[1][-1..-1]=='%'
|
124
|
+
n = a[1][0..-2].to_i.abs
|
125
|
+
a[1] = (p_height/100*n).to_i
|
126
|
+
end
|
127
|
+
if a[2][-1..-1]=='%'
|
128
|
+
n = a[2][0..-2].to_i.abs
|
129
|
+
a[2] = (p_width/100*n).to_i
|
130
|
+
end
|
131
|
+
if a[3][-1..-1]=='%'
|
132
|
+
n = a[3][0..-2].to_i.abs
|
133
|
+
a[3] = (p_height/100*n).to_i
|
134
|
+
end
|
135
|
+
|
136
|
+
args = {'width'=>a[0], 'height'=>a[1], 'x'=>a[2], 'y'=>a[3]}
|
137
|
+
@obj = @arcadia.layout.new_float_frame(args)
|
138
|
+
@obj.title(@title) if @title
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
def hinner_frame
|
143
|
+
float_frame_forge
|
144
|
+
@obj.frame if @obj
|
145
|
+
end
|
146
|
+
|
147
|
+
def title(_title=nil)
|
148
|
+
float_frame_forge
|
149
|
+
@obj.title(_title) if @obj
|
150
|
+
end
|
151
|
+
|
152
|
+
def show
|
153
|
+
float_frame_forge
|
154
|
+
@obj.show if @obj
|
155
|
+
end
|
156
|
+
|
157
|
+
def hide
|
158
|
+
float_frame_forge
|
159
|
+
@obj.hide if @obj
|
160
|
+
end
|
161
|
+
|
162
|
+
def free
|
163
|
+
@obj.destroy if @obj
|
164
|
+
@obj = nil
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
13
168
|
class ArcadiaExt
|
14
169
|
attr_reader :arcadia
|
15
|
-
|
16
170
|
def initialize(_arcadia, _name=nil)
|
17
171
|
@arcadia = _arcadia
|
18
|
-
Arcadia.
|
19
|
-
Arcadia.
|
20
|
-
Arcadia.
|
172
|
+
Arcadia.attach_listener(self, BuildEvent)
|
173
|
+
Arcadia.attach_listener(self, ExitQueryEvent)
|
174
|
+
Arcadia.attach_listener(self, FinalizeEvent)
|
21
175
|
@name = _name
|
22
176
|
@frames = Array.new
|
23
177
|
@frames_points = conf_array("#{_name}.frames")
|
24
178
|
@frames_labels = conf_array("#{_name}.labels")
|
25
179
|
@float_frames = Array.new
|
26
|
-
|
27
|
-
|
28
|
-
#
|
29
|
-
# unless self.respond_to? :before_build
|
30
|
-
# raise NoMethodError, "ArcadiaExt needs to respond to `:before_build'"
|
31
|
-
# end
|
32
|
-
# unless self.respond_to? :after_build
|
33
|
-
# raise NoMethodError, "ArcadiaExt needs to respond to `:after_build'"
|
34
|
-
# end
|
35
|
-
# if self.respond_to? :arcadia_update
|
36
|
-
# ObserverCallback.new(@arcadia.main_contract, self, :arcadia_update)
|
37
|
-
# end
|
38
|
-
ObjectSpace.define_finalizer(self, self.method(:finalize).to_proc)
|
180
|
+
@float_geometries = conf_array("#{_name}.float_frames")
|
181
|
+
@float_labels = conf_array("#{_name}.float_labels")
|
182
|
+
#ObjectSpace.define_finalizer(self, self.method(:finalize).to_proc)
|
39
183
|
end
|
40
184
|
|
41
185
|
def conf_array(_name)
|
@@ -48,67 +192,27 @@ class ArcadiaExt
|
|
48
192
|
def frame(_n=0)
|
49
193
|
if @frames[_n] == nil && @frames_points[_n]
|
50
194
|
(@frames_labels[_n].nil?)? _label = @name : _label = @frames_labels[_n]
|
51
|
-
@frames[_n] =
|
195
|
+
@frames[_n] = FixedFrameWrapper.new(@arcadia, @frames_points[_n], @name, _label)
|
52
196
|
end
|
53
197
|
return @frames[_n]
|
54
198
|
end
|
55
|
-
|
56
|
-
def frame_free(_n=0)
|
57
|
-
if _n.nil?
|
58
|
-
@frames.each_index{|i|
|
59
|
-
@arcadia.layout.unregister_panel(@frames_points[i],@name)
|
60
|
-
@frames[i]=nil
|
61
|
-
}
|
62
|
-
else
|
63
|
-
@arcadia.layout.unregister_panel(@frames_points[_n],@name)
|
64
|
-
@frames[_n] = nil
|
65
|
-
end
|
66
|
-
|
67
|
-
end
|
68
|
-
|
69
|
-
def frame_raise(_n=0)
|
70
|
-
if _n.nil?
|
71
|
-
@frames.each_index{|i|
|
72
|
-
@arcadia.layout.raise_panel(@frames_points[i],@name)
|
73
|
-
}
|
74
|
-
else
|
75
|
-
@arcadia.layout.raise_panel(@frames_points[_n],@name)
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
|
80
|
-
def frame_title(_title=nil, _n=0)
|
81
|
-
self.frames(_n) if @frames[_n] == nil
|
82
|
-
@arcadia.layout.domain(@frames_points[_n])['root'].top_text(_title)
|
83
|
-
end
|
84
|
-
|
199
|
+
|
85
200
|
def float_frame(_n=0, _args=nil)
|
86
201
|
if @float_frames[_n].nil?
|
87
|
-
@
|
202
|
+
(@float_labels[_n].nil?)? _label = @name : _label = @float_labels[_n]
|
203
|
+
@float_frames[_n] = FloatFrameWrapper.new(@arcadia, @float_geometries[_n], _label)
|
88
204
|
end
|
89
205
|
@float_frames[_n]
|
90
206
|
end
|
91
207
|
|
92
|
-
|
208
|
+
def conf(_property)
|
93
209
|
@arcadia['conf'][@name+'.'+_property]
|
94
|
-
end
|
95
|
-
|
96
|
-
# def arcadia_update(_sender, _event)
|
97
|
-
#must be implemented to activate
|
98
|
-
# end
|
99
|
-
|
100
|
-
def can_exit_query
|
101
|
-
return true
|
102
|
-
end
|
103
|
-
|
104
|
-
def finalize
|
105
|
-
#may be extendeded in child
|
106
210
|
end
|
107
211
|
|
108
|
-
def
|
109
|
-
|
110
|
-
end
|
111
|
-
|
212
|
+
# def conf_global(_property)
|
213
|
+
# @arcadia['conf'][_property]
|
214
|
+
# end
|
215
|
+
|
112
216
|
def exec(_method, _args=nil)
|
113
217
|
if self.respond_to(_method)
|
114
218
|
self.send(_method, _args)
|
@@ -268,25 +372,29 @@ module EventBus #(or SourceEvent)
|
|
268
372
|
if _class != _event.class
|
269
373
|
sub_method_name = _method_name(_event.class)
|
270
374
|
@@listeners[_class].each do|_listener|
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
elsif _listener.respond_to?(method_name)
|
277
|
-
Thread.new{_listener.send(method_name, _event)}
|
278
|
-
end
|
375
|
+
if _listener.respond_to?(sub_method_name)
|
376
|
+
Thread.new{_listener.send(sub_method_name, _event)}
|
377
|
+
elsif _listener.respond_to?(method_name)
|
378
|
+
Thread.new{_listener.send(method_name, _event)}
|
379
|
+
end
|
279
380
|
end
|
280
381
|
else
|
281
382
|
@@listeners[_class].each do|_listener|
|
282
|
-
|
383
|
+
Thread.new{
|
384
|
+
_listener.send(method_name, _event) if _listener.respond_to?(method_name)
|
385
|
+
}
|
283
386
|
end
|
284
387
|
end
|
285
388
|
end
|
286
389
|
private :_broadcast_fase
|
287
390
|
|
391
|
+
def detach_listener(_listener, _class_event)
|
392
|
+
if @@listeners[_class_event]
|
393
|
+
@@listeners[_class_event].delete(_listener)
|
394
|
+
end
|
395
|
+
end
|
288
396
|
|
289
|
-
def
|
397
|
+
def attach_listener(_listener, _class_event)
|
290
398
|
@@listeners = {} unless defined? @@listeners
|
291
399
|
@@listeners[_class_event] = [] unless @@listeners.has_key?(_class_event)
|
292
400
|
@@listeners[_class_event] << _listener
|
@@ -317,7 +425,8 @@ module Autils
|
|
317
425
|
end
|
318
426
|
|
319
427
|
module Configurable
|
320
|
-
|
428
|
+
|
429
|
+
def properties_file2hash(_property_file, _link_hash=nil)
|
321
430
|
r_hash = Hash.new
|
322
431
|
if _property_file && FileTest::exist?(_property_file)
|
323
432
|
f = File::open(_property_file,'r')
|
@@ -339,6 +448,9 @@ module Configurable
|
|
339
448
|
if var.length > 1
|
340
449
|
_value = var[1].strip
|
341
450
|
var[2..-1].collect{|x| _value=_value+'='+x} if var.length > 2
|
451
|
+
if _link_hash
|
452
|
+
_value = resolve_link(_value, _link_hash)
|
453
|
+
end
|
342
454
|
r_hash[var[0].strip]=_value
|
343
455
|
end
|
344
456
|
end
|
@@ -349,6 +461,63 @@ module Configurable
|
|
349
461
|
return r_hash
|
350
462
|
end
|
351
463
|
end
|
464
|
+
|
465
|
+
def Configurable.properties_group(_group, _hash_source)
|
466
|
+
@@conf_groups = Hash.new if !defined?(@@conf_groups)
|
467
|
+
if @@conf_groups[_group].nil?
|
468
|
+
@@conf_groups[_group] = Hash.new
|
469
|
+
glen=_group.length
|
470
|
+
_hash_source.keys.sort.each{|k|
|
471
|
+
if k[0..glen] == "#{_group}."
|
472
|
+
@@conf_groups[_group][k[glen+1..-1]]=_hash_source[k]
|
473
|
+
elsif @@conf_groups[_group].length > 0
|
474
|
+
break
|
475
|
+
end
|
476
|
+
}
|
477
|
+
end
|
478
|
+
Hash.new.update(@@conf_groups[_group])
|
479
|
+
end
|
480
|
+
|
481
|
+
|
482
|
+
def resolve_link(_v, _hash_source, _link_symbol='>>>')
|
483
|
+
if _v.length > 3 && _v[0..2]==_link_symbol
|
484
|
+
_v=_hash_source[_v[3..-1]] if _hash_source[_v[3..-1]]
|
485
|
+
end
|
486
|
+
return _v
|
487
|
+
end
|
488
|
+
|
489
|
+
def resolve_properties_link(_hash_target, _hash_source, _link_symbol='>>>')
|
490
|
+
loop_level_max = 10
|
491
|
+
# _hash_adding = Hash.new
|
492
|
+
_keys_to_extend = Array.new
|
493
|
+
_hash_target.each{|k,v|
|
494
|
+
loop_level = 0
|
495
|
+
while loop_level < loop_level_max && v.length > 3 && v[0..2]==_link_symbol
|
496
|
+
if k[-1..-1]=='.'
|
497
|
+
_keys_to_extend << k
|
498
|
+
break
|
499
|
+
elsif _hash_source[v[3..-1]]
|
500
|
+
v=_hash_source[v[3..-1]]
|
501
|
+
else
|
502
|
+
break
|
503
|
+
end
|
504
|
+
loop_level = loop_level + 1
|
505
|
+
end
|
506
|
+
_hash_target[k]=v
|
507
|
+
if loop_level == loop_level_max
|
508
|
+
raise("Link loop found for property : #{k}")
|
509
|
+
end
|
510
|
+
}
|
511
|
+
_keys_to_extend.each do |k|
|
512
|
+
v=_hash_target[k]
|
513
|
+
g=Configurable.properties_group(v[3..-1], _hash_target)
|
514
|
+
g.each do |key,value|
|
515
|
+
_hash_target["#{k[0..-2]}.#{key}"]=value if !_hash_target["#{k[0..-2]}.#{key}"]
|
516
|
+
end
|
517
|
+
_hash_target.delete(k)
|
518
|
+
end
|
519
|
+
end
|
520
|
+
|
352
521
|
end
|
353
522
|
|
354
523
|
module Persistable
|
@@ -401,6 +570,27 @@ class Application
|
|
401
570
|
@@instance
|
402
571
|
end
|
403
572
|
|
573
|
+
def Application.conf(_property)
|
574
|
+
@@instance['conf'][_property] if @@instance
|
575
|
+
end
|
576
|
+
|
577
|
+
def Application.conf_group(_group)
|
578
|
+
@@conf_groups = Hash.new if !defined?(@@conf_groups)
|
579
|
+
if @@conf_groups[_group].nil?
|
580
|
+
@@conf_groups[_group] = Hash.new
|
581
|
+
glen=_group.length
|
582
|
+
@@instance['conf'].keys.sort.each{|k|
|
583
|
+
if k[0..glen] == "#{_group}."
|
584
|
+
@@conf_groups[_group][k[glen+1..-1]]=@@instance['conf'][k]
|
585
|
+
elsif @@conf_groups[_group].length > 0
|
586
|
+
break
|
587
|
+
end
|
588
|
+
}
|
589
|
+
end
|
590
|
+
@@conf_groups[_group]
|
591
|
+
end
|
592
|
+
|
593
|
+
|
404
594
|
def prepare
|
405
595
|
end
|
406
596
|
|
@@ -435,13 +625,27 @@ class Application
|
|
435
625
|
end
|
436
626
|
else
|
437
627
|
msg = "Locad dir "+'"'+local_dir+'"'+" must be writable!"
|
438
|
-
Arcadia.
|
628
|
+
Arcadia.dialog(self, 'type'=>'ok','title' => '(Arcadia)', 'msg' => msg, 'level'=>'error')
|
439
629
|
exit
|
440
|
-
|
441
630
|
end
|
442
631
|
end
|
443
632
|
end
|
444
633
|
|
634
|
+
def load_theme(_name=nil)
|
635
|
+
_theme_file = "conf/theme-#{_name}.conf" if !_name.nil?
|
636
|
+
if _theme_file && File.exist?(_theme_file)
|
637
|
+
self['conf'].update(self.properties_file2hash(_theme_file))
|
638
|
+
_theme_res_file = "conf/theme-#{_name}.res.rb"
|
639
|
+
if _theme_res_file && File.exist?(_theme_res_file)
|
640
|
+
begin
|
641
|
+
require _theme_res_file
|
642
|
+
rescue Exception => e
|
643
|
+
end
|
644
|
+
|
645
|
+
end
|
646
|
+
end
|
647
|
+
end
|
648
|
+
|
445
649
|
def local_dir
|
446
650
|
_local_dir = File.join(ENV["HOME"],'.'+self['applicationParams'].name) if ENV["HOME"]
|
447
651
|
if _local_dir && !File.exist?(_local_dir)
|
@@ -450,7 +654,7 @@ class Application
|
|
450
654
|
@first_run = true
|
451
655
|
else
|
452
656
|
msg = "Locad dir "+'"'+ENV["HOME"]+'"'+" must be writable!"
|
453
|
-
Arcadia.
|
657
|
+
Arcadia.dialog(self, 'type'=>'ok', 'title' => "(#{self['applicationParams'].name})", 'msg' => msg, 'level'=>'error')
|
454
658
|
exit
|
455
659
|
end
|
456
660
|
end
|
@@ -473,6 +677,13 @@ class Application
|
|
473
677
|
end
|
474
678
|
end
|
475
679
|
|
680
|
+
def []=(_name, _value)
|
681
|
+
if @objs[_name]
|
682
|
+
@objs[_name] = _value
|
683
|
+
end
|
684
|
+
end
|
685
|
+
|
686
|
+
|
476
687
|
def run
|
477
688
|
end
|
478
689
|
end
|