Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Plugins

Notices

Reply
 
Thread Tools Search this Thread
Old 02-13-2018, 11:59 PM   #226
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 32,242
Karma: 9826458
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Put in a print statement in restore_state() to check if restoreState() is returning True or not.
kovidgoyal is offline   Reply With Quote
Advert
Old 02-14-2018, 12:55 PM   #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: 3,192
Karma: 587518
Join Date: Dec 2011
Location: Midwest USA
Device: Kindle Voyage
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
Old 02-14-2018, 01:21 PM   #228
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 32,242
Karma: 9826458
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Stick an

Code:
import traceback
traceback.print_stack()
in save_state to see what function chain is leading to it being called.
kovidgoyal is offline   Reply With Quote
Old 02-14-2018, 01:34 PM   #229
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: 3,192
Karma: 587518
Join Date: Dec 2011
Location: Midwest USA
Device: Kindle Voyage
(I removed username path)
Code:
Starting up...
save_state:
  File "site.py", line 101, in main
  File "site.py", line 78, in run_entry_point
  File "C:\...\calibre\src\calibre\debug.py", line 260, in main
  File "C:\...\calibre\src\calibre\gui_launch.py", line 74, in calibre
  File "C:\...\calibre\src\calibre\gui2\main.py", line 557, in main
  File "C:\...\calibre\src\calibre\gui2\main.py", line 392, in run_gui
  File "C:\...\calibre\src\calibre\gui2\main.py", line 351, in initialize
  File "C:\...\calibre\src\calibre\gui2\main.py", line 332, in initialize_db
  File "C:\...\calibre\src\calibre\gui2\main.py", line 293, in initialize_db_stage2
  File "C:\...\calibre\src\calibre\gui2\main.py", line 233, in start_gui
  File "C:\...\calibre\src\calibre\gui2\ui.py", line 349, in initialize
  File "C:\...\calibre\src\calibre\gui2\init.py", line 67, in init_library_view_mixin
  File "C:\...\calibre\src\calibre\gui2\library\views.py", line 811, in set_database
  File "C:\...\calibre\src\calibre\gui2\library\models.py", line 307, in set_database
  File "C:\...\calibre\src\calibre\gui2\library\views.py", line 904, in database_changed
  File "C:\...\calibre\src\calibre\gui2\library\views.py", line 768, in restore_state
  File "C:\...\calibre\src\calibre\gui2\pin_columns.py", line 121, in restore_state
  File "C:\...\calibre\src\calibre\gui2\pin_columns.py", line 70, in apply_state
  File "C:\...\calibre\src\calibre\gui2\pin_columns.py", line 114, in save_state
  File "C:\...\calibre\src\calibre\gui2\pin_columns.py", line 143, in save_state
JimmXinu is offline   Reply With Quote
Old 02-14-2018, 02:09 PM   #230
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 32,242
Karma: 9826458
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
This should take care of it: https://github.com/kovidgoyal/calibr...a692d0292d6549
kovidgoyal is offline   Reply With Quote
Old 02-14-2018, 02:41 PM   #231
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: 3,192
Karma: 587518
Join Date: Dec 2011
Location: Midwest USA
Device: Kindle Voyage
That does it, thanks!


If VM plugin ever does want to save/set the splitter location, we'll have to discuss how it should be done. I was mostly just curious right now.
JimmXinu is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[GUI Plugin] Goodreads Sync kiwidude Plugins 1096 02-19-2018 11:14 AM
[GUI Plugin] Open With kiwidude Plugins 328 08-21-2017 12:34 AM
[GUI Plugin] Generate Cover kiwidude Plugins 618 07-18-2017 09:58 PM
[GUI Plugin] Plugin Updater **Deprecated** kiwidude Plugins 159 06-19-2011 01:27 PM
[GUI Plugin] Book Sync **Deprecated** kiwidude Plugins 111 06-07-2011 08:47 PM


All times are GMT -4. The time now is 09:25 AM.


MobileRead.com is a privately owned, operated and funded community.