Class: Rediscover::Panel::Server
- Inherits:
-
Wx::Panel
- Object
- Wx::Panel
- Rediscover::Panel::Server
- Includes:
- Wx
- Defined in:
- lib/rediscover/panel/server.rb
Constant Summary collapse
- REFRESH_INTERVAL =
5000
Instance Method Summary collapse
- #get_info ⇒ Object
-
#initialize(parent) ⇒ Server
constructor
A new instance of Server.
- #refresh ⇒ Object
- #setup_server_info ⇒ Object
- #setup_sizer ⇒ Object
Constructor Details
#initialize(parent) ⇒ Server
Returns a new instance of Server.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/rediscover/panel/server.rb', line 8 def initialize(parent) @parent = parent super(@parent, -1) @redis = get_app.redis @logger = get_app.logger setup_sizer setup_server_info end |
Instance Method Details
#get_info ⇒ Object
32 33 34 |
# File 'lib/rediscover/panel/server.rb', line 32 def get_info @redis.info.map { |key, value| "#{key}: #{value}" }.sort.join("\n") end |
#refresh ⇒ Object
36 37 38 |
# File 'lib/rediscover/panel/server.rb', line 36 def refresh @server_info_text.set_label(get_info) end |
#setup_server_info ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/rediscover/panel/server.rb', line 24 def setup_server_info @server_info_text = StaticText.new(self, :label => get_info) @sizer.add_item(@server_info_text) timer = Timer.new(self) evt_timer(timer.id) { refresh } timer.start(REFRESH_INTERVAL) end |
#setup_sizer ⇒ Object
19 20 21 22 |
# File 'lib/rediscover/panel/server.rb', line 19 def setup_sizer @sizer = BoxSizer.new(VERTICAL) set_sizer(@sizer) end |