Refactor GUI package structure and update imports
Moved all files from src/gui/ to ytsage/gui/ and updated import statements to use relative imports within the new package structure. This improves modularity and prepares the codebase for distribution as a proper Python package.
This commit is contained in:
@@ -5,14 +5,14 @@ import subprocess
|
|||||||
from PySide6.QtCore import QMetaObject, Qt, Q_ARG, QThread, Signal
|
from PySide6.QtCore import QMetaObject, Qt, Q_ARG, QThread, Signal
|
||||||
from PySide6.QtWidgets import QMessageBox
|
from PySide6.QtWidgets import QMessageBox
|
||||||
|
|
||||||
from src.core.ytsage_utils import validate_video_url, parse_yt_dlp_error
|
from ..core.ytsage_utils import validate_video_url, parse_yt_dlp_error
|
||||||
from src.core.ytsage_yt_dlp import get_yt_dlp_path
|
from ..core.ytsage_yt_dlp import get_yt_dlp_path
|
||||||
from src.utils.ytsage_constants import SUBPROCESS_CREATIONFLAGS
|
from ..utils.ytsage_constants import SUBPROCESS_CREATIONFLAGS
|
||||||
from src.utils.ytsage_localization import _
|
from ..utils.ytsage_localization import _
|
||||||
from src.utils.ytsage_logger import logger
|
from ..utils.ytsage_logger import logger
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from src.gui.ytsage_gui_main import YTSageApp
|
from .ytsage_gui_main import YTSageApp
|
||||||
|
|
||||||
|
|
||||||
class AnalysisThread(QThread):
|
class AnalysisThread(QThread):
|
||||||
@@ -12,18 +12,18 @@ This package contains all dialog classes organized by functionality:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
# Re-export all dialog classes for backward compatibility
|
# Re-export all dialog classes for backward compatibility
|
||||||
from src.gui.ytsage_gui_dialogs.ytsage_dialogs_base import AboutDialog, LogWindow
|
from .ytsage_dialogs_base import AboutDialog, LogWindow
|
||||||
from src.gui.ytsage_gui_dialogs.ytsage_dialogs_custom import CustomOptionsDialog, TimeRangeDialog
|
from .ytsage_dialogs_custom import CustomOptionsDialog, TimeRangeDialog
|
||||||
from src.gui.ytsage_gui_dialogs.ytsage_dialogs_ffmpeg import FFmpegCheckDialog, FFmpegInstallThread
|
from .ytsage_dialogs_ffmpeg import FFmpegCheckDialog, FFmpegInstallThread
|
||||||
from src.gui.ytsage_gui_dialogs.ytsage_dialogs_history import HistoryDialog
|
from .ytsage_dialogs_history import HistoryDialog
|
||||||
from src.gui.ytsage_gui_dialogs.ytsage_dialogs_selection import (
|
from .ytsage_dialogs_selection import (
|
||||||
PlaylistSelectionDialog,
|
PlaylistSelectionDialog,
|
||||||
SponsorBlockCategoryDialog,
|
SponsorBlockCategoryDialog,
|
||||||
SubtitleSelectionDialog,
|
SubtitleSelectionDialog,
|
||||||
)
|
)
|
||||||
from src.gui.ytsage_gui_dialogs.ytsage_dialogs_settings import AutoUpdateSettingsDialog, DownloadSettingsDialog
|
from .ytsage_dialogs_settings import AutoUpdateSettingsDialog, DownloadSettingsDialog
|
||||||
from src.gui.ytsage_gui_dialogs.ytsage_dialogs_update import AutoUpdateThread, UpdateThread, VersionCheckThread, YTDLPUpdateDialog
|
from .ytsage_dialogs_update import AutoUpdateThread, UpdateThread, VersionCheckThread, YTDLPUpdateDialog
|
||||||
from src.gui.ytsage_gui_dialogs.ytsage_dialogs_updater import UpdaterTabWidget
|
from .ytsage_dialogs_updater import UpdaterTabWidget
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
# Base dialogs
|
# Base dialogs
|
||||||
+7
-7
@@ -19,13 +19,13 @@ from PySide6.QtWidgets import (
|
|||||||
QWidget,
|
QWidget,
|
||||||
)
|
)
|
||||||
|
|
||||||
from src import __version__ as APP_VERSION
|
from ... import __version__ as APP_VERSION
|
||||||
from src.utils.ytsage_localization import _
|
from ...utils.ytsage_localization import _
|
||||||
|
|
||||||
from src.core.ytsage_ffmpeg import get_ffmpeg_path
|
from ...core.ytsage_ffmpeg import get_ffmpeg_path
|
||||||
from src.core.ytsage_utils import _version_cache, check_ffmpeg, get_ffmpeg_version, get_ytdlp_version, get_deno_version, refresh_version_cache
|
from ...core.ytsage_utils import _version_cache, check_ffmpeg, get_ffmpeg_version, get_ytdlp_version, get_deno_version, refresh_version_cache
|
||||||
from src.core.ytsage_yt_dlp import check_ytdlp_installed, get_yt_dlp_path
|
from ...core.ytsage_yt_dlp import check_ytdlp_installed, get_yt_dlp_path
|
||||||
from src.core.ytsage_deno import check_deno_installed, get_deno_path
|
from ...core.ytsage_deno import check_deno_installed, get_deno_path
|
||||||
|
|
||||||
|
|
||||||
class LogWindow(QDialog):
|
class LogWindow(QDialog):
|
||||||
@@ -459,7 +459,7 @@ class AboutDialog(QDialog):
|
|||||||
# Only show path if it's not the fallback "deno" and the file exists
|
# Only show path if it's not the fallback "deno" and the file exists
|
||||||
if deno_path and deno_path != "deno":
|
if deno_path and deno_path != "deno":
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from src.utils.ytsage_constants import DENO_APP_BIN_PATH
|
from ...utils.ytsage_constants import DENO_APP_BIN_PATH
|
||||||
# Check if the path is our managed binary
|
# Check if the path is our managed binary
|
||||||
if Path(deno_path).resolve() == DENO_APP_BIN_PATH.resolve():
|
if Path(deno_path).resolve() == DENO_APP_BIN_PATH.resolve():
|
||||||
deno_path_text = deno_path
|
deno_path_text = deno_path
|
||||||
+8
-8
@@ -29,16 +29,16 @@ from PySide6.QtWidgets import (
|
|||||||
QWidget,
|
QWidget,
|
||||||
)
|
)
|
||||||
|
|
||||||
from src.core.ytsage_yt_dlp import get_yt_dlp_path
|
from ...core.ytsage_yt_dlp import get_yt_dlp_path
|
||||||
from src.core.ytsage_utils import update_auto_update_settings
|
from ...core.ytsage_utils import update_auto_update_settings
|
||||||
from src.utils.ytsage_constants import YTDLP_DOCS_URL
|
from ...utils.ytsage_constants import YTDLP_DOCS_URL
|
||||||
from src.utils.ytsage_config_manager import ConfigManager
|
from ...utils.ytsage_config_manager import ConfigManager
|
||||||
from src.utils.ytsage_localization import LocalizationManager, _
|
from ...utils.ytsage_localization import LocalizationManager, _
|
||||||
from src.utils.ytsage_logger import logger
|
from ...utils.ytsage_logger import logger
|
||||||
from src.gui.ytsage_gui_dialogs.ytsage_dialogs_updater import UpdaterTabWidget
|
from .ytsage_dialogs_updater import UpdaterTabWidget
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from src.gui.ytsage_gui_main import YTSageApp # only for type hints (no runtime import)
|
from ..ytsage_gui_main import YTSageApp # only for type hints (no runtime import)
|
||||||
|
|
||||||
|
|
||||||
class CommandWorker(QObject):
|
class CommandWorker(QObject):
|
||||||
+3
-3
@@ -9,9 +9,9 @@ from PySide6.QtCore import Qt, QThread, Signal
|
|||||||
from PySide6.QtGui import QIcon
|
from PySide6.QtGui import QIcon
|
||||||
from PySide6.QtWidgets import QDialog, QHBoxLayout, QLabel, QPushButton, QVBoxLayout
|
from PySide6.QtWidgets import QDialog, QHBoxLayout, QLabel, QPushButton, QVBoxLayout
|
||||||
|
|
||||||
from src.core.ytsage_ffmpeg import auto_install_ffmpeg, check_ffmpeg_installed
|
from ...core.ytsage_ffmpeg import auto_install_ffmpeg, check_ffmpeg_installed
|
||||||
from src.utils.ytsage_constants import ICON_PATH
|
from ...utils.ytsage_constants import ICON_PATH
|
||||||
from src.utils.ytsage_localization import _
|
from ...utils.ytsage_localization import _
|
||||||
|
|
||||||
|
|
||||||
class FFmpegInstallThread(QThread):
|
class FFmpegInstallThread(QThread):
|
||||||
+5
-5
@@ -37,13 +37,13 @@ from PySide6.QtWidgets import (
|
|||||||
QApplication
|
QApplication
|
||||||
)
|
)
|
||||||
|
|
||||||
from src.utils.ytsage_history_manager import HistoryManager
|
from ...utils.ytsage_history_manager import HistoryManager
|
||||||
from src.utils.ytsage_constants import APP_THUMBNAILS_DIR, SUBPROCESS_CREATIONFLAGS
|
from ...utils.ytsage_constants import APP_THUMBNAILS_DIR, SUBPROCESS_CREATIONFLAGS
|
||||||
from src.utils.ytsage_localization import _
|
from ...utils.ytsage_localization import _
|
||||||
from src.utils.ytsage_logger import logger
|
from ...utils.ytsage_logger import logger
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from src.gui.ytsage_gui_main import YTSageApp
|
from ..ytsage_gui_main import YTSageApp
|
||||||
|
|
||||||
|
|
||||||
class HistoryLoaderThread(QThread):
|
class HistoryLoaderThread(QThread):
|
||||||
+1
-1
@@ -17,7 +17,7 @@ from PySide6.QtWidgets import (
|
|||||||
QWidget,
|
QWidget,
|
||||||
)
|
)
|
||||||
|
|
||||||
from src.utils.ytsage_localization import _
|
from ...utils.ytsage_localization import _
|
||||||
|
|
||||||
|
|
||||||
class SubtitleSelectionDialog(QDialog):
|
class SubtitleSelectionDialog(QDialog):
|
||||||
+3
-3
@@ -27,9 +27,9 @@ from PySide6.QtWidgets import (
|
|||||||
QVBoxLayout,
|
QVBoxLayout,
|
||||||
)
|
)
|
||||||
|
|
||||||
from src.utils.ytsage_logger import logger
|
from ...utils.ytsage_logger import logger
|
||||||
from src.utils.ytsage_localization import _
|
from ...utils.ytsage_localization import _
|
||||||
from src.utils.ytsage_config_manager import ConfigManager
|
from ...utils.ytsage_config_manager import ConfigManager
|
||||||
|
|
||||||
|
|
||||||
class DownloadSettingsDialog(QDialog):
|
class DownloadSettingsDialog(QDialog):
|
||||||
+7
-7
@@ -14,16 +14,16 @@ from packaging import version
|
|||||||
from PySide6.QtCore import Qt, QThread, QTimer, Signal
|
from PySide6.QtCore import Qt, QThread, QTimer, Signal
|
||||||
from PySide6.QtWidgets import QDialog, QHBoxLayout, QLabel, QProgressBar, QPushButton, QVBoxLayout
|
from PySide6.QtWidgets import QDialog, QHBoxLayout, QLabel, QProgressBar, QPushButton, QVBoxLayout
|
||||||
|
|
||||||
from src.core.ytsage_utils import get_ytdlp_version
|
from ...core.ytsage_utils import get_ytdlp_version
|
||||||
from src.core.ytsage_yt_dlp import get_yt_dlp_path
|
from ...core.ytsage_yt_dlp import get_yt_dlp_path
|
||||||
from src.utils.ytsage_constants import OS_NAME, SUBPROCESS_CREATIONFLAGS, YTDLP_APP_BIN_PATH, YTDLP_DOWNLOAD_URL
|
from ...utils.ytsage_constants import OS_NAME, SUBPROCESS_CREATIONFLAGS, YTDLP_APP_BIN_PATH, YTDLP_DOWNLOAD_URL
|
||||||
from src.utils.ytsage_config_manager import ConfigManager
|
from ...utils.ytsage_config_manager import ConfigManager
|
||||||
from src.utils.ytsage_localization import LocalizationManager
|
from ...utils.ytsage_localization import LocalizationManager
|
||||||
|
|
||||||
# Shorthand for localization
|
# Shorthand for localization
|
||||||
_ = LocalizationManager.get_text
|
_ = LocalizationManager.get_text
|
||||||
from src.utils.ytsage_localization import _
|
from ...utils.ytsage_localization import _
|
||||||
from src.utils.ytsage_logger import logger
|
from ...utils.ytsage_logger import logger
|
||||||
|
|
||||||
|
|
||||||
class VersionCheckThread(QThread):
|
class VersionCheckThread(QThread):
|
||||||
+9
-9
@@ -23,25 +23,25 @@ from PySide6.QtWidgets import (
|
|||||||
QWidget,
|
QWidget,
|
||||||
)
|
)
|
||||||
|
|
||||||
from src.core.ytsage_utils import (
|
from ...core.ytsage_utils import (
|
||||||
get_auto_update_settings,
|
get_auto_update_settings,
|
||||||
get_ffmpeg_version_direct,
|
get_ffmpeg_version_direct,
|
||||||
update_auto_update_settings,
|
update_auto_update_settings,
|
||||||
)
|
)
|
||||||
from src.core.ytsage_yt_dlp import get_yt_dlp_path
|
from ...core.ytsage_yt_dlp import get_yt_dlp_path
|
||||||
from src.core.ytsage_deno import check_deno_update, upgrade_deno
|
from ...core.ytsage_deno import check_deno_update, upgrade_deno
|
||||||
from src.gui.ytsage_gui_dialogs.ytsage_dialogs_update import YTDLPUpdateDialog
|
from .ytsage_dialogs_update import YTDLPUpdateDialog
|
||||||
from src.utils.ytsage_config_manager import ConfigManager
|
from ...utils.ytsage_config_manager import ConfigManager
|
||||||
from src.utils.ytsage_localization import _
|
from ...utils.ytsage_localization import _
|
||||||
from src.utils.ytsage_logger import logger
|
from ...utils.ytsage_logger import logger
|
||||||
from src.utils.ytsage_constants import (
|
from ...utils.ytsage_constants import (
|
||||||
FFMPEG_7Z_VERSION_URL,
|
FFMPEG_7Z_VERSION_URL,
|
||||||
OS_NAME,
|
OS_NAME,
|
||||||
SUBPROCESS_CREATIONFLAGS,
|
SUBPROCESS_CREATIONFLAGS,
|
||||||
)
|
)
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from src.gui.ytsage_gui_dialogs.ytsage_dialogs_custom import CustomOptionsDialog
|
from .ytsage_dialogs_custom import CustomOptionsDialog
|
||||||
|
|
||||||
|
|
||||||
# Helper functions for FFmpeg version checking (copied from removed ytsage_ffmpeg_updater.py)
|
# Helper functions for FFmpeg version checking (copied from removed ytsage_ffmpeg_updater.py)
|
||||||
@@ -4,10 +4,10 @@ from PySide6.QtCore import QObject, Qt, Signal
|
|||||||
from PySide6.QtGui import QColor, QFontMetrics
|
from PySide6.QtGui import QColor, QFontMetrics
|
||||||
from PySide6.QtWidgets import QCheckBox, QHBoxLayout, QHeaderView, QSizePolicy, QTableWidget, QTableWidgetItem, QWidget
|
from PySide6.QtWidgets import QCheckBox, QHBoxLayout, QHeaderView, QSizePolicy, QTableWidget, QTableWidgetItem, QWidget
|
||||||
|
|
||||||
from src.utils.ytsage_localization import _
|
from ..utils.ytsage_localization import _
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from src.gui.ytsage_gui_main import YTSageApp
|
from .ytsage_gui_main import YTSageApp
|
||||||
|
|
||||||
|
|
||||||
class FormatSignals(QObject):
|
class FormatSignals(QObject):
|
||||||
@@ -28,12 +28,12 @@ from PySide6.QtWidgets import (
|
|||||||
QWidget,
|
QWidget,
|
||||||
)
|
)
|
||||||
|
|
||||||
from src import __version__ as APP_VERSION
|
from .. import __version__ as APP_VERSION
|
||||||
from src.core.ytsage_downloader import DownloadThread, SignalManager # Import downloader related classes
|
from ..core.ytsage_downloader import DownloadThread, SignalManager # Import downloader related classes
|
||||||
from src.core.ytsage_utils import check_ffmpeg, load_saved_path, parse_yt_dlp_error, save_path, should_check_for_auto_update, validate_video_url
|
from ..core.ytsage_utils import check_ffmpeg, load_saved_path, parse_yt_dlp_error, save_path, should_check_for_auto_update, validate_video_url
|
||||||
from src.core.ytsage_yt_dlp import get_yt_dlp_path, setup_ytdlp # Import the new yt-dlp functions
|
from ..core.ytsage_yt_dlp import get_yt_dlp_path, setup_ytdlp # Import the new yt-dlp functions
|
||||||
from src.core.ytsage_deno import get_deno_path, setup_deno # Import the new Deno functions
|
from ..core.ytsage_deno import get_deno_path, setup_deno # Import the new Deno functions
|
||||||
from src.gui.ytsage_gui_dialogs import ( # use of src\gui\ytsage_gui_dialogs\__init__.py
|
from .ytsage_gui_dialogs import ( # use of src\gui\ytsage_gui_dialogs\__init__.py
|
||||||
AboutDialog,
|
AboutDialog,
|
||||||
AutoUpdateThread,
|
AutoUpdateThread,
|
||||||
CustomOptionsDialog,
|
CustomOptionsDialog,
|
||||||
@@ -44,10 +44,10 @@ from src.gui.ytsage_gui_dialogs import ( # use of src\gui\ytsage_gui_dialogs\__
|
|||||||
TimeRangeDialog,
|
TimeRangeDialog,
|
||||||
YTDLPUpdateDialog,
|
YTDLPUpdateDialog,
|
||||||
)
|
)
|
||||||
from src.gui.ytsage_gui_format_table import FormatTableMixin
|
from .ytsage_gui_format_table import FormatTableMixin
|
||||||
from src.gui.ytsage_gui_video_info import VideoInfoMixin
|
from .ytsage_gui_video_info import VideoInfoMixin
|
||||||
from src.gui.ytsage_gui_analysis import AnalysisMixin
|
from .ytsage_gui_analysis import AnalysisMixin
|
||||||
from src.utils.ytsage_constants import (
|
from ..utils.ytsage_constants import (
|
||||||
ICON_PATH,
|
ICON_PATH,
|
||||||
SOUND_PATH,
|
SOUND_PATH,
|
||||||
SUBPROCESS_CREATIONFLAGS,
|
SUBPROCESS_CREATIONFLAGS,
|
||||||
@@ -55,11 +55,11 @@ from src.utils.ytsage_constants import (
|
|||||||
AUDIO_EXTENSIONS,
|
AUDIO_EXTENSIONS,
|
||||||
SUBTITLE_EXTENSIONS,
|
SUBTITLE_EXTENSIONS,
|
||||||
)
|
)
|
||||||
from src.utils.ytsage_logger import logger
|
from ..utils.ytsage_logger import logger
|
||||||
from src.utils.ytsage_config_manager import ConfigManager
|
from ..utils.ytsage_config_manager import ConfigManager
|
||||||
from src.utils.ytsage_localization import LocalizationManager, _
|
from ..utils.ytsage_localization import LocalizationManager, _
|
||||||
from src.utils.ytsage_history_manager import HistoryManager
|
from ..utils.ytsage_history_manager import HistoryManager
|
||||||
from src.gui.ytsage_stylesheet import StyleSheet
|
from .ytsage_stylesheet import StyleSheet
|
||||||
|
|
||||||
from concurrent.futures import ThreadPoolExecutor, as_completed
|
from concurrent.futures import ThreadPoolExecutor, as_completed
|
||||||
|
|
||||||
@@ -10,15 +10,15 @@ from PySide6.QtCore import Qt, QThread, Signal
|
|||||||
from PySide6.QtGui import QPixmap
|
from PySide6.QtGui import QPixmap
|
||||||
from PySide6.QtWidgets import QHBoxLayout, QLabel, QPushButton, QVBoxLayout, QWidget
|
from PySide6.QtWidgets import QHBoxLayout, QLabel, QPushButton, QVBoxLayout, QWidget
|
||||||
|
|
||||||
from src.gui.ytsage_gui_dialogs import ( # use of src\gui\ytsage_gui_dialogs\__init__.py
|
from .ytsage_gui_dialogs import ( # use of src\gui\ytsage_gui_dialogs\__init__.py
|
||||||
SponsorBlockCategoryDialog,
|
SponsorBlockCategoryDialog,
|
||||||
SubtitleSelectionDialog,
|
SubtitleSelectionDialog,
|
||||||
)
|
)
|
||||||
from src.utils.ytsage_localization import _
|
from ..utils.ytsage_localization import _
|
||||||
from src.utils.ytsage_logger import logger
|
from ..utils.ytsage_logger import logger
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from src.gui.ytsage_gui_main import YTSageApp
|
from .ytsage_gui_main import YTSageApp
|
||||||
|
|
||||||
|
|
||||||
class ThumbnailDownloadThread(QThread):
|
class ThumbnailDownloadThread(QThread):
|
||||||
Reference in New Issue
Block a user