Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 02-17-2010, 01:18 PM   #16
pdurrant
The Grand Mouse 高貴的老鼠
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 74,015
Karma: 315160596
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle Oasis
Quote:
Originally Posted by pdurrant View Post
I have a message box appearing now - thank you.
Arghh... but most of the time it's hidden by the large "Adding..." dialog.

Any ideas?
pdurrant is offline   Reply With Quote
Old 02-17-2010, 01:35 PM   #17
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: 45,385
Karma: 27756918
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
The plugin should either raise an exception or return the original file path on failure.

Make your message box non modal, it will then not interrupt the adding process and will still be there when the adding dialog closes.

EDIT: Actually, no that wont work, since the message box is cerated ina separate process that dies after adding is done

Instead you can try calling

self.raise_()

Last edited by kovidgoyal; 02-17-2010 at 01:58 PM.
kovidgoyal is offline   Reply With Quote
Advert
Old 02-17-2010, 02:03 PM   #18
pdurrant
The Grand Mouse 高貴的老鼠
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 74,015
Karma: 315160596
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle Oasis
Quote:
Originally Posted by kovidgoyal View Post
Instead you can try calling

self.raise()
self.raise() gives a syntax error, and self.raise_() presumably generated an exception (since my dialog no longer appeared at all).

Here's my code that gets run when I've had to give up on converting a file:

Code:
if is_ok_to_use_qt():
	#self.raise_()
	QMessageBox.question( None, 
				'My Plugin', 
				"Couldn't convert: %s\nImporting original version instead." % path_to_ebook, QMessageBox.Ok)
return path_to_ebook
Suggestions welcome - I'm afraid python is new enough to me. Adding in QT as well has me well out of my depth.
pdurrant is offline   Reply With Quote
Old 02-17-2010, 02:18 PM   #19
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: 45,385
Karma: 27756918
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You're using a pre-built messagebox, in that case raise wont work. WHat you have to do is construct your own messagebox and call raise_ on it

Code:
d = QMessageBox(QMessageBox.Warning, 'title', 'message')
d.raise_()
d.exec_()
kovidgoyal is offline   Reply With Quote
Old 02-17-2010, 04:27 PM   #20
pdurrant
The Grand Mouse 高貴的老鼠
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 74,015
Karma: 315160596
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle Oasis
Quote:
Originally Posted by kovidgoyal View Post
You're using a pre-built messagebox, in that case raise wont work. WHat you have to do is construct your own messagebox and call raise_ on it

Code:
d = QMessageBox(QMessageBox.Warning, 'title', 'message')
d.raise_()
d.exec_()
This runs OK, but my message box is still hidden behind the Adding... box.

I've attached a very simple plug-in that demonstrates the problem. I have no notion of how to get any further with this.
Attached Files
File Type: zip Demo_plugin.py.zip (1.1 KB, 276 views)
pdurrant is offline   Reply With Quote
Advert
Old 02-17-2010, 04:44 PM   #21
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: 45,385
Karma: 27756918
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Do the following:

Code:
d = QMessageBox(QMessageBox.Warning, 'title', 'message')
d.show()
d.raise_()
I was wrong earlier, the import plugins are run in the same process as the GUI, so the boxes will stick around after the adding dialog is closed. This way, the user will be informed and the adding process wont be interrupted.
kovidgoyal is offline   Reply With Quote
Old 02-17-2010, 05:53 PM   #22
pdurrant
The Grand Mouse 高貴的老鼠
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 74,015
Karma: 315160596
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle Oasis
Quote:
Originally Posted by kovidgoyal View Post
Do the following:

Code:
d = QMessageBox(QMessageBox.Warning, 'title', 'message')
d.show()
d.raise_()
I was wrong earlier, the import plugins are run in the same process as the GUI, so the boxes will stick around after the adding dialog is closed. This way, the user will be informed and the adding process wont be interrupted.
That doesn't seem to show the messagebox at all. but I found that

d.show()
d.raise_()
d.exec_()

did bring the MessageBox to the front of the "Adding..." dialog.

If I could find a way to leave messages up in a non-modal fashion behind the "Adding..." dialog, I can ses that that would be better for when people want to import loads of files and just leave it running.

But I'm happy for now.
pdurrant is offline   Reply With Quote
Old 02-17-2010, 06:58 PM   #23
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: 45,385
Karma: 27756918
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
d.setModal(False)

before the call to exec_
kovidgoyal is offline   Reply With Quote
Old 02-18-2010, 09:33 AM   #24
pdurrant
The Grand Mouse 高貴的老鼠
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 74,015
Karma: 315160596
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle Oasis
Quote:
Originally Posted by kovidgoyal View Post
d.setModal(False)

before the call to exec_
This does make the dialog non-modal, but it doesn't allow exec_() to return until after the OK button has been pressed - so an error still blocks the import.

It seems to be that I really need to be able to put the message box into its own thread or something. But reading up on QT in python, is seems to be the case that all GUI interactions must be in the main thread.

Thanks for all your suggestions. I think that warning of the problem is more important than not interrupting a large import, so I'll stick to the modal dialog for now.
pdurrant is offline   Reply With Quote
Old 02-18-2010, 12:26 PM   #25
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: 45,385
Karma: 27756918
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
If you dont want the dialog to block, dont call exec_

Just calling show will be enough to show the dialog.
kovidgoyal is offline   Reply With Quote
Old 02-18-2010, 04:31 PM   #26
pdurrant
The Grand Mouse 高貴的老鼠
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 74,015
Karma: 315160596
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle Oasis
Quote:
Originally Posted by kovidgoyal View Post
If you dont want the dialog to block, dont call exec_

Just calling show will be enough to show the dialog.
Ah - this might be a Mac/Unix/Windows difference. On Mac calling show doesn't show the dialog at all, not even behind other windows.
pdurrant is offline   Reply With Quote
Old 02-18-2010, 06:05 PM   #27
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: 45,385
Karma: 27756918
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Strange...do me a favor and open a ticket about it, and I'll add a generic mechanism plugins can use to display messages to the user.
kovidgoyal is offline   Reply With Quote
Old 02-19-2010, 04:15 AM   #28
pdurrant
The Grand Mouse 高貴的老鼠
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 74,015
Karma: 315160596
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle Oasis
Quote:
Originally Posted by kovidgoyal View Post
Strange...do me a favor and open a ticket about it, and I'll add a generic mechanism plugins can use to display messages to the user.
Thanks. Ticket 4944 added.
pdurrant is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Issues importing mobi books from Fictionwise. splat Calibre 14 02-22-2010 02:35 AM
Error importing epub book to calibre and ipod touch BigHoss Calibre 0 01-24-2010 10:21 AM
unencrypted azw books - error importing abrinton Calibre 4 01-19-2010 02:57 PM
Error when importing MobiPocket files. mbovenka Calibre 7 08-16-2008 10:07 AM
Importing multiple files into Mobi Reader Calamity Bookeen 0 07-25-2008 10:57 AM


All times are GMT -4. The time now is 06:10 PM.


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