![]() |
#511 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,450
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
@capink: what do you think about a template function
Code:
is_book_var_defined('var_name') The function would get around the ambiguity between a defined book_var that contains '' and an undefined book_var. Something like this: Code:
if is_book_var_defined('foo') then result = book_vars('foo') else result = field('whatever') fi; result |
![]() |
![]() |
![]() |
#512 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,199
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
Yes, I can see the use for this. Will add to the next release.
|
![]() |
![]() |
![]() |
#513 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,199
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
On a second thought, wouldn't a defined_book_vars() that returns a list of defined vars for book cover more ground? We can test for the above using:
Code:
str_in_list(defined_book_vars(), ',', 'var_name', 1, '') |
![]() |
![]() |
![]() |
#514 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,450
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
On the plus side: in addition to checking for individual book vars, your suggestion has the advantage of being able to ask about more than one variable at once, as in Code:
list_contains(defined_book_vars(), ',', '^(var_name1|var_name2)$', 1, '') Code:
list_contains(defined_book_vars(), ',', '^var_name.*$', 1, '') I think I lean in the same direction you do: the generality is better. And anyway, if someone really wants to use the original suggestion then they can do it with a stored template. Code:
program: arguments(var_name); if str_in_list(defined_book_vars(), ',', 'var_name', 1, '') then '1' else '' fi Code:
program: arguments(var_name); if str_in_list(defined_book_vars(), ',', 'var_name', 1, '') then return('1') else return('') fi |
|
![]() |
![]() |
![]() |
#515 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,450
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Another topic: while playing with actions today I noticed that some of the template dialogs, for example the Template Scope one, have extra fields related to stored templates, specifically the template name and the documentation. I am changing TemplateDialog to permit you to hide them.
With the changed TemplateDialog I tested this in Action Chains.templates.py and it works. Starting at line 404: Code:
TemplateDialog.__init__(self, parent, text, mi=mi, text_is_placeholder=text_is_placeholder, all_functions=self.all_functions, builtin_functions=builtin_functions, global_vars=global_vars) self.setup_saved_template_editor(show_buttonbox=not dialog_is_st_editor, show_doc_and_name=False) |
![]() |
![]() |
![]() |
#516 | |||
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,199
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
Quote:
Quote:
Quote:
|
|||
![]() |
![]() |
![]() |
#517 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,450
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
|
![]() |
![]() |
![]() |
#518 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,199
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
Quote:
![]() |
|
![]() |
![]() |
![]() |
#519 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,637
Karma: 12595249
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
|
Thank you both of you, I'll try to make it work tomorrow, and I'll be back with my misadventures for sure
![]() |
![]() |
![]() |
![]() |
#520 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,027
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
I found a tyop!
|
![]() |
![]() |
![]() |
#521 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,199
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
Version 1.7.0
The new persistent storage allows template functions to save data permanently. Here is how you can save a variable to persistent storage: Code:
set_persistent_vars('name', 'value') Code:
set_persistent_vars('name', 'value', current_library_name()) Code:
ns = strcat(current_library_name(), '.', field(id)); set_persistent_vars('name', 'value', ns) Code:
ns = strcat(current_library_name(), '.', field(id)); persistent_vars('name', ns) Finally, the action_chains_single_click_edit tweak makes it possible still edit by single clicking, which you lose when you set the tweak (in case you want to connect the double click event to a chain): Code:
doubleclick_on_library_view = 'do_nothing' |
![]() |
![]() |
![]() |
#522 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,450
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Code:
doubleclick_on_library_view = 'do_nothing' Code:
action_chains_single_click_edit = True |
|
![]() |
![]() |
![]() |
#523 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,199
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
Yes, that is what supposed to happen. Have you tried double clicking on an already selected book? It does not happen when you double click on book that is not selected.
|
![]() |
![]() |
![]() |
#524 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,450
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
|
|
![]() |
![]() |
![]() |
#525 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,199
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
Quote:
After more testing, it seems to be chain dependent. When I tested with some chains that contain only one action, it behaved normally. The chain I was initially testing with (attached below) has two conditional actions and it always triggers the abnormal behavior. This might suggest that the problem is somewhere in my code? Not really sure. Will investigate more and see if I get to the bottom of this. Edit: After testing some more, I think I found the culprit. The chain loop makes this call between actions: Code:
QApplication.processEvents() Last edited by capink; 04-13-2021 at 06:44 PM. |
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Action Chains Resources | capink | Plugins | 78 | Today 04:01 AM |
[Editor Plugin] Editor Chains | capink | Plugins | 106 | 06-17-2025 05:36 PM |
[GUI Plugin] Noosfere_util, a companion plugin to noosfere DB | lrpirlet | Plugins | 2 | 08-18-2022 03:15 PM |
[GUI Plugin] Save Virtual Libraries To Column (GUI) | chaley | Plugins | 14 | 04-04-2021 05:25 AM |