View Single Post
Old 04-01-2021, 11:13 AM   #474
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: 12,465
Karma: 8025600
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by capink View Post
@chaley: Attached to this post is a beta that adds scope management to the plugin. I will leave it for few days for testing before releasing it. I'd like to hear your feedback on this.
First comments:
  • The "Chain Variables" action template
    Code:
    program:
    	set_book_vars('sum', sum)
    fails with the exception
    Code:
    Traceback (most recent call last):
      File "...\calibre_dev\src\calibre\utils\formatter.py", line 1098, in expr
      File "...\calibre_dev\src\calibre\utils\formatter.py", line 843, in do_node_func
      File "...\calibre_dev\src\calibre\utils\formatter_functions.py", line 136, in eval_
      File "calibre_plugins.action_chains.templates", line 181, in evaluate
    AttributeError: 'ChainInterfaceAction' object has no attribute 'book_vars'
    The same thing happens with "Formula" actions.
  • You have a self.resize(700, 750) on line 424 of templates.py. The template dialog now remembers its geometry, so I think you can remove that.
  • I don't think you need the big "Icons keys" bar across the middle of the Add actions dialog. Use tooltips on the icons in the table.
  • You should disable the "Action scopes" combo box if the action doesn't support scopes. More about this below.
  • I would consider getting rid of the new first-level button dialog, replacing it with top-level menu items. As it is that dialog forces "extra" clicks. The only one missing from the top-level menu is "Keyboard Shortcuts. Reserve "Customize plugin" for when the user is doing something plugin-wide, such as if you add fonts or color schemes. Alternatively use a second-level menu.
  • Perhaps put tooltips on the menu items that "configure", adding more information about what they do.
I had trouble working out what buttons did and when I should/could use them. The following would be easier for me, but perhaps not everyone. The suggestions are predicated on using two columns for the icons, one for the conditions and one for the scopes. Visually their vertical alignment is "better", it avoids the centering problem, and it makes a blank space significant.

I would then for action conditions:
  • Add a "lock open" icon. This icon shows when there isn't a condition.
  • Double-clicking on either the open or closed lock brings up the condition dialog.
  • Right-clicking on the closed lock brings up a context menu offering "edit" and "delete"
  • Right-clicking on an open icon offers "create", which is the same as edit.
  • If it is possible to have actions on which a condition cannot be applied, put no icon in the cell.
  • Remove the "Conditions" combo box.
For scopes:
  • Don't have an "Action doesn't support scopes" icon. An empty table cell would indicate that no scope can be set. If you want to be fancy you could add a tooltip to the empty table cell saying that no scope is possible
  • Repurpose the "crossed eye" as "scope not set"
  • Double-clicking on the "scope set" icon (the uncrossed eye) opens the selected scope manager.
  • Right-clicking on the "scope set" icon opens a context menu offering edit and delete scope. Hmmm... perhaps better words are "attach scope" and "detach scope".
  • Double-clicking on the "scope not set" icon brings up the scope selector.
  • Right-clicking on the scope not set icon brings up a context menu offering the scope selector. Same as double-clicking.
  • Remove the "Scopes" combo box.

The scoping stuff works as I expect. I changed my sample "Average Ratings" chain to use the scope "Act on all books", deleting the selection modifiers. It worked, was fast, and didn't mess with the selection in the library view.

I couldn't test some things because of the chain_vars exception.

Regarding:
Quote:
Finally, Here is an example of a custom scope manager that uses a template defined by the user to return the list of book_ids (copy/paste into the module editor):
This sounds like a fine standard scope manager.

Regarding
Quote:
Edit3: Also the third option in Basic Scopes: "Act on books in that have values in Book Vars" is not at all user friendly and not descriptive enough. If anyone have better alternative?
You might consider short labels with long tooltips that explain what it means. I think it is impossible to have labels that both are concise and explain what the user needs to know. Tooltips are used as documentation throughout calibre so a calibre user would expect that.
chaley is offline   Reply With Quote