comparison python/hexedit.py @ 145:c101826ffe2b

Fixed scrollbar width
author Windel Bouwman
date Fri, 22 Feb 2013 10:03:12 +0100
parents 982ddb5f786d
children 2ccd57b1d78c
comparison
equal deleted inserted replaced
144:59a9a499e518 145:c101826ffe2b
135 self.xposAddr = GAP 135 self.xposAddr = GAP
136 self.xposHex = self.xposAddr + 8 * self.charWidth + GAP 136 self.xposHex = self.xposAddr + 8 * self.charWidth + GAP
137 self.xposAscii = self.xposHex + (BYTES_PER_LINE * 3 - 1) * self.charWidth + GAP 137 self.xposAscii = self.xposHex + (BYTES_PER_LINE * 3 - 1) * self.charWidth + GAP
138 self.xposEnd = self.xposAscii + self.charWidth * BYTES_PER_LINE + GAP 138 self.xposEnd = self.xposAscii + self.charWidth * BYTES_PER_LINE + GAP
139 self.setMinimumWidth(self.xposEnd) 139 self.setMinimumWidth(self.xposEnd)
140 sbw = self.scrollArea.verticalScrollBar().width() 140 if self.isVisible():
141 self.scrollArea.setMinimumWidth(self.xposEnd + sbw + 5) 141 sbw = self.scrollArea.verticalScrollBar().width()
142 self.scrollArea.setMinimumWidth(self.xposEnd + sbw + 5)
142 r = len(self.Data) % BYTES_PER_LINE 143 r = len(self.Data) % BYTES_PER_LINE
143 r = 1 if r > 0 else 0 144 r = 1 if r > 0 else 0
144 self.setMinimumHeight((int(len(self.Data) / BYTES_PER_LINE) + r) * self.charHeight + 4) 145 self.setMinimumHeight((int(len(self.Data) / BYTES_PER_LINE) + r) * self.charHeight + 4)
145 self.scrollArea.setMinimumHeight(self.charHeight * 8) 146 self.scrollArea.setMinimumHeight(self.charHeight * 8)
146 self.update() 147 self.update()
148 def showEvent(self, e):
149 self.adjust()
150 super().showEvent(e)
147 def setData(self, d): 151 def setData(self, d):
148 self.data = bytearray(d) 152 self.data = bytearray(d)
149 self.originalData = bytearray(d) 153 self.originalData = bytearray(d)
150 self.adjust() 154 self.adjust()
151 self.setCursorPosition(0) 155 self.setCursorPosition(0)