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

 MobileRead Forums [GUI Plugin] Entities Manager

01-05-2019, 03:37 PM   #16
BetterRed
null operator

Posts: 12,498
Karma: 10634266
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
 Originally Posted by DaltonST Perhaps automating the creation and maintenance of the various rules is the best way to go forward. Could you Export your column rules and attach them to your previous post so I have a "control" data set to compare to while testing?
That's an interesting idea.

I've added a zip to my previous post. They're made up rules to illustrate appearance, they don't draw on information from EM.

BR

 01-05-2019, 06:23 PM #17 DaltonST Deviser     Posts: 1,382 Karma: 101268 Join Date: Aug 2013 Location: Texas Device: 8" Win10 Tablet w/Calibre64 EM Version 1.0.4 now can create "icon with text" "Entity Type Column" "has" "Value" rules using entities.png as the icon. I have no conceptual problem with adding new rules, since EM is using the Preferences > Look & Feel > icon rules dialogs "behind the scenes" to do all of the work so that Calibre cannot tell the difference between an EM-created rule and a human-created rule. However, removing existing rules is not something I am comfortable with. Not at all. So, "orphan" rules that will no longer be used because the underlying Entity was deleted from Calibre's metadata are an issue for a human to rectify manually. Also, given the labor-intensive nature of manually creating rules for other-than-EM, I am going to have EM stash multiple back-up copies of existing rules in an export-format file. Probably in "...\calibre\plugins\em_data\". After reflecting on the "@" symbol, Version 1.0.4 of EM will automatically convert all existing EM data from "@" to "~", and the ToolTips etc. have been changed to reflect the "~" tilde. That is because I may want to create "real" @User Categories for each EM Entity Type having existing Entities of that Type along with their Values underneath in the Tag Browser, and I don't want any ambiguity about that tentatively possible future functionality that may or may not ever exist. DaltonST
01-06-2019, 06:34 PM   #18
BetterRed
null operator

Posts: 12,498
Karma: 10634266
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
 Originally Posted by DaltonST EM Version 1.0.4 now can create "icon with text" "Entity Type Column" "has" "Value" rules using entities.png as the icon.
Ahem - I think you forgot to update first post with a new zip

BR

 01-06-2019, 11:56 PM #19 DaltonST Deviser     Posts: 1,382 Karma: 101268 Join Date: Aug 2013 Location: Texas Device: 8" Win10 Tablet w/Calibre64 1.0.4 is under development.
 01-07-2019, 12:45 AM #20 BetterRed null operator   Posts: 12,498 Karma: 10634266 Join Date: Mar 2012 Location: Sydney Australia Device: none Ah, the thought "Wow that was damn quick." did flash through my mind, but the quoted sentence is definitely in the present tense, so . . . There have been a couple of instances of other PI developers forgetting to post updates -- no names, no pack-drill I suggest making the icon generation configurable - some people might not like them being sprinkled through their book lists BR Last edited by BetterRed; 01-07-2019 at 12:48 AM.
01-07-2019, 02:16 AM   #21
BetterRed
null operator

Posts: 12,498
Karma: 10634266
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
 Originally Posted by BetterRed I suggest making the icon generation configurable - some people might not like them being sprinkled through their book lists
That make me think - but what if user wants to attach an icon that is unrelated to entities to a cell that might also have an entity icon because it has some entity-info (Note, Link, Association)?

This can be achieved by using 'composed icons with text', viz:

I've used a composed icon rule on Title if the column File Date is set, and I've changed the 'entity' icon rule I had for Related to a composed icon. I've also changed the icon rules I had on Publisher and Tags to composed icons.

When I use composed icons I make use of a transparent icon to force consistent alignment of icons and text.

BR
Attached Files
 column_icon_rules.zip (791 Bytes, 22 views)

