metadata window height not remembered

Bug #1239597 reported by Ángel García
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
calibre
Fix Released
Undecided
Unassigned

Bug Description

Calibre version: 1.6 [64bit]

OS: Windows 7 Ultimate x64

Problem: If you open the metadata window, then resize it and finally close it, the next time the metadata window is opened it remember the width but it takes a default height instead the one it had when closed.

Revision history for this message
Kovid Goyal (kovid) wrote : Re: calibre bug 1239597

I cannot reproduce, steps I tried:

1) Open edit metadata window
2) Change its height
3) Click OK
4) Open again, its height is remembered

 status invalid

Changed in calibre:
status: New → Invalid
Revision history for this message
Ángel García (angelcas) wrote :

Not for me. Only the width is remembered. If I follow your 4 steps I end with a window of the same size than before, since there is no change in width and the change in height is ignored.

My resolution is 1920x1080 and the window is rather big, so in case it were relevant I did some tests and it resulted like this: if I set the window height minor or equal to 493 pixels (including borders) its height is remembered, if I set the window height greater 493 pixels (including borders) the height when re-opened is always 493 pixels.

Revision history for this message
Kovid Goyal (kovid) wrote :

I have no idea what could cause that, window sizes are rememebered for
me at all heights ranging from 100 pixels to 1000 pixels for me.

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

The size is remembered correctly in "Edit TOC" window and so in the "view metadata" window, but not in "edit metadata" window.

Now I realized that I said just "metadata window" without specify whether it was view or edit. What did you tested with?

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

Ok, I just see that your steps were with the "edit metadata" window.

In such case I don't know what else to test. I tried with books with or without cover image and it results the same. :(

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

Could you tell me where is the window size stored?

I wish to look at it and see whether the size is incorrectly stored when the window is closed or it's correctly stored and then ignored when the window is re-opened.

Revision history for this message
Kovid Goyal (kovid) wrote : Re: [Bug 1239597] Re: metadata window height not remembered

gui.json it is stored in binary format so you will not be able to
inspect it.

On Mon, Oct 14, 2013 at 05:21:09PM -0000, hal9000 wrote:
> Could you tell me where is the window size stored?
>
> I wish to look at it and see whether the size is incorrectly stored when
> the window is closed or it's correctly stored and then ignored when the
> window is re-opened.
>
> --
> You received this bug notification because you are subscribed to
> calibre.
> https://bugs.launchpad.net/bugs/1239597
>
> Title:
> metadata window height not remembered
>
> Status in calibre: e-book management:
> Invalid
>
> Bug description:
> Calibre version: 1.6 [64bit]
>
> OS: Windows 7 Ultimate x64
>
> Problem: If you open the metadata window, then resize it and finally
> close it, the next time the metadata window is opened it remember the
> width but it takes a default height instead the one it had when
> closed.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/calibre/+bug/1239597/+subscriptions
>
> !DSPAM:3,525c2a51281109448520989!
>
>

--
_____________________________________

Dr. Kovid Goyal
http://www.kovidgoyal.net
http://calibre-ebook.com
_____________________________________

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

D'oh!

So I'll have to continue enlarging the window every time I open the metadata editor. :-(

Thanks anyway.

P.S.: If while looking at something else in the code you find by a chance what it's causing this, please fix it. :-p

Revision history for this message
Kovid Goyal (kovid) wrote :

Since I cannot reproduce it, it isn't possible for me to fix it.

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

Yeeeeeeeeeeeeeeeeeeeeeeeeeeeees! I found it!!!! :-D

The problem is that I have defined a second display as 720x480 and the desktop extended to it. I changed the secondary display size to 800x600 (that is 120 pixles taller than before) and now the metadata window wont go more than 613 (which is exactly 120 pixels more than the 493 I mentioned above).

So the problem is that although Calibre is showing in the primary display, it's taking in account the secondary display height to limit the metadata window height. As I said before, this doesn't happen with the TOC editor window, for example.

I hope now you can replicate the problem and hopefully fix it. :-)

Revision history for this message
Kovid Goyal (kovid) wrote : Re: calibre bug 1239597

This isn't something calibre does, all calibre does is call the Qt
function restoreGeometry(), you'll have to get Digia to fix Qt's
multi-screen support.
https://github.com/kovidgoyal/calibre/blob/master/src/calibre/gui2/metadata/single.py#L102

I suspect it would be easier to just make sure your larger display is the primary display.

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

Ok, I'll try to report the bug to Digia.

But note that my larger display is already my primary display and note too that the problem doesn't happen with the TOC editor or the metadata viewer windows, which I guess uses the same method to restore the geometry, so...

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

I saw something in the Calibre source.

There is "class TOCEditor(QDialog)" and class BookInfo(QDialog), while for metadata editor there is "class MetadataSingleDialogBase(ResizableDialog)".

May the bug be affecting "ResizableDialog" and not "QDialog"? This would explain why only the metadata editor window is behaving this way.

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.

Revision history for this message
Kovid Goyal (kovid) wrote :

Yes, but setupUi is called after __init__

Revision history for this message
Kovid Goyal (kovid) wrote : Fixed in master

Fixed in branch master. The fix will be in the next release. calibre is usually released every Friday.

 status fixreleased

Changed in calibre:
status: Invalid → Fix Released
Revision history for this message
Ángel García (angelcas) wrote :

Good! Thanks, Kovid. :-)

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.