View Single Post
Old 02-14-2018, 11:55 AM   #227
JimmXinu
Plugin Developer
JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.
 
JimmXinu's Avatar
 
Posts: 7,027
Karma: 4604637
Join Date: Dec 2011
Location: Midwest USA
Device: Kobo Clara Colour running KOReader
Yes, it does. I also deleted gprefs['book_list_pin_splitter_state'] and then tried again with `calibre --ignore-plugins` and it still re-centered.

I added some debug output and save_state is being called during startup before restore_state. (calibre-debug doesn't support --ignore-plugins, BTW)

Debug output:
Spoiler:
Code:
calibre 3.17* [64bit]  embedded-python: True is64bit: True
Windows-10-10.0.16299-SP0 Windows ('64bit', 'WindowsPE')
('Windows', '10', '10.0.16299')
Python 2.7.12+
Windows: ('10', '10.0.16299', 'SP0', u'Multiprocessor Free')
Interface language: None
Successfully initialized third party plugins: DeDRM (6, 5, 2) && SmartEject (2, 0, 7) && Count Pages (1, 8, 0) && FictionDB (1, 0, 10) && fanficauthors.net CSS Fix (0, 0, 2) && Generate Cover (1, 5, 21) && Unplugged (1, 0, 0) && FanFicFare (2, 22, 2) && Webscription (1, 1, 0) && ColumnSum (2, 0, 0) && EpubSplit (2, 3, 0) && View Manager (1, 4, 3) && Reading List (1, 6, 6) && EpubMerge (2, 1, 1) && Quality Check (1, 9, 11) && Find Duplicates (1, 6, 3) && Modify ePub (1, 3, 13) && Barnes & Noble (1, 2, 14) && Favourites Menu (1, 0, 4) && Kindle 2, 3, 4, Touch, PaperWhite, Voyage Device Interface MBP Update Mod (1, 0, 0) && Manage Series (1, 2, 8)
Turning on automatic hidpi scaling
devicePixelRatio: 1.0
logicalDpi: 96.0 x 96.0
physicalDpi: 141.76744186 x 141.402061856
Using calibre Qt style: True
Starting up...
save_state:
PyQt5.QtCore.QByteArray('\x00\x00\x00\xff\x00\x00\x00\x01\x00\x00\x00\x02\xff\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\x01\x00\x00\x00\x01\x00')
restore_state():
bytearray(b'\x00\x00\x00\xff\x00\x00\x00\x01\x00\x00\x00\x02\xff\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\x01\x00\x00\x00\x01\x00')
restoreState:True
save_state:
PyQt5.QtCore.QByteArray('\x00\x00\x00\xff\x00\x00\x00\x01\x00\x00\x00\x02\x00\x00\x00F\x00\x00\x00F\x00\xff\xff\xff\xff\x01\x00\x00\x00\x01\x00')
Started up in 4.08 seconds with 17 books


I threw a quick lock boolean in to prevent saving before restoring and now the split bar is staying where I put it across restarts.

Kludged & debug PinContainer:
Spoiler:
Code:
import pprint
pp = pprint.PrettyPrinter(indent=4)

class PinContainer(QSplitter):

    def __init__(self, books_view, parent=None):
        QSplitter.__init__(self, parent)
        self.setChildrenCollapsible(False)
        self.books_view = books_view
        self.addWidget(books_view)
        self.addWidget(books_view.pin_view)
        books_view.pin_view.splitter = self
        self.has_loaded = False

    def save_state(self):
        print("save_state:")
        if self.has_loaded:
            state = bytearray(self.saveState())
            pp.pprint(self.saveState())
            gprefs['book_list_pin_splitter_state'] = state
        else:
            print("DONT save yet")

    def restore_state(self):
        val = gprefs.get('book_list_pin_splitter_state', None)
        print("restore_state():")
        self.has_loaded = True
        pp.pprint(val)
        if val is not None:
            print("restoreState:%s"%self.restoreState(val))


I can clean that code up and submit it if you find it an acceptable workaround, but it doesn't explain why it happens in the first place.
JimmXinu is offline   Reply With Quote