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

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 11-24-2010, 07:02 AM   #16
itimpi
Wizard
itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.
 
Posts: 4,552
Karma: 950151
Join Date: Nov 2008
Device: Sony PRS-950, iphone/ipad (Marvin/iBooks/QuickReader)
I knew that I need the patch to play with the facility to really understand it
itimpi is offline   Reply With Quote
Old 11-24-2010, 07:25 AM   #17
kiwidude
calibre/Sigil 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,601
Karma: 2092290
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
Quote:
Originally Posted by dwanthny View Post
The top level are whatever user categories you have already defined, look left to the tag browser in the image.
Exactly right, and apologies for any confusion my particular categories have caused in understanding this. It just happens to be that the two user categories I have created are author related and so yes only the "Selected author" submenu option is one I am likely to use for these.

Imagine however you had a "Books to Read" user category. It might contain anything with tag "ToRead", plus a couple of your favourite authors, plus a series (by multiple authors). In that situation "Books to Read" would be in the second level menu (where "Fav Authors" is in my screenshot) and you are able to add any of authors/tags/series with the sub-menu from the selected rows.
kiwidude is offline   Reply With Quote
Old 11-24-2010, 09:23 AM   #18
kiwidude
calibre/Sigil 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,601
Karma: 2092290
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
Patch file attached to ticket 7642

Read the notes in the ticket carefully if you want to apply it - as stated the patch was made with ticket 7502 already applied which is my "Search the internet" patch. So either apply both (7502 patch first), or just modify the two lines of code in the two files listed affected to remove mention of "SearchTheInternetAction" and "Search The Internet" respectively.
kiwidude is offline   Reply With Quote
Old 11-28-2010, 08:39 AM   #19
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,703
Karma: 6658935
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Apologies for resurrecting this thread, but I am curious -- wouldn't it be easier to drag the book onto the user category instead of the context menu?

Dragging onto a category doesn't currently do anything, but it wouldn't be hard to do something like 'add the currently selected column as a category'. In other words, clicking in the author cell then dragging that book to the category would add that author to the category.
chaley is offline   Reply With Quote
Old 11-28-2010, 08:45 AM   #20
kiwidude
calibre/Sigil 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,601
Karma: 2092290
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
Quote:
Originally Posted by chaley View Post
Apologies for resurrecting this thread, but I am curious -- wouldn't it be easier to drag the book onto the user category instead of the context menu?

Dragging onto a category doesn't currently do anything, but it wouldn't be hard to do something like 'add the currently selected column as a category'. In other words, clicking in the author cell then dragging that book to the category would add that author to the category.
Sounds like a nice idea additional behaviour option to add. However as that behaviour requires considerable changes to the existing code I chose the more encapsulated option of the menu to "get something now" ;-)

Plus it also requires that you not only have the tag viewer visible but also the category within it visible to drop onto which could require collapsing/scrolling etc first. I frequently have the tag viewer turned off completely while editing metadata for screen real-estate.
kiwidude is offline   Reply With Quote
Old 11-28-2010, 08:51 AM   #21
Manichean
Wizard
Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.
 
Manichean's Avatar
 
Posts: 3,130
Karma: 91256
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
Since we have UI action plugins and customizable menus now to reduce/customize the amount of UI bloat, is there something wrong with having both? Personally, had I need for such an action, I'd prefer the context menu, but I can also see the appeal for drag-and-drop.
Manichean is offline   Reply With Quote
Old 11-28-2010, 09:03 AM   #22
kiwidude
calibre/Sigil 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,601
Karma: 2092290
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
Quote:
Originally Posted by Manichean View Post
Since we have UI action plugins and customizable menus now to reduce/customize the amount of UI bloat, is there something wrong with having both?
Not at all imho - as I said above it sounds like a nice additional option to add. I just tried to justify why I didn't choose that approach first up. As I am sure others would say, feel free to write it yourself and submit it...
kiwidude is offline   Reply With Quote
Old 11-28-2010, 09:25 AM   #23
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,703
Karma: 6658935
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by kiwidude View Post
Sounds like a nice idea additional behaviour option to add. However as that behaviour requires considerable changes to the existing code I chose the more encapsulated option of the menu to "get something now" ;-)
The changes aren't large. A few of lines of code in views.py to capture the selected cell on drag start, a few lines of code in tags_view.py to recover the selected cell info on drop, then the equivalent of what you must have already done to add the item to the category.

