Commit Graph

11025 Commits

Author SHA1 Message Date
Laurent Monin
f1c5bb4e48 Introduce a base exception class PicardScriptError 2024-05-27 11:59:07 +02:00
Laurent Monin
e46428c3a4 ScriptImportExportError -> PicardScriptImportExportError 2024-05-27 11:59:07 +02:00
Laurent Monin
4fc43af380 ScriptImportError -> PicardScriptFromFileError 2024-05-27 11:59:07 +02:00
Laurent Monin
3761c7e492 TaggingScript -> PicardTaggingScript
- it's less ambiguous vs TaggingScriptSetting
- it's a subclass of PicardScript
2024-05-27 11:59:07 +02:00
Laurent Monin
dec700e9ed Consistently name list items list_item(s) 2024-05-27 11:59:07 +02:00
Laurent Monin
e70d1fbda0 script_item -> tagging_script 2024-05-27 11:59:07 +02:00
Laurent Monin
9bf130dc06 export_script(): rename variables and simplify code 2024-05-27 11:59:07 +02:00
Laurent Monin
1f49e7809f Replace enabled_tagger_scripts_texts() with iter_active_tagging_scripts()
- it iterates over enabled and non-empty tagger scripts
- it yields TaggingScriptSetting objects
2024-05-27 11:59:07 +02:00
Laurent Monin
2207e9f034 Pass TaggingScriptSetting instance if possible 2024-05-27 11:59:07 +02:00
Laurent Monin
fe88e79665 Use iter_tagging_scripts_from_*() 2024-05-27 11:59:07 +02:00
Laurent Monin
e801f83da4 Introduce TaggingScriptSetting and few helper methods 2024-05-27 11:59:07 +02:00
Laurent Monin
cdbf6431b2 Merge pull request #2498 from zas/config_syntax_colors
PICARD-2913: Let user configure syntax highlighting colors
2024-05-27 11:33:22 +02:00
Philipp Wolfer
bf454353b9 update plural rules in Spanish and Italian po files 2024-05-27 08:52:33 +02:00
Laurent Monin
a2906f2853 Let user configure syntax highlighting colors 2024-05-26 20:36:04 +02:00
Laurent Monin
1676cf1dba Merge pull request #2497 from phw/missing-function-tooltip
PICARD-2912: Show a tooltip for missing functions in script editor
2024-05-26 16:31:56 +02:00
Philipp Wolfer
f95ac57379 PICARD-2912: Show a tooltip for missing functions in script editor 2024-05-26 11:33:10 +02:00
Laurent Monin
27a6caac1d Merge pull request #2491 from zas/ignoreupdatescontext
Improve IgnoreUpdatesContext and use it for MainWindow sorting
2024-05-26 11:05:36 +02:00
Laurent Monin
5f21a6b5b9 Merge pull request #2488 from zas/image_list_cleanup
Image list cleanup
2024-05-26 11:05:16 +02:00
Laurent Monin
4de1cf830f Merge pull request #2492 from zas/scripteditor_hl
PICARD-2912: Script editor syntax highlighting fixes and improvements
2024-05-26 11:00:02 +02:00
Philipp Wolfer
f78d02e415 Fix misleading comment on dark theme colors 2024-05-26 10:41:24 +02:00
Laurent Monin
99e9cfe9c2 Introduce HighlightFormat and HighlightRule classes, simplify code 2024-05-25 22:08:14 +02:00
Laurent Monin
548a7f092b No need to make all regex and matching formats properties, move them near their use
- Most are used once to build rules
- rules themselves are stored in a property
2024-05-25 22:08:14 +02:00
Laurent Monin
383716783e Use a namedtuple to describe rules
Suggested by rdswift
2024-05-25 22:08:14 +02:00
Laurent Monin
5b565eba7d Avoid using match as variable name
See https://docs.python.org/3/reference/compound_stmts.html#the-match-statement
2024-05-25 22:08:14 +02:00
Laurent Monin
2735b54403 If a rule already matched a part of the text, don't apply next rules
So first rules have priority over later ones.
2024-05-25 22:08:14 +02:00
Laurent Monin
fb699cbda7 Properly match existing functions, and differentiate them from unknown ones
Before this patch, `$numXXX()` was highlighted the same way as `$num()`, even though it was raising a syntax error.
After this patch they have different formats.
2024-05-25 22:08:14 +02:00
Laurent Monin
3ef967a3d7 Fix special_re matching, causing alternative colors on sequence of commas and parenthesis
Before this patch, ",,,," was handled as ",," and ",," subsets, and only last character was highlighted.
Use a negative lookbehind assertion to avoid this issue, it still handles escaped characters.
2024-05-25 22:08:14 +02:00
Laurent Monin
cbc425c7d7 Add few blank lines to make code easier to read 2024-05-25 22:08:14 +02:00
Laurent Monin
e4168b5385 Merge pull request #2494 from zas/avoid_using_match
match -> match_: match is a statement in Python 3.10+
2024-05-25 19:56:08 +02:00
Laurent Monin
d771f6f3e9 Introduce ProgressStatus class and use an instance of it to pass values around 2024-05-25 19:03:39 +02:00
Laurent Monin
b1bd41016a Fix AttributeError: 'ScriptEditorDialog' object has no attribute 'unsaved_changes_confirmation'
Traceback (most recent call last):
  File "/home/zas/src/picard/./picard/ui/mainwindow/__init__.py", line 300, in closeEvent
    if not self.script_editor_dialog.unsaved_changes_confirmation():
