예제 #1
0
 def __init__(self, parent):
     """
     Constructor
     
     @param parent parent widget (QWidget)
     """
     self.tabWidgets = []
     
     QSplitter.__init__(self, parent)
     ViewManager.__init__(self)
     self.setChildrenCollapsible(False)
     
     tw = TabWidget(self)
     self.addWidget(tw)
     self.tabWidgets.append(tw)
     self.currentTabWidget = tw
     self.currentTabWidget.showIndicator(True)
     tw.currentChanged.connect(self.__currentChanged)
     tw.installEventFilter(self)
     tw.tabBar().installEventFilter(self)
     self.setOrientation(Qt.Vertical)
     self.__inRemoveView = False
     
     self.maxFileNameChars = Preferences.getUI(
         "TabViewManagerFilenameLength")
     self.filenameOnly = Preferences.getUI("TabViewManagerFilenameOnly")
예제 #2
0
 def __init__(self, parent):
     """
     Constructor
     
     @param parent parent widget (QWidget)
     @param ui reference to the main user interface
     @param dbs reference to the debug server object
     """
     self.tabWidgets = []
     
     QSplitter.__init__(self, parent)
     ViewManager.__init__(self)
     tw = TabWidget(self)
     self.addWidget(tw)
     self.tabWidgets.append(tw)
     self.currentTabWidget = tw
     self.currentTabWidget.showIndicator(True)
     self.connect(tw, SIGNAL('currentChanged(int)'),
         self.__currentChanged)
     tw.installEventFilter(self)
     tw.tabBar().installEventFilter(self)
     self.setOrientation(Qt.Vertical)
     self.__inRemoveView = False
     
     self.maxFileNameChars = Preferences.getUI("TabViewManagerFilenameLength")
     self.filenameOnly = Preferences.getUI("TabViewManagerFilenameOnly")
예제 #3
0
    def preferencesChanged(self):
        """
        Public slot to handle the preferencesChanged signal.
        """
        ViewManager.preferencesChanged(self)

        self.maxFileNameChars = Preferences.getUI(
            "TabViewManagerFilenameLength")
        self.filenameOnly = Preferences.getUI("TabViewManagerFilenameOnly")

        for tabWidget in self.tabWidgets:
            for index in range(tabWidget.count()):
                editor = tabWidget.widget(index)
                if isinstance(editor, QScintilla.Editor.Editor):
                    fn = editor.getFileName()
                    if fn:
                        if self.filenameOnly:
                            txt = os.path.basename(fn)
                        else:
                            txt = e5App().getObject("Project")\
                                .getRelativePath(fn)
                        if len(txt) > self.maxFileNameChars:
                            txt = "...{0}".format(txt[-self.maxFileNameChars:])
                        if not QFileInfo(fn).isWritable():
                            txt = self.tr("{0} (ro)").format(txt)
                        tabWidget.setTabText(index, txt)
예제 #4
0
    def __init__(self, parent):
        """
        Constructor
        
        @param parent parent widget (QWidget)
        """
        self.tabWidgets = []

        self.__splitter = QSplitter(parent)
        ViewManager.__init__(self)
        self.__splitter.setChildrenCollapsible(False)

        tw = TabWidget(self)
        self.__splitter.addWidget(tw)
        self.tabWidgets.append(tw)
        self.currentTabWidget = tw
        self.currentTabWidget.showIndicator(True)
        tw.currentChanged.connect(self.__currentChanged)
        tw.installEventFilter(self)
        tw.tabBar().installEventFilter(self)
        self.__splitter.setOrientation(Qt.Vertical)
        self.__inRemoveView = False

        self.maxFileNameChars = Preferences.getUI(
            "TabViewManagerFilenameLength")
        self.filenameOnly = Preferences.getUI("TabViewManagerFilenameOnly")
