CMS 3D CMS Logo

ConfigEditorTab.py
Go to the documentation of this file.
1 import logging
2 
3 from PyQt4.QtCore import SIGNAL, Qt
4 from PyQt4.QtGui import QWidget, QListWidget, QVBoxLayout, QPushButton,QToolButton, QSplitter
5 
6 from Vispa.Main.SplitterTab import SplitterToolBar
7 from Vispa.Plugins.Browser.BrowserTab import BrowserTab
8 from Vispa.Gui.ToolBoxContainer import ToolBoxContainer
9 from Vispa.Plugins.ConfigEditor.CodeTableView import CodeTableView
10 
12  """ This is the main frame of the Config Editor Plugin.
13 
14  The tab is split in three horizontal parts, from left to right: Tree View, Center View, Property View.
15  The editor can be dispayed using createEditor(). The Property View is then shared with the ConfigBrowser.
16  """
17 
18  def __init__(self, parent=None):
19  """ constructor """
20  logging.debug(self.__class__.__name__ +": __init__()")
21  BrowserTab.__init__(self, parent,True)
22  self._editorSplitter = None
23 
24  def createEditor(self):
25  self.createToolBar(0)
26  self._editorSplitter = QSplitter(Qt.Horizontal)
27 
28  toolBarSectionId = self.toolBar().addSection(SplitterToolBar.ALIGNMENT_LEFT)
29 
31 
32  self._editorSplitter.setSizes([100, 300])
33 
34  self._minimizeButton = QToolButton()
35  self._minimizeButton.setText("v")
36  self._minimizeButton.setCheckable(True)
37  self._originalButton = QToolButton()
38  self._originalButton.setText("-")
39  self._originalButton.setCheckable(True)
40  self._originalButton.setChecked(True)
41  self._maximizeButton = QToolButton()
42  self._maximizeButton.setText("^")
43  self._maximizeButton.setCheckable(True)
44 
45  self._centerViewToolBarId = self.toolBar().addSection(SplitterToolBar.ALIGNMENT_CENTER)
46  self.toolBar().addWidgetToSection(self._minimizeButton, self._centerViewToolBarId)
47  self.toolBar().addWidgetToSection(self._originalButton, self._centerViewToolBarId)
48  self.toolBar().addWidgetToSection(self._maximizeButton, self._centerViewToolBarId)
49 
50  self.verticalSplitter().insertWidget(0,self._editorSplitter)
51  self.updateToolBarSizes()
52 
53  controller = self.controller()
54  if controller:
55  self.connect(self._minimizeButton, SIGNAL('clicked(bool)'), controller.minimizeEditor)
56  self.connect(self._originalButton, SIGNAL('clicked(bool)'), controller.originalEditor)
57  self.connect(self._maximizeButton, SIGNAL('clicked(bool)'), controller.maximizeEditor)
58 
59  def editorSplitter(self):
60  return self._editorSplitter
61 
62  def horizontalSplitterMovedSlot(self, pos, index):
63  if self.toolBar():
64  self.updateToolBarSizes()
65 
66  def updateToolBarSizes(self):
67  self.toolBar().setSectionSizes(self.horizontalSplitter().sizes())
68 
69  def minimizeButton(self):
70  return self._minimizeButton
71 
72  def originalButton(self):
73  return self._originalButton
74 
75  def maximizeButton(self):
76  return self._maximizeButton
77 
78  def editorTableView(self):
79  return self._editorTableView
80 
def createToolBar(self, index=None)
Definition: SplitterTab.py:55