Comment 14 for bug 1239597

Revision history for this message
Ángel García (angelcas) wrote :

Here is, in "gui2/__init__.py":

-------------------
...

def available_heights():
    desktop = QCoreApplication.instance().desktop()
    return map(lambda x: x.height(), map(desktop.availableGeometry, range(desktop.numScreens())))

...

def min_available_height():
    return min(available_heights())

...

class ResizableDialog(QDialog):

    def __init__(self, *args, **kwargs):
        QDialog.__init__(self, *args)
        self.setupUi(self)
        nh, nw = min_available_height()-25, available_width()-10
        if nh < 0:
            nh = 800
        if nw < 0:
            nw = 600
        nh = min(self.height(), nh)
        nw = min(self.width(), nw)
        self.resize(nw, nh)
---------

So when created, the ResizableDialog takes the main (or may be current) display width, but the minimum of the heights of the available displays.