CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
Vispa.Plugins.Browser.BrowserPlugin.BrowserPlugin Class Reference
Inheritance diagram for Vispa.Plugins.Browser.BrowserPlugin.BrowserPlugin:
Vispa.Main.VispaPlugin.VispaPlugin Vispa.Plugins.ConfigEditor.ConfigEditorPlugin.ConfigEditorPlugin Vispa.Plugins.EventBrowser.EventBrowserPlugin.EventBrowserPlugin Vispa.Plugins.EdmBrowser.EdmBrowserPlugin.EdmBrowserPlugin

Public Member Functions

def __init__ (self, application=None)
 
def addCenterView (self, viewClass, default=False, enabled=True)
 
def availableCenterViews (self)
 
def boxContentAction (self)
 
def collapseAllAction (self)
 
def defaultCenterViewId (self)
 
def disabledCenterViewIds (self)
 
def expandAllAction (self)
 
def expandToDepthAction (self)
 
def filterDialog (self)
 
def newTab (self)
 
def openFile (self, filename=None)
 
def saveImage (self)
 
def saveImageAction (self)
 
def setDisabledCenterViewIds (self, ids)
 
def startUp (self)
 
def switchCenterViewSlot (self)
 
def viewClassId (self, viewClass)
 
def viewMenu (self)
 
def zoomAction (self)
 
def zoomDialog (self)
 
- Public Member Functions inherited from Vispa.Main.VispaPlugin.VispaPlugin
def __init__ (self, application=None)
 
def addNewFileAction (self, label, slot=None)
 
def application (self)
 
def filetypes (self)
 
def getNewFileActions (self)
 
def openFile (self, filename)
 
def registerFiletype (self, ext, description)
 
def registerFiletypesFromTabController (self, TabControllerClass)
 
def shutdown (self)
 

Private Member Functions

def _collapseAll (self)
 
def _expandAll (self)
 
def _expandToDepth (self)
 
def _fillMenu (self)
 
def _showBoxContentDialog (self)
 

Private Attributes

 _availableCenterViews
 
 _boxContentAction
 
 _collapseAllAction
 
 _defaultCenterViewId
 
 _disabledCenterViewIds
 
 _expandAllAction
 
 _expandToDepthAction
 
 _filterAction
 
 _saveImageAction
 
 _startUp
 
 _viewMenu
 
 _zoomAction
 

Detailed Description

The BrowserPlugin supplies the view menu and supports center views.

Definition at line 10 of file BrowserPlugin.py.

Constructor & Destructor Documentation

def Vispa.Plugins.Browser.BrowserPlugin.BrowserPlugin.__init__ (   self,
  application = None 
)

Definition at line 14 of file BrowserPlugin.py.

14  def __init__(self, application=None):
15  logging.debug(__name__ + ": __init__")
16  VispaPlugin.__init__(self, application)
20  self._startUp=True
21 

Member Function Documentation

def Vispa.Plugins.Browser.BrowserPlugin.BrowserPlugin._collapseAll (   self)
private
Calls collapseAll() function of tree view.

Definition at line 78 of file BrowserPlugin.py.

References Vispa.Main.VispaPlugin.VispaPlugin.application(), and Vispa.Main.MainWindow.MainWindow.application().

78  def _collapseAll(self):
79  """ Calls collapseAll() function of tree view.
80  """
81  try:
82  self.application().currentTabController().tab().treeView().collapseAll()
83  except NoCurrentTabControllerException:
84  logging.warning(self.__class__.__name__ + ": _collapseAll() - No tab controller found.")
85 
def Vispa.Plugins.Browser.BrowserPlugin.BrowserPlugin._expandAll (   self)
private
Calls expandAll() function of tree view.

Definition at line 62 of file BrowserPlugin.py.

References Vispa.Main.VispaPlugin.VispaPlugin.application(), and Vispa.Main.MainWindow.MainWindow.application().

62  def _expandAll(self):
63  """ Calls expandAll() function of tree view.
64  """
65  try:
66  self.application().currentTabController().tab().treeView().expandAll()
67  except NoCurrentTabControllerException:
68  logging.warning(self.__class__.__name__ + ": _expandAll() - No tab controller found.")
69 
def Vispa.Plugins.Browser.BrowserPlugin.BrowserPlugin._expandToDepth (   self)
private
Calls expandToDepthDialog() function of current tab controller.

