CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
Vispa.Main.TabController.TabController Class Reference
Inheritance diagram for Vispa.Main.TabController.TabController:
Vispa.Plugins.Browser.BrowserTabController.BrowserTabController Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController Vispa.Plugins.EventBrowser.EventBrowserTabController.EventBrowserTabController Vispa.Plugins.EdmBrowser.EdmBrowserTabController.EdmBrowserTabController

Public Member Functions

def __init__ (self, plugin)
 
def activated (self)
 
def addUndoEvent (self, undoEvent)
 
def allowClose (self)
 
def allowSelectAll (self)
 
def cancel (self)
 
def checkModificationTimestamp (self)
 
def close (self)
 
def copy (self)
 
def cut (self)
 
def dumpUndoEvents (self)
 
def enableUndo (self, enable=True)
 
def filename (self)
 
def find (self)
 
def getFileBasename (self)
 
def isCopyPasteEnabled (self)
 
def isEditable (self)
 
def isFindEnabled (self)
 
def isModified (self)
 
def open (self, filename=None, update=True)
 
def paste (self)
 
def plugin (self)
 
def readFile (self, filename)
 
def redo (self, numberOfEvents=1)
 
def redoEvents (self)
 
def refresh (self)
 
def resetZoomButtonPressedBefore (self)
 
def save (self, filename="")
 
def selectAll (self)
 
def setAllowSelectAll (self, allowSelectAll)
 
def setCopyPasteEnabled (self, enable=True)
 
def setEditable (self, editable)
 
def setFilename (self, filename)
 
def setFindEnabled (self, enable=True)
 
def setLastSavedStateEvent (self, undoEvent)
 
def setModified (self, modified=True)
 
def setTab (self, tab)
 
def setZoom (self, zoom)
 
def staticSupportedFileTypes ()
 
def supportedFileFilters (self)
 
def supportedFileTypes (self)
 
def supportsUndo (self)
 
def tab (self)
 
def undo (self, numberOfEvents=1)
 
def undoEvents (self)
 
def updateContent (self)
 
def updateLabel (self, prefix="", titletext="")
 
def writeFile (self, filename)
 
def zoom (self)
 
def zoomAll (self)
 
def zoomChanged (self, zoom)
 
def zoomDialog (self)
 
def zoomHundred (self)
 
def zoomUser (self)
 

Private Attributes

 _allowSelectAllFlag
 
 _copyPasteEnabledFlag
 
 _fileModifcationTimestamp
 
 _fileModifiedFlag
 
 _filename
 
 _findEnabledFlag
 
 _isEditableFlag
 
 _plugin
 
 _redoEvents
 
 _showingModifiedMessageFlag
 
 _supportsUndo
 
 _tab
 
 _undoEvents
 
 _userZoomLevel
 
 _zoomButtonPressedBeforeFlag
 

Detailed Description

Base class for all tab controllers.

Tab controllers control the functionality of plugin tabs.

Definition at line 12 of file TabController.py.

Constructor & Destructor Documentation

def Vispa.Main.TabController.TabController.__init__ (   self,
  plugin 
)

Definition at line 20 of file TabController.py.

20  def __init__(self, plugin):
21  QObject.__init__(self)
22  logging.debug(__name__ + ": __init__")
23  self._plugin = plugin
24  self._fileModifiedFlag = False
25  self._isEditableFlag = True
26  self._tab = None
27  self._filename = None
28  self._copyPasteEnabledFlag = False
29  self._allowSelectAllFlag = False
30  self._findEnabledFlag = False
31  self._userZoomLevel = 100
35  self._supportsUndo = False
36  self._undoEvents = []
37  self._redoEvents = []
38 

Member Function Documentation

def Vispa.Main.TabController.TabController.activated (   self)
Called by application when tab is activated in tabWidget.

This function should be overwritten if special treatment on tab selection is required.

Definition at line 366 of file TabController.py.

366  def activated(self):
367  """ Called by application when tab is activated in tabWidget.
368 
369  This function should be overwritten if special treatment on tab selection is required.
370  """
371  pass
372 
def Vispa.Main.TabController.TabController.addUndoEvent (   self,
  undoEvent 
)
Adds event of type UndoEvent to this tab controller's list of undoable events.

Undo can be invoked by calling undo().

Definition at line 543 of file TabController.py.

References Vispa.Main.TabController.TabController._redoEvents, Vispa.Main.TabController.TabController._supportsUndo, Vispa.Main.TabController.TabController._undoEvents, Vispa.Main.TabController.TabController.isModified(), PFTauMVAInputDiscriminantTranslator::DiscriminantInfo.plugin, Vispa.Main.TabController.TabController.plugin(), Vispa.Main.Application.Application.plugin(), and Vispa.Main.TabController.TabController.setLastSavedStateEvent().

543  def addUndoEvent(self, undoEvent):
544  """ Adds event of type UndoEvent to this tab controller's list of undoable events.
545 
546  Undo can be invoked by calling undo().
547  """
548  if self._supportsUndo:
549  if not isinstance(undoEvent, UndoEvent):
550  logging.error("%s: Tried to add non-UndoEvent to list of undo events. Aborting..." % self.__class__.__name__)
551  return
552  self._redoEvents = []
553  no_of_events = len(self._undoEvents)
554  # try to combine similar events
555  if no_of_events < 1 or not self._undoEvents[no_of_events -1].combine(undoEvent):
556  self._undoEvents.append(undoEvent)
557  if not self.isModified():
558  self.setLastSavedStateEvent(undoEvent)
559  self.plugin().application().updateMenu()
560  else:
561  logging.warning("%s: Tried to add undo event, however undo functionality is not enabled. Aborting..." % self.__class__.__name__)
562  #self.dumpUndoEvents()
563 
def setLastSavedStateEvent(self, undoEvent)
def Vispa.Main.TabController.TabController.allowClose (   self)

Definition at line 272 of file TabController.py.

References Vispa.Main.TabController.TabController.isEditable(), Vispa.Main.TabController.TabController.isModified(), PFTauMVAInputDiscriminantTranslator::DiscriminantInfo.plugin, Vispa.Main.TabController.TabController.plugin(), Vispa.Main.Application.Application.plugin(), CalibrationHistograms.save(), l1t::WriterProxy.save(), TkHistoMap.save(), l1t::WriterProxyT< Record, Type >.save(), NuclearInteractionSimulator.save(), PiecewiseScalingPolynomial.save(), HcalIndexLookup.save(), HBHENegativeEFilter.save(), MaterialEffects.save(), HBHEChannelGroups.save(), MaterialEffectsSimulator.save(), fastsim::NuclearInteraction.save(), TrackerMap.save(), CommissioningHistograms.save(), OOTPileupCorrData.save(), SpecificationBuilder_cfi.Specification.save(), Vispa.Main.TabController.TabController.save(), svgfig.SVG.save(), DQMStore.save(), and TkAlMap.TkAlMap.save().

Referenced by Vispa.Main.TabController.TabController.close().

