![]() |
#301 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,476
Karma: 8025702
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
![]() A variable is a container, not an alias. You set or change the contents of a variable by assigning to it. A copy is made of the result of computing the expression on the right-hand side of the '=' then then stored in the variable named on the left-hand side of the '='. The right-hand expression is evaluated before assignment so assigning to a variable doesn't affect the result of the expression. And vice versa, you can change anything that was used in a previous expression without changing what was stored in the variable. Examples: Code:
x = 5; # x contains the value 5. y = x + 1; # y contains 6 (5 + 1). x still contains 5. x = x + 10 # x contains 15 (5 + 10). y still contains 6. y = x + 1; # y contains 16 (15 + 1). x still contains 15. y = (x + y) * 2; # y contains 62 ((15 + 16) * 2). x still contains 15. y = x; # y contains 15. x still contains 15. y = y + 1 # y contains 16. x still contains 15. |
|
![]() |
![]() |
![]() |
#302 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,110
Karma: 77213681
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Thanks.
![]() Some stuff in the PyQt6 migration thread made me wonder: can template detect whether light or dark mode is in use? |
![]() |
![]() |
![]() |
#303 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,203
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
You can do it with a custom template function.
Code:
def evaluate(self, formatter, kwargs, mi, locals): from qt.core import QApplication if QApplication.instance().is_dark_theme: return 1 else: return '' arg count: -1 Code:
program: is_dark_theme() Last edited by capink; 01-25-2022 at 04:34 PM. |
![]() |
![]() |
![]() |
#304 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,110
Karma: 77213681
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Thanks.
![]() |
![]() |
![]() |
![]() |
#305 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,110
Karma: 77213681
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Is there any type of "goto" option in a template? e.g. if a book matches a certain check, then skip the rest of the if-tree and then go to the next one?
Last edited by ownedbycats; 01-26-2022 at 10:34 PM. |
![]() |
![]() |
![]() |
#306 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,476
Karma: 8025702
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
The language doesn't support goto. It does support continue, break, and return. |
|
![]() |
![]() |
![]() |
#307 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,110
Karma: 77213681
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Yeah, I meant nested ifs. Probably a nested if would work just as well.
|
![]() |
![]() |
![]() |
#308 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,476
Karma: 8025702
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
|
![]() |
![]() |
![]() |
#309 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,110
Karma: 77213681
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
If you mean the nested stored template thing, it's working on source.
![]() |
![]() |
![]() |
![]() |
#310 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,476
Karma: 8025702
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
|
![]() |
![]() |
![]() |
#311 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,110
Karma: 77213681
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
My addition was mostly just about how it only affected new stored templates. For example, I'd already had a nested template, fanfic_unreadchaps(). Duplicating it into fanfic_unreadchaps2() and swapping it in broke the nesting. Putting it back unbroke it. Just found that very strange.
|
![]() |
![]() |
![]() |
#312 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,110
Karma: 77213681
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Last edited by ownedbycats; 01-28-2022 at 01:52 AM. |
![]() |
![]() |
![]() |
#313 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,476
Karma: 8025702
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
|
![]() |
![]() |
![]() |
#314 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,110
Karma: 77213681
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Code:
if select(ids, 'url') then if '(Archive of Our Own|Fanfiction.net)' in $publisher && '(Completed|Abandoned|Oneshot|Incomplete)' in status then "metadata.png" elif !select(ids, 'ao3') && $publisher == 'Archive of Our Own' && status == 'In-Progress' then 'metadata.png' elif !select(ids, 'ffnet') && $publisher == 'FanFiction.net' && status == 'In-Progress' then "metadata.png" fi fi EDIT: Another question: Did I somehow accidentally turn it into last_non_empty? Last edited by ownedbycats; 01-29-2022 at 04:19 AM. |
![]() |
![]() |
![]() |
#315 | ||
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,476
Karma: 8025702
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Quote:
Code:
for x in $tags:'aa' rof |
||
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Library Management: various questions not worth their own thread | ownedbycats | Library Management | 234 | 08-22-2025 05:42 AM |
[Metadata Source Plugin] Questions regarding parse select, docs and ref templates | Boilerplate4U | Development | 13 | 07-07-2020 02:35 AM |
Questions on Kobo [Interfered with another thread topic] | spdavies | Kobo Reader | 8 | 10-12-2014 11:37 AM |
[OLD Thread] Some questions before buying the fire. | darthreader13 | Kindle Fire | 7 | 05-10-2013 09:19 PM |
Thread management questions | meme | Feedback | 6 | 01-31-2011 05:07 PM |