Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 06-30-2012, 05:13 PM   #31
Agama
Guru
Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.
 
Agama's Avatar
 
Posts: 776
Karma: 2751519
Join Date: Jul 2010
Location: UK
Device: PW2, Nexus7
Perfect! Thank-you.

It's taking a bit of time to get to grips with Python but I'm really starting to enjoy it!

(I've been a UniBasic analyst/programmer for 15 years, with previous experience in Fortran 77 and x86 assembler and these are nothing like Python with all its classes/methods etc., so this might account for some of my questions being a bit simple.)

Last edited by Agama; 06-30-2012 at 05:22 PM.
Agama is offline   Reply With Quote
Old 06-30-2012, 05:30 PM   #32
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,637
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
What IDE are you using? You should be able to setup the python path for your project workspace if you are using Eclipse or Aptana so that hovering over such imports will give you big handy tootltips and allow you to navigate straight to the source files. Invaluable for navigating the code, be it calibre code or python imports.
kiwidude is offline   Reply With Quote
Advert
Old 06-30-2012, 05:35 PM   #33
Agama
Guru
Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.
 
Agama's Avatar
 
Posts: 776
Karma: 2751519
Join Date: Jul 2010
Location: UK
Device: PW2, Nexus7
IDE?? I'm just using Notepad++

Python appears to have installed something called IDLE (Python GUI) on my Windows start menu. Would this be an IDE?

P.S. I ran IDLE and the Help > About says that it's "Python's Integrated DeveLopment Environment" so this sounds quite likely.

Last edited by Agama; 06-30-2012 at 06:08 PM.
Agama is offline   Reply With Quote
Old 06-30-2012, 10:35 PM   #34
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,857
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
I dont think IDLE has the "go to definition" functionality that kiwidude is talking about. You need to use something like Eclipse+PyDev or ViM with an appropriately created tags file for that. In general anything that comes from calibre's code will have its import of the form


from calibre....

anything else comes from either the python stdlib or a python third party package.
kovidgoyal is online now   Reply With Quote
Old 07-01-2012, 12:29 PM   #35
Agama
Guru
Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.
 
Agama's Avatar
 
Posts: 776
Karma: 2751519
Join Date: Jul 2010
Location: UK
Device: PW2, Nexus7
I checked: there's no "go to definition" in IDLE.

Is there anyway to add the "Load plug-in from file" command to the main toolbar? I couldn't find it in the list of available actions and I use this command a lot whilst testing my plugins.

Now I guess I could write a plugin just to add this function to the toolbar, but that seems a bit over the top.
Agama is offline   Reply With Quote
Advert
Old 07-01-2012, 12:33 PM   #36
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,637
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
Do it from the command line with a script - I always have a batch file with rebuilds the zip, installs it and then launches calibre for testing.

This is to install it:
calibre-customize -a "%ZIPNAME%.zip"
kiwidude is offline   Reply With Quote
Old 07-02-2012, 12:36 AM   #37
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,857
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You dont need a script, read the last couple of paragraphs here: http://manual.calibre-ebook.com/crea...ugging-plugins
kovidgoyal is online now   Reply With Quote
Old 07-02-2012, 07:35 AM   #38
Agama
Guru
Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.
 
Agama's Avatar
 
Posts: 776
Karma: 2751519
Join Date: Jul 2010
Location: UK
Device: PW2, Nexus7
Thanks. calibre -s; zip -r /path/to/plugin/zip/file.zip *; calibre is much better than my rather manual method.

I went looking for a zip utililty with a command line to use with this script and found 7-Zip for Windows to be very useful. A couple of features in particular help in this context:

1) 7-Zip can be made the default program to open .zip files.

2) 7-Zip allows files within the zip to be edited directly, unlike the Windows built-in option.

Last edited by Agama; 07-02-2012 at 02:13 PM.
Agama is offline   Reply With Quote
Old 07-04-2012, 04:57 PM   #39
Agama
Guru
Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.
 
