33 from python_qt_binding.QtWidgets 
import QVBoxLayout, QMenu, QWidget, QDockWidget
 
   38     def __init__(self, popup_name, timeline, viewer_type, topic):
 
   39         super(TopicPopupWidget, self).
__init__()
 
   40         self.setObjectName(popup_name)
 
   41         self.setWindowTitle(popup_name)
 
   43         layout = QVBoxLayout()
 
   44         self.setLayout(layout)
 
   56         super(TopicPopupWidget, self).
hideEvent(event)
 
   62         super(TopicPopupWidget, self).
showEvent(event)
 
   66         Make this topic popup visible, if necessary. This includes setting up 
   67         the proper close button hacks 
   70             context.add_widget(self)
 
   72             dock_features = self.parent().features()
 
   73             dock_features |= QDockWidget.DockWidgetClosable
 
   74             self.parent().setFeatures(dock_features)
 
   83             for i 
in reversed(range(self.layout().count())):
 
   84                 self.layout().itemAt(i).widget().setParent(
None)
 
   92         super(TopicPopupWidget, self).
show()
 
   98     Custom popup menu displayed on rightclick from timeline 
  102         super(TimelinePopupMenu, self).
__init__()
 
  107         if menu_topic 
is not None:
 
  108             self.setTitle(menu_topic)
 
  125         if menu_topic 
is None:
 
  126             submenu = self.addMenu(
'Thumbnails...')
 
  129             submenu.addSeparator()
 
  135                     self.
timeline._timeline_frame.is_renderer_active(topic))
 
  140                 if menu_topic == topic:
 
  144                         self.
timeline._timeline_frame.is_renderer_active(topic))
 
  149         if menu_topic 
is None:
 
  151             view_topics_menu = self.addMenu(
'View (by Topic)')
 
  156                 topic_menu = QMenu(topic, self)
 
  157                 viewer_types = self.
timeline._timeline_frame.get_viewer_types(datatype)
 
  160                 for viewer_type 
in viewer_types:
 
  161                     tempaction = topic_menu.addAction(viewer_type.name)
 
  162                     tempaction.setData(viewer_type)
 
  164                 view_topics_menu.addMenu(topic_menu)
 
  166             view_type_menu = self.addMenu(
'View (by Type)')
 
  170                 datatype_menu = QMenu(datatype, self)
 
  172                 viewer_types = self.
timeline._timeline_frame.get_viewer_types(datatype)
 
  173                 for topic 
in [t 
for t 
in self.
_topics if t 
in datatype_topics]:   
 
  174                     topic_menu = QMenu(topic, datatype_menu)
 
  176                     for viewer_type 
in viewer_types:
 
  177                         tempaction = topic_menu.addAction(viewer_type.name)
 
  178                         tempaction.setData(viewer_type)
 
  180                     datatype_menu.addMenu(topic_menu)
 
  181                 view_type_menu.addMenu(datatype_menu)
 
  183             view_menu = self.addMenu(
"View")
 
  186             viewer_types = self.
timeline._timeline_frame.get_viewer_types(datatype)
 
  187             for viewer_type 
in viewer_types:
 
  188                 tempaction = view_menu.addAction(viewer_type.name)
 
  189                 tempaction.setData(viewer_type)
 
  196         if menu_topic 
is None:
 
  197             submenu = self.addMenu(
'Publish...')
 
  202             submenu.addSeparator()
 
  215         action = self.exec_(event.globalPos())
 
  216         if action 
is not None and action != 0:
 
  221         :param action: action to execute, ''QAction'' 
  222         :raises: when it doesn't recognice the action passed in, ''Exception'' 
  225             self.
timeline._timeline_frame.reset_timeline()
 
  229             for topic 
in self.
timeline._timeline_frame.topics:
 
  230                 if not self.
timeline.start_publishing(topic):
 
  233             for topic 
in self.
timeline._timeline_frame.topics:
 
  234                 if not self.
timeline.stop_publishing(topic):
 
  237             self.
timeline._timeline_frame.set_renderers_active(
True)
 
  239             self.
timeline._timeline_frame.set_renderers_active(
False)
 
  242                 topic = action.text()
 
  246             if self.
timeline._timeline_frame.is_renderer_active(topic):
 
  247                 self.
timeline._timeline_frame.set_renderer_active(topic, 
False)
 
  249                 self.
timeline._timeline_frame.set_renderer_active(topic, 
True)
 
  252                 topic = action.parentWidget().title()
 
  256             popup_name = topic + 
'__' + action.text()
 
  257             if popup_name 
not in self.
timeline.popups:
 
  259                                          action.data(), str(topic))
 
  261                 self.
timeline.add_view(topic, frame)
 
  262                 self.
timeline.popups[popup_name] = frame
 
  265             frame = self.
timeline.popups[popup_name]
 
  266             frame.show(self.
timeline.get_context())
 
  270                 topic = action.text()
 
  274             if self.
timeline.is_publishing(topic):
 
  275                 self.
timeline.stop_publishing(topic)
 
  277                 self.
timeline.start_publishing(topic)
 
  279             raise Exception(
'Unknown action in TimelinePopupMenu.process')