Last edited by BetterRed; 01-07-2019 at 02:39 AM.

 01-07-2019, 05:58 PM #22 DaltonST Deviser     Posts: 1,382 Karma: 101268 Join Date: Aug 2013 Location: Texas Device: 8" Win10 Tablet w/Calibre64 Deleted since Version 1.0.4 has been released. Last edited by DaltonST; 01-08-2019 at 01:12 PM. Reason: Version 1.0.4 released
 01-07-2019, 07:13 PM #23 BetterRed null operator   Posts: 12,498 Karma: 10634266 Join Date: Mar 2012 Location: Sydney Australia Device: none Looking good. One thing concerns me: that the EM generated column icon rules will not be easily distinguishable from user created column icon rules - other than the fact that they use the entity_reserved.png icon. I wonder if chaley would be amenable to adding a 'hidden' flag on column icon and colour rules, and a show/hide hidden rules toggle on the L&F Colour and Icon rules dialogue tabs. Aside: I don't much like the stylised 'e' as a column icon - too obtrusive. But I quite like the Entities Manager toolbar icon. So I will replace entity_reserved.png with a copy the of entities_manager.png -- unless you beat me to it BR
 01-07-2019, 09:55 PM #24 DaltonST Deviser     Posts: 1,382 Karma: 101268 Join Date: Aug 2013 Location: Texas Device: 8" Win10 Tablet w/Calibre64 The EM generated column icon rules will be easily distinguishable from user created column icon rules in Look & Feel if all of the EM generated rules are first removed by executing the new utility in "Remove" mode, leaving only the user created rules. It is trivial and fast to re-add the EM generated rules. DaltonST
 01-08-2019, 01:09 PM #25 DaltonST Deviser     Posts: 1,382 Karma: 101268 Join Date: Aug 2013 Location: Texas Device: 8" Win10 Tablet w/Calibre64 Version 1.0.4 Entity 'Column Icon Rules': automatic creation Version 1.0.4 - 2019-01-08 Entity Column Icon Rules automatic creation. '@Entity Types' converted to '~Entity Types'. Refer to the image attached to the Original Post, which includes important ToolTips. ToolTips, including Menu ToolTips, are the documentation for EM. You must hover your mouse over the Menus to see the Menu ToolTips. If you "tear-off" the EM menus, the ToolTips will no longer be active and cannot be viewed upon mouse-hover. DaltonST
01-08-2019, 03:15 PM   #26
DaltonST
Deviser

Posts: 1,382
Karma: 101268
Join Date: Aug 2013
Location: Texas
Device: 8" Win10 Tablet w/Calibre64
Composed Icon Column Rules & Color Column Rules

Quote:
 What if user wants to attach an icon that is unrelated to entities to a cell that might also have an entity icon because it has some entity-info (Note, Link, Association)?
I have tested having an "icon with text" rule created by EM plus a manually-created "composed with text" rule for 2+ other icons. The key is "2+" (not "1") other icons.

If only 1 composed icon is used, then the Library View only shows the composed single icon, and not also the EM icon. Add a 2nd icon to the composed rule (tell it there are multiple icons), and all 3 appear. Telling it that multiple icons exist force it to show all available icons regardless of the source of each icon.

However, Calibre Look & Feel does not update the Library View icons properly when such a rule is first created, so a restart of Calibre is required for everything to show properly (i.e., multiple icons assumed to exist): 2 icons (even if 1 is transparent) from the composed rule, and 1 icon from the EM rule. 3 total icons appear.

So, it would seem that EM should do nothing related to composed icon rules since the user can do anything they want to add additional icons as long as they specify at least 2 icons.

Quote:
 Column Color Rules
This would be easy to do by adapting the current 'icon with text' function for colors with a special #abcdef color. Emphasis on the 'special'. As in 'unique' to the Library for color rules. Just like 'entity_reserved.png' tells EM that it created a particular rule, there must be a 'reserved color' that each user chooses.

Example: they like and already use in other color rules the RGC color 230/20/220 which is html code #e614dc. They could simply increment the ending RGC color digits to make 231/21/221 which is html code #e715dd, and set that as their "unique" EM color. I cannot see the difference, but the html codes that are physically stored within the rules will be different.

