Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 07-30-2012, 12:40 AM   #466
PeterT
Grand Sorcerer
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
PeterT's Avatar
 
Posts: 12,160
Karma: 73448616
Join Date: Nov 2007
Location: Toronto
Device: Nexus 7, Clara, Touch, Tolino EPOS
@Kiwidude; still seeing occurrences of

Code:
calibre, version 0.8.62
ERROR: Unhandled exception: <b>RuntimeError</b>:wrapped C/C++ object of %S has been deleted

Traceback (most recent call last):
  File "calibre_plugins.reading_list.config", line 773, in on_device_connection_changed
  File "calibre_plugins.reading_list.config", line 862, in update_from_connection_status
  File "calibre_plugins.reading_list.config", line 376, in get_data
RuntimeError: wrapped C/C++ object of %S has been deleted
This seems to happen after I have gone into the configuration option of the plugin and made no changes.

Then when I attach my device and it is processing either the Auto Update list or the Send to Device list, that error happens.

Also just received an occurrence on Eject Device. Will see if I can get a calibre debug log and a repeatable failure.
PeterT is offline   Reply With Quote
Old 07-30-2012, 12:52 AM   #467
PeterT
Grand Sorcerer
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
PeterT's Avatar
 
Posts: 12,160
Karma: 73448616
Join Date: Nov 2007
Location: Toronto
Device: Nexus 7, Clara, Touch, Tolino EPOS
As far as I can tell these are the steps I did:
  • Right clicked on book
  • selected Reading List
  • selected Customize Plugin
  • went to devices tab, then other tab, and back to lists tab
  • shows my "sync later" list
    • device to sync this list too Kobo Touch (main)
    • Add new list items to device
    • Sync to device when connected
    • Clear this list after sync
  • selected my "On Kobo Touch" list
    • device to sync this list too Kobo Touch (main)
    • Auto populate from books on device
    • Update column for add or remove
    • Column name: #onKobo (On Kobo)
    • Value to add / remove Y
  • selected OK
  • Attached Kobo
  • Error message
  • Ejected Kobo
  • Error message



Spoiler:

Code:
DeviceJob: 2 Get list of books on device done, calling callback
READING LIST: Metadata available: {'main': {u'device_store_uuid': u'abf9c02a-5a0b-4150-a227-9c625bdf9550', u'location_code': 'main', u'device_name': u'Kobo Reader', u'calibre_version': u'0.8.62', u'prefix': 'P:/', u'last_library_uuid': u'f5ff2231-fad2-4df4-98e7-41638249dd44', u'date_last_connected': u'2012-07-30T04:41:41.019000+00:00'}}
READING LIST: Sync Now - force_sync= False
READING LIST: Device found to sync to: Kobo Reader abf9c02a-5a0b-4150-a227-9c625bdf9550
READING LIST: No books on 'Sync Later' list need to be synced
READING LIST: Checking for automatic list(s)  [u'On Kobo Touch']
READING LIST: Auto-populating list:  On Kobo Touch
READING LIST: Removing 0 ids from automatic list: On Kobo Touch
READING LIST: Adding 0 ids to automatic list: On Kobo Touch
Traceback (most recent call last):
  File "calibre_plugins.reading_list.config", line 777, in on_device_metadata_available
  File "calibre_plugins.reading_list.config", line 862, in update_from_connection_status
  File "calibre_plugins.reading_list.config", line 376, in get_data
RuntimeError: wrapped C/C++ object of %S has been deleted

Job: 2 Get list of books on device finished
No details available.
DeviceJob: 2 Get list of books on device callback returned
Job: 2 Get list of books on device finished
No details available.
READING LIST: Device disconnected
Traceback (most recent call last):
  File "calibre_plugins.reading_list.config", line 773, in on_device_connection_changed
  File "calibre_plugins.reading_list.config", line 862, in update_from_connection_status
  File "calibre_plugins.reading_list.config", line 376, in get_data