예제 #5
0
 def preferencesChanged(self):
     """
     Public slot to handle the preferencesChanged signal.
     """
     ViewManager.preferencesChanged(self)
     
     self.maxFileNameChars = Preferences.getUI(
         "TabViewManagerFilenameLength")
     self.filenameOnly = Preferences.getUI("TabViewManagerFilenameOnly")
     
     for tabWidget in self.tabWidgets:
         for index in range(tabWidget.count()):
             editor = tabWidget.widget(index)
             if isinstance(editor, QScintilla.Editor.Editor):
                 fn = editor.getFileName()
                 if fn:
                     if self.filenameOnly:
                         txt = os.path.basename(fn)
                     else:
                         txt = e5App().getObject("Project")\
                             .getRelativePath(fn)
                     if len(txt) > self.maxFileNameChars:
                         txt = "...{0}".format(txt[-self.maxFileNameChars:])
                     if not QFileInfo(fn).isWritable():
                         txt = self.tr("{0} (ro)").format(txt)
                     tabWidget.setTabText(index, txt)
예제 #6
0
 def _syntaxErrorToggled(self, editor):
     """
     Protected slot to handle the syntaxerrorToggled signal.
     
     @param editor editor that sent the signal
     """
     if editor.hasSyntaxErrors():
         editor.setWindowIcon(UI.PixmapCache.getIcon("syntaxError.png"))
     else:
         editor.setWindowIcon(UI.PixmapCache.getIcon("empty.png"))
             
     ViewManager._syntaxErrorToggled(self, editor)
예제 #7
0
 def _syntaxErrorToggled(self, editor):
     """
     Protected slot to handle the syntaxerrorToggled signal.
     
     @param editor editor that sent the signal
     """
     currentRow = self.viewlist.currentRow()
     index = self.editors.index(editor)
     if editor.hasSyntaxErrors():
         self.viewlist.item(index).setIcon(UI.PixmapCache.getIcon("syntaxError.png"))
     else:
         self.viewlist.item(index).setIcon(UI.PixmapCache.getIcon("empty.png"))
     self.viewlist.setCurrentRow(currentRow)
     
     ViewManager._syntaxErrorToggled(self, editor)
예제 #8
0
 def _syntaxErrorToggled(self, editor):
     """
     Protected slot to handle the syntaxerrorToggled signal.
     
     @param editor editor that sent the signal
     """
     for tw in self.tabWidgets:
         if tw.hasEditor(editor):
             break
     index = tw.indexOf(editor)
     if editor.hasSyntaxErrors():
         tw.setTabIcon(index, UI.PixmapCache.getIcon("syntaxError.png"))
     else:
         tw.setTabIcon(index, UI.PixmapCache.getIcon("empty.png"))
     
     ViewManager._syntaxErrorToggled(self, editor)
예제 #9
0
 def __init__(self, parent):
     """
     Constructor
     
     @param parent parent widget (QWidget)
     @param ui reference to the main user interface
     @param dbs reference to the debug server object
     """
     QWorkspace.__init__(self, parent)
     ViewManager.__init__(self)
     self.setScrollBarsEnabled(True)
     self.lastFN = ''
     
     self.__windowMapper = QSignalMapper(self)
     
     self.connect(self.__windowMapper, SIGNAL('mapped(QWidget*)'), 
         self.setActiveWindow)
     self.connect(self, SIGNAL('windowActivated(QWidget*)'),
         self.__windowActivated)