I created a text color rule that already had a 2-icon (1 was transparent) composed with text rule plus an EM icon with text rule, and all of it displayed properly.

I am going to move forward with the Column Color Rules concept described above for EM.

DaltonST

01-08-2019, 04:31 PM   #27
BetterRed
null operator

Posts: 12,498
Karma: 10634266
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
 Originally Posted by DaltonST I have tested having an "icon with text" rule created by EM plus a manually-created "composed with text" rule for 2+ other icons. The key is "2+" (not "1") other icons. If only 1 composed icon is used, then the Library View only shows the composed single icon, and not also the EM icon. Add a 2nd icon to the composed rule (tell it there are multiple icons), and all 3 appear. Telling it that multiple icons exist force it to show all available icons regardless of the source of each icon. However, Calibre Look & Feel does not update the Library View icons properly when such a rule is first created, so a restart of Calibre is required for everything to show properly (i.e., multiple icons assumed to exist): 2 icons (even if 1 is transparent) from the composed rule, and 1 icon from the EM rule. 3 total icons appear. So, it would seem that EM should do nothing related to composed icon rules since the user can do anything they want to add additional icons as long as they specify at least 2 icons.
I imagine the most common scenario is that the user would want to have a single regular icon and the entities icon, rather than several icons (composed icons) and the entities icon.

A factor we forgot to consider was the option of icons with no text, I often use this on long text columns, especially those containing HTML, which can look messy/misleading when displayed in book list.

So, I'm wondering if the Entity Definition ought have some icon related settings:
1. Show entity icon in book list: [checkbox]
2. Icon rule type: [same drop down list as the Set the widget in L&F column icons)
3. Icon to use: drop down of the cc_icons folder
If 1 is not checked 2 and 3 would be disabled (greyed out)

I don't use column colouring at all, so I am less able to comment on it with respect to EM.

Aside 1 : I discovered that after I pop the 'main' EM dialogue, I can click a cell in the book list and then press the QP button (top right) to populate the Entiity type and Value widgets, same for the QP button in Associations... and if the selected cell is multiple value you get to choose which value - that's very cool.

Aside 2: If you are looking for something to do, a plugin that presented the Preferences icon array as a nested keyboard navigable list at the press of a key (e.g Alt+P) would be very cool too

BR

Last edited by BetterRed; 01-08-2019 at 04:35 PM.

01-08-2019, 08:13 PM   #28
BetterRed
null operator

Posts: 12,498
Karma: 10634266
Join Date: Mar 2012
Location: Sydney Australia
Device: none
I Added a Scope Note to Princeton Press, then I did this:

I got this:

Code:
calibre, version 3.37.0
ERROR: Unhandled exception: <b>AttributeError</b>:'unicode' object has no attribute 'template'

calibre 3.37 [64bit]  embedded-python: True is64bit: True
Windows-10-10.0.17134-SP0 Windows ('64bit', 'WindowsPE')
('Windows', '10', '10.0.17134')
Python 2.7.12+
Windows: ('10', '10.0.17134', 'SP0', u'Multiprocessor Free')
Interface language: None
Successfully initialized third party plugins: Entities Manager (1, 0, 4) && Job Spy (1, 0, 137) && Count Pages (1, 8, 2) && EpubSplit (2, 6, 0) && Extract ISBN (1, 4, 4) && View Manager (1, 3, 2) && Reading List (1, 6, 6) && Beam Ebooks (1, 0, 0) && Generate Cover (1, 5, 21) && CalibreSpy (1, 0, 66) && User Category (1, 5, 3) && Barnes & Noble (1, 2, 15) && Quality Check (1, 9, 11) && GetFileName (0, 0, 13) && Drop Search Results (1, 0, 8) && Favourites Menu (1, 0, 4) && Resize Cover (1, 0, 3) && Goodreads (1, 4, 0) && Modify ePub (1, 3, 13) && Find Duplicates (1, 6, 3)
Traceback (most recent call last):
File "calibre_plugins.entities_manager.ui", line 1289, in add_column_icon_with_text_rules
File "calibre_plugins.entities_manager.ui", line 1302, in maintain_column_icon_with_text_rules
File "calibre_plugins.entities_manager.ui", line 1421, in add_new_entity_column_rules
AttributeError: 'unicode' object has no attribute 'template'
This is what I have for Entities