272  def allowClose(self):
273  if self.isEditable() and self.isModified():
274  messageResult = self.plugin().application().showMessageBox("The document has been modified.",
275  "Do you want to save your changes?",
276  QMessageBox.Save | QMessageBox.Discard | QMessageBox.Cancel,
277  QMessageBox.Save)
278 
279  if messageResult == QMessageBox.Save:
280  if not self.save():
281  return False
282  elif messageResult == QMessageBox.Cancel:
283  return False
284  return True
285 
def Vispa.Main.TabController.TabController.allowSelectAll (   self)
Evaluates the sllowSelectAll flag.

Definition at line 189 of file TabController.py.

References Vispa.Main.TabController.TabController._allowSelectAllFlag.

189  def allowSelectAll(self):
190  """ Evaluates the sllowSelectAll flag.
191  """
192  return self._allowSelectAllFlag
193 
def Vispa.Main.TabController.TabController.cancel (   self)
def Vispa.Main.TabController.TabController.checkModificationTimestamp (   self)
Compares the actual modification timestamp of self.filename() to the modification at opening or last save operation.

This function is called by Application when the tab associated with this controller was activated.
If modification timestamps differ the refresh() method is called.

Definition at line 313 of file TabController.py.

References Vispa.Main.TabController.TabController._fileModifcationTimestamp, Vispa.Main.TabController.TabController._filename, DQMIO2histo.DQMIO._filename, MuonGeometryArrange._filename, TrackerGeometryCompare._filename, Vispa.Main.TabController.TabController._showingModifiedMessageFlag, Vispa.Main.TabController.TabController.isEditable(), MELaserPrim.refresh(), Vispa.Main.TabController.TabController.refresh(), CalibrationHistograms.save(), l1t::WriterProxy.save(), TkHistoMap.save(), l1t::WriterProxyT< Record, Type >.save(), NuclearInteractionSimulator.save(), PiecewiseScalingPolynomial.save(), HcalIndexLookup.save(), HBHENegativeEFilter.save(), MaterialEffects.save(), HBHEChannelGroups.save(), MaterialEffectsSimulator.save(), fastsim::NuclearInteraction.save(), TrackerMap.save(), CommissioningHistograms.save(), OOTPileupCorrData.save(), SpecificationBuilder_cfi.Specification.save(), Vispa.Main.TabController.TabController.save(), svgfig.SVG.save(), DQMStore.save(), TkAlMap.TkAlMap.save(), and Vispa.Main.TabController.TabController.setModified().

314  """ Compares the actual modification timestamp of self.filename() to the modification at opening or last save operation.
315 
316  This function is called by Application when the tab associated with this controller was activated.
317  If modification timestamps differ the refresh() method is called.
318  """
319  if not self._filename or self._fileModifcationTimestamp == 0:
320  return
321 
322  msgBox = None
323  if not os.path.exists(self._filename):
324  logging.debug(self.__class__.__name__ + ": checkModificationTimestamp() - File was removed.")
326  msgBox = QMessageBox()
327  msgBox.setText("The file was removed.")
328  if self.isEditable():
329  msgBox.setInformativeText("Do you want to save the file with your version?")
330  saveButton = msgBox.addButton("Save", QMessageBox.ActionRole)
331  ignoreButton = msgBox.addButton("Ignore", QMessageBox.RejectRole)
332  else:
333  ignoreButton = msgBox.addButton("OK", QMessageBox.RejectRole)
334  reloadButton = None
335 
336  elif self._fileModifcationTimestamp != os.path.getmtime(self._filename):
337  logging.debug(self.__class__.__name__ + ": checkModificationTimestamp() - File was modified.")
338  msgBox = QMessageBox()
339  msgBox.setText("The file has been modified.")
340  if self.isEditable():
341  msgBox.setInformativeText("Do you want to overwrite the file with your version or reload the file?")
342  saveButton = msgBox.addButton("Overwrite", QMessageBox.ActionRole)
343  else:
344  msgBox.setInformativeText("Do you want to reload the file?")
345  reloadButton = msgBox.addButton("Reload", QMessageBox.DestructiveRole)
346  ignoreButton = msgBox.addButton("Ignore", QMessageBox.RejectRole)
347 
348  if msgBox and not self._showingModifiedMessageFlag:
349  self.setModified()
351  msgBox.exec_()
352  self._showingModifiedMessageFlag=False
353 
354  if self.isEditable() and msgBox.clickedButton() == saveButton:
355  self.save()
356  elif msgBox.clickedButton() == reloadButton:
357  self.refresh()
358  self.setModified(False)
359  elif msgBox.clickedButton() == ignoreButton and os.path.exists(self._filename):
360  self._fileModifcationTimestamp = os.path.getmtime(self._filename)
361 
362  else:
363  #logging.debug(self.__class__.__name__ + ": checkModificationTimestamp() - File was not modified.")
364  pass
365 
def setModified(self, modified=True)
def Vispa.Main.TabController.TabController.close (   self)
Asks user if he wants to save potentially unsaved data and closes the tab. 

This function usually does not need to be overwritten by a PluginTab.

Definition at line 286 of file TabController.py.

References Vispa.Main.TabController.TabController.allowClose(), and Vispa.Main.TabController.TabController.tab().

Referenced by lumiQTWidget.ApplicationWindow.fileQuit(), esMonitoring.AsyncLineReaderMixin.handle_close(), esMonitoring.FDJsonServer.handle_close(), Vispa.Gui.BoxContentDialog.BoxContentDialog.keyPressEvent(), and Vispa.Gui.FindDialog.FindDialog.keyPressEvent().

286  def close(self):
287  """ Asks user if he wants to save potentially unsaved data and closes the tab.
288 
289  This function usually does not need to be overwritten by a PluginTab.
290  """
291  allowClose = self.allowClose()
292  if allowClose:
293  if self.tab().tabWidget():
294  self.tab().tabWidget().removeTab(self.tab().tabWidget().indexOf(self.tab()))
295  #if self.tab() in self.tab().mainWindow()._tabWindows:
296  # self.tab().mainWindow()._tabWindows.remove(self.tab())
297  self.tab().close()
298  # no effect?
299  #self._tab.deleteLater()
300  #self._tab = None
301  return allowClose
302 
def Vispa.Main.TabController.TabController.copy (   self)
Handle copy event.

This function is called if the user selects 'Copy' from menu. PluginTabs should override it if needed.
See also setCopyPasteEnabled(), isCopyPasteEnabled().

Definition at line 381 of file TabController.py.

381  def copy(self):
382  """ Handle copy event.
383 
384  This function is called if the user selects 'Copy' from menu. PluginTabs should override it if needed.
385  See also setCopyPasteEnabled(), isCopyPasteEnabled().
386  """
387  raise NotImplementedError
388 
def Vispa.Main.TabController.TabController.cut (   self)
Handle cut event.

This function is called if the user selects 'Cut' from menu. PluginTabs should override it if needed.
See also setCopyPasteEnabled(), isCopyPasteEnabled().

Definition at line 373 of file TabController.py.

373  def cut(self):
374  """ Handle cut event.
375 
376  This function is called if the user selects 'Cut' from menu. PluginTabs should override it if needed.
377  See also setCopyPasteEnabled(), isCopyPasteEnabled().
378  """
379  raise NotImplementedError
380 
def Vispa.Main.TabController.TabController.dumpUndoEvents (   self)

