rsence-pre 2.1.0.1.pre → 2.1.0.2.pre

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/VERSION CHANGED
@@ -1 +1 @@
1
- 2.1.0.1.pre
1
+ 2.1.0.2.pre
@@ -10,16 +10,21 @@
10
10
  /*** = Description
11
11
  ** HSheet is a container component that toggles its visibility
12
12
  ** based on its value. When the value is 0, it's visible, otherwise
13
- ** it's hidden. It expands to fill its parent view, the rect
14
- ** specifies the size of the sheet inside. The sheet is
15
- ** centered. It's practical when combined with button
16
- ** values. Also see HAlertSheet and HConfirmSheet components.
17
- **
13
+ ** it's hidden. It expands to fill its parent view.
14
+ **
15
+ ** Its rect specifies the relative size and position of the centered inner
16
+ ** sheet, which acts as a subview.
17
+ **
18
+ ** It's practical when combined with button values.
19
+ **
20
+ ** Also see HAlertSheet and HConfirmSheet components.
21
+ **
18
22
  ***/
19
23
  var//RSence.Controls
20
24
  HSheet = HControl.extend({
25
+
21
26
  componentName: 'sheet',
22
-
27
+
23
28
  /** = Description
24
29
  * Shows of hides HSheet depending on the value.
25
30
  * If the value is 0 the HSheet#show() will be called.
@@ -34,7 +39,7 @@ HSheet = HControl.extend({
34
39
  this.hide();
35
40
  }
36
41
  },
37
-
42
+
38
43
  /** = Description
39
44
  * Draws the sheet rectangle once it has been created and
40
45
  * if it has not been set as hidden by constructor.
@@ -45,13 +50,15 @@ HSheet = HControl.extend({
45
50
  **/
46
51
  drawRect: function() {
47
52
  if (this.parent && this.rect.isValid) {
48
- var _this = this,
49
- _elemId = _this.elemId,
50
- _styl = ELEM.setStyle,
51
- _rect = _this.rect,
52
- _width = _rect.width,
53
- _left = 0-Math.floor(_rect.width/2),
54
- _height = _rect.height;
53
+ var
54
+ _this = this,
55
+ _elemId = _this.elemId,
56
+ _styl = ELEM.setStyle,
57
+ _rect = _this.rect,
58
+ _width = _rect.width,
59
+ _top = _rect.top,
60
+ _left = 0-Math.floor(_rect.width/2)+_rect.left,
61
+ _height = _rect.height;
55
62
 
56
63
  _styl( _elemId, 'left', '0px', true);
57
64
  _styl( _elemId, 'top', '0px', true);
@@ -65,7 +72,7 @@ HSheet = HControl.extend({
65
72
  if(_this['markupElemIds']){
66
73
  var _stateId = _this.markupElemIds['state'];
67
74
  _styl( _stateId, 'left', _left+'px', true );
68
- _styl( _stateId, 'top', '0px', true );
75
+ _styl( _stateId, 'top', _top+'px', true );
69
76
  _styl( _stateId, 'width', _width+'px', true );
70
77
  _styl( _stateId, 'height', _height+'px', true );
71
78
  }
@@ -127,7 +127,7 @@ ReloadApp = HApplication.extend({
127
127
  );
128
128
  }
129
129
  }).nu(
130
- HRect.nu( _alertX, _alertY, _alertX+_alertWidth, _alertY+_alertHeight ),
130
+ HRect.nu( 0, 0, _alertWidth, _alertHeight ),
131
131
  _this, {
132
132
  label: _title,
133
133
  value: 0
@@ -29,18 +29,6 @@ module RSence
29
29
  # @return [:GUIPlugin]
30
30
  def self.bundle_type; :GUIPlugin; end
31
31
 
32
-
33
- # @private Placeholder for actual gui yaml file.
34
- @@default_yaml_src = <<-END
35
- type: GUITree
36
- version: 0.6
37
-
38
- class: RSence.GUIApp
39
- options:
40
- label: "Dummy Application"
41
-
42
- END
43
-
44
32
  # In addition to {Plugin__#init Plugin#init}, also automatically initializes a {GUIParser} instance as +@gui+
45
33
  #
46
34
  # @return [nil]
@@ -48,8 +36,11 @@ options:
48
36
  super
49
37
  yaml_src = file_read( "gui/#{@name}.yaml" )
50
38
  yaml_src = file_read( "gui/main.yaml" ) unless yaml_src
51
- yaml_src = @@default_yaml_src unless yaml_src
52
- @gui = GUIParser.new( self, yaml_src )
39
+ if yaml_src
40
+ @gui = GUIParser.new( self, yaml_src )
41
+ else
42
+ @gui = nil
43
+ end
53
44
  @client_pkgs = false
54
45
  end
55
46
 
@@ -79,6 +70,7 @@ options:
79
70
  # end
80
71
  #
81
72
  def gui_params( msg )
73
+ return unless @gui
82
74
  { :values => @gui.values( get_ses( msg ) ) }
83
75
  end
84
76
 
@@ -147,11 +139,13 @@ options:
147
139
  #
148
140
  # @return [nil]
149
141
  def init_ui( msg )
142
+ return unless @gui
150
143
  @gui.init( msg, gui_params( msg ) )
151
144
  end
152
145
 
153
146
  # @private Automatically kills the UI using {GUIParser#kill}
154
147
  def kill_ui( msg )
148
+ return unless @gui
155
149
  @gui.kill( msg )
156
150
  end
157
151
 
@@ -25,7 +25,11 @@ module RSence
25
25
  # Extended {#init}, delegates calls to the sub-plugins.
26
26
  def init
27
27
  super
28
- @plugin_plugins = RSence::PluginManager.new( [ bundle_path('plugins') ] )
28
+ @plugin_plugins = RSence::PluginManager.new({
29
+ :plugin_paths => [ bundle_path('plugins') ],
30
+ :autoreload => @plugins.autoreload,
31
+ :parent_manager => @plugins
32
+ })
29
33
  end
30
34
 
31
35
  # Extended {#open}, delegates calls to the sub-plugins.
@@ -25,7 +25,13 @@ module RSence
25
25
 
26
26
  # Returns the registry data for plugin bundle +plugin_name+
27
27
  def registry( plugin_name )
28
- return @registry[ plugin_name ]
28
+ if @registry.has_key?( plugin_name )
29
+ return @registry[ plugin_name ]
30
+ elsif @parent_manager
31
+ return @parent_manager.registry( plugin_name )
32
+ else
33
+ throw "Plugin not in registry: #{plugin_name.inspect}"
34
+ end
29
35
  end
30
36
  alias [] registry
31
37
 
@@ -37,6 +43,8 @@ module RSence
37
43
  elsif block == nil
38
44
  call( sym, *args )
39
45
  end
46
+ elsif @parent_manager
47
+ return @parent_manager.method_missing( sym, *args, &block )
40
48
  end
41
49
  end
42
50
 
@@ -584,20 +592,29 @@ module RSence
584
592
 
585
593
  # Initialize with a list of directories as plugin_paths.
586
594
  # It's an array containing all plugin directories to scan.
587
- def initialize( plugin_paths, transporter=nil,
588
- autoreload=false, name_prefix=false,
589
- resolved_deps=[], resolved_categories={} )
590
- if transporter
591
- @transporter = transporter
592
- @sessions = transporter.sessions
593
- end
594
- @name_prefix = name_prefix
595
- @plugin_paths = plugin_paths
596
- @deps = Dependencies.new( resolved_deps, resolved_categories )
597
- puts "Loading #{name_prefix+' ' if name_prefix}plugins..." if RSence.args[:verbose]
595
+ def initialize( options )
596
+ options = {
597
+ :plugin_paths => nil,
598
+ :transporter => nil,
599
+ :autoreload => false,
600
+ :name_prefix => false,
601
+ :resolved_deps => [],
602
+ :resolved_categories => {},
603
+ :parent_manager => nil
604
+ }.merge( options )
605
+
606
+ self.plugin_paths = options[:plugin_paths]
607
+ self.transporter = options[:transporter]
608
+ self.autoreload = options[:autoreload]
609
+ self.name_prefix = options[:name_prefix]
610
+ self.parent_manager = options[:parent_manager]
611
+
612
+ @deps = Dependencies.new( options[:resolved_deps], options[:resolved_categories] )
613
+
614
+ puts "Loading #{@name_prefix+' ' if @name_prefix}plugins..." if RSence.args[:verbose]
598
615
  init_bundles!
599
- puts %{Plugins #{"of #{name_prefix} " if name_prefix}loaded.} if RSence.args[:verbose]
600
- if autoreload
616
+ puts %{Plugins #{"of #{@name_prefix} " if @name_prefix}loaded.} if RSence.args[:verbose]
617
+ if @autoreload
601
618
  @thr = Thread.new do
602
619
  Thread.pass
603
620
  while true
@@ -610,7 +627,39 @@ module RSence
610
627
  end
611
628
  end
612
629
  end
630
+
613
631
  end
632
+
633
+ attr_reader :transporter
634
+ attr_reader :sessions
635
+ def transporter=( transporter )
636
+ if transporter
637
+ @transporter = transporter
638
+ @sessions = transporter.sessions
639
+ end
640
+ end
641
+
642
+ attr_reader :autoreload
643
+ def autoreload=( autoreload )
644
+ @autoreload = autoreload
645
+ end
646
+
647
+ attr_reader :name_prefix
648
+ def name_prefix=( name_prefix )
649
+ @name_prefix = name_prefix
650
+ end
651
+
652
+ attr_reader :plugin_paths
653
+ def plugin_paths=( plugin_paths )
654
+ @plugin_paths = plugin_paths
655
+ end
656
+
657
+ # Optionally set a parent plugin manager to fall back on
658
+ attr_reader :parent_manager
659
+ def parent_manager=( parent_manager )
660
+ @parent_manager = parent_manager
661
+ end
662
+
614
663
  end
615
664
  end
616
665
 
@@ -43,14 +43,14 @@ module RSence
43
43
  core_pkgs = {
44
44
  :core => [:transporter, :session_storage, :session_manager, :value_manager]
45
45
  }
46
- @plugins = PluginManager.new(
47
- RSence.config[:plugin_paths],
48
- self,
49
- RSence.args[:autoupdate],
50
- false,
51
- core_pkgs[:core],
52
- core_pkgs
53
- )
46
+ @plugins = PluginManager.new( {
47
+ :plugin_paths => RSence.config[:plugin_paths],
48
+ :transporter => self,
49
+ :autoupdate => RSence.args[:autoupdate],
50
+ :name_prefix => false,
51
+ :resolved_deps => core_pkgs[:core],
52
+ :resolved_categories => core_pkgs
53
+ })
54
54
  if RSence.launch_pid != Process.pid
55
55
  Process.kill( 'TERM', RSence.launch_pid )
56
56
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rsence-pre
3
3
  version: !ruby/object:Gem::Version
4
- hash: 961916128
4
+ hash: 961916140
5
5
  prerelease: true
6
6
  segments:
7
7
  - 2
8
8
  - 1
9
9
  - 0
10
- - 1
10
+ - 2
11
11
  - pre
12
- version: 2.1.0.1.pre
12
+ version: 2.1.0.2.pre
13
13
  platform: ruby
14
14
  authors:
15
15
  - Riassence Inc.