However, as I wouldn't use the feature, I won't be submitting a patch. I asked because I was wondering about your rationale, and that was exactly the what you gave me.
chaley is offline   Reply With Quote
Old 11-29-2010, 01:10 PM   #24
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,703
Karma: 6658935
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by chaley View Post
However, as I wouldn't use the feature, I won't be submitting a patch. I asked because I was wondering about your rationale, and that was exactly the what you gave me.
I changed my mind, because I got curious about what code would really be necessary. Turned out to be a bit more complicated than I had thought (it always is), because I had to dynamically control the drop indicator by checking that the mouse pointer is over a user category and that the selected library view cell is an acceptable source. Took around 35 lines of code to control the indicator, and around 50 lines of code to update the category after a drop.

The code works with authors, publisher, series, non-multiple text custom columns, and series-like custom columns. I chose not to do tags and multiple custom columns, because it didn't make sense to me to add *all* the tags on a book to a user category.

Note that autoscroll and autoexpand are both enabled, so you don't need to position the tags pane first. However, I did notice that it wants to open only one category at a time. If you want to open another one, simply move the mouse pointer out of, then back into, the tags pane. Autoscroll by moving the mouse pointer to the bottom or the top.

Code is available in 'trunk', and will be in the next release.
chaley is offline   Reply With Quote
Old 11-29-2010, 01:40 PM   #25
kiwidude
calibre/Sigil 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,601
Karma: 2092290
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
Quote:
Originally Posted by chaley View Post
I changed my mind, because I got curious about what code would really be necessary.
Sounds good, sounds far more work than my minimal Python skills could have coped with so rather you than me . Totally agree on adding "all" tags not usually making sense, I had that and publishers in my plugin menu only for consistency with the "Manage" dialog. In reality I would ever only use authors and series.

As you are someone who is clearly familiar with the code/writing features etc there is something else I would like. Got any ideas about an easy way to select all of the items within a user category (for applying as a search)? At the moment you have to ctrl+single click each one by one. Perhaps something like a "Select All" or similar right-click on the user category name?
kiwidude is offline   Reply With Quote
Old 11-29-2010, 02:00 PM   #26
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,703
Karma: 6658935
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by kiwidude View Post
Sounds good, sounds far more work than my minimal Python skills could have coped with so rather you than me .
Your python skills are fine. Where you are probably lacking is Qt skills, but that can be corrected.
Quote:
As you are someone who is clearly familiar with the code/writing features etc there is something else I would like. Got any ideas about an easy way to select all of the items within a user category (for applying as a search)? At the moment you have to ctrl+single click each one by one. Perhaps something like a "Select All" or similar right-click on the user category name?
Yea, you could do this. Take a look at gui.tag_view.py.show_context_menu. You could add a 'search for all' menu item. Add a method to gui.tag_view.TagsModel to generate a list of search token strings (look at the tokens method) Finally, change tag_view.context_menu_handler to accept the new action. The accept action would call the new method, then emit the search signal with a 'match_any' argument (see 'toggle' in tag_view for an example).
chaley is offline   Reply With Quote
Old 11-29-2010, 02:19 PM   #27
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by chaley View Post
Your python skills are fine. Where you are probably lacking is Qt skills, but that can be corrected.
Do you have any suggestions on the best way to correct such a deficiency? I've read a tutorial and browsed the docs, but I'm still having trouble with Qt. I can add option boxes and menu items, but much more than that and I get lost. I haven't played much with the designer - should I be focusing there more?
Starson17 is offline   Reply With Quote
Old 11-29-2010, 03:51 PM   #28
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,703
Karma: 6658935
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Starson17 View Post
Do you have any suggestions on the best way to correct such a deficiency? I've read a tutorial and browsed the docs, but I'm still having trouble with Qt. I can add option boxes and menu items, but much more than that and I get lost. I haven't played much with the designer - should I be focusing there more?
You ask a difficult question.