RuntimeError: wrapped C/C++ object of %S has been deleted
PeterT is offline   Reply With Quote
Advert
Old 07-30-2012, 02:37 AM   #468
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,734
Karma: 6690881
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
@kiwidude: it is possible that you are being bit by something that got me while developing the new smartdevice driver. It turns out that any plugin can be allocated and its __init__ called more than once. For example, this happened to my driver when I added a book.

The lesson I learned after discussion with Kovid: __init__ must not allocate externally-visible resources or initialize class-level attributes (attributes declared explicitly in the class). In my case I was allocating the listen socket in __init__, an action that blew up in the second __init__. The problem with class-level attributes is that they are static; they exist in memory only once. The second __init__ is changing the value of the same memory used by the first.
chaley is offline   Reply With Quote
Old 07-30-2012, 03:41 AM   #469
kiwidude
Calibre Plugins Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
Posts: 4,636
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
@chaley - thx for the info and that makes sense, but why would __init__() be being called more than once on a GUI plugin? Surely only one instance of the Reading List plugin is ever being created?

What happens with this plugin is that the configuration widget subscribes to some signals from the plugin action, which it uses to updates its grid to shwo device status, in case a user plugs in a device while they have the config screen open. It looks to me like those signals are not being disconnected in PeterT's case (I can't replicate the error myself).

At the moment I disconnect those signals in an __exit__() function on my config widget, but that must be the wrong place for PeterT. The problem is that there are no guaranteed callbacks to my widget from calibre's do_user_config code() if the user does not click on "ok" so that save_settings gets called. So where should I put my signal disconnections?

I am guessing that the Qt object the config widget uses is being garbage collected before the Python ConfigWidget is, so my __exit__ has not yet been called or something. However since from a config widget you have no hooks to the parent dialog I can't think of a way out of this that doesn't involve calibre looking for an optional functional name on the config widget to call as a "cleanup" that I could disconnect in that gets invoked when the config dialog is closed?

Last edited by kiwidude; 07-30-2012 at 03:53 AM.
kiwidude is offline   Reply With Quote
Old 07-30-2012, 04:07 AM   #470
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: 43,844
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
@kiwidude: In the slot your are connecting to the signal, use

import sip
if sip.isdeleted(self): return

sip.isdeleted() returns True if the underlying C++ object has been deleted.
kovidgoyal is online now   Reply With Quote
Advert
Old 07-30-2012, 04:14 AM   #471
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,734
Karma: 6690881
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by kiwidude View Post
@chaley - thx for the info and that makes sense, but why would __init__() be being called more than once on a GUI plugin? Surely only one instance of the Reading List plugin is ever being created?
To quote Kovid:
Quote:
__init__ can be called at anytime or multiple times on a plugin class. There can be multiple plugin objects.
I haven't been able to find a spot outside of a worker process where this would happen, but that doesn't mean that there isn't one.
Quote:
What happens with this plugin is that the configuration widget subscribes to some signals from the plugin action, which it uses to updates its grid to shwo device status, in case a user plugs in a device while they have the config screen open. It looks to me like those signals are not being disconnected in PeterT's case (I can't replicate the error myself).

At the moment I disconnect those signals in an __exit__() function on my config widget, but that must be the wrong place for PeterT. The problem is that there are no guaranteed callbacks to my widget from calibre's do_user_config code() if the user does not click on "ok" so that save_settings gets called. So where should I put my signal disconnections?
__exit__ is part of the "with x:" construct. Do you do something like "with configWidgetClass() as widget:"? Interesting idea. I haven't ever tried that.

Doesn't do_user_config open a Qt widget of some kind? If so, then override the accept and reject methods. One of the two of these will get called when the dialog is closed in some way.

Another possibility is to connect the signals to methods that will not go away. These methods verify the situation and pass the calls along only when it is correct to do so. This way you connect the signal once, never disconnecting it. Edit: Kovid has provided a method to check if it is correct to pass the call along.
chaley is offline   Reply With Quote
Old 07-30-2012, 08:31 AM   #472
darkmiss
Member
darkmiss began at the beginning.
 
