def sizeHint(self): """we never want a horizontal scrollbar for player names, we always want to see them in full""" result = QWidget.sizeHint(self) available = KApplication.kApplication().desktop().availableGeometry() height = max(result.height(), available.height() * 2 // 3) width = max(result.width(), available.width() // 2) return QSize(width, height)
def sizeHint(self): """give the main window a sensible default size""" result = KXmlGuiWindow.sizeHint(self) result.setWidth(result.height() * 3 // 2) # we want space to the right for the buttons # the default is too small. Use at least 2/3 of screen height and 1/2 of screen width: available = KApplication.kApplication().desktop().availableGeometry() height = max(result.height(), available.height() * 2 // 3) width = max(result.width(), available.width() // 2) result.setHeight(height) result.setWidth(width) return result
def sizeHint(self): """give the scoring table window a sensible default size""" result = QWidget.sizeHint(self) result.setWidth(result.height() * 3 / 2) # the default is too small. Use at least 2/5 of screen height and 1/4 of screen width: available = KApplication.kApplication().desktop().availableGeometry() height = max(result.height(), available.height() * 2 / 5) width = max(result.width(), available.width() / 4) result.setHeight(height) result.setWidth(width) return result
def resizeEvent(self, event): """Use this hook to determine if we want to ignore one more resize event happening for maximized / almost maximized windows. this misses a few cases where the window is almost maximized because at this point the window has no border yet: event.size, self.geometry() and self.frameGeometry are all the same. So we cannot check if the bordered window would fit into availableGeometry. """ available = KApplication.kApplication().desktop().availableGeometry() if self.ignoreResizing == 1: # at startup if available.width() <= event.size().width() \ or available.height() <= event.size().height(): self.ignoreResizing += 1 KXmlGuiWindow.resizeEvent(self, event) if self.clientDialog: self.clientDialog.placeInField()