Definition at line 632 of file TabController.py.

References Vispa.Main.TabController.TabController._redoEvents, and Vispa.Main.TabController.TabController._undoEvents.

632  def dumpUndoEvents(self):
633  for event in self._undoEvents:
634  event.dump("undo")
635  for event in self._redoEvents:
636  event.dump("redo")
def Vispa.Main.TabController.TabController.enableUndo (   self,
  enable = True 
)
If enable is True this controller enables its undo function.

For any tab controller that wants to use this feature, it needs to be made sure the corresponding UndoEvents
for actions that should be undoable exists and are added by addUndoEvent().

Definition at line 525 of file TabController.py.

References Vispa.Main.TabController.TabController._supportsUndo.

525  def enableUndo(self, enable=True):
526  """ If enable is True this controller enables its undo function.
527 
528  For any tab controller that wants to use this feature, it needs to be made sure the corresponding UndoEvents
529  for actions that should be undoable exists and are added by addUndoEvent().
530  """
531  self._supportsUndo = enable
532 
def Vispa.Main.TabController.TabController.filename (   self)
def Vispa.Main.TabController.TabController.find (   self)
Handle find event.

This function is called if the user selects 'Find' from menu. PluginTabs should override it if needed."
See also setFindEnabled(), isFindEnabled().

Definition at line 397 of file TabController.py.

397  def find(self):
398  """ Handle find event.
399 
400  This function is called if the user selects 'Find' from menu. PluginTabs should override it if needed."
401  See also setFindEnabled(), isFindEnabled().
402  """
403  raise NotImplementedError
404 
def Vispa.Main.TabController.TabController.getFileBasename (   self)
Returns the basename of this tab's filename.

Part of filename after last /.

Definition at line 85 of file TabController.py.

References Vispa.Main.TabController.TabController._filename, DQMIO2histo.DQMIO._filename, MuonGeometryArrange._filename, and TrackerGeometryCompare._filename.

85  def getFileBasename(self):
86  """ Returns the basename of this tab's filename.
87 
88  Part of filename after last /.
89  """
90  return os.path.basename(self._filename)
91 
def Vispa.Main.TabController.TabController.isCopyPasteEnabled (   self)
Return True if the copyPasteFlag is set.

See setCopyPasteEnabled(), cut(), copy(), paste().

Definition at line 99 of file TabController.py.

References Vispa.Main.TabController.TabController._copyPasteEnabledFlag.

99  def isCopyPasteEnabled(self):
100  """ Return True if the copyPasteFlag is set.
101 
102  See setCopyPasteEnabled(), cut(), copy(), paste().
103  """
104  return self._copyPasteEnabledFlag
105 
def Vispa.Main.TabController.TabController.isFindEnabled (   self)
Returns True if findEnabledFlag is set.

See setFindEnabled(), find().

Definition at line 113 of file TabController.py.

References Vispa.Main.TabController.TabController._findEnabledFlag.

113  def isFindEnabled(self):
114  """Returns True if findEnabledFlag is set.
115 
116  See setFindEnabled(), find().
117  """
118  return self._findEnabledFlag
119 
def Vispa.Main.TabController.TabController.isModified (   self)
Evaluates the file Modified flag. Always returns True if no filename is set.

Definition at line 166 of file TabController.py.

References Vispa.Main.TabController.TabController._fileModifiedFlag.

Referenced by Vispa.Main.TabController.TabController.addUndoEvent(), Vispa.Main.TabController.TabController.allowClose(), and Vispa.Main.TabController.TabController.updateLabel().

166  def isModified(self):
167  """ Evaluates the file Modified flag. Always returns True if no filename is set.
168  """
169  return self._fileModifiedFlag
170 
def Vispa.Main.TabController.TabController.open (   self,
  filename = None,
  update = True 
)
Open given file.

Definition at line 194 of file TabController.py.

References Vispa.Main.TabController.TabController._filename, DQMIO2histo.DQMIO._filename, MuonGeometryArrange._filename, TrackerGeometryCompare._filename, PFTauMVAInputDiscriminantTranslator::DiscriminantInfo.plugin, Vispa.Main.TabController.TabController.plugin(), Vispa.Main.Application.Application.plugin(), SurveyDataReader.readFile(), SurveyInputTextReader.readFile(), DeviationsFromFileSensor2D.readFile(), CovarianceParameterization.readFile(), edm::InputSource.readFile(), edm::EventProcessor.readFile(), Vispa.Main.TabController.TabController.readFile(), DQMStore.readFile(), Vispa.Main.TabController.TabController.setFilename(), Vispa.Main.TabController.TabController.updateContent(), and Vispa.Main.TabController.TabController.updateLabel().

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

194  def open(self, filename=None, update=True):
195  """ Open given file.
196  """
197  logging.debug(self.__class__.__name__ + ": open()")
198 
199  statusMessage = self.plugin().application().startWorking("Opening file " + filename)
200 
201  if filename == None:
202  if self._filename:
203  filename = self._filename
204  else:
205  self.plugin().application().stopWorking(statusMessage, "failed")
206  return False
207 
208  if self.readFile(filename):
209  self.setFilename(filename)
210  self.updateLabel()
211  if update:
212  self.updateContent()
213  self.plugin().application().stopWorking(statusMessage)
214  return True
215 
216  self.plugin().application().stopWorking(statusMessage, "failed")
217  return False
218 
def open(self, filename=None, update=True)
def updateLabel(self, prefix="", titletext="")
def Vispa.Main.TabController.TabController.paste (   self)
Handle paste event.

This function is called if the user selects 'Paste' from menu. PluginTabs should override it if needed."
See also setCopyPasteEnabled(), isCopyPasteEnabled().

Definition at line 389 of file TabController.py.

389  def paste(self):
390  """ Handle paste event.
391 
392  This function is called if the user selects 'Paste' from menu. PluginTabs should override it if needed."
393  See also setCopyPasteEnabled(), isCopyPasteEnabled().
394  """
395  raise NotImplementedError
396 
def Vispa.Main.TabController.TabController.plugin (   self)
Returns the plugin reference, set by setPlugin().

Definition at line 58 of file TabController.py.

References Vispa.Main.TabController.TabController._plugin.