Definition at line 70 of file BrowserPlugin.py.

References Vispa.Main.VispaPlugin.VispaPlugin.application(), and Vispa.Main.MainWindow.MainWindow.application().

70  def _expandToDepth(self):
71  """ Calls expandToDepthDialog() function of current tab controller.
72  """
73  try:
74  self.application().currentTabController().tab().treeView().expandToDepthDialog()
75  except NoCurrentTabControllerException:
76  logging.warning(self.__class__.__name__ + ": _expandToDepth() - No tab controller found.")
77 
def Vispa.Plugins.Browser.BrowserPlugin.BrowserPlugin._fillMenu (   self)
private
Fill specific menu.

Definition at line 38 of file BrowserPlugin.py.

Referenced by Vispa.Plugins.Browser.BrowserPlugin.BrowserPlugin.startUp().

38  def _fillMenu(self):
39  """ Fill specific menu.
40  """
41  self._viewMenu = self.application().createPluginMenu('&View')
42  self._expandAllAction = self.application().createAction('&Expand all', self._expandAll,"Ctrl+E")
43  self._viewMenu.addAction(self._expandAllAction)
44  self._expandToDepthAction = self.application().createAction('Expand to &depth...', self._expandToDepth, "Ctrl+Shift+E")
45  self._viewMenu.addAction(self._expandToDepthAction)
46  self._collapseAllAction = self.application().createAction('&Collapse all', self._collapseAll,"Ctrl+L")
47  self._viewMenu.addAction(self._collapseAllAction)
48  self._viewMenu.addSeparator()
49  self._filterAction = self.application().createAction('&Apply filter...', self.filterDialog, "Ctrl+P")
50  self._viewMenu.addAction(self._filterAction)
51  self._boxContentAction = self.application().createAction('Show &object details...', self._showBoxContentDialog, "Ctrl+B")
52  self._viewMenu.addAction(self._boxContentAction)
53  self._saveImageAction = self.application().createAction('&Save image...', self.saveImage, "Ctrl+I")
54  self._viewMenu.addAction(self._saveImageAction)
55  self._zoomAction = self.application().createAction('&Zoom...', self.zoomDialog, "Ctrl+Shift+Z")
56  self._viewMenu.addAction(self._zoomAction)
57  self._viewMenu.addSeparator()
58 
def Vispa.Plugins.Browser.BrowserPlugin.BrowserPlugin._showBoxContentDialog (   self)
private
Calls showBoxContentDialog() function of current tab controller.

Definition at line 94 of file BrowserPlugin.py.

References Vispa.Main.VispaPlugin.VispaPlugin.application(), and Vispa.Main.MainWindow.MainWindow.application().

95  """ Calls showBoxContentDialog() function of current tab controller.
96  """
97  try:
98  self.application().currentTabController().showBoxContentDialog()
99  except NoCurrentTabControllerException:
100  logging.warning(self.__class__.__name__ + ": showBoxContentDialog() - No tab controller found.")
101 
def Vispa.Plugins.Browser.BrowserPlugin.BrowserPlugin.addCenterView (   self,
  viewClass,
  default = False,
  enabled = True 
)
add a View for the Center View

 selection: name is the menu entry, function the function to be
 added as action if the menu is selecteds

Definition at line 123 of file BrowserPlugin.py.

References Vispa.Plugins.Browser.BrowserPlugin.BrowserPlugin._availableCenterViews, Vispa.Plugins.Browser.BrowserPlugin.BrowserPlugin._defaultCenterViewId, Vispa.Plugins.Browser.BrowserPlugin.BrowserPlugin._disabledCenterViewIds, Vispa.Main.VispaPlugin.VispaPlugin.application(), Vispa.Main.MainWindow.MainWindow.application(), str, Vispa.Plugins.Browser.BrowserPlugin.BrowserPlugin.switchCenterViewSlot(), and Vispa.Plugins.Browser.BrowserPlugin.BrowserPlugin.viewClassId().

Referenced by Vispa.Plugins.EdmBrowser.EdmBrowserPlugin.EdmBrowserPlugin.startUp(), and Vispa.Plugins.ConfigEditor.ConfigEditorPlugin.ConfigEditorPlugin.startUp().

