03-13-2013, 08:54 AM | #61 |
Grand Sorcerer
Posts: 11,731
Karma: 6690881
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
You do an OR by creating more than one rule for the same column/icon. Order is important: the first rule that evaluates to TRUE is used and the rest are not evaluated. To get a true OR, the rules must have the same setup (column, text, icon).
|
03-14-2013, 12:08 AM | #62 |
Grand Sorcerer
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
That's what I had done as I hadn't even noticed I could have multiple conditions. But as I had managed to use different options, I was thinking it would be nice to group them together.
|
Advert | |
|
03-30-2013, 03:35 PM | #63 |
Member
Posts: 13
Karma: 1034
Join Date: Mar 2010
Location: NC
Device: PB 360
|
This is a really cool feature! Is there anyway to allow wider icons though?
I had an idea for using these custom icons to implement half-star ratings, by using different images of each star rating. But when I tried it, the icons got shrunk down so I could barely see the stars. This would just be a really nice way to do custom half-star ratings. I'm using a custom float column now, but the numbers don't have the same immediate visual impact that seeing the stars do. |
03-31-2013, 07:03 AM | #64 | |
Grand Sorcerer
Posts: 11,731
Karma: 6690881
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
The next release (it is available in source now) will display an image non-square if the image's width is more than 1.5 times the image's height. The bounding box will be (row_height by min(image_width, 128)). If the image width is more than 128 it will be resized to 128, preserving aspect ratio. If after resizing the image height is more than row height it will be center-clipped. Why these rules? To preserve existing behavior while allowing what you trying to do. This should work for you as you are clearly prepared to make the images. Assuming 1/2 stars you would need 11 images, 1 for empty and one for each 1/2 star increment; and 11 rules to select the correct image. My guess is that the images should have a height of around 20 to 24 pixels, but you should experiment a bit to find the best shape for your display. |
|
03-31-2013, 10:23 AM | #65 |
Member
Posts: 13
Karma: 1034
Join Date: Mar 2010
Location: NC
Device: PB 360
|
Ah, awesome! Thank you for adding support for this! I love the column icons and how visually attractive they are, it's a nice way to highlight certain metadata.
|
Advert | |
|
04-18-2013, 05:43 PM | #66 |
Enthusiast
Posts: 25
Karma: 10
Join Date: Mar 2013
Location: Canada
Device: iPhone, iPad, Sony, Kobo
|
Hi Chaley. I am attempting to use the icons but running into trouble trying to get the text to show. I have read through your comments and the only thing I am having an issue with is that when I select "text with a fixed set of values" it doesn't permit me to leave values empty it requires at least one entry.
I use the icons a little different. I have a column titled Read. It is set to show one of three icons based on the Shelves column that I use with the Goodreads plugin. (it works great just no text). This shows the two columns: This shows the rules: And this is the column setup Icons show. No text. My only reason for doing this is I would like to be able to set up a few more complicated rules but I want to be able to filter on them, which I can't right now. Any ideas? Thanks for your help. |
04-18-2013, 05:59 PM | #67 |
Grand Sorcerer
Posts: 11,731
Karma: 6690881
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
@rifka: sorry but I dont understand exactly what you are asking.
Columns with a fixed set of values always include the empty value. You don't need to specify it and you can't remove it. The text that shows in a column is the text in that column, not the text in columns referenced in the rule. If you want text from another column you will need to use something like a 'column built from other columns'. I hope I answered at least one of your questions. |
04-23-2013, 01:16 PM | #68 |
Enthusiast
Posts: 25
Karma: 10
Join Date: Mar 2013
Location: Canada
Device: iPhone, iPad, Sony, Kobo
|
Actually Chaley you answered my question perfectly. One more question:
How do I get the Icons field to recognize greater than, less than, and equal to. I have discover that: if the NUMBER column IS <1 doesn't work. Thanks again for your help |
04-23-2013, 03:03 PM | #69 | |
Grand Sorcerer
Posts: 11,731
Karma: 6690881
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
I have no time for several weeks to look at whether relational ops can be added without breaking much. I might forget so if you feel like it and still need it, remind me. |
|
04-25-2013, 05:33 PM | #70 |
Enthusiast
Posts: 25
Karma: 10
Join Date: Mar 2013
Location: Canada
Device: iPhone, iPad, Sony, Kobo
|
You created it. NUMBER is {#releasedate:'days_between($, today())'}. I'll make a note to remind you in a couple of weeks.
Meanwhile can you make this work: {#number_index: ifempty(na),>=1, calendar, star} So if NUMBER is empty then "NA". if NUMBER is greater than or equal to 1 then "calendar", otherwise "star". Am I even close? Tx |
04-26-2013, 05:57 PM | #71 | |
Grand Sorcerer
Posts: 11,731
Karma: 6690881
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
I am not near a real computer so typing programs isn't straightforward. That said, the template would look something like Code:
program: n = field('#number_index'); test(n, cmp(n, 1, 'star', 'calendar', 'calendar'), 'n/a') |
|
05-06-2013, 02:49 PM | #72 |
Enthusiast
Posts: 25
Karma: 10
Join Date: Mar 2013
Location: Canada
Device: iPhone, iPad, Sony, Kobo
|
I'm not sure what to do with what you gave me. The formula I gave you went into the template field for a new column.
Basically what I want is: if the NUMBER field is blank then "NA" if the NUMBER field is greater than 0 then "calendar" if the NUMBER field is less than 0 then "star" Thanks Last edited by rifka; 05-06-2013 at 02:49 PM. Reason: error |
05-06-2013, 03:46 PM | #73 | |
Grand Sorcerer
Posts: 11,731
Karma: 6690881
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
|
|
05-14-2013, 11:05 AM | #74 | |
Grand Sorcerer
Posts: 11,731
Karma: 6690881
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Rather than continuing to add special purpose rule types, I bit the bullet and added "advanced rules" for column icons. This kind of rule already existed for column colors. An advanced rule is a general program mode template that should return the name of the icon file to use or the empty string if no icon is to be used. This kind of rule allows arbitrary rules, subject to the ability to express the rule in the template language. The following is an example of a (rather silly) rule that chooses between two icons based on whether the author's name contains the word "weber". Code:
program: a = field('authors'); contains(a, 'weber', 'arrow-down.png', 'catalog.png') Code:
program: a = field('#myNumber'); cmp(a, 2, 'arrow-down.png', 'catalog.png', 'debug.png') |
|
06-17-2013, 03:56 PM | #75 |
Enthusiast
Posts: 33
Karma: 10
Join Date: Aug 2010
Location: NJ, USA
Device: iPad mini 4, iPhone 6s
|
Hello. I have a question about using custom icons. How do I delete an icon from the drop-down on the Add rule screen? Even if I delete the icon from the resources\images folder in Calibre Settings or if I add a revised icon with the same name, Calibre doesn't seem to pick up the change.
Thanks. DJRM |
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
how to move value(s) of tag column to a custom made column | zoorakhan | Library Management | 0 | 12-08-2012 03:53 AM |
custom date column from two state column | Dopedangel | Library Management | 7 | 01-03-2012 08:20 AM |
Can custom book data be displayed in a custom column? | kiwidude | Development | 9 | 03-02-2011 05:35 AM |
Custom Icons not Honored in 0.7.18 | edbro | Calibre | 1 | 09-10-2010 09:15 PM |
Custom Icons for Your ePub Files | Zero9 | ePub | 1 | 06-09-2009 07:45 PM |