AttributeError: 'ScriptEditorDialog' object has no attribute 'unsaved_changes_confirmation'. Did you mean: 'unsaved_changes_in_profile_confirmation'?

This issue was introduced in e253ef4956
2024-05-25 18:57:35 +02:00
Laurent Monin
2835732962 match -> match_: match is a statement in Python 3.10+
It doesn't really conflict with variable name but it confuses syntax highlighters (if they are Python 3.10+ aware ofc)
2024-05-25 12:21:31 +02:00
Laurent Monin
21e8d53d39 Use MainWindow.suspend_sorting context manager whenever possible 2024-05-24 13:46:46 +02:00
Laurent Monin
7ec728e9e1 MainPanel: log when sorting is enabled/disabled, and only do it when needed 2024-05-24 13:46:46 +02:00
Laurent Monin
8e2826e36a MainWindow: introduce suspend_sorting IgnoreUpdatesContext 2024-05-24 13:46:46 +02:00
Laurent Monin
abfdbb3ac6 IgnoreUpdatesContext: add on_last_exit and matching tests 2024-05-24 13:46:46 +02:00
Laurent Monin
977c4e5602 IgnoreUpdatesContext: rename __exit__() parameters to match Python documentation
It avoids defining `type` which is a builtin.
2024-05-24 13:46:46 +02:00
Laurent Monin
ef14f46744 IgnoreUpdatesContext: add on_first_enter and matching tests 2024-05-24 13:46:45 +02:00
Laurent Monin
5e499e5dcd Test nested on_exit/on_enter 2024-05-24 13:46:45 +02:00
Laurent Monin
c24c9133e9 IgnoreUpdatesContext: add on_enter and matching test 2024-05-24 13:46:45 +02:00
Laurent Monin
b60d98febe IgnoreUpdatesContext: onexit -> on_exit 2024-05-24 13:46:45 +02:00
Laurent Monin
b5aedad683 Merge pull request #2490 from zas/clustering
Clustering: use tuple and improve debug logging
2024-05-24 13:46:24 +02:00
Laurent Monin
cbf4adc2ba Fix and improve Clustering debug output
- it was logging something like `Clustering <itertools.chain object at 0x7f318466ae60>`
- Now it will log something like:
`Clustering 21 files: (<FLACFile '1-01 Amsterdam, Amsterdam!.flac'>, <FLACFile '1-02 Them There Eyes.flac'>, <FLACFile "1-03 Sinner's Prayer.flac">, <FLACFile "1-04 Can't Let Go.flac">, <FLACFile '1-05 For My Friends.flac'>) and 16 more files...
`
- logged sequence of files is truncated to 5 files, but the number of files is shown in all cases
2024-05-24 12:18:31 +02:00
Laurent Monin
745767bcce cluster()/_do_clustering(): pass files as tuple instead of list
- the sequence isn't modified anywhere between cluster() and _clustering_finished() (that loops over it)
2024-05-24 12:15:24 +02:00
Laurent Monin
d46d4bb08a remove_metadata_images() -> remove_metadata_images_from_children()
Not perfect, but it used the same scheme as other methods in this group at least
2024-05-23 16:08:03 +02:00
Laurent Monin
75bfb1c274 add_metadata_images() -> add_metadata_images_from_children()
It does what it says.
2024-05-23 16:05:55 +02:00
Laurent Monin
8920c415ba Compare sets of keys, rather than dict_keys 2024-05-23 16:02:54 +02:00
Laurent Monin
8ca7f2cd21 Also test return values 2024-05-23 15:58:37 +02:00
Laurent Monin
df00e4522d Make remove_metadata_images() returns a boolean indicating changes like similar methods 2024-05-23 15:44:30 +02:00
Laurent Monin
8e09dfce07 iter_children_items_metadata(): use an ignore set instead of matching class instance 2024-05-23 15:24:15 +02:00