123  def addCenterView(self, viewClass, default=False, enabled=True):
124  """ add a View for the Center View
125 
126  selection: name is the menu entry, function the function to be
127  added as action if the menu is selecteds
128  """
129  logging.debug(__name__ + ": addCenterView")
130  if not issubclass(viewClass, AbstractView):
131  logging.error(self.__class__.__name__ + ": addCenterView() - Cannot add non views as view. Aborting...")
132  return
133  if viewClass in self._availableCenterViews:
134  logging.warning(self.__class__.__name__ + ": Already have a View of type "+ viewClass.__name__ +". Aborting...")
135  return
136  viewClassId=self.viewClassId(viewClass)
137  action = self.application().createAction(viewClass.LABEL, self.switchCenterViewSlot, "Ctrl+"+ str(len(self._availableCenterViews)))
138  action.setCheckable(True)
139  action.setEnabled(enabled)
140  if not enabled:
141  self._disabledCenterViewIds = [viewClassId]
142  action.setData(QVariant(viewClassId))
143  if default:
144  self._defaultCenterViewId = self.viewClassId(viewClass)
145  self._availableCenterViews.append(viewClass)
146  self._viewMenu.addAction(action)
147 
def addCenterView(self, viewClass, default=False, enabled=True)
#define str(s)
def Vispa.Plugins.Browser.BrowserPlugin.BrowserPlugin.availableCenterViews (   self)
def Vispa.Plugins.Browser.BrowserPlugin.BrowserPlugin.boxContentAction (   self)
def Vispa.Plugins.Browser.BrowserPlugin.BrowserPlugin.collapseAllAction (   self)
def Vispa.Plugins.Browser.BrowserPlugin.BrowserPlugin.defaultCenterViewId (   self)
def Vispa.Plugins.Browser.BrowserPlugin.BrowserPlugin.disabledCenterViewIds (   self)
def Vispa.Plugins.Browser.BrowserPlugin.BrowserPlugin.expandAllAction (   self)
def Vispa.Plugins.Browser.BrowserPlugin.BrowserPlugin.expandToDepthAction (   self)
def Vispa.Plugins.Browser.BrowserPlugin.BrowserPlugin.filterDialog (   self)
Calls filterDialog() function of current tab controller.

Definition at line 86 of file BrowserPlugin.py.

References Vispa.Main.VispaPlugin.VispaPlugin.application(), and Vispa.Main.MainWindow.MainWindow.application().

86  def filterDialog(self):
87  """ Calls filterDialog() function of current tab controller.
88  """
89  try:
90  self.application().currentTabController().filterDialog()
91  except NoCurrentTabControllerException:
92  logging.warning(self.__class__.__name__ + ": filterDialog() - No tab controller found.")
93 
def Vispa.Plugins.Browser.BrowserPlugin.BrowserPlugin.newTab (   self)
def Vispa.Plugins.Browser.BrowserPlugin.BrowserPlugin.openFile (   self,
  filename = None 
)
Open the requested file in a new tab.

This method is called when the user wants to open a file with an extension this plugin.
previously registered.

This methods overwrites openFile from VispaPlugin.

Definition at line 159 of file BrowserPlugin.py.

References Vispa.Plugins.Browser.BrowserPlugin.BrowserPlugin._startUp, Vispa.Main.VispaPlugin.VispaPlugin.filetypes(), Vispa.Plugins.Browser.BrowserPlugin.BrowserPlugin.newTab(), Vispa.Plugins.Browser.BrowserPlugin.BrowserPlugin.startUp(), and digitizers_cfi.strip.

159  def openFile(self, filename=None):
160  """ Open the requested file in a new tab.
161 
162  This method is called when the user wants to open a file with an extension this plugin.
163  previously registered.
164 
165  This methods overwrites openFile from VispaPlugin.
166  """
167  logging.debug(__name__ + ": openFile " + filename)
168  if self._startUp:
169  self.startUp()
170  if filename == None:
171  return False
172  base = os.path.basename(filename)
173  ext = os.path.splitext(base)[1].lower().strip(".")
174  if ext in [ft.extension() for ft in self.filetypes()]:
175  tab = self.newTab()
176  return tab.controller().open(filename)
177  return False
178 
def Vispa.Plugins.Browser.BrowserPlugin.BrowserPlugin.saveImage (   self)
Calls saveImage() function of current tab controller.