Agama's Avatar
 
Posts: 776
Karma: 2751519
Join Date: Jul 2010
Location: UK
Device: PW2, Nexus7
How can I change the width of the QDialog box that my plugin uses?

Based on the interface_demo plugin my box uses self.resize(self.sizeHint()) - but because my buttons have short names the text in the title bar of the dialog gets cropped. So, can I make the dialog wider?
Agama is offline   Reply With Quote
Old 07-04-2012, 05:35 PM   #40
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,637
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
QDialog has a setMinimumWidth() function you can use.
kiwidude is offline   Reply With Quote
Old 07-05-2012, 07:25 AM   #41
Agama
Guru
Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.
 
Agama's Avatar
 
Posts: 776
Karma: 2751519
Join Date: Jul 2010
Location: UK
Device: PW2, Nexus7
Thanks. I used your reply to find the Qt documentation at http://qt-project.org/doc/, so I'll check any further Qt issues there first of all. Which version of Qt does calibre use?

I want to test some of the standard Python os and io functions to understand their use before incorporating into my plugin. Is there any way to play with them outside of a plugin?
Agama is offline   Reply With Quote
Old 07-05-2012, 07:35 AM   #42
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,637
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
Quote:
Originally Posted by Agama View Post
Thanks. I used your reply to find the Qt documentation at http://qt-project.org/doc/, so I'll check any further Qt issues there first of all. Which version of Qt does calibre use?
4.8 - just look at the properties for version of any of the dlls in your calibre install folder.
Quote:
I want to test some of the standard Python os and io functions to understand their use before incorporating into my plugin. Is there any way to play with them outside of a plugin?
Yeah I do this all the time. Just create a standalone .py file with your test code, and you can either run it using default python in your path "python test.py" or using calibre (which tends to be more practical if you start importing calibre namespaces) by "calibre-debug -e test.py".

Or you can create a __main__ section in the bottom of one of your plugin files for testing, you will see that around the place in calibre code and the odd plugin.
kiwidude is offline   Reply With Quote
Old 07-05-2012, 01:48 PM   #43
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,166
Karma: 73448616
Join Date: Nov 2007
Location: Toronto
Device: Nexus 7, Clara, Touch, Tolino EPOS
Couldn't you also just run either python with no command line options and type commands in, or run idle and use the python supplied IDE ?
PeterT is offline   Reply With Quote
Old 07-05-2012, 02:23 PM   #44
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,637
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
Sure you "could" - but it means yet another way of doing things that won't work when suddenly your test code needs a library or function that is in calibre. Which happens *alot* for me at least. So rather than have to deal with two different ways of doing things just because a line or two of your test code has changed I gave Agama the simplest answer which has worked for me.

I just keep a command line window open to run calibre-debug -e with (a simple up-arrow enter to re-run things), and edit the test file within Eclipse along with the plugin code. You still get all the code analysis checking of the IDE, but can run *any* code be it 100% python only or a mixture using the same approach.
kiwidude is offline   Reply With Quote
Old 07-06-2012, 01:18 AM   #45
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,857
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Note that running calibre-debug with no arguments gives you a python prompt where you can run arbitrary commands, including importing stuff from calibre.
kovidgoyal is online now   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Plugin not customizable: Plugin: HTML Output does not need customization flyingfoxlee Conversion 2 02-24-2012 02:24 AM
[GUI Plugin] Plugin Updater **Deprecated** kiwidude Plugins 159 06-19-2011 12:27 PM
Help with plugin writing meme Plugins 2 01-21-2011 01:57 PM
Writing an interface action plugin kiwidude Plugins 21 11-11-2010 04:11 PM
New Plugin Type Idea: Library Plugin cgranade Plugins 3 09-15-2010 12:11 PM


All times are GMT -4. The time now is 12:44 AM.


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