Referenced by Vispa.Plugins.EventBrowser.EventBrowserTabController.EventBrowserTabController.activated(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController.activated(), Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController.activated(), Vispa.Main.TabController.TabController.addUndoEvent(), Vispa.Main.TabController.TabController.allowClose(), Vispa.Plugins.EdmBrowser.EdmBrowserTabController.EdmBrowserTabController.centerViewMenuButtonClicked(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController.centerViewMenuButtonClicked(), Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController.codeSelected(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController.currentCenterViewClassId(), Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController.dumpPython(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController.enableCenterViewSelectionMenu(), Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController.eventContent(), Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController.exportDot(), Vispa.Plugins.EventBrowser.EventBrowserTabController.EventBrowserTabController.goto(), Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController.history(), Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController.importConfig(), Vispa.Plugins.EdmBrowser.EdmBrowserTabController.EdmBrowserTabController.loadIni(), Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController.loadIni(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController.loadIni(), Vispa.Plugins.EventBrowser.EventBrowserTabController.EventBrowserTabController.navigate(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController.onSelected(), Vispa.Main.TabController.TabController.open(), Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController.readFile(), Vispa.Main.TabController.TabController.redo(), Vispa.Main.TabController.TabController.refresh(), Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController.removeButtonClicked(), Vispa.Main.TabController.TabController.save(), Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController.save(), Vispa.Plugins.EdmBrowser.EdmBrowserTabController.EdmBrowserTabController.saveIni(), Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController.saveIni(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController.saveIni(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController.select(), Vispa.Main.TabController.TabController.setAllowSelectAll(), Vispa.Main.TabController.TabController.setEditable(), Vispa.Main.TabController.TabController.setModified(), Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController.startEditMode(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController.switchCenterView(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController.treeViewMenuButtonClicked(), Vispa.Main.TabController.TabController.undo(), Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController.updateCenterView(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController.updateCenterView(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController.updateContent(), Vispa.Plugins.EventBrowser.EventBrowserTabController.EventBrowserTabController.updateEventNumberDisplay(), Vispa.Plugins.EdmBrowser.EdmBrowserTabController.EdmBrowserTabController.updateViewMenu(), and Vispa.Plugins.Browser.BrowserTabController.BrowserTabController.updateViewMenu().

58  def plugin(self):
59  """ Returns the plugin reference, set by setPlugin().
60  """
61  return self._plugin
62 
def Vispa.Main.TabController.TabController.readFile (   self,
  filename 
)
This function performs the actual reading of a file. It should be overwritten by any PluginTab which inherits Tab.
If the reading was successful True should be returned.
The file should be read from the file given in the argument filename not to the one in self._filename.

Definition at line 219 of file TabController.py.

Referenced by Vispa.Plugins.EventBrowser.EventBrowserTabController.EventBrowserTabController.navigate(), Vispa.Main.TabController.TabController.open(), and Vispa.Main.TabController.TabController.refresh().

219  def readFile(self, filename):
220  """
221  This function performs the actual reading of a file. It should be overwritten by any PluginTab which inherits Tab.
222  If the reading was successful True should be returned.
223  The file should be read from the file given in the argument filename not to the one in self._filename.
224  """
225  raise NotImplementedError
226 
def Vispa.Main.TabController.TabController.redo (   self,
  numberOfEvents = 1 
)

Definition at line 589 of file TabController.py.

References Vispa.Main.TabController.TabController._redoEvents, Vispa.Main.TabController.TabController._supportsUndo, Vispa.Main.TabController.TabController._undoEvents, PFTauMVAInputDiscriminantTranslator::DiscriminantInfo.plugin, Vispa.Main.TabController.TabController.plugin(), Vispa.Main.Application.Application.plugin(), Vispa.Main.TabController.TabController.setModified(), and str.

589  def redo(self, numberOfEvents=1):
590  if not self._supportsUndo:
591  logging.warning(self.__class__.__name__ + ": Tried to undo action, however undo functionality is not enabled. Aborting...")
592  return
593  logging.debug(self.__class__.__name__ +": redo("+ str(numberOfEvents) +")")
594  #self.dumpUndoEvents()
595 
596  for i in range(0, numberOfEvents):
597  if len(self._redoEvents) > 0:
598  lastEvent = self._redoEvents.pop()
599  lastEvent.redo()
600  self._undoEvents.append(lastEvent)
601 
602  # set modification flag
603  if i == (numberOfEvents -1):
604  undo_events_count = len(self._redoEvents)
605  if undo_events_count > 0:
606  if self._redoEvents[undo_events_count-1].isLastSavedState():
607  self.setModified(False)
608  else:
609  self.setModified()
610  else:
611  # if there are no more redo events
612  # and there is no event with last saved state flag set to True
613  # no action was performed since the last save
614  # and thus modification flag should be False
615  modified = False
616  for event in self._undoEvents + self._redoEvents:
617  if event.isLastSavedState():
618  modified = True
619  break
620  self.setModified(modified)
621  self.plugin().application().updateMenu()
622 
def setModified(self, modified=True)
def redo(self, numberOfEvents=1)
#define str(s)
def Vispa.Main.TabController.TabController.redoEvents (   self)
Returns list of all UndoEvents that have already been undone before.

Definition at line 538 of file TabController.py.

References Vispa.Main.TabController.TabController._redoEvents.

538  def redoEvents(self):
539  """ Returns list of all UndoEvents that have already been undone before.
540  """
541  return self._redoEvents
542 
def Vispa.Main.TabController.TabController.refresh (   self)
Reloads file content and refreshes tab.

May be implemented by inheriting controllers.

Definition at line 491 of file TabController.py.

References Vispa.Main.TabController.TabController._fileModifcationTimestamp, Vispa.Main.TabController.TabController._filename, DQMIO2histo.DQMIO._filename, MuonGeometryArrange._filename, TrackerGeometryCompare._filename, PFTauMVAInputDiscriminantTranslator::DiscriminantInfo.plugin, Vispa.Main.TabController.TabController.plugin(), Vispa.Main.Application.Application.plugin(), SurveyDataReader.readFile(), SurveyInputTextReader.readFile(), DeviationsFromFileSensor2D.readFile(), CovarianceParameterization.readFile(), edm::InputSource.readFile(), edm::EventProcessor.readFile(), Vispa.Main.TabController.TabController.readFile(), DQMStore.readFile(), and Vispa.Main.TabController.TabController.updateContent().

Referenced by Vispa.Main.TabController.TabController.checkModificationTimestamp().

491  def refresh(self):
492  """ Reloads file content and refreshes tab.
493 
494  May be implemented by inheriting controllers.
495  """
496  statusMessage = self.plugin().application().startWorking("Reopening file")
497  self._fileModifcationTimestamp = os.path.getmtime(self._filename)
498  self.readFile(self._filename)
499  self.updateContent()
500  self.plugin().application().stopWorking(statusMessage)
501 
def Vispa.Main.TabController.TabController.resetZoomButtonPressedBefore (   self)
Sets the zoom button pressed before flag to False.

If the flag is set functions handling the zoom toolbar buttons (zoomHundred(), zoomAll()) wont store the last zoom factor. The flag is set to true by these functions.
By this mechanism the user can click the zoom buttons several times and will still be able to return to his orignal zoom level by zoomUser().
The reset function needs to be called if the user manually sets the zoom level. For instance by connecting this function to the wheelEvent of the workspace scroll area.

Definition at line 434 of file TabController.py.

References Vispa.Main.TabController.TabController._zoomButtonPressedBeforeFlag.

435  """ Sets the zoom button pressed before flag to False.
436 
437  If the flag is set functions handling the zoom toolbar buttons (zoomHundred(), zoomAll()) wont store the last zoom factor. The flag is set to true by these functions.
438  By this mechanism the user can click the zoom buttons several times and will still be able to return to his orignal zoom level by zoomUser().
439  The reset function needs to be called if the user manually sets the zoom level. For instance by connecting this function to the wheelEvent of the workspace scroll area.
440  """
441  self._zoomButtonPressedBeforeFlag = False
442 
def Vispa.Main.TabController.TabController.save (   self,
  filename = "" 
)
Takes care the tab's data will be written to the file given as argument or if this is an empty string to self._filename.

Whenever the content of the tab should be saved, this method should be called. If no filename is specified nor already set set it asks the user to set one. 
Afterwards the writing is initiated by calling writeFile(). 

Definition at line 227 of file TabController.py.

References Vispa.Main.TabController.TabController._filename, DQMIO2histo.DQMIO._filename, MuonGeometryArrange._filename, TrackerGeometryCompare._filename, Vispa.Main.TabController.TabController._redoEvents, PFTauMVAInputDiscriminantTranslator::DiscriminantInfo.plugin, Vispa.Main.TabController.TabController.plugin(), Vispa.Main.Application.Application.plugin(), Vispa.Main.TabController.TabController.setFilename(), Vispa.Main.TabController.TabController.setLastSavedStateEvent(), Vispa.Main.TabController.TabController.setModified(), str, Vispa.Main.TabController.TabController.tab(), Vispa.Main.TabController.TabController.updateLabel(), popcon::EcalTPGWeightIdMapHandler.writeFile(), popcon::EcalTPGLutIdMapHandler.writeFile(), popcon::EcalTPGPhysicsConstHandler.writeFile(), popcon::EcalTPGLinConstHandler.writeFile(), popcon::EcalTPGFineGrainEBIdMapHandler.writeFile(), popcon::EcalTPGBadXTHandler.writeFile(), popcon::EcalTPGBadStripHandler.writeFile(), popcon::EcalTPGBadTTHandler.writeFile(), popcon::EcalTPGFineGrainEBGroupHandler.writeFile(), popcon::EcalTPGWeightGroupHandler.writeFile(), popcon::EcalTPGFineGrainTowerEEHandler.writeFile(), popcon::EcalTPGPedestalsHandler.writeFile(), popcon::EcalTPGFineGrainStripEEHandler.writeFile(), popcon::EcalTPGSlidingWindowHandler.writeFile(), popcon::EcalTPGLutGroupHandler.writeFile(), popcon::EcalTPGSpikeThresholdHandler.writeFile(), and Vispa.Main.TabController.TabController.writeFile().

Referenced by Vispa.Main.TabController.TabController.allowClose(), and Vispa.Main.TabController.TabController.checkModificationTimestamp().

227  def save(self, filename=""):
228  """ Takes care the tab's data will be written to the file given as argument or if this is an empty string to self._filename.
229 
230  Whenever the content of the tab should be saved, this method should be called. If no filename is specified nor already set set it asks the user to set one.
231  Afterwards the writing is initiated by calling writeFile().
232  """
233  #logging.debug('Tab: save()')
234 
235  if filename == '':
236  if self._filename:
237  filename = self._filename
238  else:
239  return self.plugin().application().saveFileAsDialog()
240 
241  statusMessage = self.plugin().application().startWorking("Saving file " + filename)
242 
243  good=True
244  message=""
245  try:
246  good=self.writeFile(filename)
247  except Exception as e:
248  good=False
249  message="\n"+str(e)
250  if good:
251  self.setFilename(filename)
252  self.setModified(False)
253  self.updateLabel()
254  self.plugin().application().addRecentFile(filename)
255  self.plugin().application().updateMenuAndWindowTitle()
256 
257  # set last saved state for undo events
258  if len(self._redoEvents) > 0:
259  lastSavedStateEvent = self._redoEvents[len(self._redoEvents) -1]
260  else:
261  lastSavedStateEvent = None
262  self.setLastSavedStateEvent(lastSavedStateEvent)
263 
264  self.plugin().application().stopWorking(statusMessage)
265  return True
266  else:
267  QMessageBox.critical(self.tab().mainWindow(), 'Error while saving data', 'Could not write to file ' + filename +'.'+message)
268  logging.error(self.__class__.__name__ + ": save() : Could not write to file " + filename +'.'+message)
269  self.plugin().application().stopWorking(statusMessage, "failed")
270  return False
271 
def setModified(self, modified=True)
def setLastSavedStateEvent(self, undoEvent)
def updateLabel(self, prefix="", titletext="")
#define str(s)
def Vispa.Main.TabController.TabController.selectAll (   self)
Handle to perform select all action.

This function is called if the user selects 'Select all' from menu. PluginTabs should override it if needed."
See also setAllowSelectAll(), allowSelectAll().

Definition at line 405 of file TabController.py.

405  def selectAll(self):
406  """ Handle to perform select all action.
407 
408  This function is called if the user selects 'Select all' from menu. PluginTabs should override it if needed."
409  See also setAllowSelectAll(), allowSelectAll().
410  """
411  raise NotImplementedError
412 
def Vispa.Main.TabController.TabController.setAllowSelectAll (   self,
  allowSelectAll 
)
Sets the allowSelectAll flag.

Definition at line 183 of file TabController.py.

References Vispa.Main.TabController.TabController._allowSelectAllFlag, PFTauMVAInputDiscriminantTranslator::DiscriminantInfo.plugin, Vispa.Main.TabController.TabController.plugin(), and Vispa.Main.Application.Application.plugin().

183  def setAllowSelectAll(self, allowSelectAll):
184  """ Sets the allowSelectAll flag.
185  """
186  self._allowSelectAllFlag = allowSelectAll
187  self.plugin().application().updateMenu()
188 
def setAllowSelectAll(self, allowSelectAll)
def Vispa.Main.TabController.TabController.setCopyPasteEnabled (   self,
  enable = True 
)
Sets a flag indicating whether this tab can handle copy and paste events.

See also isCopyPasteEnabled(), cut(), copy(), paste().

Definition at line 92 of file TabController.py.

References Vispa.Main.TabController.TabController._copyPasteEnabledFlag.

92  def setCopyPasteEnabled(self, enable=True):
93  """ Sets a flag indicating whether this tab can handle copy and paste events.
94 
95  See also isCopyPasteEnabled(), cut(), copy(), paste().
96  """
97  self._copyPasteEnabledFlag = enable
98 
def setCopyPasteEnabled(self, enable=True)
def Vispa.Main.TabController.TabController.setEditable (   self,
  editable 
)
Sets the file Editable flag.

Definition at line 171 of file TabController.py.

References Vispa.Main.TabController.TabController._isEditableFlag, PFTauMVAInputDiscriminantTranslator::DiscriminantInfo.plugin, Vispa.Main.TabController.TabController.plugin(), and Vispa.Main.Application.Application.plugin().

Referenced by Vispa.Plugins.EventBrowser.EventBrowserTabController.EventBrowserTabController.__init__(), and Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController.startEditMode().

171  def setEditable(self, editable):
172  """ Sets the file Editable flag.
173  """
174  #logging.debug(self.__class__.__name__ +": setEditable(" + str(editable) +")")
175  self._isEditableFlag = editable
176  self.plugin().application().updateMenu()
177 
def Vispa.Main.TabController.TabController.setFindEnabled (   self,
  enable = True 
)
Sets a flag indicating whether this tab can handle find requests.

See isFindEnabled(), find().

Definition at line 106 of file TabController.py.

References Vispa.Main.TabController.TabController._findEnabledFlag.

106  def setFindEnabled(self, enable=True):
107  """Sets a flag indicating whether this tab can handle find requests.
108 
109  See isFindEnabled(), find().
110  """
111  self._findEnabledFlag = enable
112 
def setFindEnabled(self, enable=True)
def Vispa.Main.TabController.TabController.setLastSavedStateEvent (   self,
  undoEvent 
)
Sets last saved state flag of given UndoEvent to True and to False for all other events.

Definition at line 623 of file TabController.py.

References Vispa.Main.TabController.TabController._redoEvents, and Vispa.Main.TabController.TabController._undoEvents.

Referenced by Vispa.Main.TabController.TabController.addUndoEvent(), and Vispa.Main.TabController.TabController.save().

623  def setLastSavedStateEvent(self, undoEvent):
624  """ Sets last saved state flag of given UndoEvent to True and to False for all other events.
625  """
626  for current_event in self._undoEvents + self._redoEvents:
627  if current_event == undoEvent:
628  current_event.setLastSavedState(True)
629  else:
630  current_event.setLastSavedState(False)
631 
def setLastSavedStateEvent(self, undoEvent)
def Vispa.Main.TabController.TabController.setModified (   self,
  modified = True 
)
Sets the file Modified flag to True or False.

This affects the closing of this tab.
It is only possible to set the modification flag to True if the controller is editable (see isEditable()).

Definition at line 147 of file TabController.py.

References Vispa.Main.TabController.TabController._fileModifiedFlag, Vispa.Main.TabController.TabController.isEditable(), PFTauMVAInputDiscriminantTranslator::DiscriminantInfo.plugin, Vispa.Main.TabController.TabController.plugin(), Vispa.Main.Application.Application.plugin(), Vispa.Main.TabController.TabController.tab(), and Vispa.Main.TabController.TabController.updateLabel().

Referenced by Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController.applyButtonClicked(), Vispa.Main.TabController.TabController.checkModificationTimestamp(), Vispa.Main.TabController.TabController.redo(), Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController.removeButtonClicked(), Vispa.Main.TabController.TabController.save(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController.switchCenterView(), Vispa.Main.TabController.TabController.undo(), and Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController.valueChanged().

147  def setModified(self, modified=True):
148  """ Sets the file Modified flag to True or False.
149 
150  This affects the closing of this tab.
151  It is only possible to set the modification flag to True if the controller is editable (see isEditable()).
152  """
153  if modified and not self.isEditable():
154  return
155 
156  previous = self._fileModifiedFlag
157  self._fileModifiedFlag = modified
158 
159  if previous != self._fileModifiedFlag:
160  self.updateLabel()
161  if self.tab().mainWindow():
162  self.plugin().application().updateMenuAndWindowTitle()
163  else:
164  logging.info(self.__class__.__name__ +": setModified() - Cannot tell application the modification state: There is no application associated with the tab.")
165 
def setModified(self, modified=True)
def updateLabel(self, prefix="", titletext="")
def Vispa.Main.TabController.TabController.setTab (   self,
  tab 
)
Sets tab.

Definition at line 63 of file TabController.py.

References Vispa.Main.TabController.TabController._tab.

63  def setTab(self, tab):
64  """ Sets tab.
65  """
66  self._tab = tab
67 
def Vispa.Main.TabController.TabController.setZoom (   self,
  zoom 
)
This function has to be implemented by tab controllers who want to use the zoom toolbar.

The implementation has to forward the zoom value to the Zoomable object for which the toolbar is set up.
See also zoom()

Definition at line 413 of file TabController.py.

Referenced by Vispa.Main.TabController.TabController.zoomAll(), Vispa.Main.TabController.TabController.zoomDialog(), Vispa.Main.TabController.TabController.zoomHundred(), and Vispa.Main.TabController.TabController.zoomUser().

413  def setZoom(self, zoom):
414  """ This function has to be implemented by tab controllers who want to use the zoom toolbar.
415 
416  The implementation has to forward the zoom value to the Zoomable object for which the toolbar is set up.
417  See also zoom()
418  """
419  raise NotImplementedError
420 
def Vispa.Main.TabController.TabController.staticSupportedFileTypes ( )
Static function returning all filetypes the tab controller can handle.

Sub classes should reimplement this function. It returns a list with 2-tuples of the following form:
('extension', 'description of file type').

Definition at line 40 of file TabController.py.

41  """ Static function returning all filetypes the tab controller can handle.
42 
43  Sub classes should reimplement this function. It returns a list with 2-tuples of the following form:
44  ('extension', 'description of file type').
45  """
46  return []
def Vispa.Main.TabController.TabController.supportedFileFilters (   self)

Definition at line 54 of file TabController.py.

References join().

55  supportedFileTypes = self.__class__.staticSupportedFileTypes()
56  return ";;".join([Filetype(t[0], t[1]).fileDialogFilter() for t in supportedFileTypes])
57 
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def Vispa.Main.TabController.TabController.supportedFileTypes (   self)
Returns staticSupportedFileTypes() of the class to which this object belongs.

Definition at line 49 of file TabController.py.

49  def supportedFileTypes(self):
50  """ Returns staticSupportedFileTypes() of the class to which this object belongs.
51  """
52  return self.__class__.staticSupportedFileTypes()
53 
def Vispa.Main.TabController.TabController.supportsUndo (   self)
Returns True if the this tab controller supports undo history.

Definition at line 520 of file TabController.py.

520  def supportsUndo(self):
521  """ Returns True if the this tab controller supports undo history.
522  """
523  return self._supportsUndo
524 
def Vispa.Main.TabController.TabController.tab (   self)
Returns tab.

Definition at line 68 of file TabController.py.

References Vispa.Main.TabController.TabController._tab.

Referenced by Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController._updateCode(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController.activated(), Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController.activated(), Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController.applyButtonClicked(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController.cancel(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController.centerView(), Vispa.Plugins.EdmBrowser.EdmBrowserTabController.EdmBrowserTabController.centerViewMenuButtonClicked(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController.centerViewMenuButtonClicked(), Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController.chooseEditor(), Vispa.Main.TabController.TabController.close(), Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController.codeSelected(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController.currentCenterViewClassId(), Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController.dumpPython(), Vispa.Plugins.EdmBrowser.EdmBrowserTabController.EdmBrowserTabController.eventContent(), Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController.eventContent(), Vispa.Plugins.EdmBrowser.EdmBrowserTabController.EdmBrowserTabController.expandToDepthDialog(), Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController.exportDot(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController.filterDialog(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController.find(), Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController.history(), Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController.importButtonClicked(), Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController.importConfig(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController.isBusy(), Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController.maximizeEditor(), Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController.minimizeEditor(), Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController.onCenterViewDoubleClicked(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController.onSelected(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController.onTreeViewSelected(), Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController.openEditor(), Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController.originalEditor(), Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController.readFile(), Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController.refresh(), Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController.removeButtonClicked(), Vispa.Main.TabController.TabController.save(), Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController.save(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController.saveImage(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController.scriptChanged(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController.select(), Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController.selectDataAccessor(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController.setDataAccessor(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController.setEditable(), Vispa.Main.TabController.TabController.setModified(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController.setTab(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController.setZoom(), Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController.startEditMode(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController.switchCenterView(), Vispa.Plugins.EdmBrowser.EdmBrowserTabController.EdmBrowserTabController.toggleCollapsed(), Vispa.Plugins.EdmBrowser.EdmBrowserTabController.EdmBrowserTabController.toggleUnderscoreProperties(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController.treeViewMenuButtonClicked(), Vispa.Plugins.EdmBrowser.EdmBrowserTabController.EdmBrowserTabController.updateCenterView(), Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController.updateCenterView(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController.updateCenterView(), Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController.updateConfigHighlight(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController.updateContent(), Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController.updateContent(), Vispa.Main.TabController.TabController.updateLabel(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController.updateTreeView(), Vispa.Plugins.EdmBrowser.EdmBrowserTabController.EdmBrowserTabController.updateViewMenu(), Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController.updateViewMenu(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController.updateViewMenu(), Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController.valueChanged(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController.zoom(), Vispa.Main.TabController.TabController.zoomAll(), Vispa.Main.TabController.TabController.zoomChanged(), and Vispa.Main.TabController.TabController.zoomDialog().

68  def tab(self):
69  """ Returns tab.
70  """
71  return self._tab
72 
def Vispa.Main.TabController.TabController.undo (   self,
  numberOfEvents = 1 
)
Invokes undo of last stored UndoEvent (see addUndoEvent()), if undo functionality is enabled.

Definition at line 564 of file TabController.py.

References Vispa.Main.TabController.TabController._supportsUndo, Vispa.Main.TabController.TabController._undoEvents, PFTauMVAInputDiscriminantTranslator::DiscriminantInfo.plugin, Vispa.Main.TabController.TabController.plugin(), Vispa.Main.Application.Application.plugin(), Vispa.Main.TabController.TabController.setModified(), and str.

564  def undo(self, numberOfEvents=1):
565  """ Invokes undo of last stored UndoEvent (see addUndoEvent()), if undo functionality is enabled.
566  """
567  if not self._supportsUndo:
568  logging.warning(self.__class__.__name__ + ": Tried to undo action, however undo functionality is not enabled. Aborting...")
569  return
570  logging.debug(self.__class__.__name__ +": undo("+ str(numberOfEvents) +")")
571  #self.dumpUndoEvents()
572 
573  for i in range(0, numberOfEvents):
574  if len(self._undoEvents) > 0:
575  lastEvent = self._undoEvents.pop()
576  lastEvent.undo()
577  self._redoEvents.append(lastEvent)
578 
579  # set modification flag
580  if i == (numberOfEvents -1):
581  if lastEvent.isLastSavedState():
582  self.setModified(False)
583  else:
584  self.setModified()
585  self.plugin().application().updateMenu()
586 
587  #self.dumpUndoEvents()
588 
def setModified(self, modified=True)
def undo(self, numberOfEvents=1)
#define str(s)
def Vispa.Main.TabController.TabController.undoEvents (   self)
Returns list of all registered UndoEvents.

Definition at line 533 of file TabController.py.

References Vispa.Main.TabController.TabController._undoEvents.

533  def undoEvents(self):
534  """ Returns list of all registered UndoEvents.
535  """
536  return self._undoEvents
537 
def Vispa.Main.TabController.TabController.updateLabel (   self,
  prefix = "",
  titletext = "" 
)
Sets the text of the tab to filename if it is set. If
titletext
is not an emty string, it is used instead of the filename.

Otherwise it is set to 'UNTITLED'. It also evaluates the fileModifiedFlag and indicates changes with an *.

Definition at line 120 of file TabController.py.

References Vispa.Main.TabController.TabController._filename, DQMIO2histo.DQMIO._filename, MuonGeometryArrange._filename, TrackerGeometryCompare._filename, Vispa.Main.TabController.TabController.isModified(), digitizers_cfi.strip, and Vispa.Main.TabController.TabController.tab().

Referenced by Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController.importConfig(), Vispa.Main.TabController.TabController.open(), Vispa.Main.TabController.TabController.save(), Vispa.Main.TabController.TabController.setModified(), and Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController.startEditMode().

120  def updateLabel(self,prefix="",titletext = ""):
121  """ Sets the text of the tab to filename if it is set. If
122  titletext
123  is not an emty string, it is used instead of the filename.
124 
125  Otherwise it is set to 'UNTITLED'. It also evaluates the fileModifiedFlag and indicates changes with an *.
126  """
127  if self._filename:
128  title = os.path.basename(self._filename)
129  if len(os.path.splitext(title)[0]) > self.TAB_LABEL_MAX_LENGTH:
130  ext = os.path.splitext(title)[1].lower().strip(".")
131  title = os.path.splitext(title)[0][0:self.TAB_LABEL_MAX_LENGTH] + "...." + ext
132  elif titletext == "":
133  title = 'UNTITLED'
134  else:
135  title = titletext
136 
137  if self.isModified():
138  title = '*' + title
139 
140  title = prefix+title
141 
142  if self.tab().tabWidget():
143  self.tab().tabWidget().setTabText(self.tab().tabWidget().indexOf(self.tab()), title)
144  else:
145  self.tab().setWindowTitle(title)
146 
def updateLabel(self, prefix="", titletext="")
def Vispa.Main.TabController.TabController.writeFile (   self,
  filename 
)
This function performs the actual writing / saving of a file. It should be overwritten by any PluginTab which inherits Tab.
If the writing was successful True should be returned.
The file should be written to the file given in the argument filename not to the one in self._filename.
These variables may differ in case the user selects "save as..." and picks a new filename on a file which already has a name set.
If writing was successful the self._filename variable will then be set to the value of filename.

Definition at line 303 of file TabController.py.

Referenced by Vispa.Main.TabController.TabController.save().

303  def writeFile(self, filename):
304  """
305  This function performs the actual writing / saving of a file. It should be overwritten by any PluginTab which inherits Tab.
306  If the writing was successful True should be returned.
307  The file should be written to the file given in the argument filename not to the one in self._filename.
308  These variables may differ in case the user selects "save as..." and picks a new filename on a file which already has a name set.
309  If writing was successful the self._filename variable will then be set to the value of filename.
310  """
311  raise NotImplementedError
312 
def Vispa.Main.TabController.TabController.zoom (   self)
This function has to be implemented by tab controllers who want to use the zoom toolbar.

The implementation should return the zoom value of the Zoomable object for which the toolbar is set up.
See also setZoom()

Definition at line 421 of file TabController.py.

Referenced by Vispa.Main.TabController.TabController.zoomAll(), Vispa.Main.TabController.TabController.zoomDialog(), and Vispa.Main.TabController.TabController.zoomHundred().

421  def zoom(self):
422  """ This function has to be implemented by tab controllers who want to use the zoom toolbar.
423 
424  The implementation should return the zoom value of the Zoomable object for which the toolbar is set up.
425  See also setZoom()
426  """
427  raise NotImplementedError
428 
def Vispa.Main.TabController.TabController.zoomAll (   self)
Zooms workspace content to fit optimal.

Currently only works if scroll area is used and accessible through self.tab().scrollArea().

Definition at line 458 of file TabController.py.

References Vispa.Main.TabController.TabController._userZoomLevel, Vispa.Main.TabController.TabController._zoomButtonPressedBeforeFlag, Vispa.Gui.Zoomable.Zoomable.setZoom(), Vispa.Gui.ZoomableScrollableWidgetOwner.ZoomableScrollableWidgetOwner.setZoom(), Vispa.Gui.ZoomableWidget.ZoomableWidget.setZoom(), Vispa.Gui.ZoomableScrollArea.ZoomableScrollArea.setZoom(), Vispa.Gui.PortConnection.PointToPointConnection.setZoom(), Vispa.Gui.ConnectableWidget.ConnectableWidget.setZoom(), Vispa.Main.TabController.TabController.setZoom(), Vispa.Gui.VispaWidget.VispaWidget.setZoom(), Vispa.Main.TabController.TabController.tab(), ApeEstimator_cff.width, Vispa.Gui.Zoomable.Zoomable.zoom(), and Vispa.Main.TabController.TabController.zoom().

458  def zoomAll(self):
459  """ Zooms workspace content to fit optimal.
460 
461  Currently only works if scroll area is used and accessible through self.tab().scrollArea().
462  """
463  logging.debug(__name__ + ": zoomAll()")
464  if not self._zoomButtonPressedBeforeFlag:
465  self._userZoomLevel = self.zoom()
466  self._zoomButtonPressedBeforeFlag = True
467 
468  viewportWidth = self.tab().scrollArea().viewport().width()
469  viewportHeight = self.tab().scrollArea().viewport().height()
470 
471  for i in range(0, 2):
472  # do 2 iterations to prevent rounding error --> better fit
473  workspaceChildrenRect = self.tab().scrollArea().widget().childrenRect()
474  widthRatio = self.zoom() * viewportWidth / (workspaceChildrenRect.right())
475  heightRatio = self.zoom() * viewportHeight / (workspaceChildrenRect.bottom())
476 
477  if widthRatio > heightRatio:
478  ratio = heightRatio
479  else:
480  ratio = widthRatio
481 
482  self.setZoom(math.floor(ratio))
483 
def Vispa.Main.TabController.TabController.zoomChanged (   self,
  zoom 
)
Shows zoom value on main window's status bar.

Definition at line 429 of file TabController.py.

References str, and Vispa.Main.TabController.TabController.tab().

429  def zoomChanged(self, zoom):
430  """ Shows zoom value on main window's status bar.
431  """
432  self.tab().mainWindow().statusBar().showMessage("Zoom " + str(round(zoom)) + " %")
433 
#define str(s)
def Vispa.Main.TabController.TabController.zoomDialog (   self)

Definition at line 502 of file TabController.py.

References Vispa.Main.TabController.TabController._userZoomLevel, Vispa.Gui.Zoomable.Zoomable.setZoom(), Vispa.Gui.ZoomableScrollableWidgetOwner.ZoomableScrollableWidgetOwner.setZoom(), Vispa.Gui.ZoomableWidget.ZoomableWidget.setZoom(), Vispa.Gui.ZoomableScrollArea.ZoomableScrollArea.setZoom(), Vispa.Gui.PortConnection.PointToPointConnection.setZoom(), Vispa.Gui.ConnectableWidget.ConnectableWidget.setZoom(), Vispa.Main.TabController.TabController.setZoom(), Vispa.Gui.VispaWidget.VispaWidget.setZoom(), Vispa.Main.TabController.TabController.tab(), Vispa.Gui.Zoomable.Zoomable.zoom(), and Vispa.Main.TabController.TabController.zoom().

502  def zoomDialog(self):
503  if hasattr(QInputDialog, "getInteger"):
504  # Qt 4.3
505  (zoom, ok) = QInputDialog.getInteger(self.tab(), "Zoom...", "Input zoom factor in percent:", self.zoom(), 0)
506  else:
507  # Qt 4.5
508  (zoom, ok) = QInputDialog.getInt(self.tab(), "Zoom...", "Input zoom factor in percent:", self.zoom(), 0)
509  if ok:
510  self.setZoom(zoom)
511  self._userZoomLevel = zoom
512 
def Vispa.Main.TabController.TabController.zoomHundred (   self)
Sets zoom factor to 100 %.

Definition at line 449 of file TabController.py.

References Vispa.Main.TabController.TabController._userZoomLevel, Vispa.Main.TabController.TabController._zoomButtonPressedBeforeFlag, Vispa.Gui.Zoomable.Zoomable.setZoom(), Vispa.Gui.ZoomableScrollableWidgetOwner.ZoomableScrollableWidgetOwner.setZoom(), Vispa.Gui.ZoomableWidget.ZoomableWidget.setZoom(), Vispa.Gui.ZoomableScrollArea.ZoomableScrollArea.setZoom(), Vispa.Gui.PortConnection.PointToPointConnection.setZoom(), Vispa.Gui.ConnectableWidget.ConnectableWidget.setZoom(), Vispa.Main.TabController.TabController.setZoom(), Vispa.Gui.VispaWidget.VispaWidget.setZoom(), Vispa.Gui.Zoomable.Zoomable.zoom(), and Vispa.Main.TabController.TabController.zoom().

449  def zoomHundred(self):
450  """ Sets zoom factor to 100 %.
451  """
452  logging.debug(__name__ + ": zoomHundred()")
453  if not self._zoomButtonPressedBeforeFlag:
454  self._userZoomLevel = self.zoom()
455  self._zoomButtonPressedBeforeFlag = True
456  self.setZoom(100)
457 
def Vispa.Main.TabController.TabController.zoomUser (   self)

Member Data Documentation

Vispa.Main.TabController.TabController._allowSelectAllFlag
private
Vispa.Main.TabController.TabController._copyPasteEnabledFlag
private
Vispa.Main.TabController.TabController._fileModifcationTimestamp
private
Vispa.Main.TabController.TabController._fileModifiedFlag
private
Vispa.Main.TabController.TabController._findEnabledFlag
private
Vispa.Main.TabController.TabController._isEditableFlag
private
Vispa.Main.TabController.TabController._plugin
private

Definition at line 23 of file TabController.py.

Referenced by Vispa.Main.TabController.TabController.plugin().

Vispa.Main.TabController.TabController._showingModifiedMessageFlag
private
Vispa.Main.TabController.TabController._tab
private
Vispa.Main.TabController.TabController._zoomButtonPressedBeforeFlag
private