First, I should note that I am continually frustrated by Qt. Its organization and the class hierarchies do not match my mental model, which derives from writing code for Win 3.1 and early smalltalk programs. I have similar problems with Java's class hierarchies. If I didn't have samples (Kovid's code), I would be totally lost.

Regarding getting experience, there are two facets to consider: event-driven programming and the Qt package. If you aren't familiar with the first, then the second is much more problematic.

As regards the first, at the risk of being booed out of town, playing with MS Visual Basic might be a way to go forward, much better that Qt's designer. VB has a rather clean event and form model, so it is easy to get used to writing code that reacts to events instead of code that proactively does something. It supports instant addition and execution of event functions. Qt's designer does not permit easy insertion of event functions, making it harder to use as a learning tool.

As regards the second, what I did (and do) is choose something interesting in the code, then try to understand what is happening. I then try to predict the effect of changes, then test the predictions. In addition, I look at the change logs and the change sets for most GUI changes that Kovid makes, worrying at it until I can describe what the change does, and why. As a side benefit, sometimes I find bugs.

My first real effort with Qt was adding custom columns and user-defined categories to the library view and tag browser. I looked at how Kovid did the standard stuff, and then played with possible changes. I changed the code, submitted it, and then looked at how Kovid changed what I did. I still check the code in 'trunk' against what I submitted, because the differences are instructive.

I suppose that what I am suggesting is that you jump in and try. Of course, this might be impractical if you have a 'real job', because the process is quite time consuming.

BTW: if you are going to do much more development, you might want to consider creating a launchpad account. Managing repositories is much easier if you don't need to deal with patches. I maintain a local shadow of trunk, merge from that, then push changes to my launchpad repository. Kovid takes changes from there. I think that it is easier for Kovid to merge from launchpad repositories as opposed to patches, but I am not sure of that. I know that it is easier for me.
chaley is offline   Reply With Quote
Old 11-29-2010, 05:53 PM   #29
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,774
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
I bootstrapped myself on GUI programming with Qt, evidence of which you can find in some of the older code in calibre, which is, to put it charitably, a mess.

I still occasionally find Qt jarring to use, primarily because it doesn't have a pythonic interface. PyQt, understandably, models the C++ interface of Qt very closely, so that people new to it can use the C++ documentation. So keep that in mind. When you're using Qt, you're doing things the C++ way.

As for getting started on Qt, I would suggest avoiding Qt Designer, and hand coding a few dialogs, that will give you a better feel for what goes on underneath.

I know it is really tedious creating endless labels and input fields and putting them all together in a layout, but if you succesfully do it once of twice it will raise your confidence levels.

Another trick I would suggest is develop dialogs as standalone objects, which you can run independent of calibre easily and quickly. There are many examples of that in the calibre code.

For instance

calibre-debug -e src/calibre/gui2/preferences/main.py

or

calibre-debug -e src/calibre/gui2/dialogs/scheduler.py


Look at the if __name__ == '__main__' section of these files to see how to do that.
kovidgoyal is online now   Reply With Quote
Old 11-30-2010, 09:14 AM   #30
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by kovidgoyal View Post
I bootstrapped myself on GUI programming
Thanks, Charles and Kovid, for your helpful comments. I've been doing pretty much what Charles has suggested - picking interesting bits of Kovid's code, trying to understand it, modifying it to see the effects, etc. It's been instructive. I tried to play with the Designer, but didn't feel it was helping me much, so I'm going to go back to what Kovid suggests and do it by hand, bit by bit, until I understand it.
Starson17 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
Suggestion: Selecting a user-defined Category should show all of the books in it Daemon Calibre 6 08-23-2010 01:19 PM
Author category: feature request! alexxxm Calibre 1 08-18-2010 07:21 PM
Feature Request - Edit File Option fcoulter Calibre 10 07-22-2010 12:56 AM
Power Mode option in diagnostics menu? scarab1 Ectaco jetBook 0 02-28-2010 10:59 PM


All times are GMT -4. The time now is 10:42 AM.


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