Robot Framework Integrated Development Environment (RIDE)
tree_aware_plugin_mixin.py
Go to the documentation of this file.
1 # Copyright 2008-2015 Nokia Networks
2 # Copyright 2016- Robot Framework Foundation
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 
16 from ..publish.messages import RideTreeAwarePluginAdded
17 
18 
19 
38 
39 
42  _tree_aware_plugins_set = None
43 
45  return any(twb.is_focused() for twb in self._tree_aware_plugins_tree_aware_plugins_tree_aware_plugins)
46 
48  RideTreeAwarePluginAdded(plugin=self).publish()
49  self.subscribe(self._tree_aware_plugin_added_tree_aware_plugin_added, RideTreeAwarePluginAdded)
50 
52  self.unsubscribe(self._tree_aware_plugin_added_tree_aware_plugin_added, RideTreeAwarePluginAdded)
53  for other in self._tree_aware_plugins_tree_aware_plugins_tree_aware_plugins:
54  other.remove_tree_aware_plugin(self)
55 
56  def add_tree_aware_plugin(self, other):
57  self._tree_aware_plugins_tree_aware_plugins_tree_aware_plugins.add(other)
58 
59  def remove_tree_aware_plugin(self, other):
60  self._tree_aware_plugins_tree_aware_plugins_tree_aware_plugins.remove(other)
61 
62  def _tree_aware_plugin_added(self, message):
63  self.add_tree_aware_pluginadd_tree_aware_plugin(message.plugin)
64  message.plugin.add_tree_aware_plugin(self)
65 
66  @property
67  _tree_aware_plugins = property
68 
70  if self._tree_aware_plugins_set_tree_aware_plugins_set is None:
71  self._tree_aware_plugins_set_tree_aware_plugins_set = set()
72  return self._tree_aware_plugins_set_tree_aware_plugins_set
Mixin to help solve if tree aware plugin has focus.