173 """ |
173 """ |
174 Private method to shrink the sidebar. |
174 Private method to shrink the sidebar. |
175 """ |
175 """ |
176 self.__minimized = True |
176 self.__minimized = True |
177 self.__bigSize = self.size() |
177 self.__bigSize = self.size() |
178 if self.__orientation in (EricSideBarSide.NORTH, EricSideBarSide.SOUTH): |
178 if self.__orientation in ( |
|
179 EricSideBarSide.NORTH, EricSideBarSide.SOUTH |
|
180 ): |
179 self.__minSize = self.minimumSizeHint().height() |
181 self.__minSize = self.minimumSizeHint().height() |
180 self.__maxSize = self.maximumHeight() |
182 self.__maxSize = self.maximumHeight() |
181 else: |
183 else: |
182 self.__minSize = self.minimumSizeHint().width() |
184 self.__minSize = self.minimumSizeHint().width() |
183 self.__maxSize = self.maximumWidth() |
185 self.__maxSize = self.maximumWidth() |
184 if self.splitter: |
186 if self.splitter: |
185 self.splitterSizes = self.splitter.sizes() |
187 self.splitterSizes = self.splitter.sizes() |
186 |
188 |
187 self.__stackedWidget.hide() |
189 self.__stackedWidget.hide() |
188 |
190 |
189 if self.__orientation in (EricSideBarSide.NORTH, EricSideBarSide.SOUTH): |
191 if self.__orientation in ( |
|
192 EricSideBarSide.NORTH, EricSideBarSide.SOUTH |
|
193 ): |
190 self.setFixedHeight(self.__tabBar.minimumSizeHint().height()) |
194 self.setFixedHeight(self.__tabBar.minimumSizeHint().height()) |
191 else: |
195 else: |
192 self.setFixedWidth(self.__tabBar.minimumSizeHint().width()) |
196 self.setFixedWidth(self.__tabBar.minimumSizeHint().width()) |
193 |
197 |
194 self.__actionMethod = None |
198 self.__actionMethod = None |
206 Private method to expand the sidebar. |
210 Private method to expand the sidebar. |
207 """ |
211 """ |
208 self.__minimized = False |
212 self.__minimized = False |
209 self.__stackedWidget.show() |
213 self.__stackedWidget.show() |
210 self.resize(self.__bigSize) |
214 self.resize(self.__bigSize) |
211 if self.__orientation in (EricSideBarSide.NORTH, EricSideBarSide.SOUTH): |
215 if self.__orientation in ( |
|
216 EricSideBarSide.NORTH, EricSideBarSide.SOUTH |
|
217 ): |
212 minSize = max(self.__minSize, self.minimumSizeHint().height()) |
218 minSize = max(self.__minSize, self.minimumSizeHint().height()) |
213 self.setMinimumHeight(minSize) |
219 self.setMinimumHeight(minSize) |
214 self.setMaximumHeight(self.__maxSize) |
220 self.setMaximumHeight(self.__maxSize) |
215 else: |
221 else: |
216 minSize = max(self.__minSize, self.minimumSizeHint().width()) |
222 minSize = max(self.__minSize, self.minimumSizeHint().width()) |
285 self.__tabBar.setTabToolTip(index, label) |
291 self.__tabBar.setTabToolTip(index, label) |
286 else: |
292 else: |
287 index = self.__tabBar.addTab(iconOrLabel) |
293 index = self.__tabBar.addTab(iconOrLabel) |
288 self.__tabBar.setTabToolTip(index, iconOrLabel) |
294 self.__tabBar.setTabToolTip(index, iconOrLabel) |
289 self.__stackedWidget.addWidget(widget) |
295 self.__stackedWidget.addWidget(widget) |
290 if self.__orientation in (EricSideBarSide.NORTH, EricSideBarSide.SOUTH): |
296 if self.__orientation in ( |
|
297 EricSideBarSide.NORTH, EricSideBarSide.SOUTH |
|
298 ): |
291 self.__minSize = self.minimumSizeHint().height() |
299 self.__minSize = self.minimumSizeHint().height() |
292 else: |
300 else: |
293 self.__minSize = self.minimumSizeHint().width() |
301 self.__minSize = self.minimumSizeHint().width() |
294 |
302 |
295 def insertTab(self, index, widget, iconOrLabel, label=None): |
303 def insertTab(self, index, widget, iconOrLabel, label=None): |
308 self.__tabBar.setTabToolTip(index, label) |
316 self.__tabBar.setTabToolTip(index, label) |
309 else: |
317 else: |
310 index = self.__tabBar.insertTab(index, iconOrLabel) |
318 index = self.__tabBar.insertTab(index, iconOrLabel) |
311 self.__tabBar.setTabToolTip(index, iconOrLabel) |
319 self.__tabBar.setTabToolTip(index, iconOrLabel) |
312 self.__stackedWidget.insertWidget(index, widget) |
320 self.__stackedWidget.insertWidget(index, widget) |
313 if self.__orientation in (EricSideBarSide.NORTH, EricSideBarSide.SOUTH): |
321 if self.__orientation in ( |
|
322 EricSideBarSide.NORTH, EricSideBarSide.SOUTH |
|
323 ): |
314 self.__minSize = self.minimumSizeHint().height() |
324 self.__minSize = self.minimumSizeHint().height() |
315 else: |
325 else: |
316 self.__minSize = self.minimumSizeHint().width() |
326 self.__minSize = self.minimumSizeHint().width() |
317 |
327 |
318 def removeTab(self, index): |
328 def removeTab(self, index): |
321 |
331 |
322 @param index the index of the tab to remove (integer) |
332 @param index the index of the tab to remove (integer) |
323 """ |
333 """ |
324 self.__stackedWidget.removeWidget(self.__stackedWidget.widget(index)) |
334 self.__stackedWidget.removeWidget(self.__stackedWidget.widget(index)) |
325 self.__tabBar.removeTab(index) |
335 self.__tabBar.removeTab(index) |
326 if self.__orientation in (EricSideBarSide.NORTH, EricSideBarSide.SOUTH): |
336 if self.__orientation in ( |
|
337 EricSideBarSide.NORTH, EricSideBarSide.SOUTH |
|
338 ): |
327 self.__minSize = self.minimumSizeHint().height() |
339 self.__minSize = self.minimumSizeHint().height() |
328 else: |
340 else: |
329 self.__minSize = self.minimumSizeHint().width() |
341 self.__minSize = self.minimumSizeHint().width() |
330 |
342 |
331 def clear(self): |
343 def clear(self): |
608 return False |
620 return False |
609 |
621 |
610 if not stateDict: |
622 if not stateDict: |
611 return False |
623 return False |
612 |
624 |
613 if self.__orientation in (EricSideBarSide.NORTH, EricSideBarSide.SOUTH): |
625 if self.__orientation in ( |
|
626 EricSideBarSide.NORTH, EricSideBarSide.SOUTH |
|
627 ): |
614 minSize = self.layout.minimumSize().height() |
628 minSize = self.layout.minimumSize().height() |
615 maxSize = self.maximumHeight() |
629 maxSize = self.maximumHeight() |
616 else: |
630 else: |
617 minSize = self.layout.minimumSize().width() |
631 minSize = self.layout.minimumSize().width() |
618 maxSize = self.maximumWidth() |
632 maxSize = self.maximumWidth() |