35 self.__backgroundColor = QColor("#e7e7e7") |
35 self.__backgroundColor = QColor("#e7e7e7") |
36 self.__setSliderColor() |
36 self.__setSliderColor() |
37 |
37 |
38 self._master = None |
38 self._master = None |
39 self.__enabled = False |
39 self.__enabled = False |
|
40 self.__rightSide = True |
40 |
41 |
41 if parent is not None and isinstance(parent, QAbstractScrollArea): |
42 if parent is not None and isinstance(parent, QAbstractScrollArea): |
42 self.setMaster(parent) |
43 self.setMaster(parent) |
43 |
44 |
44 def __setSliderColor(self): |
45 def __setSliderColor(self): |
60 if self._master: |
61 if self._master: |
61 if self.__enabled: |
62 if self.__enabled: |
62 width = self.__width |
63 width = self.__width |
63 else: |
64 else: |
64 width = 0 |
65 width = 0 |
65 self._master.setViewportMargins(0, 0, width, 0) |
66 if self.__rightSide: |
|
67 self._master.setViewportMargins(0, 0, width, 0) |
|
68 else: |
|
69 self._master.setViewportMargins(width, 0, 0, 0) |
66 |
70 |
67 def setMaster(self, master): |
71 def setMaster(self, master): |
68 """ |
72 """ |
69 Public method to set the map master widget. |
73 Public method to set the map master widget. |
70 |
74 |
92 Public method to get the widget's width. |
96 Public method to get the widget's width. |
93 |
97 |
94 @return widget width (integer) |
98 @return widget width (integer) |
95 """ |
99 """ |
96 return self.__width |
100 return self.__width |
|
101 |
|
102 def setMapPosition(self, onRight): |
|
103 """ |
|
104 Public method to set, whether the map should be shown to the right or |
|
105 left of the master widget. |
|
106 |
|
107 @param onRight flag indicating to show the map on the right side of |
|
108 the master widget |
|
109 @type bool |
|
110 """ |
|
111 if onRight != self.__rightSide: |
|
112 self.__rightSide = onRight |
|
113 self.__updateMasterViewportWidth() |
|
114 self.update() |
|
115 |
|
116 def isOnRightSide(self): |
|
117 """ |
|
118 Public method to test, if the map is shown on the right side of the |
|
119 master widget. |
|
120 |
|
121 @return flag indicating that the map is to the right of the master |
|
122 widget |
|
123 @type bool |
|
124 """ |
|
125 return self.__rightSide |
97 |
126 |
98 def setLineDimensions(self, border, height): |
127 def setLineDimensions(self, border, height): |
99 """ |
128 """ |
100 Public method to set the line (indicator) dimensions. |
129 Public method to set the line (indicator) dimensions. |
101 |
130 |
243 else: |
272 else: |
244 vsbw = 0 |
273 vsbw = 0 |
245 left, top, right, bottom = self._master.getContentsMargins() |
274 left, top, right, bottom = self._master.getContentsMargins() |
246 if right > vsbw: |
275 if right > vsbw: |
247 vsbw = 0 |
276 vsbw = 0 |
248 self.setGeometry(QRect(cr.right() - self.__width - vsbw, cr.top(), |
277 if self.__rightSide: |
249 self.__width, cr.height())) |
278 self.setGeometry( |
|
279 QRect(cr.right() - self.__width - vsbw, cr.top(), |
|
280 self.__width, cr.height())) |
|
281 else: |
|
282 self.setGeometry( |
|
283 QRect(0, cr.top(), self.__width, cr.height())) |
250 self.update() |
284 self.update() |
251 |
285 |
252 def scaleFactor(self, slider=False): |
286 def scaleFactor(self, slider=False): |
253 """ |
287 """ |
254 Public method to determine the scrollbar's scale factor. |
288 Public method to determine the scrollbar's scale factor. |