src/eric7/EricWidgets/EricSideBar.py

branch
eric7
changeset 9298
8863f3e970a2
parent 9221
bf71ee032bb4
child 9473
3f23dbf37dbe
equal deleted inserted replaced
9297:c1c808e65211 9298:8863f3e970a2
80 orientation = EricSideBarSide.NORTH 80 orientation = EricSideBarSide.NORTH
81 self.setOrientation(orientation) 81 self.setOrientation(orientation)
82 82
83 self.__iconBar.currentChanged.connect(self.__stackedWidget.setCurrentIndex) 83 self.__iconBar.currentChanged.connect(self.__stackedWidget.setCurrentIndex)
84 self.__iconBar.currentChanged.connect(self.__currentIconChanged) 84 self.__iconBar.currentChanged.connect(self.__currentIconChanged)
85 self.__iconBar.currentClicked.connect(self.__currentIconClicked) 85 self.__iconBar.currentClicked.connect(self.__shrinkOrExpandIt)
86 self.__iconBar.emptyClicked.connect(self.__shrinkOrExpandIt)
86 87
87 def __shrinkIt(self): 88 def __shrinkIt(self):
88 """ 89 """
89 Private method to shrink the sidebar. 90 Private method to shrink the sidebar.
90 """ 91 """
118 else: 119 else:
119 minSize = max(self.__minSize, self.minimumSizeHint().width()) 120 minSize = max(self.__minSize, self.minimumSizeHint().width())
120 self.setMinimumWidth(minSize) 121 self.setMinimumWidth(minSize)
121 self.setMaximumWidth(self.__maxSize) 122 self.setMaximumWidth(self.__maxSize)
122 123
124 @pyqtSlot()
125 def __shrinkOrExpandIt(self):
126 """
127 Private slot to shrink or expand the widget stack.
128 """
129 if self.isMinimized():
130 self.__expandIt()
131 else:
132 self.__shrinkIt()
133
123 def isMinimized(self): 134 def isMinimized(self):
124 """ 135 """
125 Public method to check the minimized state. 136 Public method to check the minimized state.
126 137
127 @return flag indicating the minimized state (boolean) 138 @return flag indicating the minimized state (boolean)
136 @param index index of the current icon 147 @param index index of the current icon
137 @type int 148 @type int
138 """ 149 """
139 if self.isMinimized(): 150 if self.isMinimized():
140 self.__expandIt() 151 self.__expandIt()
141
142 @pyqtSlot(int)
143 def __currentIconClicked(self, index):
144 """
145 Private slot to handle a click of the current icon.
146
147 @param index index of the clicked icon
148 @type int
149 """
150 if self.isMinimized():
151 self.__expandIt()
152 else:
153 self.__shrinkIt()
154 152
155 def addTab(self, widget, icon, label=None): 153 def addTab(self, widget, icon, label=None):
156 """ 154 """
157 Public method to add a tab to the sidebar. 155 Public method to add a tab to the sidebar.
158 156

eric ide

mercurial