CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EventBrowserPlugin.py
Go to the documentation of this file.
1 import os.path
2 import logging
3 
4 from PyQt4.QtGui import QLabel
5 
6 from Vispa.Plugins.Browser.BrowserPlugin import BrowserPlugin
7 
8 from Vispa.Main.Exceptions import NoCurrentTabControllerException
9 
11  """ The EventBrowserPlugin supports navigation in files.
12  """
13 
14  def __init__(self, application=None):
15  logging.debug(__name__ + ": __init__")
16  BrowserPlugin.__init__(self, application)
17 
18  def startUp(self):
19  BrowserPlugin.startUp(self)
21 
23  """ Fill EventNavigator specific menu.
24  """
25  self._navigateMenu = self._application.createPluginMenu('&Navigate')
26  self._navigateToolBar = self._application.createPluginToolBar('&Navigate')
27  self._firstAction = self._application.createAction('&First', self.first, "Ctrl+Home", "first")
28  self._previousAction = self._application.createAction('&Previous', self.previous, "Ctrl+PgUp", "previous")
29  self._nextAction = self._application.createAction('&Next', self.next, "Ctrl+PgDown", "next")
30  self._lastAction = self._application.createAction('&Last', self.last, "Ctrl+End", "last")
31  self._gotoAction = self._application.createAction('&Goto...', self.goto, "Ctrl+G")
32  self._eventNumberDisplay = QLabel("")
33  self._navigateMenu.addAction(self._firstAction)
34  self._navigateMenu.addAction(self._previousAction)
35  self._navigateMenu.addAction(self._nextAction)
36  self._navigateMenu.addAction(self._lastAction)
37  self._navigateMenu.addAction(self._gotoAction)
38  self._navigateToolBar.addAction(self._firstAction)
39  self._navigateToolBar.addAction(self._previousAction)
40  self._navigateToolBar.addWidget(self._eventNumberDisplay)
41  self._navigateToolBar.addAction(self._nextAction)
42  self._navigateToolBar.addAction(self._lastAction)
43 
44  def eventNumberDisplay(self):
45  return self._eventNumberDisplay
46 
47  def first(self):
48  """ Calls first() function of current tab controller.
49  """
50  try:
51  self.application().currentTabController().first()
52  except NoCurrentTabControllerException:
53  logging.warning(self.__class__.__name__ + ": first() - No tab controller found.")
54 
55  def previous(self):
56  """ Calls previous() function of current tab controller.
57  """
58  try:
59  self.application().currentTabController().previous()
60  except NoCurrentTabControllerException:
61  logging.warning(self.__class__.__name__ + ": previous() - No tab controller found.")
62 
63  def next(self):
64  """ Calls next() function of current tab controller.
65  """
66  try:
67  self.application().currentTabController().next()
68  except NoCurrentTabControllerException:
69  logging.warning(self.__class__.__name__ + ": next() - No tab controller found.")
70 
71  def last(self):
72  """ Calls last() function of current tab controller.
73  """
74  try:
75  self.application().currentTabController().last()
76  except NoCurrentTabControllerException:
77  logging.warning(self.__class__.__name__ + ": last() - No tab controller found.")
78 
79  def goto(self):
80  """ Calls goto() function of current tab controller.
81  """
82  try:
83  self.application().currentTabController().goto()
84  except NoCurrentTabControllerException:
85  logging.warning(self.__class__.__name__ + ": goto() - No tab controller found.")
86 
87  def navigateMenu(self):
88  return self._navigateMenu
89 
90  def navigateToolBar(self):
91  return self._navigateToolBar
92