summaryrefslogtreecommitdiff
path: root/tidal_dl_ng/ui/__init__.py
blob: 3c4a724380ae1192bc1b9feb4b94db2ec4379e77 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
"""UI package initializer.

- Ensures that `tidal_dl_ng.ui.dialog_playlist_manager` exposes both the generated
  `Ui_DialogPlaylistManager` and the implementation `PlaylistManagerDialog`.
- Does not modify generated UI .py files; composes at import time.
"""

from __future__ import annotations

import importlib
from types import ModuleType

# Import generated UI module
_ui_mod: ModuleType = importlib.import_module("tidal_dl_ng.ui.dialog_playlist_manager")

# Attach the implementation class from gui
try:
    from tidal_dl_ng.gui.dialog_playlist_manager import PlaylistManagerDialog as _ImplDialog
except Exception:
    _ImplDialog = None  # type: ignore[assignment]

if _ImplDialog is not None:
    _ui_mod.PlaylistManagerDialog = _ImplDialog

# Re-export for convenience when importing from the package
if _ImplDialog is not None:
    PlaylistManagerDialog = _ImplDialog  # type: ignore[assignment]

try:
    from tidal_dl_ng.ui.dialog_playlist_manager import Ui_DialogPlaylistManager as _UiClass
except Exception:
    _UiClass = None  # type: ignore[assignment]

if _UiClass is not None:
    Ui_DialogPlaylistManager = _UiClass  # type: ignore[assignment]

__all__ = [name for name in ("PlaylistManagerDialog", "Ui_DialogPlaylistManager") if name in globals()]