6 from Vispa.Plugins.Browser.BrowserPlugin
import BrowserPlugin
7 from Vispa.Plugins.Browser.BrowserTab
import BrowserTab
8 from Vispa.Main.Exceptions
import NoCurrentTabControllerException
9 from Vispa.Main.Exceptions
import PluginIgnoredException
12 from Vispa.Plugins.ConfigEditor.ConfigDataAccessor
import ConfigDataAccessor
14 raise PluginIgnoredException(
"cannot import CMSSW: " + str(e))
16 from Vispa.Plugins.ConfigEditor.ConfigEditorTab
import ConfigEditorTab
17 from Vispa.Plugins.ConfigEditor.ConfigEditorTabController
import ConfigEditorTabController
18 from Vispa.Plugins.ConfigEditor.ConfigEditorBoxView
import ConnectionStructureView
19 from Vispa.Plugins.ConfigEditor.ConfigEditorBoxView
import SequenceStructureView
20 from Vispa.Views.AbstractView
import NoneView
23 """ The ConfigEditorPlugin opens config files in a ConfigEditorTab.
26 def __init__(self, application=None, name=None):
27 logging.debug(__name__ +
": __init__")
28 BrowserPlugin.__init__(self, application)
29 self.registerFiletypesFromTabController(ConfigEditorTabController)
30 self.addNewFileAction(
"New configuration file", self.
newFile)
31 self.application().commandLineParser().add_option(
"-s",
"--saveimage", dest=
"saveimage", help=
"save center view to image FILE", metavar=
"FILE")
34 BrowserPlugin.startUp(self)
35 self.addCenterView(NoneView)
36 self.addCenterView(ConnectionStructureView,
True)
37 self.addCenterView(SequenceStructureView)
40 """ Create ConfigEditorTab and add to MainWindow.
42 tab = ConfigEditorTab(self.application().mainWindow())
43 controller = ConfigEditorTabController(self)
44 controller.setDataAccessor(ConfigDataAccessor())
45 tab.setController(controller)
46 controller.boxContentDialog().addButton(
"&Type",
"object.type")
47 controller.boxContentDialog().addButton(
"&Classname",
"object.classname")
48 controller.boxContentDialog().addButton(
"&Filename",
"object.filename")
49 controller.boxContentDialog().addButton(
"&Package",
"object.package")
50 self.application().mainWindow().addTab(tab)
54 """ Create ConfigEditorTab and add to MainWindow.
59 controller=self.
newTab().controller()
62 if isinstance(self.application().currentTabController(),ConfigEditorTabController):
63 controller=self.application().currentTabController()
64 except NoCurrentTabControllerException:
67 logging.error(__name__ +
": No configuration file was opened for editing.")
68 self.application().errorMessage(
"No configuration file was opened for editing.")
70 controller.startEditMode()