예제 #10
0
 def __init__(self, parent):
     """
     Constructor
     
     @param parent parent widget (QWidget)
     @param ui reference to the main user interface
     @param dbs reference to the debug server object
     """
     self.stacks = []
     
     QSplitter.__init__(self, parent)
     ViewManager.__init__(self)
     
     self.viewlist = QListWidget(self)
     policy = self.viewlist.sizePolicy()
     policy.setHorizontalPolicy(QSizePolicy.Ignored)
     self.viewlist.setSizePolicy(policy)
     self.addWidget(self.viewlist)
     self.viewlist.setContextMenuPolicy(Qt.CustomContextMenu)
     self.connect(self.viewlist, SIGNAL("itemActivated(QListWidgetItem*)"),
                  self.__showSelectedView)
     self.connect(self.viewlist, SIGNAL("itemClicked(QListWidgetItem*)"),
                  self.__showSelectedView)
     self.connect(self.viewlist, SIGNAL("customContextMenuRequested(const QPoint &)"),
                  self.__showMenu)
     
     self.stackArea = QSplitter(self)
     self.addWidget(self.stackArea)
     self.stackArea.setOrientation(Qt.Vertical)
     stack = StackedWidget(self.stackArea)
     self.stackArea.addWidget(stack)
     self.stacks.append(stack)
     self.currentStack = stack
     self.connect(stack, SIGNAL('currentChanged(int)'),
         self.__currentChanged)
     stack.installEventFilter(self)
     self.setSizes([int(self.width() * 0.2), int(self.width() * 0.8)]) # 20% for viewlist
     self.__inRemoveView = False
     
     self.__initMenu()
     self.contextMenuEditor = None
예제 #11
0
    def _syntaxErrorToggled(self, editor):
        """
        Protected slot to handle the syntaxerrorToggled signal.
        
        @param editor editor that sent the signal
        """
        currentRow = self.viewlist.currentRow()
        index = self.editors.index(editor)
        keys = []
        if editor.isModified():
            keys.append("fileModified.png")
        if editor.hasSyntaxErrors():
            keys.append("syntaxError22.png")
        elif editor.hasWarnings():
            keys.append("warning22.png")
        if not keys:
            keys.append("empty.png")
        self.viewlist.item(index).setIcon(UI.PixmapCache.getCombinedIcon(keys))
        self.viewlist.setCurrentRow(currentRow)

        ViewManager._syntaxErrorToggled(self, editor)
예제 #12
0
    def __init__(self, parent):
        """
        Constructor
        
        @param parent parent widget (QWidget)
        """
        self.stacks = []

        self.__splitter = QSplitter(parent)
        ViewManager.__init__(self)
        self.__splitter.setChildrenCollapsible(False)

        self.viewlist = QListWidget(self)
        policy = self.viewlist.sizePolicy()
        policy.setHorizontalPolicy(QSizePolicy.Ignored)
        self.viewlist.setSizePolicy(policy)
        self.__splitter.addWidget(self.viewlist)
        self.viewlist.setContextMenuPolicy(Qt.CustomContextMenu)
        self.viewlist.currentRowChanged.connect(self.__showSelectedView)
        self.viewlist.customContextMenuRequested.connect(self.__showMenu)

        self.stackArea = QSplitter(self)
        self.stackArea.setChildrenCollapsible(False)
        self.__splitter.addWidget(self.stackArea)
        self.stackArea.setOrientation(Qt.Vertical)
        stack = StackedWidget(self.stackArea)
        self.stackArea.addWidget(stack)
        self.stacks.append(stack)
        self.currentStack = stack
        stack.currentChanged.connect(self.__currentChanged)
        stack.installEventFilter(self)
        self.__splitter.setSizes(
            [int(self.width() * 0.2),
             int(self.width() * 0.8)])
        # 20% for viewlist, 80% for the editors
        self.__inRemoveView = False

        self.__initMenu()
        self.contextMenuEditor = None
        self.contextMenuIndex = -1
예제 #13
0
 def __init__(self, parent):
     """
     Constructor
     
     @param parent parent widget (QWidget)
     @param ui reference to the main user interface
     @param dbs reference to the debug server object
     """
     QMdiArea.__init__(self, parent)
     ViewManager.__init__(self)
     self.lastFN = ''
     self.__removingView = False
     
     self.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded)
     self.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded)
     
     self.__windowMapper = QSignalMapper(self)
     
     self.connect(self.__windowMapper, SIGNAL('mapped(QWidget*)'), 
         self.setActiveSubWindow)
     self.connect(self, SIGNAL('subWindowActivated(QMdiSubWindow*)'),
         self.__subWindowActivated)
