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