src/eric7/EricWidgets/EricToolBox.py

branch
eric7
changeset 9876
800c539f8700
parent 9874
b89dce027259
child 10423
299802979277
equal deleted inserted replaced
9875:b4512fbcf567 9876:800c539f8700
31 Public slot to set the current widget. 31 Public slot to set the current widget.
32 32
33 @param widget reference to the widget to become the current widget 33 @param widget reference to the widget to become the current widget
34 (QWidget) 34 (QWidget)
35 """ 35 """
36 index = self.indexOf(widget) 36 try:
37 if index < 0: 37 index = self.indexOf(widget)
38 # not found, set first widget as default 38 if index < 0:
39 # not found, set first widget as default
40 index = 0
41 except RuntimeError:
39 index = 0 42 index = 0
40 self.setCurrentIndex(index) 43 self.setCurrentIndex(index)
41 44
42 45
43 class EricHorizontalToolBox(EricTabWidget): 46 class EricHorizontalToolBox(EricTabWidget):
113 Public slot to set the current widget. 116 Public slot to set the current widget.
114 117
115 @param widget reference to the widget to become the current widget 118 @param widget reference to the widget to become the current widget
116 (QWidget) 119 (QWidget)
117 """ 120 """
118 index = self.indexOf(widget) 121 try:
119 if index < 0: 122 index = self.indexOf(widget)
120 # not found, set first widget as default 123 if index < 0:
124 # not found, set first widget as default
125 index = 0
126 except RuntimeError:
121 index = 0 127 index = 0
122 self.setCurrentIndex(index) 128 self.setCurrentIndex(index)

eric ide

mercurial