Posts: 13
Karma: 10
Join Date: Jun 2012
Device: Sony T1
Feature request - Checkboxes?

Hi kiwidude,

most of the time I add a book to more than one reading list and it's a bit tedious to go "Reading List" -> Add to list -> List A several times per book.

I have no inkling about writing software so I don't know if this is even possible but it would be really cool to have a list of the lists (ha!) displayed with checkboxes. This way you wouldn't even need the "add to" and "remove from" menu items, because you could see if the book is on the list by looking at the checkboxes.

Just dreaming here ...

Take care, Ingrid
darkmiss is offline   Reply With Quote
Old 07-30-2012, 08:53 AM   #473
kiwidude
Calibre Plugins Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
Posts: 4,636
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
Beta for next version

@Kovid/chaley, thx for the info. The __exit__ was just a brain fart on my part a long time ago. I figured out a solution (overriding do_user_config so that I can disconnect).

@PeterT - please give the attached version a whirl to see if it solves the issue for you.

@darkmiss - I've enhanced the "Move to list" option to allow you to select multiple lists on the RHS. So use that option instead of the Add menus. Can you also please give the attached version a whirl and verify it is working without issues for you.

I wiill release it officially when you have both replied.

Last edited by kiwidude; 07-30-2012 at 02:39 PM. Reason: Removed attachment as officially released
kiwidude is offline   Reply With Quote
Old 07-30-2012, 10:33 AM   #474
PeterT
Grand Sorcerer
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
PeterT's Avatar
 
Posts: 12,160
Karma: 73448616
Join Date: Nov 2007
Location: Toronto
Device: Nexus 7, Clara, Touch, Tolino EPOS
@Kiwidude; so far seems fine. I will try a few more times but it was reproducible at will last night and is not now.

OOPS.. Spoke to soonn.. Trying to go reinvoke the plugin after ejecting now gets the following

Spoiler:

Code:
calibre, version 0.8.62
ERROR: Unhandled exception: <b>TypeError</b>:'ConfigWidget' object is not callable

Traceback (most recent call last):
  File "calibre_plugins.reading_list.action", line 732, in show_configuration
  File "calibre_plugins.reading_list.__init__", line 48, in do_user_config
  File "site-packages\calibre\customize\__init__.py", line 150, in do_user_config
TypeError: 'ConfigWidget' object is not callable
PeterT is offline   Reply With Quote
Old 07-30-2012, 10:37 AM   #475
PeterT
Grand Sorcerer
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
PeterT's Avatar
 
Posts: 12,160
Karma: 73448616
Join Date: Nov 2007
Location: Toronto
Device: Nexus 7, Clara, Touch, Tolino EPOS
It does not even need the device to be attached; just try to launch Reading list | Customize twice in a row

Spoiler:

Code:
calibre Debug log
calibre 0.8.62
Windows-7-6.1.7601-SP1
Windows
('Windows', '7', '6.1.7601')
Python 2.7.3
Windows: ('7', '6.1.7601', 'SP1', 'Multiprocessor Free')
Starting up...
INFO:cherrypy.error:[30/Jul/2012:10:35:38] ENGINE Bus STARTING
INFO:cherrypy.error:[30/Jul/2012:10:35:38] ENGINE Started monitor thread '_TimeoutMonitor'.
self.current_prefs == None(True) or self.libraryid != libraryid(True)
get prefs from db
INFO:cherrypy.error:[30/Jul/2012:10:35:38] ENGINE Serving on 0.0.0.0:8080
INFO:cherrypy.error:[30/Jul/2012:10:35:40] ENGINE Bus STARTED
Started up in 13.69 seconds with 731 books
Traceback (most recent call last):
  File "calibre_plugins.reading_list.action", line 732, in show_configuration
  File "calibre_plugins.reading_list.__init__", line 48, in do_user_config
  File "site-packages\calibre\customize\__init__.py", line 150, in do_user_config
