Class: ArcadiaExt
- Inherits:
-
Object
show all
- Defined in:
- lib/a-commons.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
-
#add_to_conf_property(_name, _value) ⇒ Object
-
#array_conf(_name, _array) ⇒ Object
-
#conf(_property, _value = nil) ⇒ Object
-
#conf_array(_name) ⇒ Object
-
#conf_default(_property) ⇒ Object
-
#del_from_conf_property(_name, _value) ⇒ Object
-
#destroy_frame(_n = 0) ⇒ Object
-
#exec(_method, _args = nil) ⇒ Object
def conf_global(_property) @arcadia[_property] end.
-
#float_frame(_n = 0, _args = nil) ⇒ Object
-
#frame(_n = 0, create_if_not_exist = true) ⇒ Object
-
#frame_def_visible?(_n = 0) ⇒ Boolean
-
#frame_domain(_n = 0, _value = nil) ⇒ Object
-
#frame_domain_default(_n = 0) ⇒ Object
-
#frame_raised?(_n = 0) ⇒ Boolean
-
#frame_title(_n = 0) ⇒ Object
-
#frame_visible?(_n = 0) ⇒ Boolean
-
#hide_frame(_n = 0) ⇒ Object
-
#hinner_dialog(_n = 0, side = 'top', args = nil) ⇒ Object
-
#hinner_splitted_dialog(_n = 0, _side = 'top', _height = 100, _args = nil) ⇒ Object
-
#hinner_splitted_dialog_titled(_title = nil, _n = 0, _side = 'top', _height = 100, _args = nil) ⇒ Object
-
#initialize(_arcadia, _name = nil) ⇒ ArcadiaExt
constructor
A new instance of ArcadiaExt.
-
#maximize(_n = 0) ⇒ Object
-
#maximized?(_n = 0) ⇒ Boolean
-
#resize(_n = 0) ⇒ Object
-
#restore_default_conf(_property) ⇒ Object
Constructor Details
#initialize(_arcadia, _name = nil) ⇒ ArcadiaExt
Returns a new instance of ArcadiaExt.
Instance Attribute Details
#arcadia ⇒ Object
Returns the value of attribute arcadia.
214
215
216
|
# File 'lib/a-commons.rb', line 214
def arcadia
@arcadia
end
|
#name ⇒ Object
Returns the value of attribute name.
215
216
217
|
# File 'lib/a-commons.rb', line 215
def name
@name
end
|
Instance Method Details
#add_to_conf_property(_name, _value) ⇒ Object
265
266
267
268
269
270
271
|
# File 'lib/a-commons.rb', line 265
def add_to_conf_property(_name, _value)
a = conf_array(_name)
if !a.include?(_value)
a << _value
array_conf(_name,a)
end
end
|
#array_conf(_name, _array) ⇒ Object
251
252
253
254
255
256
257
258
259
260
261
262
263
|
# File 'lib/a-commons.rb', line 251
def array_conf(_name, _array)
Application.array_conf("#{@name}.#{_name}", _array)
end
|
#conf(_property, _value = nil) ⇒ Object
385
386
387
388
389
390
|
# File 'lib/a-commons.rb', line 385
def conf(_property, _value=nil)
if !_value.nil?
@arcadia['conf'][@name+'.'+_property] = _value
end
@arcadia['conf'][@name+'.'+_property]
end
|
#conf_array(_name) ⇒ Object
243
244
245
246
247
248
249
|
# File 'lib/a-commons.rb', line 243
def conf_array(_name)
Application.conf_array("#{@name}.#{_name}")
end
|
#conf_default(_property) ⇒ Object
392
393
394
|
# File 'lib/a-commons.rb', line 392
def conf_default(_property)
@arcadia['conf_without_local'][@name+'.'+_property]
end
|
#del_from_conf_property(_name, _value) ⇒ Object
273
274
275
276
277
|
# File 'lib/a-commons.rb', line 273
def del_from_conf_property(_name, _value)
a = conf_array(_name)
a.delete(_value)
array_conf(_name,a)
end
|
#destroy_frame(_n = 0) ⇒ Object
239
240
241
|
# File 'lib/a-commons.rb', line 239
def destroy_frame(_n=0)
Arcadia.layout.unregister_panel(frame(_n), true, true)
end
|
#exec(_method, _args = nil) ⇒ Object
def conf_global(_property)
@arcadia['conf'][_property]
end
406
407
408
409
410
|
# File 'lib/a-commons.rb', line 406
def exec(_method, _args=nil)
if self.respond_to(_method)
self.send(_method, _args)
end
end
|
#float_frame(_n = 0, _args = nil) ⇒ Object
377
378
379
380
381
382
383
|
# File 'lib/a-commons.rb', line 377
def float_frame(_n=0, _args=nil)
if @float_frames[_n].nil?
(@float_labels[_n].nil?)? _label = @name : _label = @float_labels[_n]
@float_frames[_n] = FloatFrameWrapper.new(@arcadia, @float_geometries[_n], _label)
end
@float_frames[_n]
end
|
#frame(_n = 0, create_if_not_exist = true) ⇒ Object
296
297
298
299
300
301
302
303
304
305
306
307
308
|
# File 'lib/a-commons.rb', line 296
def frame(_n=0,create_if_not_exist=true)
if @frames_points[_n].nil?
@frames_points[_n] = '0.0'
Arcadia['conf']["#{@name}.frames"]+=',0.0'
end
if @frames[_n] == nil && @frames_points[_n] && create_if_not_exist
(@frames_labels[_n].nil?)? _label = @name : _label = @frames_labels[_n]
(@frames_names[_n].nil?)? _name = @name : _name = @frames_names[_n]
@frames[_n] = FixedFrameWrapper.new(self, @frames_points[_n], _name, _label, _n)
@frames[_n].hinner_frame.bind_append("Enter", proc{self.frame.root.shift_on if self.frame_visible?})
end
return @frames[_n]
end
|
#frame_def_visible?(_n = 0) ⇒ Boolean
283
284
285
286
|
# File 'lib/a-commons.rb', line 283
def frame_def_visible?(_n=0)
@arcadia.layout.domains.include?(@frames_points[_n])
end
|
#frame_domain(_n = 0, _value = nil) ⇒ Object
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
|
# File 'lib/a-commons.rb', line 333
def frame_domain(_n=0, _value=nil)
if conf('frames')
frs = conf('frames').split(',')
else
frs = Array.new
end
ret = nil
if frs.length > _n
if _value != nil
ret = _value
conf_value = ''
frs.each_with_index{|v,i|
if i==_n
cv = _value
else
cv = v
end
if conf_value.length > 0
conf_value+=",#{cv}"
else
conf_value+=cv
end
}
conf('frames', conf_value)
else
ret = frs[_n]
end
end
ret
end
|
#frame_domain_default(_n = 0) ⇒ Object
364
365
366
367
368
369
370
371
372
373
374
375
|
# File 'lib/a-commons.rb', line 364
def frame_domain_default(_n=0)
if conf_default('frames')
frs = conf_default('frames').split(',')
else
frs = Array.new
end
ret = nil
if frs.length > _n
ret = frs[_n]
end
ret
end
|
#frame_raised?(_n = 0) ⇒ Boolean
292
293
294
|
# File 'lib/a-commons.rb', line 292
def frame_raised?(_n=0)
@arcadia.layout.raised?(frame_domain(_n), @name)
end
|
#frame_title(_n = 0) ⇒ Object
279
280
281
|
# File 'lib/a-commons.rb', line 279
def frame_title(_n=0)
@frames_labels[_n] if @frames[_n] != nil
end
|
#frame_visible?(_n = 0) ⇒ Boolean
288
289
290
|
# File 'lib/a-commons.rb', line 288
def frame_visible?(_n=0)
@frames != nil && @frames[_n] != nil && @frames[_n].hinner_frame && TkWinfo.mapped?(@frames[_n].hinner_frame)
end
|
#hide_frame(_n = 0) ⇒ Object
235
236
237
|
# File 'lib/a-commons.rb', line 235
def hide_frame(_n=0)
Arcadia.layout.unregister_panel(frame(_n), false, true)
end
|
#hinner_dialog(_n = 0, side = 'top', args = nil) ⇒ Object
310
311
312
313
314
315
316
|
# File 'lib/a-commons.rb', line 310
def hinner_dialog(_n=0, side='top', args=nil)
if @hinner_dialogs[0].nil?
@hinner_dialogs[_n] = @arcadia.layout.add_hinner_dialog(side, args)
@hinner_dialogs[_n].pack('side' =>side,'padx'=>0, 'pady'=>0, 'fill'=>'x', 'expand'=>'1')
end
@hinner_dialogs[_n]
end
|
#hinner_splitted_dialog(_n = 0, _side = 'top', _height = 100, _args = nil) ⇒ Object
318
319
320
321
322
323
|
# File 'lib/a-commons.rb', line 318
def hinner_splitted_dialog(_n=0, _side='top', _height=100, _args=nil)
if @hinner_dialogs[0].nil?
@hinner_dialogs[_n] = @arcadia.layout.add_hinner_splitted_dialog(_side, _height, _args)
end
@hinner_dialogs[_n]
end
|
#hinner_splitted_dialog_titled(_title = nil, _n = 0, _side = 'top', _height = 100, _args = nil) ⇒ Object
325
326
327
328
329
330
|
# File 'lib/a-commons.rb', line 325
def hinner_splitted_dialog_titled(_title=nil, _n=0, _side='top', _height=100, _args=nil)
if @hinner_dialogs[0].nil?
@hinner_dialogs[_n] = @arcadia.layout.add_hinner_splitted_dialog_titled(_title, _side, _height, _args)
end
@hinner_dialogs[_n]
end
|
#maximize(_n = 0) ⇒ Object
418
419
420
|
# File 'lib/a-commons.rb', line 418
def maximize(_n=0)
@frames[_n].maximize if @frames[_n]
end
|
#maximized?(_n = 0) ⇒ Boolean
412
413
414
415
416
|
# File 'lib/a-commons.rb', line 412
def maximized?(_n=0)
ret= false
ret=@frames[_n].maximized? if @frames[_n]
ret
end
|
#resize(_n = 0) ⇒ Object
422
423
424
|
# File 'lib/a-commons.rb', line 422
def resize(_n=0)
@frames[_n].resize if @frames[_n]
end
|
#restore_default_conf(_property) ⇒ Object
396
397
398
399
400
|
# File 'lib/a-commons.rb', line 396
def restore_default_conf(_property)
if @arcadia['conf'][@name+'.'+_property] && @arcadia['conf_without_local'][@name+'.'+_property]
@arcadia['conf'][@name+'.'+_property] = @arcadia['conf_without_local'][@name+'.'+_property]
end
end
|