Show More
@@ -113,7 +113,7 b' class ConsoleWidget(QtGui.QWidget):' | |||
|
113 | 113 | |
|
114 | 114 | # Create the layout and underlying text widget. |
|
115 | 115 | layout = QtGui.QStackedLayout(self) |
|
116 | layout.setMargin(0) | |
|
116 | layout.setContentsMargins(0, 0, 0, 0) | |
|
117 | 117 | self._control = self._create_control(kind) |
|
118 | 118 | self._page_control = None |
|
119 | 119 | self._splitter = None |
@@ -199,17 +199,21 b' class ConsoleWidget(QtGui.QWidget):' | |||
|
199 | 199 | """ Reimplemented to suggest a size that is 80 characters wide and |
|
200 | 200 | 25 lines high. |
|
201 | 201 | """ |
|
202 | style = self.style() | |
|
203 | opt = QtGui.QStyleOptionHeader() | |
|
204 | 202 | font_metrics = QtGui.QFontMetrics(self.font) |
|
205 | splitwidth = style.pixelMetric(QtGui.QStyle.PM_SplitterWidth, opt, self) | |
|
203 | margin = (self._control.frameWidth() + | |
|
204 | self._control.document().documentMargin()) * 2 | |
|
205 | style = self.style() | |
|
206 | splitwidth = style.pixelMetric(QtGui.QStyle.PM_SplitterWidth) | |
|
206 | 207 | |
|
207 | width = font_metrics.width(' ') * 80 | |
|
208 | width += style.pixelMetric(QtGui.QStyle.PM_ScrollBarExtent, opt, self) | |
|
208 | # Despite my best efforts to take the various margins into account, the | |
|
209 | # width is still coming out a bit too small, so we include a fudge | |
|
210 | # factor of one character here. | |
|
211 | width = font_metrics.maxWidth() * 81 + margin | |
|
212 | width += style.pixelMetric(QtGui.QStyle.PM_ScrollBarExtent) | |
|
209 | 213 | if self._page_style == 'hsplit': |
|
210 | 214 | width = width * 2 + splitwidth |
|
211 | 215 | |
|
212 | height = font_metrics.height() * 25 | |
|
216 | height = font_metrics.height() * 25 + margin | |
|
213 | 217 | if self._page_style == 'vsplit': |
|
214 | 218 | height = height * 2 + splitwidth |
|
215 | 219 | |
@@ -222,7 +226,7 b' class ConsoleWidget(QtGui.QWidget):' | |||
|
222 | 226 | def can_paste(self): |
|
223 | 227 | """ Returns whether text can be pasted from the clipboard. |
|
224 | 228 | """ |
|
225 |
# |
|
|
229 | # Only accept text that can be ASCII encoded. | |
|
226 | 230 | if self._control.textInteractionFlags() & QtCore.Qt.TextEditable: |
|
227 | 231 | text = QtGui.QApplication.clipboard().text() |
|
228 | 232 | if not text.isEmpty(): |
@@ -800,7 +804,7 b' class ConsoleWidget(QtGui.QWidget):' | |||
|
800 | 804 | |
|
801 | 805 | # Calculate the number of characters available. |
|
802 | 806 | width = self._control.viewport().width() |
|
803 |
char_width = QtGui.QFontMetrics(self.font). |
|
|
807 | char_width = QtGui.QFontMetrics(self.font).maxWidth() | |
|
804 | 808 | displaywidth = max(10, (width / char_width) - 1) |
|
805 | 809 | |
|
806 | 810 | # Some degenerate cases. |
General Comments 0
You need to be logged in to leave comments.
Login now