You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/PLUGINSV3/API.md
+41-42Lines changed: 41 additions & 42 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -69,28 +69,29 @@ class MyWidget(QWidget):
69
69
70
70
## Class References
71
71
72
-
The following classes are available through the `api` object:
73
-
74
-
-`api.Album` - Album object
75
-
-`api.Track` - Track object
76
-
-`api.File` - File base class (for custom formats)
77
-
-`api.Cluster` - Cluster object
78
-
-`api.Metadata` - Metadata container for tags
79
-
-`api.BaseAction` - Base class for UI actions
80
-
-`api.OptionsPage` - Base class for options pages
81
-
-`api.CoverArtImage` - Cover art image object
82
-
-`api.CoverArtProvider` - Base class for cover art providers
83
-
-`api.ProviderOptions` - Base class for cover art provider option pages
72
+
The following classes are available through the `api` module:
73
+
74
+
-`Album` - Album object
75
+
-`Track` - Track object
76
+
-`File` - File base class (for custom formats)
77
+
-`Cluster` - Cluster object
78
+
-`Metadata` - Metadata container for tags
79
+
-`BaseAction` - Base class for UI actions
80
+
-`OptionsPage` - Base class for options pages
81
+
-`CoverArtImage` - Cover art image object
82
+
-`CoverArtProvider` - Base class for cover art providers
83
+
-`ProviderOptions` - Base class for cover art provider option pages
84
+
-`ScriptParser` - A parser for parsing tagger scripts
84
85
85
86
**Example**:
86
87
```python
87
-
from picard.plugin3.api import BaseAction, OptionsPage, File, CoverArtProvider
88
-
from picard.metadata import Metadata
88
+
from picard.plugin3.api import BaseAction, OptionsPage, File, CoverArtProvider, Metadata
89
89
90
90
classMyProvider(CoverArtProvider):
91
91
NAME="My Provider"
92
92
93
93
classMyFormat(File):
94
+
NAME="Custom Format"
94
95
EXTENSIONS= [".custom"]
95
96
96
97
def_load(self, filename):
@@ -99,10 +100,9 @@ class MyFormat(File):
99
100
return metadata
100
101
```
101
102
102
-
**Note**: Classes that are considered part of the API `Metadata`, `Track`, `Album`, etc.
103
-
should be accessed via their aliases defined in `PluginApi`, e.g. `PluginApi.Track`.
104
-
This is also the case for classes meant for inheritance (`BaseAction`, `OptionsPage`,
105
-
`File`, `CoverArtProvider`).
103
+
**Note**: Classes that are considered part of the API like `Metadata`, `Track`, `Album`,
104
+
etc. should be imported directly from `picard.plugin3.api` instead from elsewhere
105
+
in Picard.
106
106
107
107
---
108
108
@@ -216,9 +216,9 @@ def enable(api):
216
216
217
217
**In OptionsPage:**
218
218
```python
219
-
from picard.plugin3 import PluginApi
219
+
from picard.plugin3.apiimport PluginApi, OptionsPage
220
220
221
-
classMyOptionsPage(PluginApi.OptionsPage):
221
+
classMyOptionsPage(OptionsPage):
222
222
def__init__(self):
223
223
super().__init__()
224
224
# Initialize the UI here
@@ -385,8 +385,7 @@ Mark a string for translation extraction without translating it immediately.
385
385
This is a marker function that allows you to define translatable strings at module level or in data structures before the API is available. At runtime, it simply returns the key (or tuple for plurals) unchanged.
386
386
387
387
```python
388
-
from picard.plugin3 import PluginApi
389
-
from picard.plugin3.api import t_
388
+
from picard.plugin3.api import PluginApi, BaseAction, t_
0 commit comments