예제 #14
0
 def _syntaxErrorToggled(self, editor):
     """
     Protected slot to handle the syntaxerrorToggled signal.
     
     @param editor editor that sent the signal
     """
     currentRow = self.viewlist.currentRow()
     index = self.editors.index(editor)
     keys = []
     if editor.isModified():
         keys.append("fileModified.png")
     if editor.hasSyntaxErrors():
         keys.append("syntaxError22.png")
     elif editor.hasWarnings():
         keys.append("warning22.png")
     if not keys:
         keys.append("empty.png")
     self.viewlist.item(index).setIcon(
         UI.PixmapCache.getCombinedIcon(keys))
     self.viewlist.setCurrentRow(currentRow)
     
     ViewManager._syntaxErrorToggled(self, editor)
예제 #15
0
    def _syntaxErrorToggled(self, editor):
        """
        Protected slot to handle the syntaxerrorToggled signal.
        
        @param editor editor that sent the signal
        """
        for tw in self.tabWidgets:
            if tw.hasEditor(editor):
                break
        index = tw.indexOf(editor)
        keys = []
        if editor.isModified():
            keys.append("fileModified.png")
        if editor.hasSyntaxErrors():
            keys.append("syntaxError22.png")
        elif editor.hasWarnings():
            keys.append("warning22.png")
        if not keys:
            keys.append("empty.png")
        tw.setTabIcon(index, UI.PixmapCache.getCombinedIcon(keys))

        ViewManager._syntaxErrorToggled(self, editor)
예제 #16
0
 def _syntaxErrorToggled(self, editor):
     """
     Protected slot to handle the syntaxerrorToggled signal.
     
     @param editor editor that sent the signal
     """
     for tw in self.tabWidgets:
         if tw.hasEditor(editor):
             break
     index = tw.indexOf(editor)
     keys = []
     if editor.isModified():
         keys.append("fileModified.png")
     if editor.hasSyntaxErrors():
         keys.append("syntaxError22.png")
     elif editor.hasWarnings():
         keys.append("warning22.png")
     if not keys:
         keys.append("empty.png")
     tw.setTabIcon(index, UI.PixmapCache.getCombinedIcon(keys))
     
     ViewManager._syntaxErrorToggled(self, editor)
예제 #17
0
 def __init__(self, parent):
     """
     Constructor
     
     @param parent parent widget (QWidget)
     """
     self.stacks = []
     
     QSplitter.__init__(self, parent)
     ViewManager.__init__(self)
     self.setChildrenCollapsible(False)
     
     self.viewlist = QListWidget(self)
     policy = self.viewlist.sizePolicy()
     policy.setHorizontalPolicy(QSizePolicy.Ignored)
     self.viewlist.setSizePolicy(policy)
     self.addWidget(self.viewlist)
     self.viewlist.setContextMenuPolicy(Qt.CustomContextMenu)
     self.viewlist.currentRowChanged.connect(self.__showSelectedView)
     self.viewlist.customContextMenuRequested.connect(self.__showMenu)
     
     self.stackArea = QSplitter(self)
     self.stackArea.setChildrenCollapsible(False)
     self.addWidget(self.stackArea)
     self.stackArea.setOrientation(Qt.Vertical)
     stack = StackedWidget(self.stackArea)
     self.stackArea.addWidget(stack)
     self.stacks.append(stack)
     self.currentStack = stack
     stack.currentChanged.connect(self.__currentChanged)
     stack.installEventFilter(self)
     self.setSizes([int(self.width() * 0.2), int(self.width() * 0.8)])
     # 20% for viewlist, 80% for the editors
     self.__inRemoveView = False
     
     self.__initMenu()
     self.contextMenuEditor = None
     self.contextMenuIndex = -1