Tue, 28 May 2013 20:52:12 +0200
Merge with default branch.
55
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1 | # -*- coding: utf-8 -*- |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2 | |
2302
f29e9405c851
Updated copyright for 2013.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2114
diff
changeset
|
3 | # Copyright (c) 2008 - 2013 Detlev Offenbach <detlev@die-offenbachs.de> |
55
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4 | # |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
5 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
6 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
7 | Module implementing a sidebar class. |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
8 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
9 | |
2525
8b507a9a2d40
Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
2302
diff
changeset
|
10 | from __future__ import unicode_literals # __IGNORE_WARNING__ |
8b507a9a2d40
Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
2302
diff
changeset
|
11 | |
2624
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
12 | from PyQt4.QtCore import QEvent, QSize, Qt, QByteArray, QDataStream, QIODevice, QTimer |
1451
65bdd7da65f7
Did the final tweak to the side bar widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1447
diff
changeset
|
13 | from PyQt4.QtGui import QTabBar, QWidget, QStackedWidget, QBoxLayout, QToolButton, \ |
65bdd7da65f7
Did the final tweak to the side bar widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1447
diff
changeset
|
14 | QSizePolicy |
55
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
15 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
16 | from E5Gui.E5Application import e5App |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
17 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
18 | import UI.PixmapCache |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
19 | |
945
8cd4d08fa9f6
Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
818
diff
changeset
|
20 | |
55
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
21 | class E5SideBar(QWidget): |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
22 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
23 | Class implementing a sidebar with a widget area, that is hidden or shown, if the |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
24 | current tab is clicked again. |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
25 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
26 | Version = 1 |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
27 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
28 | North = 0 |
945
8cd4d08fa9f6
Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
818
diff
changeset
|
29 | East = 1 |
55
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
30 | South = 2 |
945
8cd4d08fa9f6
Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
818
diff
changeset
|
31 | West = 3 |
55
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
32 | |
2624
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
33 | def __init__(self, orientation=None, delay=200, parent=None): |
55
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
34 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
35 | Constructor |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
36 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
37 | @param orientation orientation of the sidebar widget (North, East, South, West) |
2624
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
38 | @param delay value for the expand/shrink delay in milliseconds (integer) |
55
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
39 | @param parent parent widget (QWidget) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
40 | """ |
2525
8b507a9a2d40
Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
2302
diff
changeset
|
41 | super(E5SideBar, self).__init__(parent) |
55
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
42 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
43 | self.__tabBar = QTabBar() |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
44 | self.__tabBar.setDrawBase(True) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
45 | self.__tabBar.setShape(QTabBar.RoundedNorth) |
1447
715bfc0c02db
Yet another fix to side bars.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1440
diff
changeset
|
46 | self.__tabBar.setUsesScrollButtons(True) |
715bfc0c02db
Yet another fix to side bars.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1440
diff
changeset
|
47 | self.__tabBar.setDrawBase(False) |
55
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
48 | self.__stackedWidget = QStackedWidget(self) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
49 | self.__stackedWidget.setContentsMargins(0, 0, 0, 0) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
50 | self.__autoHideButton = QToolButton() |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
51 | self.__autoHideButton.setCheckable(True) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
52 | self.__autoHideButton.setIcon(UI.PixmapCache.getIcon("autoHideOff.png")) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
53 | self.__autoHideButton.setChecked(True) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
54 | self.__autoHideButton.setToolTip( |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
55 | self.trUtf8("Deselect to activate automatic collapsing")) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
56 | self.barLayout = QBoxLayout(QBoxLayout.LeftToRight) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
57 | self.barLayout.setMargin(0) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
58 | self.layout = QBoxLayout(QBoxLayout.TopToBottom) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
59 | self.layout.setMargin(0) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
60 | self.layout.setSpacing(0) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
61 | self.barLayout.addWidget(self.__autoHideButton) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
62 | self.barLayout.addWidget(self.__tabBar) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
63 | self.layout.addLayout(self.barLayout) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
64 | self.layout.addWidget(self.__stackedWidget) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
65 | self.setLayout(self.layout) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
66 | |
2624
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
67 | # initialize the delay timer |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
68 | self.__actionMethod = None |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
69 | self.__delayTimer = QTimer(self) |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
70 | self.__delayTimer.setSingleShot(True) |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
71 | self.__delayTimer.setInterval(delay) |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
72 | self.__delayTimer.timeout.connect(self.__delayedAction) |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
73 | |
55
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
74 | self.__minimized = False |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
75 | self.__minSize = 0 |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
76 | self.__maxSize = 0 |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
77 | self.__bigSize = QSize() |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
78 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
79 | self.splitter = None |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
80 | self.splitterSizes = [] |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
81 | |
945
8cd4d08fa9f6
Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
818
diff
changeset
|
82 | self.__hasFocus = False # flag storing if this widget or any child has the focus |
55
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
83 | self.__autoHide = False |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
84 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
85 | self.__tabBar.installEventFilter(self) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
86 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
87 | self.__orientation = E5SideBar.North |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
88 | if orientation is None: |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
89 | orientation = E5SideBar.North |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
90 | self.setOrientation(orientation) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
91 | |
482
4650a72c307a
Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
137
diff
changeset
|
92 | self.__tabBar.currentChanged[int].connect(self.__stackedWidget.setCurrentIndex) |
4650a72c307a
Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
137
diff
changeset
|
93 | e5App().focusChanged[QWidget, QWidget].connect(self.__appFocusChanged) |
4650a72c307a
Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
137
diff
changeset
|
94 | self.__autoHideButton.toggled[bool].connect(self.__autoHideToggled) |
55
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
95 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
96 | def setSplitter(self, splitter): |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
97 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
98 | Public method to set the splitter managing the sidebar. |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
99 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
100 | @param splitter reference to the splitter (QSplitter) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
101 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
102 | self.splitter = splitter |
818
476d99fd8981
Fixed an issue in the sidebar widget causing splitter size not being saved when moved.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
791
diff
changeset
|
103 | self.splitter.splitterMoved.connect(self.__splitterMoved) |
1368
4489ee4feb59
Fixed a few Mac OS X related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1131
diff
changeset
|
104 | self.splitter.setChildrenCollapsible(False) |
4489ee4feb59
Fixed a few Mac OS X related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1131
diff
changeset
|
105 | index = self.splitter.indexOf(self) |
4489ee4feb59
Fixed a few Mac OS X related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1131
diff
changeset
|
106 | self.splitter.setCollapsible(index, False) |
818
476d99fd8981
Fixed an issue in the sidebar widget causing splitter size not being saved when moved.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
791
diff
changeset
|
107 | |
476d99fd8981
Fixed an issue in the sidebar widget causing splitter size not being saved when moved.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
791
diff
changeset
|
108 | def __splitterMoved(self, pos, index): |
476d99fd8981
Fixed an issue in the sidebar widget causing splitter size not being saved when moved.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
791
diff
changeset
|
109 | """ |
476d99fd8981
Fixed an issue in the sidebar widget causing splitter size not being saved when moved.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
791
diff
changeset
|
110 | Private slot to react on splitter moves. |
476d99fd8981
Fixed an issue in the sidebar widget causing splitter size not being saved when moved.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
791
diff
changeset
|
111 | |
476d99fd8981
Fixed an issue in the sidebar widget causing splitter size not being saved when moved.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
791
diff
changeset
|
112 | @param pos new position of the splitter handle (integer) |
476d99fd8981
Fixed an issue in the sidebar widget causing splitter size not being saved when moved.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
791
diff
changeset
|
113 | @param index index of the splitter handle (integer) |
476d99fd8981
Fixed an issue in the sidebar widget causing splitter size not being saved when moved.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
791
diff
changeset
|
114 | """ |
476d99fd8981
Fixed an issue in the sidebar widget causing splitter size not being saved when moved.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
791
diff
changeset
|
115 | if self.splitter: |
476d99fd8981
Fixed an issue in the sidebar widget causing splitter size not being saved when moved.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
791
diff
changeset
|
116 | self.splitterSizes = self.splitter.sizes() |
55
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
117 | |
2624
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
118 | def __delayedAction(self): |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
119 | """ |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
120 | Private slot to handle the firing of the delay timer. |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
121 | """ |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
122 | if self.__actionMethod is not None: |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
123 | self.__actionMethod() |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
124 | |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
125 | def setDelay(self, delay): |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
126 | """ |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
127 | Public method to set the delay value for the expand/shrink delay in milliseconds. |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
128 | |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
129 | @param delay value for the expand/shrink delay in milliseconds (integer) |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
130 | """ |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
131 | self.__delayTimer.setInterval(delay) |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
132 | |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
133 | def delay(self): |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
134 | """ |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
135 | Public method to get the delay value for the expand/shrink delay in milliseconds. |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
136 | |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
137 | @return value for the expand/shrink delay in milliseconds (integer) |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
138 | """ |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
139 | return self.__delayTimer.interval() |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
140 | |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
141 | def __cancelDelayTimer(self): |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
142 | """ |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
143 | Private method to cancel the current delay timer. |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
144 | """ |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
145 | self.__delayTimer.stop() |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
146 | self.__actionMethod = None |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
147 | |
55
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
148 | def shrink(self): |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
149 | """ |
2624
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
150 | Public method to record a shrink request. |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
151 | """ |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
152 | self.__delayTimer.stop() |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
153 | self.__actionMethod = self.__shrinkIt |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
154 | self.__delayTimer.start() |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
155 | |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
156 | def __shrinkIt(self): |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
157 | """ |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
158 | Private method to shrink the sidebar. |
55
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
159 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
160 | self.__minimized = True |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
161 | self.__bigSize = self.size() |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
162 | if self.__orientation in [E5SideBar.North, E5SideBar.South]: |
1411
f170cd6440d2
Annother change to E5SideBar to fix the vanishing issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1396
diff
changeset
|
163 | self.__minSize = self.minimumSizeHint().height() |
55
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
164 | self.__maxSize = self.maximumHeight() |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
165 | else: |
1411
f170cd6440d2
Annother change to E5SideBar to fix the vanishing issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1396
diff
changeset
|
166 | self.__minSize = self.minimumSizeHint().width() |
55
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
167 | self.__maxSize = self.maximumWidth() |
137
9b3f3e8fc798
Fixed a few issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
96
diff
changeset
|
168 | if self.splitter: |
9b3f3e8fc798
Fixed a few issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
96
diff
changeset
|
169 | self.splitterSizes = self.splitter.sizes() |
55
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
170 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
171 | self.__stackedWidget.hide() |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
172 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
173 | if self.__orientation in [E5SideBar.North, E5SideBar.South]: |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
174 | self.setFixedHeight(self.__tabBar.minimumSizeHint().height()) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
175 | else: |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
176 | self.setFixedWidth(self.__tabBar.minimumSizeHint().width()) |
2624
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
177 | |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
178 | self.__actionMethod = None |
55
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
179 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
180 | def expand(self): |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
181 | """ |
2624
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
182 | Public method to record a expand request. |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
183 | """ |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
184 | self.__delayTimer.stop() |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
185 | self.__actionMethod = self.__expandIt |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
186 | self.__delayTimer.start() |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
187 | |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
188 | def __expandIt(self): |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
189 | """ |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
190 | Private method to expand the sidebar. |
55
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
191 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
192 | self.__minimized = False |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
193 | self.__stackedWidget.show() |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
194 | self.resize(self.__bigSize) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
195 | if self.__orientation in [E5SideBar.North, E5SideBar.South]: |
1413
7b9d59fc16e8
Some more sidebar changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1411
diff
changeset
|
196 | minSize = max(self.__minSize, self.minimumSizeHint().height()) |
7b9d59fc16e8
Some more sidebar changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1411
diff
changeset
|
197 | self.setMinimumHeight(minSize) |
55
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
198 | self.setMaximumHeight(self.__maxSize) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
199 | else: |
1413
7b9d59fc16e8
Some more sidebar changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1411
diff
changeset
|
200 | minSize = max(self.__minSize, self.minimumSizeHint().width()) |
7b9d59fc16e8
Some more sidebar changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1411
diff
changeset
|
201 | self.setMinimumWidth(minSize) |
55
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
202 | self.setMaximumWidth(self.__maxSize) |
137
9b3f3e8fc798
Fixed a few issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
96
diff
changeset
|
203 | if self.splitter: |
9b3f3e8fc798
Fixed a few issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
96
diff
changeset
|
204 | self.splitter.setSizes(self.splitterSizes) |
2624
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
205 | |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
206 | self.__actionMethod = None |
55
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
207 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
208 | def isMinimized(self): |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
209 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
210 | Public method to check the minimized state. |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
211 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
212 | @return flag indicating the minimized state (boolean) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
213 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
214 | return self.__minimized |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
215 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
216 | def isAutoHiding(self): |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
217 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
218 | Public method to check, if the auto hide function is active. |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
219 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
220 | @return flag indicating the state of auto hiding (boolean) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
221 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
222 | return self.__autoHide |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
223 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
224 | def eventFilter(self, obj, evt): |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
225 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
226 | Protected method to handle some events for the tabbar. |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
227 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
228 | @param obj reference to the object (QObject) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
229 | @param evt reference to the event object (QEvent) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
230 | @return flag indicating, if the event was handled (boolean) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
231 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
232 | if obj == self.__tabBar: |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
233 | if evt.type() == QEvent.MouseButtonPress: |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
234 | pos = evt.pos() |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
235 | for i in range(self.__tabBar.count()): |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
236 | if self.__tabBar.tabRect(i).contains(pos): |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
237 | break |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
238 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
239 | if i == self.__tabBar.currentIndex(): |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
240 | if self.isMinimized(): |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
241 | self.expand() |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
242 | else: |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
243 | self.shrink() |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
244 | return True |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
245 | elif self.isMinimized(): |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
246 | self.expand() |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
247 | elif evt.type() == QEvent.Wheel and not self.__stackedWidget.isHidden(): |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
248 | if evt.delta() > 0: |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
249 | self.prevTab() |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
250 | else: |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
251 | self.nextTab() |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
252 | return True |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
253 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
254 | return QWidget.eventFilter(self, obj, evt) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
255 | |
945
8cd4d08fa9f6
Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
818
diff
changeset
|
256 | def addTab(self, widget, iconOrLabel, label=None): |
55
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
257 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
258 | Public method to add a tab to the sidebar. |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
259 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
260 | @param widget reference to the widget to add (QWidget) |
1451
65bdd7da65f7
Did the final tweak to the side bar widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1447
diff
changeset
|
261 | @param iconOrLabel reference to the icon or the label text of the tab |
55
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
262 | (QIcon, string) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
263 | @param label the labeltext of the tab (string) (only to be |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
264 | used, if the second parameter is a QIcon) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
265 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
266 | if label: |
1451
65bdd7da65f7
Did the final tweak to the side bar widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1447
diff
changeset
|
267 | index = self.__tabBar.addTab(iconOrLabel, label) |
65bdd7da65f7
Did the final tweak to the side bar widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1447
diff
changeset
|
268 | self.__tabBar.setTabToolTip(index, label) |
55
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
269 | else: |
1451
65bdd7da65f7
Did the final tweak to the side bar widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1447
diff
changeset
|
270 | index = self.__tabBar.addTab(iconOrLabel) |
65bdd7da65f7
Did the final tweak to the side bar widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1447
diff
changeset
|
271 | self.__tabBar.setTabToolTip(index, iconOrLabel) |
55
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
272 | self.__stackedWidget.addWidget(widget) |
1411
f170cd6440d2
Annother change to E5SideBar to fix the vanishing issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1396
diff
changeset
|
273 | if self.__orientation in [E5SideBar.North, E5SideBar.South]: |
f170cd6440d2
Annother change to E5SideBar to fix the vanishing issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1396
diff
changeset
|
274 | self.__minSize = self.minimumSizeHint().height() |
f170cd6440d2
Annother change to E5SideBar to fix the vanishing issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1396
diff
changeset
|
275 | else: |
f170cd6440d2
Annother change to E5SideBar to fix the vanishing issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1396
diff
changeset
|
276 | self.__minSize = self.minimumSizeHint().width() |
55
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
277 | |
945
8cd4d08fa9f6
Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
818
diff
changeset
|
278 | def insertTab(self, index, widget, iconOrLabel, label=None): |
55
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
279 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
280 | Public method to insert a tab into the sidebar. |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
281 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
282 | @param index the index to insert the tab at (integer) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
283 | @param widget reference to the widget to insert (QWidget) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
284 | @param iconOrLabel reference to the icon or the labeltext of the tab |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
285 | (QIcon, string) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
286 | @param label the labeltext of the tab (string) (only to be |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
287 | used, if the second parameter is a QIcon) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
288 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
289 | if label: |
1451
65bdd7da65f7
Did the final tweak to the side bar widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1447
diff
changeset
|
290 | index = self.__tabBar.insertTab(index, iconOrLabel, label) |
65bdd7da65f7
Did the final tweak to the side bar widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1447
diff
changeset
|
291 | self.__tabBar.setTabToolTip(index, label) |
55
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
292 | else: |
1451
65bdd7da65f7
Did the final tweak to the side bar widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1447
diff
changeset
|
293 | index = self.__tabBar.insertTab(index, iconOrLabel) |
65bdd7da65f7
Did the final tweak to the side bar widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1447
diff
changeset
|
294 | self.__tabBar.setTabToolTip(index, iconOrLabel) |
55
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
295 | self.__stackedWidget.insertWidget(index, widget) |
1411
f170cd6440d2
Annother change to E5SideBar to fix the vanishing issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1396
diff
changeset
|
296 | if self.__orientation in [E5SideBar.North, E5SideBar.South]: |
f170cd6440d2
Annother change to E5SideBar to fix the vanishing issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1396
diff
changeset
|
297 | self.__minSize = self.minimumSizeHint().height() |
f170cd6440d2
Annother change to E5SideBar to fix the vanishing issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1396
diff
changeset
|
298 | else: |
f170cd6440d2
Annother change to E5SideBar to fix the vanishing issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1396
diff
changeset
|
299 | self.__minSize = self.minimumSizeHint().width() |
55
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
300 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
301 | def removeTab(self, index): |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
302 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
303 | Public method to remove a tab. |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
304 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
305 | @param index the index of the tab to remove (integer) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
306 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
307 | self.__stackedWidget.removeWidget(self.__stackedWidget.widget(index)) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
308 | self.__tabBar.removeTab(index) |
1411
f170cd6440d2
Annother change to E5SideBar to fix the vanishing issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1396
diff
changeset
|
309 | if self.__orientation in [E5SideBar.North, E5SideBar.South]: |
f170cd6440d2
Annother change to E5SideBar to fix the vanishing issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1396
diff
changeset
|
310 | self.__minSize = self.minimumSizeHint().height() |
f170cd6440d2
Annother change to E5SideBar to fix the vanishing issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1396
diff
changeset
|
311 | else: |
f170cd6440d2
Annother change to E5SideBar to fix the vanishing issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1396
diff
changeset
|
312 | self.__minSize = self.minimumSizeHint().width() |
55
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
313 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
314 | def clear(self): |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
315 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
316 | Public method to remove all tabs. |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
317 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
318 | while self.count() > 0: |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
319 | self.removeTab(0) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
320 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
321 | def prevTab(self): |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
322 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
323 | Public slot used to show the previous tab. |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
324 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
325 | ind = self.currentIndex() - 1 |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
326 | if ind == -1: |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
327 | ind = self.count() - 1 |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
328 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
329 | self.setCurrentIndex(ind) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
330 | self.currentWidget().setFocus() |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
331 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
332 | def nextTab(self): |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
333 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
334 | Public slot used to show the next tab. |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
335 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
336 | ind = self.currentIndex() + 1 |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
337 | if ind == self.count(): |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
338 | ind = 0 |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
339 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
340 | self.setCurrentIndex(ind) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
341 | self.currentWidget().setFocus() |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
342 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
343 | def count(self): |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
344 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
345 | Public method to get the number of tabs. |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
346 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
347 | @return number of tabs in the sidebar (integer) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
348 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
349 | return self.__tabBar.count() |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
350 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
351 | def currentIndex(self): |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
352 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
353 | Public method to get the index of the current tab. |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
354 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
355 | @return index of the current tab (integer) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
356 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
357 | return self.__stackedWidget.currentIndex() |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
358 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
359 | def setCurrentIndex(self, index): |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
360 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
361 | Public slot to set the current index. |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
362 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
363 | @param index the index to set as the current index (integer) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
364 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
365 | self.__tabBar.setCurrentIndex(index) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
366 | self.__stackedWidget.setCurrentIndex(index) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
367 | if self.isMinimized(): |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
368 | self.expand() |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
369 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
370 | def currentWidget(self): |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
371 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
372 | Public method to get a reference to the current widget. |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
373 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
374 | @return reference to the current widget (QWidget) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
375 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
376 | return self.__stackedWidget.currentWidget() |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
377 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
378 | def setCurrentWidget(self, widget): |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
379 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
380 | Public slot to set the current widget. |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
381 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
382 | @param widget reference to the widget to become the current widget (QWidget) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
383 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
384 | self.__stackedWidget.setCurrentWidget(widget) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
385 | self.__tabBar.setCurrentIndex(self.__stackedWidget.currentIndex()) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
386 | if self.isMinimized(): |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
387 | self.expand() |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
388 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
389 | def indexOf(self, widget): |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
390 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
391 | Public method to get the index of the given widget. |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
392 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
393 | @param widget reference to the widget to get the index of (QWidget) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
394 | @return index of the given widget (integer) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
395 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
396 | return self.__stackedWidget.indexOf(widget) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
397 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
398 | def isTabEnabled(self, index): |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
399 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
400 | Public method to check, if a tab is enabled. |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
401 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
402 | @param index index of the tab to check (integer) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
403 | @return flag indicating the enabled state (boolean) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
404 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
405 | return self.__tabBar.isTabEnabled(index) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
406 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
407 | def setTabEnabled(self, index, enabled): |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
408 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
409 | Public method to set the enabled state of a tab. |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
410 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
411 | @param index index of the tab to set (integer) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
412 | @param enabled enabled state to set (boolean) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
413 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
414 | self.__tabBar.setTabEnabled(index, enabled) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
415 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
416 | def orientation(self): |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
417 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
418 | Public method to get the orientation of the sidebar. |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
419 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
420 | @return orientation of the sidebar (North, East, South, West) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
421 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
422 | return self.__orientation |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
423 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
424 | def setOrientation(self, orient): |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
425 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
426 | Public method to set the orientation of the sidebar. |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
427 | @param orient orientation of the sidebar (North, East, South, West) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
428 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
429 | if orient == E5SideBar.North: |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
430 | self.__tabBar.setShape(QTabBar.RoundedNorth) |
1447
715bfc0c02db
Yet another fix to side bars.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1440
diff
changeset
|
431 | self.__tabBar.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred) |
55
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
432 | self.barLayout.setDirection(QBoxLayout.LeftToRight) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
433 | self.layout.setDirection(QBoxLayout.TopToBottom) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
434 | self.layout.setAlignment(self.barLayout, Qt.AlignLeft) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
435 | elif orient == E5SideBar.East: |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
436 | self.__tabBar.setShape(QTabBar.RoundedEast) |
1447
715bfc0c02db
Yet another fix to side bars.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1440
diff
changeset
|
437 | self.__tabBar.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding) |
55
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
438 | self.barLayout.setDirection(QBoxLayout.TopToBottom) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
439 | self.layout.setDirection(QBoxLayout.RightToLeft) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
440 | self.layout.setAlignment(self.barLayout, Qt.AlignTop) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
441 | elif orient == E5SideBar.South: |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
442 | self.__tabBar.setShape(QTabBar.RoundedSouth) |
1447
715bfc0c02db
Yet another fix to side bars.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1440
diff
changeset
|
443 | self.__tabBar.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred) |
55
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
444 | self.barLayout.setDirection(QBoxLayout.LeftToRight) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
445 | self.layout.setDirection(QBoxLayout.BottomToTop) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
446 | self.layout.setAlignment(self.barLayout, Qt.AlignLeft) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
447 | elif orient == E5SideBar.West: |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
448 | self.__tabBar.setShape(QTabBar.RoundedWest) |
1447
715bfc0c02db
Yet another fix to side bars.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1440
diff
changeset
|
449 | self.__tabBar.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding) |
55
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
450 | self.barLayout.setDirection(QBoxLayout.TopToBottom) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
451 | self.layout.setDirection(QBoxLayout.LeftToRight) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
452 | self.layout.setAlignment(self.barLayout, Qt.AlignTop) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
453 | self.__orientation = orient |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
454 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
455 | def tabIcon(self, index): |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
456 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
457 | Public method to get the icon of a tab. |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
458 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
459 | @param index index of the tab (integer) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
460 | @return icon of the tab (QIcon) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
461 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
462 | return self.__tabBar.tabIcon(index) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
463 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
464 | def setTabIcon(self, index, icon): |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
465 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
466 | Public method to set the icon of a tab. |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
467 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
468 | @param index index of the tab (integer) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
469 | @param icon icon to be set (QIcon) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
470 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
471 | self.__tabBar.setTabIcon(index, icon) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
472 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
473 | def tabText(self, index): |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
474 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
475 | Public method to get the text of a tab. |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
476 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
477 | @param index index of the tab (integer) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
478 | @return text of the tab (string) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
479 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
480 | return self.__tabBar.tabText(index) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
481 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
482 | def setTabText(self, index, text): |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
483 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
484 | Public method to set the text of a tab. |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
485 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
486 | @param index index of the tab (integer) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
487 | @param text text to set (string) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
488 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
489 | self.__tabBar.setTabText(index, text) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
490 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
491 | def tabToolTip(self, index): |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
492 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
493 | Public method to get the tooltip text of a tab. |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
494 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
495 | @param index index of the tab (integer) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
496 | @return tooltip text of the tab (string) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
497 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
498 | return self.__tabBar.tabToolTip(index) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
499 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
500 | def setTabToolTip(self, index, tip): |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
501 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
502 | Public method to set the tooltip text of a tab. |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
503 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
504 | @param index index of the tab (integer) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
505 | @param tooltip text text to set (string) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
506 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
507 | self.__tabBar.setTabToolTip(index, tip) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
508 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
509 | def tabWhatsThis(self, index): |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
510 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
511 | Public method to get the WhatsThis text of a tab. |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
512 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
513 | @param index index of the tab (integer) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
514 | @return WhatsThis text of the tab (string) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
515 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
516 | return self.__tabBar.tabWhatsThis(index) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
517 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
518 | def setTabWhatsThis(self, index, text): |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
519 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
520 | Public method to set the WhatsThis text of a tab. |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
521 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
522 | @param index index of the tab (integer) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
523 | @param WhatsThis text text to set (string) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
524 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
525 | self.__tabBar.setTabWhatsThis(index, text) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
526 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
527 | def widget(self, index): |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
528 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
529 | Public method to get a reference to the widget associated with a tab. |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
530 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
531 | @param index index of the tab (integer) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
532 | @return reference to the widget (QWidget) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
533 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
534 | return self.__stackedWidget.widget(index) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
535 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
536 | def saveState(self): |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
537 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
538 | Public method to save the state of the sidebar. |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
539 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
540 | @return saved state as a byte array (QByteArray) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
541 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
542 | if len(self.splitterSizes) == 0: |
137
9b3f3e8fc798
Fixed a few issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
96
diff
changeset
|
543 | if self.splitter: |
9b3f3e8fc798
Fixed a few issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
96
diff
changeset
|
544 | self.splitterSizes = self.splitter.sizes() |
55
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
545 | self.__bigSize = self.size() |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
546 | if self.__orientation in [E5SideBar.North, E5SideBar.South]: |
1411
f170cd6440d2
Annother change to E5SideBar to fix the vanishing issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1396
diff
changeset
|
547 | self.__minSize = self.minimumSizeHint().height() |
55
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
548 | self.__maxSize = self.maximumHeight() |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
549 | else: |
1411
f170cd6440d2
Annother change to E5SideBar to fix the vanishing issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1396
diff
changeset
|
550 | self.__minSize = self.minimumSizeHint().width() |
55
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
551 | self.__maxSize = self.maximumWidth() |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
552 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
553 | data = QByteArray() |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
554 | stream = QDataStream(data, QIODevice.WriteOnly) |
2095
5bf2d8a73173
Set the format of the data stream used to save information explicitly to ensure compatibility of the resulting file with Qt 5.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1509
diff
changeset
|
555 | stream.setVersion(QDataStream.Qt_4_6) |
55
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
556 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
557 | stream.writeUInt16(self.Version) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
558 | stream.writeBool(self.__minimized) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
559 | stream << self.__bigSize |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
560 | stream.writeUInt16(self.__minSize) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
561 | stream.writeUInt16(self.__maxSize) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
562 | stream.writeUInt16(len(self.splitterSizes)) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
563 | for size in self.splitterSizes: |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
564 | stream.writeUInt16(size) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
565 | stream.writeBool(self.__autoHide) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
566 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
567 | return data |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
568 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
569 | def restoreState(self, state): |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
570 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
571 | Public method to restore the state of the sidebar. |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
572 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
573 | @param state byte array containing the saved state (QByteArray) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
574 | @return flag indicating success (boolean) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
575 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
576 | if state.isEmpty(): |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
577 | return False |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
578 | |
1413
7b9d59fc16e8
Some more sidebar changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1411
diff
changeset
|
579 | if self.__orientation in [E5SideBar.North, E5SideBar.South]: |
7b9d59fc16e8
Some more sidebar changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1411
diff
changeset
|
580 | minSize = self.layout.minimumSize().height() |
1440
268366c65cbb
Fixed another quirk in the side bars.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1428
diff
changeset
|
581 | maxSize = self.maximumHeight() |
1413
7b9d59fc16e8
Some more sidebar changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1411
diff
changeset
|
582 | else: |
7b9d59fc16e8
Some more sidebar changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1411
diff
changeset
|
583 | minSize = self.layout.minimumSize().width() |
1440
268366c65cbb
Fixed another quirk in the side bars.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1428
diff
changeset
|
584 | maxSize = self.maximumWidth() |
1413
7b9d59fc16e8
Some more sidebar changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1411
diff
changeset
|
585 | |
55
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
586 | data = QByteArray(state) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
587 | stream = QDataStream(data, QIODevice.ReadOnly) |
2095
5bf2d8a73173
Set the format of the data stream used to save information explicitly to ensure compatibility of the resulting file with Qt 5.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1509
diff
changeset
|
588 | stream.setVersion(QDataStream.Qt_4_6) |
945
8cd4d08fa9f6
Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
818
diff
changeset
|
589 | stream.readUInt16() # version |
55
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
590 | minimized = stream.readBool() |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
591 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
592 | if minimized: |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
593 | self.shrink() |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
594 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
595 | stream >> self.__bigSize |
1413
7b9d59fc16e8
Some more sidebar changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1411
diff
changeset
|
596 | self.__minSize = max(stream.readUInt16(), minSize) |
1440
268366c65cbb
Fixed another quirk in the side bars.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1428
diff
changeset
|
597 | self.__maxSize = max(stream.readUInt16(), maxSize) |
55
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
598 | count = stream.readUInt16() |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
599 | self.splitterSizes = [] |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
600 | for i in range(count): |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
601 | self.splitterSizes.append(stream.readUInt16()) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
602 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
603 | self.__autoHide = stream.readBool() |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
604 | self.__autoHideButton.setChecked(not self.__autoHide) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
605 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
606 | if not minimized: |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
607 | self.expand() |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
608 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
609 | return True |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
610 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
611 | ####################################################################### |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
612 | ## methods below implement the autohide functionality |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
613 | ####################################################################### |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
614 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
615 | def __autoHideToggled(self, checked): |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
616 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
617 | Private slot to handle the toggling of the autohide button. |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
618 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
619 | @param checked flag indicating the checked state of the button (boolean) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
620 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
621 | self.__autoHide = not checked |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
622 | if self.__autoHide: |
702
fcc22b12299e
Fixed a long undetected issue in the sidebar widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
482
diff
changeset
|
623 | self.__autoHideButton.setIcon(UI.PixmapCache.getIcon("autoHideOn.png")) |
55
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
624 | else: |
702
fcc22b12299e
Fixed a long undetected issue in the sidebar widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
482
diff
changeset
|
625 | self.__autoHideButton.setIcon(UI.PixmapCache.getIcon("autoHideOff.png")) |
55
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
626 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
627 | def __appFocusChanged(self, old, now): |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
628 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
629 | Private slot to handle a change of the focus. |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
630 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
631 | @param old reference to the widget, that lost focus (QWidget or None) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
632 | @param now reference to the widget having the focus (QWidget or None) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
633 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
634 | self.__hasFocus = self.isAncestorOf(now) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
635 | if self.__autoHide and not self.__hasFocus and not self.isMinimized(): |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
636 | self.shrink() |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
637 | elif self.__autoHide and self.__hasFocus and self.isMinimized(): |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
638 | self.expand() |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
639 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
640 | def enterEvent(self, event): |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
641 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
642 | Protected method to handle the mouse entering this widget. |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
643 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
644 | @param event reference to the event (QEvent) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
645 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
646 | if self.__autoHide and self.isMinimized(): |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
647 | self.expand() |
2624
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
648 | else: |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
649 | self.__cancelDelayTimer() |
55
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
650 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
651 | def leaveEvent(self, event): |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
652 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
653 | Protected method to handle the mouse leaving this widget. |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
654 | |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
655 | @param event reference to the event (QEvent) |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
656 | """ |
b5c84934de9c
Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
657 | if self.__autoHide and not self.__hasFocus and not self.isMinimized(): |
96
9624a110667d
Started to clean up the code supported by py3flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
55
diff
changeset
|
658 | self.shrink() |
2624
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
659 | else: |
e04b5d53281e
Introduced a configurable delay timer to get smoother sidebars behavior.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
660 | self.__cancelDelayTimer() |
2114
c07f0cb40b18
Changed the logic for another occurance of focusChanged.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2095
diff
changeset
|
661 | |
c07f0cb40b18
Changed the logic for another occurance of focusChanged.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2095
diff
changeset
|
662 | def shutdown(self): |
c07f0cb40b18
Changed the logic for another occurance of focusChanged.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2095
diff
changeset
|
663 | """ |
c07f0cb40b18
Changed the logic for another occurance of focusChanged.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2095
diff
changeset
|
664 | Public method to shut down the object. |
c07f0cb40b18
Changed the logic for another occurance of focusChanged.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2095
diff
changeset
|
665 | |
c07f0cb40b18
Changed the logic for another occurance of focusChanged.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2095
diff
changeset
|
666 | This method does some preparations so the object can be deleted properly. |
c07f0cb40b18
Changed the logic for another occurance of focusChanged.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2095
diff
changeset
|
667 | It disconnects from the focusChanged signal in order to avoid trouble later |
c07f0cb40b18
Changed the logic for another occurance of focusChanged.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2095
diff
changeset
|
668 | on. |
c07f0cb40b18
Changed the logic for another occurance of focusChanged.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2095
diff
changeset
|
669 | """ |
c07f0cb40b18
Changed the logic for another occurance of focusChanged.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2095
diff
changeset
|
670 | e5App().focusChanged[QWidget, QWidget].disconnect(self.__appFocusChanged) |