Class: Roby::Interface::V2::Async::UIConnector
- Defined in:
- lib/roby/interface/v2/async/ui_connector.rb
Overview
Creates a connection between a Syskit job and a Qt-based GUI
A job is a placeholder for an action with some arguments set. It is created by Interface#connect_to_ui. More than one job can exist based on a given action (as long as they differ by their arguments), but a given job can be started by the GUI only once.
Defined Under Namespace
Classes: ActionConnector, DropCommand, KillCommand, ProgressMonitorCommand, SetArgumentCommand, StartCommand
Instance Attribute Summary collapse
-
#interface ⇒ Object
readonly
Returns the value of attribute interface.
-
#widget ⇒ Object
readonly
Returns the value of attribute widget.
Instance Method Summary collapse
- #ARGUMENT(action, argument_name) ⇒ Object
- #connect(*args, &block) ⇒ Object
- #DROP(action) ⇒ Object
-
#initialize(interface, widget) ⇒ UIConnector
constructor
A new instance of UIConnector.
- #KILL(action) ⇒ Object
- #method_missing(m, *args, &block) ⇒ Object
- #on_reachable(&block) ⇒ Object
- #on_unreachable(&block) ⇒ Object
- #PROGRESS(action) ⇒ Object
- #respond_to_missing?(m, include_private = false) ⇒ Boolean
- #START(action) ⇒ Object
- #to_widget ⇒ Object
Constructor Details
#initialize(interface, widget) ⇒ UIConnector
Returns a new instance of UIConnector.
111 112 113 114 |
# File 'lib/roby/interface/v2/async/ui_connector.rb', line 111 def initialize(interface, ) @interface = interface @widget = end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args, &block) ⇒ Object
170 171 172 173 174 175 176 177 178 |
# File 'lib/roby/interface/v2/async/ui_connector.rb', line 170 def method_missing(m, *args, &block) if m =~ /!$/ ActionMonitor.new(interface, m.to_s[0..-2], *args) elsif .respond_to?(m) .public_send(m, *args, &block) else super end end |
Instance Attribute Details
#interface ⇒ Object (readonly)
Returns the value of attribute interface.
109 110 111 |
# File 'lib/roby/interface/v2/async/ui_connector.rb', line 109 def interface @interface end |
#widget ⇒ Object (readonly)
Returns the value of attribute widget.
109 110 111 |
# File 'lib/roby/interface/v2/async/ui_connector.rb', line 109 def @widget end |
Instance Method Details
#ARGUMENT(action, argument_name) ⇒ Object
162 163 164 |
# File 'lib/roby/interface/v2/async/ui_connector.rb', line 162 def ARGUMENT(action, argument_name) SetArgumentCommand.new(self, action, argument_name) end |
#connect(*args, &block) ⇒ Object
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/roby/interface/v2/async/ui_connector.rb', line 124 def connect(*args, &block) if args.first.kind_of?(Qt::Widget) # Signature from a widget's signal to Syskit = args.shift signal = args.shift action = args.shift action. = args.shift || {} if .respond_to?(:to_widget) = . end .connect(signal) do |*args| action.run(*args) end else # Signature from syskit to a block action = args.shift action. = args.shift action.callback = block action.connect end end |
#DROP(action) ⇒ Object
150 151 152 |
# File 'lib/roby/interface/v2/async/ui_connector.rb', line 150 def DROP(action) DropCommand.new(self, action) end |
#KILL(action) ⇒ Object
154 155 156 |
# File 'lib/roby/interface/v2/async/ui_connector.rb', line 154 def KILL(action) KillCommand.new(self, action) end |
#on_reachable(&block) ⇒ Object
116 117 118 |
# File 'lib/roby/interface/v2/async/ui_connector.rb', line 116 def on_reachable(&block) interface.on_reachable(&block) end |
#on_unreachable(&block) ⇒ Object
120 121 122 |
# File 'lib/roby/interface/v2/async/ui_connector.rb', line 120 def on_unreachable(&block) interface.on_unreachable(&block) end |
#PROGRESS(action) ⇒ Object
158 159 160 |
# File 'lib/roby/interface/v2/async/ui_connector.rb', line 158 def PROGRESS(action) ProgressMonitorCommand.new(self, action) end |
#respond_to_missing?(m, include_private = false) ⇒ Boolean
166 167 168 |
# File 'lib/roby/interface/v2/async/ui_connector.rb', line 166 def respond_to_missing?(m, include_private = false) (m =~ /!$/) || .respond_to?(m) || super end |
#START(action) ⇒ Object
146 147 148 |
# File 'lib/roby/interface/v2/async/ui_connector.rb', line 146 def START(action) StartCommand.new(self, action) end |
#to_widget ⇒ Object
180 181 182 |
# File 'lib/roby/interface/v2/async/ui_connector.rb', line 180 def end |