Quote:
 Entity: Publisher Princeton press Link: Note: Scope Princeton press scope note Association: __________________________________________________ ______________________ Entity: Title À la recherche du temps perdu Link: Note: Association: ~Search_for-lost_time ➕ __________________________________________________ ______________________ Entity: ~Association (Title �� À la recherche du temps perdu ⇄ ~Search_for-lost_time �� ➕) Link: Note: Association: __________________________________________________ ______________________ Entity: ~Search_for-lost_time ➕ Link: Note: Association: Title À la recherche du temps perdu __________________________________________________ ______________________
I cleared the Entities database using the option in EM->Utilities and Checked the database, and re-added the Scope note, and got the same error when I used the same option.

I should add after adding the Note and exiting the EM dialogue I expected to see the entity_reserved.png icon alongside Princeton press in the book list - when I didn't I tried the Add/refresh ... option. But, there is no icon rule in L&F for the Publisher column - maybe I am misunderstanding something.

Might be useful to put a copy to clipboard and/or Save to file button(s) on the List Entities popup. Its' surprising how few think of doing a ctrl/+a, ctrl+c etc, when faced with something like that popup.

BR

Last edited by BetterRed; 01-08-2019 at 08:35 PM.

01-08-2019, 09:24 PM   #29
BetterRed
null operator

Posts: 12,498
Karma: 10634266
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
 Originally Posted by BetterRed I should add after adding the Note and exiting the EM dialogue I expected to see the entity_reserved.png icon alongside Princeton press in the book list - when I didn't I tried the Add/refresh ... option. But, there is no icon rule in L&F for the Publisher column - maybe I am misunderstanding something.
Which I sort of was, the icons don't appear automatically - you do have to ask for them.

I started again on a library with no existing icon rules, I added my Scope note for Princeton Press and this time when I selected the Add/refresh option I got an explanatory popup and the entity_reserved icon appeared beside Princeton Press.

So the error I was getting must have been related to existing icon rules, of which there were plenty. Perhaps the error message could give a hint as to which column icon rule caused the problem - e.g. the column lookup name.

But when I added a Scope note to another Publisher, the icon did not appear against that publisher after I did the Add Refresh. So I went into L&F Column icons to have a look at what EM had placed there, nothing out of the ordinary - so I shuffled the order of the two rules and clicked Apply, and the icon appeared on the other publisher.

I'm attaching the column_icon.rules file.

BR
Attached Files
 column_icon_rules.zip (482 Bytes, 24 views)

Last edited by BetterRed; 01-08-2019 at 09:32 PM.

 01-08-2019, 09:44 PM #30 DaltonST Deviser     Posts: 1,382 Karma: 101268 Join Date: Aug 2013 Location: Texas Device: 8" Win10 Tablet w/Calibre64 EM deletes all EM created rules every time that it runs, and then adds new ones based on the current EM entities. That line 1421 was checking a rule's template for the existence of the reserved icon name, and then to delete the rule if it was found. The rule was missing the important template for the column rule, so threw an exception. I have changed the above to be bullet-proof if any future errors occur. That is what Beta testing is for. What I do not understand is why the error happened. You had uninstalled EM, which deleted all EM tables including all data, created a few new entities, then ran the icon rule program. The previous EM rules still existed, since they are Calibre and not EM. EM was deleting all of them when it failed, but the fact that the rules belonged to entities that no longer existed in EM does not matter, as long as the rules that do exist are not corrupted. There is a missing link here that I need to find. If you wack the EM tables again, please first delete all of the existing icon rules in Look & Feel by running the Remove option. Or, delete them manually. DaltonST