Class: Syskit::GUI::LoggingConfigurationItem
- Inherits:
-
LoggingConfigurationItemBase
- Object
- Vizkit::VizkitItem
- LoggingConfigurationItemBase
- Syskit::GUI::LoggingConfigurationItem
- Defined in:
- lib/syskit/gui/logging_configuration_item.rb
Overview
A QStandardItem that displays a Sysit::ShellInterface::LoggingConfiguration in a tree view
Instance Attribute Summary collapse
-
#conf_logs_item_name ⇒ Object
readonly
Returns the value of attribute conf_logs_item_name.
-
#conf_logs_item_value ⇒ Object
readonly
Returns the value of attribute conf_logs_item_value.
-
#groups_item_name ⇒ Object
readonly
Returns the value of attribute groups_item_name.
-
#groups_item_value ⇒ Object
readonly
Returns the value of attribute groups_item_value.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#port_logs_item_name ⇒ Object
readonly
Returns the value of attribute port_logs_item_name.
-
#port_logs_item_value ⇒ Object
readonly
Returns the value of attribute port_logs_item_value.
Attributes inherited from LoggingConfigurationItemBase
#current_model, #editing_model
Instance Method Summary collapse
-
#accept_changes ⇒ Object
Notify child to also accept user changes, updates internal copy of the logging configuration, and calls a block that should the data to the remote side.
-
#initialize(logging_configuration, options = Hash.new) ⇒ LoggingConfigurationItem
constructor
A new instance of LoggingConfigurationItem.
-
#on_accept_changes(&block) ⇒ Object
Sets the block to be called when the user accepts the changes made to the model.
-
#update_conf(new_model) ⇒ Object
Updates the model with a new logging configuration.
-
#write ⇒ Object
Called when the user commit changes made to the model.
Methods inherited from LoggingConfigurationItemBase
#add_conf_item, #data, #deep_copy, #modified!, #reject_changes
Constructor Details
#initialize(logging_configuration, options = Hash.new) ⇒ LoggingConfigurationItem
Returns a new instance of LoggingConfigurationItem
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/syskit/gui/logging_configuration_item.rb', line 18 def initialize(logging_configuration, = Hash.new) super(logging_configuration) @options = setText 'Logging Configuration' @conf_logs_item_name, @conf_logs_item_value = add_conf_item('Enable conf logs', :conf_logs_enabled) @port_logs_item_name, @port_logs_item_value = add_conf_item('Enable port logs', :port_logs_enabled) @groups_item_name = LoggingGroupsItem.new(@current_model.groups, 'Enable group') @groups_item_value = Vizkit::VizkitItem.new("#{@current_model.groups.size} logging group(s)") appendRow([@groups_item_name, @groups_item_value]) end |
Instance Attribute Details
#conf_logs_item_name ⇒ Object (readonly)
Returns the value of attribute conf_logs_item_name
12 13 14 |
# File 'lib/syskit/gui/logging_configuration_item.rb', line 12 def conf_logs_item_name @conf_logs_item_name end |
#conf_logs_item_value ⇒ Object (readonly)
Returns the value of attribute conf_logs_item_value
13 14 15 |
# File 'lib/syskit/gui/logging_configuration_item.rb', line 13 def conf_logs_item_value @conf_logs_item_value end |
#groups_item_name ⇒ Object (readonly)
Returns the value of attribute groups_item_name
16 17 18 |
# File 'lib/syskit/gui/logging_configuration_item.rb', line 16 def groups_item_name @groups_item_name end |
#groups_item_value ⇒ Object (readonly)
Returns the value of attribute groups_item_value
17 18 19 |
# File 'lib/syskit/gui/logging_configuration_item.rb', line 17 def groups_item_value @groups_item_value end |
#options ⇒ Object (readonly)
Returns the value of attribute options
11 12 13 |
# File 'lib/syskit/gui/logging_configuration_item.rb', line 11 def @options end |
#port_logs_item_name ⇒ Object (readonly)
Returns the value of attribute port_logs_item_name
14 15 16 |
# File 'lib/syskit/gui/logging_configuration_item.rb', line 14 def port_logs_item_name @port_logs_item_name end |
#port_logs_item_value ⇒ Object (readonly)
Returns the value of attribute port_logs_item_value
15 16 17 |
# File 'lib/syskit/gui/logging_configuration_item.rb', line 15 def port_logs_item_value @port_logs_item_value end |
Instance Method Details
#accept_changes ⇒ Object
Notify child to also accept user changes, updates internal copy of the logging configuration, and calls a block that should the data to the remote side
48 49 50 51 52 53 |
# File 'lib/syskit/gui/logging_configuration_item.rb', line 48 def accept_changes super @groups_item_name.accept_changes @current_model.groups = @groups_item_name.current_model @commit_block.call current_model end |
#on_accept_changes(&block) ⇒ Object
Sets the block to be called when the user accepts the changes made to the model
66 67 68 |
# File 'lib/syskit/gui/logging_configuration_item.rb', line 66 def on_accept_changes(&block) @commit_block = block end |
#update_conf(new_model) ⇒ Object
Updates the model with a new logging configuration
56 57 58 59 60 61 62 |
# File 'lib/syskit/gui/logging_configuration_item.rb', line 56 def update_conf(new_model) @current_model = deep_copy(new_model) @editing_model = deep_copy(new_model) @groups_item_name.update_groups(@current_model.groups) @groups_item_value.setText "#{@current_model.groups.size} logging group(s)" model.layoutChanged end |
#write ⇒ Object
Called when the user commit changes made to the model
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/syskit/gui/logging_configuration_item.rb', line 34 def write if column == 1 i = index.sibling(row, 0) return if !i.isValid item = i.model.itemFromIndex i item.accept_changes end modified!(false) end |