Definition at line 110 of file BrowserPlugin.py.

References Vispa.Main.VispaPlugin.VispaPlugin.application(), and Vispa.Main.MainWindow.MainWindow.application().

Referenced by Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController.readFile().

110  def saveImage(self):
111  """ Calls saveImage() function of current tab controller.
112  """
113  try:
114  self.application().currentTabController().saveImage()
115  except NoCurrentTabControllerException:
116  logging.warning(self.__class__.__name__ + ": saveImage() - No tab controller found.")
117 
def Vispa.Plugins.Browser.BrowserPlugin.BrowserPlugin.saveImageAction (   self)
def Vispa.Plugins.Browser.BrowserPlugin.BrowserPlugin.setDisabledCenterViewIds (   self,
  ids 
)
def Vispa.Plugins.Browser.BrowserPlugin.BrowserPlugin.switchCenterViewSlot (   self)
Slot for center view menu entries.

It switches the tab's current center view to the selected view.

Definition at line 148 of file BrowserPlugin.py.

References Vispa.Main.VispaPlugin.VispaPlugin.application(), Vispa.Main.MainWindow.MainWindow.application(), data, and toString().

Referenced by Vispa.Plugins.Browser.BrowserPlugin.BrowserPlugin.addCenterView().

149  """ Slot for center view menu entries.
150 
151  It switches the tab's current center view to the selected view.
152  """
153  requestedViewClassId = self.sender().data().toString()
154  try:
155  self.application().currentTabController().switchCenterView(requestedViewClassId)
156  except NoCurrentTabControllerException:
157  logging.warning(self.__class__.__name__ + ": switchCenterViewSlot() - No tab controller found.")
158 
std::string toString(const std::pair< T, T > &aT)
Definition: CaloEllipse.h:72
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
def Vispa.Plugins.Browser.BrowserPlugin.BrowserPlugin.viewClassId (   self,
  viewClass 
)

Definition at line 118 of file BrowserPlugin.py.

References str.

Referenced by Vispa.Plugins.Browser.BrowserPlugin.BrowserPlugin.addCenterView().

118  def viewClassId(self, viewClass):
119  if not viewClass:# or not isinstance(viewClass, AbstractView):
120  return None
121  return str(viewClass) + str(viewClass.LABEL)
122 
#define str(s)
def Vispa.Plugins.Browser.BrowserPlugin.BrowserPlugin.viewMenu (   self)
def Vispa.Plugins.Browser.BrowserPlugin.BrowserPlugin.zoomAction (   self)
def Vispa.Plugins.Browser.BrowserPlugin.BrowserPlugin.zoomDialog (   self)
Calls zoomDialog() function of current tab controller.

Definition at line 102 of file BrowserPlugin.py.

References Vispa.Main.VispaPlugin.VispaPlugin.application(), and Vispa.Main.MainWindow.MainWindow.application().

102  def zoomDialog(self):
103  """ Calls zoomDialog() function of current tab controller.
104  """
105  try:
106  self.application().currentTabController().zoomDialog()
107  except NoCurrentTabControllerException:
108  logging.warning(self.__class__.__name__ + ": zoomDialog() - No tab controller found.")
109 

Member Data Documentation

Vispa.Plugins.Browser.BrowserPlugin.BrowserPlugin._availableCenterViews
private
Vispa.Plugins.Browser.BrowserPlugin.BrowserPlugin._boxContentAction
private
Vispa.Plugins.Browser.BrowserPlugin.BrowserPlugin._collapseAllAction
private
Vispa.Plugins.Browser.BrowserPlugin.BrowserPlugin._defaultCenterViewId
private
Vispa.Plugins.Browser.BrowserPlugin.BrowserPlugin._expandAllAction
private
Vispa.Plugins.Browser.BrowserPlugin.BrowserPlugin._expandToDepthAction
private
Vispa.Plugins.Browser.BrowserPlugin.BrowserPlugin._filterAction
private

Definition at line 49 of file BrowserPlugin.py.

Vispa.Plugins.Browser.BrowserPlugin.BrowserPlugin._saveImageAction
private
Vispa.Plugins.Browser.BrowserPlugin.BrowserPlugin._viewMenu
private
Vispa.Plugins.Browser.BrowserPlugin.BrowserPlugin._zoomAction
private