TypeError: 'ConfigWidget' object is not callable

INFO:cherrypy.error:[30/Jul/2012:10:36:25] ENGINE Bus STOPPING
INFO:cherrypy.error:[30/Jul/2012:10:36:26] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down
INFO:cherrypy.error:[30/Jul/2012:10:36:26] ENGINE Stopped thread '_TimeoutMonitor'.
INFO:cherrypy.error:[30/Jul/2012:10:36:26] ENGINE Bus STOPPED
INFO:cherrypy.error:[30/Jul/2012:10:36:26] ENGINE Bus EXITING
INFO:cherrypy.error:[30/Jul/2012:10:36:26] ENGINE Waiting for child threads to terminate...
INFO:cherrypy.error:[30/Jul/2012:10:36:26] ENGINE Bus EXITED
INFO:cherrypy.error:[30/Jul/2012:10:36:26] ENGINE Waiting for thread MainThread.
PeterT is offline   Reply With Quote
Old 07-30-2012, 11:13 AM   #476
darkmiss
Member
darkmiss began at the beginning.
 
Posts: 13
Karma: 10
Join Date: Jun 2012
Device: Sony T1
Thanks for the prompt reply, kiwidude. I tested the "move to list" -> perfect. It will be a great time saver!

Regards from Germany,
Ingrid
darkmiss is offline   Reply With Quote
Old 07-30-2012, 11:33 AM   #477
kiwidude
Calibre Plugins Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
Posts: 4,636
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
@darkmiss - thx for the feedback.

@PeterT - try the new version above. I am at work and USB is blocked so I wasn't able to test the attaching here, and did something stupid in the code...
kiwidude is offline   Reply With Quote
Old 07-30-2012, 11:44 AM   #478
PeterT
Grand Sorcerer
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
PeterT's Avatar
 
Posts: 12,160
Karma: 73448616
Join Date: Nov 2007
Location: Toronto
Device: Nexus 7, Clara, Touch, Tolino EPOS
@Kiwidude; looks good
PeterT is offline   Reply With Quote
Old 07-30-2012, 11:54 AM   #479
magphil
Connoisseur
magphil , Klaatu Barada Niktu!magphil , Klaatu Barada Niktu!magphil , Klaatu Barada Niktu!magphil , Klaatu Barada Niktu!magphil , Klaatu Barada Niktu!magphil , Klaatu Barada Niktu!magphil , Klaatu Barada Niktu!magphil , Klaatu Barada Niktu!magphil , Klaatu Barada Niktu!magphil , Klaatu Barada Niktu!magphil , Klaatu Barada Niktu!
 
Posts: 60
Karma: 5090
Join Date: Jun 2009
Device: Gen3, Kobo glow
Will this plugin help create/manage kobo touch shelves in recent 2.0 firmware ?
magphil is offline   Reply With Quote
Old 07-30-2012, 12:20 PM   #480
PeterT
Grand Sorcerer
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
PeterT's Avatar
 
Posts: 12,160
Karma: 73448616
Join Date: Nov 2007
Location: Toronto
Device: Nexus 7, Clara, Touch, Tolino EPOS
@Magphil: nope
PeterT is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[GUI Plugin] Extract ISBN kiwidude Plugins 532 04-07-2024 11:01 AM
[GUI Plugin] Open With kiwidude Plugins 403 04-01-2024 08:39 AM
[GUI Plugin] Manage Sony x50 Reader Book List kpw Plugins 170 10-02-2014 08:23 PM
[GUI Plugin] Temp Marker kiwidude Plugins 41 10-14-2013 12:25 AM
[GUI Plugin] Plugin Updater **Deprecated** kiwidude Plugins 159 06-19-2011 12:27 PM


All times are GMT -4. The time now is 07:49 PM.


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