CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ConfigEditorTabController.py
Go to the documentation of this file.
1 from __future__ import absolute_import
2 import sys
3 import logging
4 import os.path
5 import copy
6 
7 from PyQt4.QtCore import SIGNAL,QString,QCoreApplication
8 from PyQt4.QtGui import QMessageBox,QFileDialog
9 
10 from Vispa.Main.Application import Application
11 from Vispa.Main.Exceptions import exception_traceback
12 from Vispa.Share.ThreadChain import ThreadChain
13 from Vispa.Plugins.Browser.BrowserTabController import BrowserTabController
14 from Vispa.Views.WidgetView import WidgetView
15 from Vispa.Plugins.ConfigEditor.ConfigEditorBoxView import ConfigEditorBoxView,ConnectionStructureView,SequenceStructureView
16 from Vispa.Gui.TextDialog import TextDialog
17 
18 try:
19  from FWCore.GuiBrowsers.DOTExport import DotExport
20  import_dotexport_error=None
21 except Exception as e:
22  import_dotexport_error=(str(e),exception_traceback())
23 
24 try:
25  from Vispa.Plugins.EdmBrowser.EventContentDialog import EventContentDialog
26  event_content_error=None
27 except Exception as e:
28  event_content_error=(str(e),exception_traceback())
29 
30 try:
31  from .ToolDataAccessor import ToolDataAccessor,ConfigToolBase,standardConfigDir
32  from .ToolDialog import ToolDialog
33  import_tools_error=None
34 except Exception as e:
35  import_tools_error=(str(e),exception_traceback())
36 
38  """
39  """
40  def __init__(self, plugin):
41  logging.debug(__name__ + ": __init__")
42  BrowserTabController.__init__(self, plugin)
43 
44  self._editorName = ""
45  self._thread = None
46  self._originalSizes=[100,1,200]
47  self._toolDialog=None
48  self._updateCenterView=False
49  self.setEditable(False)
50 
51  self._configMenu = self.plugin().application().createPluginMenu('&Config')
52  self._configToolBar = self.plugin().application().createPluginToolBar('&Config')
53  openEditorAction = self.plugin().application().createAction('&Open in custom editor', self.openEditor, "F6")
54  self._configMenu.addAction(openEditorAction)
55  chooseEditorAction = self.plugin().application().createAction('&Choose custom editor...', self.chooseEditor, "Ctrl+T")
56  self._configMenu.addAction(chooseEditorAction)
57  self._configMenu.addSeparator()
58  self._dumpAction = self.plugin().application().createAction('&Dump python config to single file...', self.dumpPython, "Ctrl+D")
59  self._configMenu.addAction(self._dumpAction)
60  self._dotExportAction = self.plugin().application().createAction('&Export dot graphic...', self.exportDot, "Ctrl+G")
61  self._configMenu.addAction(self._dotExportAction)
62  self._historyAction = self.plugin().application().createAction('&Show history...', self.history, "Ctrl+H")
63  self._configMenu.addAction(self._historyAction)
64  self._eventContentAction = self.plugin().application().createAction('&Browse event content...', self.eventContent, "Ctrl+Shift+C")
65  self._configMenu.addAction(self._eventContentAction)
66  self._configMenu.addSeparator()
67  self._editorAction = self.plugin().application().createAction('&Edit using ConfigEditor', self.startEditMode, "F8")
68  self._configMenu.addAction(self._editorAction)
69  self._configToolBar.addAction(self._editorAction)
70 
71  #@staticmethod
73  """ Returns supported file type: py.
74  """
75  return [('py', 'Config file')]
76  staticSupportedFileTypes = staticmethod(staticSupportedFileTypes)
77 
78  def dotExportAction(self):
79  return self._dotExportAction
80 
81  def updateViewMenu(self):
82  BrowserTabController.updateViewMenu(self)
83  self.disconnect(self.tab().centerView(), SIGNAL("doubleClicked"), self.onCenterViewDoubleClicked)
84  self.connect(self.tab().centerView(), SIGNAL("doubleClicked"), self.onCenterViewDoubleClicked)
85 
86  def onCenterViewDoubleClicked(self,object):
87  logging.debug(__name__ + ": onCenterViewDoubleClicked()")
88  self.tab().treeView().select(object)
89  self.onTreeViewSelected(object)
90 
91  def updateCenterView(self, propertyView=True):
92  """ Fill the center view from an item in the TreeView and update it """
93  if not self._updateCenterView:
94  # Do not update the very first time
95  self._updateCenterView=True
96  return
97  statusMessage = self.plugin().application().startWorking("Updating center view")
98  if propertyView:
99  self.selectDataAccessor(True)
100  else:
101  self.selectDataAccessor(self.tab().propertyView().dataObject())
102  if self._thread != None and self._thread.isRunning():
103  self.dataAccessor().cancelOperations()
104  while self._thread.isRunning():
105  if not Application.NO_PROCESS_EVENTS:
106  QCoreApplication.instance().processEvents()
107  objects = []
108  select=self.tab().treeView().selection()
109  if select != None:
110  if self.currentCenterViewClassId() == self.plugin().viewClassId(ConnectionStructureView):
111  self.tab().centerView().setArrangeUsingRelations(True)
112  if self.tab().centerView().checkNumberOfObjects():
113  if self.dataAccessor().isContainer(select):
114  self._thread = ThreadChain(self.dataAccessor().readConnections, [select]+self.dataAccessor().allChildren(select))
115  else:
116  self._thread = ThreadChain(self.dataAccessor().readConnections, [select], True)
117  while self._thread.isRunning():
118  if not Application.NO_PROCESS_EVENTS:
119  QCoreApplication.instance().processEvents()
120  self.tab().centerView().setConnections(self._thread.returnValue())
121  self.tab().centerView().setDataObjects(self.dataAccessor().nonSequenceChildren(select))
122  else:
123  self.tab().centerView().setDataObjects([])
124  elif self.currentCenterViewClassId() == self.plugin().viewClassId(SequenceStructureView):
125  self.tab().centerView().setArrangeUsingRelations(False)
126  self.tab().centerView().setDataObjects([select])
127  self.tab().centerView().setConnections({})
128  if (self.currentCenterViewClassId() == self.plugin().viewClassId(ConnectionStructureView) or self.currentCenterViewClassId() == self.plugin().viewClassId(SequenceStructureView)) and \
129  self.tab().centerView().updateContent(True):
130  if not self.dataAccessor().isContainer(select) and self.currentCenterViewClassId() == self.plugin().viewClassId(ConnectionStructureView):
131  self.tab().centerView().select(select,500)
132  else:
133  self.tab().centerView().restoreSelection()
134  select = self.tab().centerView().selection()
135  if select != None:
136  if self.tab().propertyView().dataObject() != select and propertyView:
137  self.tab().propertyView().setDataObject(select)
138  self.tab().propertyView().updateContent()
139  if import_tools_error==None and self.tab().editorSplitter():
140  self.updateConfigHighlight()
141  self.plugin().application().stopWorking(statusMessage)
142 
143  def activated(self):
144  """ Shows plugin menus when user selects tab.
145  """
146  logging.debug(__name__ + ": activated()")
147  BrowserTabController.activated(self)
148  self.plugin().application().showPluginMenu(self._configMenu)
149  self.plugin().application().showPluginToolBar(self._configToolBar)
150  self._editorAction.setVisible(not self.tab().editorSplitter())
151  if self.tab().editorSplitter():
152  self._applyPatToolAction.setVisible(self.dataAccessor().process()!=None)
153  self.tab().mainWindow().application().showZoomToolBar()
154 
155  def openEditor(self):
156  """ Call editor """
157  logging.debug(__name__ + ": openEditor")
158  selected_object = self.tab().propertyView().dataObject()
159  filename = self.dataAccessor().fullFilename(selected_object)
160  if self._editorName != "" and selected_object != None and os.path.exists(filename):
161  if os.path.expandvars("$CMSSW_RELEASE_BASE") in filename:
162  QMessageBox.information(self.tab(), "Opening readonly file...", "This file is from $CMSSW_RELEASE_BASE and readonly")
163  command = self._editorName
164  command += " " + filename
165  command += " &"
166  os.system(command)
167 
168  def chooseEditor(self, _editorName=""):
169  """ Choose editor using FileDialog """
170  logging.debug(__name__ + ": chooseEditor")
171  if _editorName == "":
172  _editorName = str(QFileDialog.getSaveFileName(self.tab(), "Choose editor", self._editorName, "Editor (*)", None , QFileDialog.DontConfirmOverwrite or QFileDialog.DontResolveSymlinks))
173  if not os.path.exists(_editorName):
174  _editorName = os.path.basename(_editorName)
175  if _editorName != None and _editorName != "":
176  self._editorName = _editorName
177  self.saveIni()
178 
179  def dumpPython(self, fileName=None):
180  """ Dump python configuration to file """
181  logging.debug(__name__ + ": dumpPython")
182  dump = self.dataAccessor().dumpPython()
183  if dump == None:
184  logging.error(self.__class__.__name__ +": dumpPython() - "+"Cannot dump this config because it does not contain a 'process'.\nNote that only 'cfg' files contain a 'process'.")
185  self.plugin().application().errorMessage("Cannot dump this config because it does not contain a 'process'.\nNote that only 'cfg' files contain a 'process'.")
186  return None
187  filter = QString("")
188  if not fileName:
189  defaultname = os.path.splitext(self._filename)[0] + "_dump" + os.path.splitext(self._filename)[1]
190  fileName = str(QFileDialog.getSaveFileName(self.tab(), "Save python config...", defaultname, "Python config (*.py)", filter))
191  if fileName != "":
192  name = fileName
193  ext = "PY"
194  if os.path.splitext(fileName)[1].upper().strip(".") == ext:
195  name = os.path.splitext(fileName)[0]
196  ext = os.path.splitext(fileName)[1].upper().strip(".")
197  text_file = open(name + "." + ext.lower(), "w")
198  text_file.write(dump)
199  text_file.close()
200 
201  def history(self):
202  """ Show config history """
203  logging.debug(__name__ + ": history")
204  history = self.dataAccessor().history()
205  if history == None:
206  logging.error(self.__class__.__name__ +": history() - "+"Cannot show config history because it does not contain a 'process'.\nNote that only 'cfg' files contain a 'process'.")
207  self.plugin().application().errorMessage("Cannot show config history because it does not contain 'process'.\nNote that only 'cfg' files contain a 'process'.")
208  return None
209  dialog=TextDialog(self.tab(), "Configuration history", history, True, "This window lists the parameter changes and tools applied in this configuration file before it was loaded into ConfigEditor.")
210  dialog.exec_()
211 
212  def eventContent(self):
213  """ Open event content dialog """
214  logging.debug(__name__ + ": eventContent")
215  if event_content_error!=None:
216  logging.error(__name__ + ": Could not import EventContentDialog: "+event_content_error[1])
217  self.plugin().application().errorMessage("Could not import EventContentDialog (see logfile for details):\n"+event_content_error[0])
218  return
219  dialog=EventContentDialog(self.tab(),"This dialog let's you check if the input needed by your configuration file is in a dataformat or edm root file. You can compare either to a dataformat definition from a txt file (e.g. RECO_3_3_0) or any edm root file by selecting an input file.\n\nBranches that are used as input by your configuration but not present in the dataformat or file are marked in red.\nBranches that are newly created by your configuration are marked in green.")
220  dialog.setConfigDataAccessor(self.dataAccessor())
221  dialog.exec_()
222 
223  def loadIni(self):
224  """ read options from ini """
225  ini = self.plugin().application().ini()
226  if ini.has_option("config", "editor"):
227  self._editorName = str(ini.get("config", "editor"))
228  else:
229  self._editorName = "emacs"
230  if ini.has_option("config", "CurrentView"):
231  proposed_view = ini.get("config", "CurrentView")
232  else:
233  proposed_view = self.plugin().viewClassId(ConnectionStructureView)
234  self.switchCenterView(proposed_view)
235  if ini.has_option("config", "box content script") and isinstance(self.centerView(),ConfigEditorBoxView):
236  self.centerView().setBoxContentScript(str(ini.get("config", "box content script")))
237  self._boxContentDialog.setScript(str(ini.get("config", "box content script")))
238 
239  def scriptChanged(self, script):
240  BrowserTabController.scriptChanged(self, script)
241  self.saveIni()
242 
243  def saveIni(self):
244  """ write options to ini """
245  ini = self.plugin().application().ini()
246  if not ini.has_section("config"):
247  ini.add_section("config")
248  ini.set("config", "editor", self._editorName)
249  if self.currentCenterViewClassId():
250  ini.set("config", "CurrentView", self.currentCenterViewClassId())
251  if isinstance(self.centerView(),ConfigEditorBoxView):
252  ini.set("config", "box content script", self.centerView().boxContentScript())
253  self.plugin().application().writeIni()
254 
255  def exportDot(self, fileName=None):
256  if import_dotexport_error!=None:
257  logging.error(__name__ + ": Could not import DOTExport: "+import_dotexport_error[1])
258  self.plugin().application().errorMessage("Could not import DOTExport (see logfile for details):\n"+import_dotexport_error[0])
259  return
260  dot = DotExport()
261  if self.currentCenterViewClassId() == self.plugin().viewClassId(ConnectionStructureView):
262  presets = {'seqconnect':False, 'tagconnect':True, 'seq':False, 'services':False, 'es':False, 'endpath':True, 'source':True, 'legend':False}
263  else:
264  presets = {'seqconnect':True, 'tagconnect':False, 'seq':True, 'services':False, 'es':False, 'endpath':True, 'source':True, 'legend':False}
265  for opt, val in presets.items():
266  dot.setOption(opt, val)
267  types = ""
268  for ft in dot.file_types:
269  if types != "":
270  types += ";;"
271  types += ft.upper() + " File (*." + ft.lower() + ")"
272  filter = QString("PDF File (*.pdf)")
273  if not fileName:
274  defaultname = os.path.splitext(self._filename)[0] + "_export"
275  fileName = str(QFileDialog.getSaveFileName(self.tab(), "Export dot graphic...", defaultname, types, filter))
276  if fileName != "":
277  name = fileName
278  ext = str(filter).split(" ")[0].lower()
279  if os.path.splitext(fileName)[1].lower().strip(".") in dot.file_types:
280  name = os.path.splitext(fileName)[0]
281  ext = os.path.splitext(fileName)[1].lower().strip(".")
282  try:
283  dot.export(self.dataAccessor(), name + "." + ext, ext)
284  except Exception:
285  try:
286  dot.export(self.dataAccessor(), name + ".dot", "dot")
287  logging.error(self.__class__.__name__ +": exportDot() - "+"'dot' executable not found which is needed for conversion to '*." + ext + "'. Created '*.dot' file instead.")
288  self.plugin().application().errorMessage("'dot' executable not found which is needed for conversion to '*." + ext + "'. Created '*.dot' file instead.")
289  except Exception as e:
290  logging.error(self.__class__.__name__ +": exportDot() - "+"Could not export dot graphic (see logfile for details): " + str(e))
291  self.plugin().application().errorMessage("Could not export dot graphic: " + exception_traceback())
292 
293  def readFile(self, filename):
294  """ Reads in the file in a separate thread.
295  """
296  self._updateCenterView=False
297  if self.dataAccessor().open(filename):
298  self._dumpAction.setEnabled(self.dataAccessor().process()!=None)
299  self._historyAction.setEnabled(self.dataAccessor().process()!=None)
300  self._eventContentAction.setEnabled(self.dataAccessor().process()!=None)
301  self._editorAction.setEnabled(self.dataAccessor().process()!=None)
302  if self.plugin().application().commandLineOptions().saveimage:
303  self.tab().centerView().updateConnections()
304  self.saveImage(self.plugin().application().commandLineOptions().saveimage)
305  print "Saved image to", self.plugin().application().commandLineOptions().saveimage, "."
306  sys.exit(2)
307  return True
308  return False
309 
310  def save(self, filename=''):
311  logging.debug(__name__ + ': save')
312  self.startEditMode()
313  if filename != "":
314  if os.path.basename(filename) == os.path.basename(self.dataAccessor().configFile()):
315  logging.error(self.__class__.__name__ +": save() - "+"Cannot use name of original configuration file: "+str(filename))
316  self.plugin().application().errorMessage("Cannot use name of original configuration file.")
317  elif BrowserTabController.save(self, filename):
318  self.dataAccessor().setIsReplaceConfig()
319  return True
320  else:
321  return False
322  elif self.dataAccessor().isReplaceConfig():
323  return BrowserTabController.save(self, filename)
324  return self.tab().mainWindow().application().saveFileAsDialog()
325 
326  def writeFile(self, filename):
327  """ Write replace config file.
328  """
329  logging.debug(__name__ + ': writeFile')
330 
331  text_file = open(filename, "w")
332  text_file.write(self.toolDataAccessor().topLevelObjects()[0].dumpPython()[1])
333  if self.dataAccessor().process():
334  text_file.write(self.dataAccessor().process().dumpHistory(False))
335  text_file.close()
336  return True
337 
338  def open(self, filename=None, update=True):
339  if BrowserTabController.open(self, filename, update):
340  if self.dataAccessor().isReplaceConfig():
341  self.startEditMode()
342  return True
343  return False
344 
345  def startEditMode(self):
346  logging.debug(__name__ + ": startEditMode")
347  if import_tools_error!=None:
348  logging.error(__name__ + ": Could not import tools for ConfigEditor: "+import_tools_error[1])
349  self.plugin().application().errorMessage("Could not import tools for ConfigEditor (see logfile for details):\n"+import_tools_error[0])
350  return
351  if self.tab().editorSplitter():
352  return
353  if self._filename and not self.dataAccessor().process():
354  logging.error(__name__ + ": Config does not contain a process and cannot be edited using ConfigEditor.")
355  self.plugin().application().errorMessage("Config does not contain a process and cannot be edited using ConfigEditor.")
356  return
357  if self._filename and not self.dataAccessor().isReplaceConfig():
358  self.setFilename(None)
359  self.updateLabel()
360  self.tab().createEditor()
361  self.setEditable(True)
362  self.tab().verticalSplitter().setSizes(self._originalSizes)
363 
364  self._importAction = self.plugin().application().createAction('&Import configuration...', self.importButtonClicked, "F2")
365  self._configMenu.addAction(self._importAction)
366  self._configToolBar.addAction(self._importAction)
367  self._applyPatToolAction = self.plugin().application().createAction('&Apply tool...', self.applyButtonClicked, "F3")
368  self._configMenu.addAction(self._applyPatToolAction)
369  self._configToolBar.addAction(self._applyPatToolAction)
370  self.activated()
371 
372  self._toolDataAccessor=ToolDataAccessor()
373  self._toolDataAccessor.setConfigDataAccessor(self.dataAccessor())
374  self.tab().editorTableView().setDataAccessor(self._toolDataAccessor)
375  self.connect(self.tab().editorTableView(), SIGNAL('importButtonClicked'), self.importButtonClicked)
376  self.connect(self.tab().editorTableView(), SIGNAL('applyButtonClicked'), self.applyButtonClicked)
377  self.connect(self.tab().editorTableView(), SIGNAL('removeButtonClicked'), self.removeButtonClicked)
378  self.connect(self.tab().editorTableView(), SIGNAL('selected'), self.codeSelected)
379  self.connect(self.tab().propertyView(), SIGNAL('valueChanged'), self.valueChanged)
380  self._updateCode()
381 
382  def toolDataAccessor(self):
383  return self._toolDataAccessor
384 
385  def minimizeEditor(self):
386  if self.tab().originalButton().isChecked():
387  self._originalSizes=self.tab().verticalSplitter().sizes()
388  self.tab().minimizeButton().setChecked(True)
389  self.tab().originalButton().setChecked(False)
390  self.tab().maximizeButton().setChecked(False)
391  self.tab().verticalSplitter().setSizes([100, 1, 0])
392 
393  def originalEditor(self):
394  self.tab().minimizeButton().setChecked(False)
395  self.tab().originalButton().setChecked(True)
396  self.tab().maximizeButton().setChecked(False)
397  self.tab().verticalSplitter().setSizes(self._originalSizes)
398 
399  def maximizeEditor(self):
400  if self.tab().originalButton().isChecked():
401  self._originalSizes=self.tab().verticalSplitter().sizes()
402  self.tab().minimizeButton().setChecked(False)
403  self.tab().originalButton().setChecked(False)
404  self.tab().maximizeButton().setChecked(True)
405  self.tab().verticalSplitter().setSizes([0, 1, 100])
406 
407  def _updateCode(self,propertyView=True):
408  logging.debug(__name__ + ": _updateCode")
409  self.tab().propertyView().setEnabled(False)
410  self.toolDataAccessor().updateToolList()
411  self.tab().editorTableView().setDataObjects(self.toolDataAccessor().topLevelObjects())
412  if self.tab().editorTableView().updateContent():
413  self.tab().editorTableView().restoreSelection()
414  self.updateContent(False,propertyView)
415  self.tab().propertyView().setEnabled(True)
416 
417  def importConfig(self,filename):
418  logging.debug(__name__ + ": importConfig")
419  statusMessage = self.plugin().application().startWorking("Import python configuration in Editor")
420  try:
421  good=self.open(filename,False)
422  except:
423  logging.error(__name__ + ": Could not open configuration file: "+exception_traceback())
424  self.plugin().application().errorMessage("Could not open configuration file (see log file for details).")
425  self.plugin().application().stopWorking(statusMessage,"failed")
426  return False
427  if not good:
428  logging.error(__name__ + ": Could not open configuration file.")
429  self.plugin().application().errorMessage("Could not open configuration file.")
430  self.plugin().application().stopWorking(statusMessage,"failed")
431  return False
432  if not self.dataAccessor().process():
433  logging.error(__name__ + ": Config does not contain a process and cannot be edited using ConfigEditor.")
434  self.plugin().application().errorMessage("Config does not contain a process and cannot be edited using ConfigEditor.")
435  self.plugin().application().stopWorking(statusMessage,"failed")
436  return False
437  if self._filename and not self.dataAccessor().isReplaceConfig():
438  self.setFilename(None)
439  self.updateLabel()
440  self.toolDataAccessor().setConfigDataAccessor(self.dataAccessor())
441  self.tab().propertyView().setDataObject(None)
442  self._updateCode()
443  self._applyPatToolAction.setVisible(True)
444  self.plugin().application().stopWorking(statusMessage)
445  return True
446 
448  if self.tab().editorTableView().selection() in self.toolDataAccessor().toolModules().keys():
449  self.tab().centerView().highlight(self.toolDataAccessor().toolModules()[self.tab().editorTableView().selection()])
450  else:
451  self.tab().centerView().highlight([])
452 
454  logging.debug(__name__ + ": importButtonClicked")
455  filename = QFileDialog.getOpenFileName(
456  self.tab(),'Select a configuration file',standardConfigDir,"Python configuration (*.py)")
457  if not filename.isEmpty():
458  self.importConfig(str(filename))
459 
461  logging.debug(__name__ + ": applyButtonClicked")
462  if not self._toolDialog:
463  self._toolDialog=ToolDialog()
464  self._toolDialog.setDataAccessor(self._toolDataAccessor)
465  if not self._toolDialog.exec_():
466  return
467  if not self.toolDataAccessor().addTool(self._toolDialog.tool()):
468  return
469  self.setModified(True)
470  self._updateCode()
471  self.tab().editorTableView().select(self.tab().editorTableView().dataObjects()[-2])
472  self.codeSelected(self.tab().editorTableView().dataObjects()[-2])
473 
474  def removeButtonClicked(self,object):
475  logging.debug(__name__ + ": removeButtonClicked")
476  if not object or not self.dataAccessor().process() or\
477  self._toolDataAccessor.label(object) in ["Import","ApplyTool"]:
478  return
479  if not self.toolDataAccessor().removeTool(object):
480  self.plugin().application().errorMessage("Could not apply tool. See log file for details.")
481  return
482  self.setModified(True)
483  self._updateCode()
484  self.tab().editorTableView().select(self.tab().editorTableView().dataObjects()[-1])
485  self.codeSelected(self.tab().editorTableView().dataObjects()[-1])
486 
487  def onSelected(self, select):
488  self.selectDataAccessor(select)
489  BrowserTabController.onSelected(self, select)
490 
491  def refresh(self):
492  self.tab().propertyView().setDataObject(None)
493  BrowserTabController.refresh(self)
494 
495  def updateContent(self, filtered=False, propertyView=True):
496  if import_tools_error==None and isinstance(object,ConfigToolBase):
497  propertyView=False
498  else:
499  self.tab().propertyView().setDataAccessor(self.dataAccessor())
500  BrowserTabController.updateContent(self, filtered, propertyView)
501 
502  def select(self, object):
503  self.selectDataAccessor(object)
504  BrowserTabController.select(self, object)
505 
506  def selectDataAccessor(self,object):
507  if import_tools_error==None and isinstance(object,ConfigToolBase):
508  self.tab().propertyView().setDataAccessor(self.toolDataAccessor())
509  else:
510  self.tab().propertyView().setDataAccessor(self.dataAccessor())
511 
512  def codeSelected(self,select):
513  if self.tab().propertyView().dataObject() != select:
514  statusMessage = self.plugin().application().startWorking("Updating property view")
515  self.tab().propertyView().setDataAccessor(self.toolDataAccessor())
516  self.tab().propertyView().setDataObject(select)
517  self.tab().propertyView().updateContent()
518  self.plugin().application().stopWorking(statusMessage)
519  self.updateConfigHighlight()
520 
521  def valueChanged(self,name):
522  if isinstance(self.tab().propertyView().dataObject(),ConfigToolBase):
523  if self._toolDataAccessor.label(self.tab().propertyView().dataObject())=="Import":
524  filename=self.toolDataAccessor().propertyValue(self.tab().propertyView().dataObject(),"filename")
525  return self.importConfig(filename)
526  else:
527  self.toolDataAccessor().updateProcess()
528  self.setModified(True)
529  self._updateCode(False)
530  self.codeSelected(self.tab().editorTableView().selection())
531  else:
532  self._updateCode()
selection
main part
Definition: corrVsCorr.py:98
tuple process
Definition: LaserDQM_cfg.py:3
double split
Definition: MVATrainer.cc:139