This commit is contained in:
afkarxyz committed 2025-07-26 11:55:30 +07:00
1 parent cd48b6f9bc
commit 77b443ace0
2 files changed
+215 -63

No files matched your search

+214 -63
View File
@@ -11,9 +11,10 @@ from datetime import datetime
from pathlib import Path from pathlib import Path
from packaging import version from packaging import version
from dataclasses import dataclass from dataclasses import dataclass
import qdarktheme
from PyQt6.QtWidgets import ( from PyQt6.QtWidgets import (
QApplication, QWidget, QVBoxLayout, QHBoxLayout, QPushButton, QLineEdit, QApplication, QWidget, QVBoxLayout, QHBoxLayout, QPushButton, QLineEdit,
QLabel, QFileDialog, QListWidget, QTextEdit, QTabWidget, QAbstractItemView, QSpacerItem, QSizePolicy, QProgressBar, QCheckBox, QDialog, QLabel, QFileDialog, QListWidget, QTextEdit, QTabWidget, QAbstractItemView, QProgressBar, QCheckBox, QDialog,
QDialogButtonBox, QComboBox, QListWidgetItem QDialogButtonBox, QComboBox, QListWidgetItem
) )
from PyQt6.QtCore import Qt, QThread, pyqtSignal, QUrl, QTimer, QTime, QSettings, QSize from PyQt6.QtCore import Qt, QThread, pyqtSignal, QUrl, QTimer, QTime, QSettings, QSize
@@ -313,26 +314,20 @@ class DownloadWorker(QThread):
class UpdateDialog(QDialog): class UpdateDialog(QDialog):
def __init__(self, current_version, new_version, parent=None): def __init__(self, current_version, new_version, parent=None):
super().__init__(parent) super().__init__(parent)
self.setWindowTitle("Update Available") self.setWindowTitle("Update Now")
self.setFixedWidth(400) self.setFixedWidth(400)
self.setModal(True) self.setModal(True)
layout = QVBoxLayout() layout = QVBoxLayout()
message = QLabel(f"A new version of Twitter/X Media Batch Downloader is available!\n\n" message = QLabel(f"Twitter/X Media Batch Downloader v{new_version} Available!")
f"Current version: v{current_version}\n"
f"New version: v{new_version}")
message.setWordWrap(True) message.setWordWrap(True)
layout.addWidget(message) layout.addWidget(message)
self.disable_check = QCheckBox("Turn off update checking")
self.disable_check.setCursor(Qt.CursorShape.PointingHandCursor)
layout.addWidget(self.disable_check)
button_box = QDialogButtonBox() button_box = QDialogButtonBox()
self.update_button = QPushButton("Update") self.update_button = QPushButton("Check")
self.update_button.setCursor(Qt.CursorShape.PointingHandCursor) self.update_button.setCursor(Qt.CursorShape.PointingHandCursor)
self.cancel_button = QPushButton("Cancel") self.cancel_button = QPushButton("Later")
self.cancel_button.setCursor(Qt.CursorShape.PointingHandCursor) self.cancel_button.setCursor(Qt.CursorShape.PointingHandCursor)
button_box.addButton(self.update_button, QDialogButtonBox.ButtonRole.AcceptRole) button_box.addButton(self.update_button, QDialogButtonBox.ButtonRole.AcceptRole)
@@ -348,7 +343,7 @@ class UpdateDialog(QDialog):
class TwitterMediaDownloaderGUI(QWidget): class TwitterMediaDownloaderGUI(QWidget):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
self.current_version = "3.1" self.current_version = "3.2"
self.accounts = [] self.accounts = []
self.temp_dir = os.path.join(tempfile.gettempdir(), "twitterxmediabatchdownloader") self.temp_dir = os.path.join(tempfile.gettempdir(), "twitterxmediabatchdownloader")
os.makedirs(self.temp_dir, exist_ok=True) os.makedirs(self.temp_dir, exist_ok=True)
@@ -367,6 +362,7 @@ class TwitterMediaDownloaderGUI(QWidget):
self.convert_gif = self.settings.value('convert_gif', False, type=bool) self.convert_gif = self.settings.value('convert_gif', False, type=bool)
self.gif_resolution = self.settings.value('gif_resolution', 'original') self.gif_resolution = self.settings.value('gif_resolution', 'original')
self.check_for_updates = self.settings.value('check_for_updates', True, type=bool) self.check_for_updates = self.settings.value('check_for_updates', True, type=bool)
self.current_theme_color = self.settings.value('theme_color', '#2196F3')
self.current_page = 0 self.current_page = 0
self.media_info = None self.media_info = None
@@ -401,10 +397,6 @@ class TwitterMediaDownloaderGUI(QWidget):
dialog = UpdateDialog(self.current_version, new_version, self) dialog = UpdateDialog(self.current_version, new_version, self)
result = dialog.exec() result = dialog.exec()
if dialog.disable_check.isChecked():
self.settings.setValue('check_for_updates', False)
self.check_for_updates = False
if result == QDialog.DialogCode.Accepted: if result == QDialog.DialogCode.Accepted:
QDesktopServices.openUrl(QUrl("https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/releases")) QDesktopServices.openUrl(QUrl("https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/releases"))
@@ -431,9 +423,8 @@ class TwitterMediaDownloaderGUI(QWidget):
def initUI(self): def initUI(self):
self.setWindowTitle('Twitter/X Media Batch Downloader') self.setWindowTitle('Twitter/X Media Batch Downloader')
self.setMinimumWidth(650) self.setFixedWidth(650)
self.setMinimumHeight(350) self.setMinimumHeight(350)
self.resize(650, 350)
icon_path = os.path.join(os.path.dirname(__file__), "icon.svg") icon_path = os.path.join(os.path.dirname(__file__), "icon.svg")
if os.path.exists(icon_path): if os.path.exists(icon_path):
@@ -457,7 +448,7 @@ class TwitterMediaDownloaderGUI(QWidget):
self.twitter_url.setText(self.last_url) self.twitter_url.setText(self.last_url)
self.twitter_url.textChanged.connect(self.save_url) self.twitter_url.textChanged.connect(self.save_url)
self.fetch_btn = QPushButton('Fetch') self.fetch_btn = QPushButton('Fetch')
self.fetch_btn.setFixedWidth(100) self.fetch_btn.setFixedWidth(80)
self.fetch_btn.setCursor(Qt.CursorShape.PointingHandCursor) self.fetch_btn.setCursor(Qt.CursorShape.PointingHandCursor)
self.fetch_btn.clicked.connect(self.fetch_account) self.fetch_btn.clicked.connect(self.fetch_account)
@@ -473,6 +464,7 @@ class TwitterMediaDownloaderGUI(QWidget):
self.setup_dashboard_tab() self.setup_dashboard_tab()
self.setup_process_tab() self.setup_process_tab()
self.setup_settings_tab() self.setup_settings_tab()
self.setup_theme_tab()
self.setup_about_tab() self.setup_about_tab()
def setup_dashboard_tab(self): def setup_dashboard_tab(self):
@@ -485,9 +477,6 @@ class TwitterMediaDownloaderGUI(QWidget):
self.account_list.setIconSize(QSize(36, 36)) self.account_list.setIconSize(QSize(36, 36))
self.account_list.setStyleSheet(""" self.account_list.setStyleSheet("""
QListWidget { QListWidget {
background-color: palette(base);
border: 1px solid palette(mid);
border-radius: 4px;
padding: 0px; padding: 0px;
outline: none; outline: none;
} }
@@ -495,11 +484,9 @@ class TwitterMediaDownloaderGUI(QWidget):
padding: 8px 12px; padding: 8px 12px;
margin: 2px 0px; margin: 2px 0px;
border: none; border: none;
border-radius: 4px;
outline: none; outline: none;
} }
QListWidget::item:selected { QListWidget::item:selected {
background-color: palette(highlight);
border: none; border: none;
outline: none; outline: none;
} }
@@ -507,9 +494,6 @@ class TwitterMediaDownloaderGUI(QWidget):
border: none; border: none;
outline: none; outline: none;
} }
QListWidget::item:hover {
background-color: palette(midlight);
}
""") """)
dashboard_layout.addWidget(self.account_list) dashboard_layout.addWidget(self.account_list)
@@ -529,7 +513,7 @@ class TwitterMediaDownloaderGUI(QWidget):
self.clear_btn = QPushButton('Clear') self.clear_btn = QPushButton('Clear')
for btn in [self.download_selected_btn, self.download_all_btn, self.remove_btn, self.clear_btn]: for btn in [self.download_selected_btn, self.download_all_btn, self.remove_btn, self.clear_btn]:
btn.setFixedWidth(150) btn.setMinimumWidth(120)
btn.setCursor(Qt.CursorShape.PointingHandCursor) btn.setCursor(Qt.CursorShape.PointingHandCursor)
self.download_selected_btn.clicked.connect(self.download_selected) self.download_selected_btn.clicked.connect(self.download_selected)
@@ -539,7 +523,7 @@ class TwitterMediaDownloaderGUI(QWidget):
self.btn_layout.addStretch() self.btn_layout.addStretch()
for btn in [self.download_selected_btn, self.download_all_btn, self.remove_btn, self.clear_btn]: for btn in [self.download_selected_btn, self.download_all_btn, self.remove_btn, self.clear_btn]:
self.btn_layout.addWidget(btn) self.btn_layout.addWidget(btn, 1)
self.btn_layout.addStretch() self.btn_layout.addStretch()
def setup_process_tab(self): def setup_process_tab(self):
@@ -567,8 +551,8 @@ class TwitterMediaDownloaderGUI(QWidget):
self.stop_btn = QPushButton('Stop') self.stop_btn = QPushButton('Stop')
self.pause_resume_btn = QPushButton('Pause') self.pause_resume_btn = QPushButton('Pause')
self.stop_btn.setFixedWidth(150) self.stop_btn.setFixedWidth(120)
self.pause_resume_btn.setFixedWidth(150) self.pause_resume_btn.setFixedWidth(120)
self.stop_btn.setCursor(Qt.CursorShape.PointingHandCursor) self.stop_btn.setCursor(Qt.CursorShape.PointingHandCursor)
self.pause_resume_btn.setCursor(Qt.CursorShape.PointingHandCursor) self.pause_resume_btn.setCursor(Qt.CursorShape.PointingHandCursor)
@@ -587,7 +571,7 @@ class TwitterMediaDownloaderGUI(QWidget):
self.stop_fetch_btn = QPushButton('Stop Fetch') self.stop_fetch_btn = QPushButton('Stop Fetch')
for btn in [self.next_batch_btn, self.auto_batch_btn, self.stop_fetch_btn]: for btn in [self.next_batch_btn, self.auto_batch_btn, self.stop_fetch_btn]:
btn.setFixedWidth(150) btn.setFixedWidth(120)
btn.setCursor(Qt.CursorShape.PointingHandCursor) btn.setCursor(Qt.CursorShape.PointingHandCursor)
self.next_batch_btn.setToolTip("Fetch next batch manually") self.next_batch_btn.setToolTip("Fetch next batch manually")
@@ -636,6 +620,7 @@ class TwitterMediaDownloaderGUI(QWidget):
self.output_dir.setText(self.last_output_path) self.output_dir.setText(self.last_output_path)
self.output_dir.textChanged.connect(self.save_settings) self.output_dir.textChanged.connect(self.save_settings)
self.output_browse = QPushButton('Browse') self.output_browse = QPushButton('Browse')
self.output_browse.setFixedWidth(80)
self.output_browse.setCursor(Qt.CursorShape.PointingHandCursor) self.output_browse.setCursor(Qt.CursorShape.PointingHandCursor)
self.output_browse.clicked.connect(self.browse_output) self.output_browse.clicked.connect(self.browse_output)
@@ -679,7 +664,7 @@ class TwitterMediaDownloaderGUI(QWidget):
first_row_layout = QHBoxLayout() first_row_layout = QHBoxLayout()
first_row_layout.setSpacing(5) first_row_layout.setSpacing(5)
self.batch_checkbox = QCheckBox("Batch") self.batch_checkbox = QCheckBox("Fetch Batch")
self.batch_checkbox.setCursor(Qt.CursorShape.PointingHandCursor) self.batch_checkbox.setCursor(Qt.CursorShape.PointingHandCursor)
self.batch_checkbox.setToolTip("Enable for accounts with thousands of media") self.batch_checkbox.setToolTip("Enable for accounts with thousands of media")
self.batch_checkbox.stateChanged.connect(self.handle_batch_checkbox) self.batch_checkbox.stateChanged.connect(self.handle_batch_checkbox)
@@ -745,7 +730,7 @@ class TwitterMediaDownloaderGUI(QWidget):
download_layout.addWidget(download_label) download_layout.addWidget(download_label)
batch_layout = QHBoxLayout() batch_layout = QHBoxLayout()
batch_label = QLabel('Batch Size:') batch_label = QLabel('Concurrent Downloads:')
self.download_batch_combo = QComboBox() self.download_batch_combo = QComboBox()
self.download_batch_combo.setCursor(Qt.CursorShape.PointingHandCursor) self.download_batch_combo.setCursor(Qt.CursorShape.PointingHandCursor)
@@ -764,7 +749,7 @@ class TwitterMediaDownloaderGUI(QWidget):
batch_layout.addWidget(self.download_batch_combo) batch_layout.addWidget(self.download_batch_combo)
batch_layout.addWidget(self.convert_gif_checkbox) batch_layout.addWidget(self.convert_gif_checkbox)
self.gif_resolution_label = QLabel("GIF Quality:") self.gif_resolution_label = QLabel("Converted GIF Quality:")
self.gif_resolution_combo = QComboBox() self.gif_resolution_combo = QComboBox()
self.gif_resolution_combo.setCursor(Qt.CursorShape.PointingHandCursor) self.gif_resolution_combo.setCursor(Qt.CursorShape.PointingHandCursor)
self.gif_resolution_combo.setFixedWidth(85) self.gif_resolution_combo.setFixedWidth(85)
@@ -793,19 +778,190 @@ class TwitterMediaDownloaderGUI(QWidget):
settings_tab.setLayout(settings_layout) settings_tab.setLayout(settings_layout)
self.tab_widget.addTab(settings_tab, "Settings") self.tab_widget.addTab(settings_tab, "Settings")
def setup_theme_tab(self):
theme_tab = QWidget()
theme_layout = QVBoxLayout()
theme_layout.setSpacing(8)
theme_layout.setContentsMargins(15, 15, 15, 15)
grid_layout = QVBoxLayout()
self.color_buttons = {}
first_row_palettes = [
("Red", [
("#FFCDD2", "100"), ("#EF9A9A", "200"), ("#E57373", "300"), ("#EF5350", "400"), ("#F44336", "500"), ("#E53935", "600"), ("#D32F2F", "700"), ("#C62828", "800"), ("#B71C1C", "900"), ("#FF8A80", "A100"), ("#FF5252", "A200"), ("#FF1744", "A400"), ("#D50000", "A700")
]),
("Pink", [
("#F8BBD0", "100"), ("#F48FB1", "200"), ("#F06292", "300"), ("#EC407A", "400"), ("#E91E63", "500"), ("#D81B60", "600"), ("#C2185B", "700"), ("#AD1457", "800"), ("#880E4F", "900"), ("#FF80AB", "A100"), ("#FF4081", "A200"), ("#F50057", "A400"), ("#C51162", "A700")
]),
("Purple", [
("#E1BEE7", "100"), ("#CE93D8", "200"), ("#BA68C8", "300"), ("#AB47BC", "400"), ("#9C27B0", "500"), ("#8E24AA", "600"), ("#7B1FA2", "700"), ("#6A1B9A", "800"), ("#4A148C", "900"), ("#EA80FC", "A100"), ("#E040FB", "A200"), ("#D500F9", "A400"), ("#AA00FF", "A700")
])
]
second_row_palettes = [
("Deep Purple", [
("#D1C4E9", "100"), ("#B39DDB", "200"), ("#9575CD", "300"), ("#7E57C2", "400"), ("#673AB7", "500"), ("#5E35B1", "600"), ("#512DA8", "700"), ("#4527A0", "800"), ("#311B92", "900"), ("#B388FF", "A100"), ("#7C4DFF", "A200"), ("#651FFF", "A400"), ("#6200EA", "A700")
]),
("Indigo", [
("#C5CAE9", "100"), ("#9FA8DA", "200"), ("#7986CB", "300"), ("#5C6BC0", "400"), ("#3F51B5", "500"), ("#3949AB", "600"), ("#303F9F", "700"), ("#283593", "800"), ("#1A237E", "900"), ("#8C9EFF", "A100"), ("#536DFE", "A200"), ("#3D5AFE", "A400"), ("#304FFE", "A700")
]),
("Blue", [
("#BBDEFB", "100"), ("#90CAF9", "200"), ("#64B5F6", "300"), ("#42A5F5", "400"), ("#2196F3", "500"), ("#1E88E5", "600"), ("#1976D2", "700"), ("#1565C0", "800"), ("#0D47A1", "900"), ("#82B1FF", "A100"), ("#448AFF", "A200"), ("#2979FF", "A400"), ("#2962FF", "A700")
])
]
third_row_palettes = [
("Light Blue", [
("#B3E5FC", "100"), ("#81D4FA", "200"), ("#4FC3F7", "300"), ("#29B6F6", "400"), ("#03A9F4", "500"), ("#039BE5", "600"), ("#0288D1", "700"), ("#0277BD", "800"), ("#01579B", "900"), ("#80D8FF", "A100"), ("#40C4FF", "A200"), ("#00B0FF", "A400"), ("#0091EA", "A700")
]),
("Cyan", [
("#B2EBF2", "100"), ("#80DEEA", "200"), ("#4DD0E1", "300"), ("#26C6DA", "400"), ("#00BCD4", "500"), ("#00ACC1", "600"), ("#0097A7", "700"), ("#00838F", "800"), ("#006064", "900"), ("#84FFFF", "A100"), ("#18FFFF", "A200"), ("#00E5FF", "A400"), ("#00B8D4", "A700")
]),
("Teal", [
("#B2DFDB", "100"), ("#80CBC4", "200"), ("#4DB6AC", "300"), ("#26A69A", "400"), ("#009688", "500"), ("#00897B", "600"), ("#00796B", "700"), ("#00695C", "800"), ("#004D40", "900"), ("#A7FFEB", "A100"), ("#64FFDA", "A200"), ("#1DE9B6", "A400"), ("#00BFA5", "A700")
])
]
fourth_row_palettes = [
("Green", [
("#C8E6C9", "100"), ("#A5D6A7", "200"), ("#81C784", "300"), ("#66BB6A", "400"), ("#4CAF50", "500"), ("#43A047", "600"), ("#388E3C", "700"), ("#2E7D32", "800"), ("#1B5E20", "900"), ("#B9F6CA", "A100"), ("#69F0AE", "A200"), ("#00E676", "A400"), ("#00C853", "A700")
]),
("Light Green", [
("#DCEDC8", "100"), ("#C5E1A5", "200"), ("#AED581", "300"), ("#9CCC65", "400"), ("#8BC34A", "500"), ("#7CB342", "600"), ("#689F38", "700"), ("#558B2F", "800"), ("#33691E", "900"), ("#CCFF90", "A100"), ("#B2FF59", "A200"), ("#76FF03", "A400"), ("#64DD17", "A700")
]),
("Lime", [
("#F0F4C3", "100"), ("#E6EE9C", "200"), ("#DCE775", "300"), ("#D4E157", "400"), ("#CDDC39", "500"), ("#C0CA33", "600"), ("#AFB42B", "700"), ("#9E9D24", "800"), ("#827717", "900"), ("#F4FF81", "A100"), ("#EEFF41", "A200"), ("#C6FF00", "A400"), ("#AEEA00", "A700")
])
]
fifth_row_palettes = [
("Yellow", [
("#FFF9C4", "100"), ("#FFF59D", "200"), ("#FFF176", "300"), ("#FFEE58", "400"), ("#FFEB3B", "500"), ("#FDD835", "600"), ("#FBC02D", "700"), ("#F9A825", "800"), ("#F57F17", "900"), ("#FFFF8D", "A100"), ("#FFFF00", "A200"), ("#FFEA00", "A400"), ("#FFD600", "A700")
]),
("Amber", [
("#FFECB3", "100"), ("#FFE082", "200"), ("#FFD54F", "300"), ("#FFCA28", "400"), ("#FFC107", "500"), ("#FFB300", "600"), ("#FFA000", "700"), ("#FF8F00", "800"), ("#FF6F00", "900"), ("#FFE57F", "A100"), ("#FFD740", "A200"), ("#FFC400", "A400"), ("#FFAB00", "A700")
]),
("Orange", [
("#FFE0B2", "100"), ("#FFCC80", "200"), ("#FFB74D", "300"), ("#FFA726", "400"), ("#FF9800", "500"), ("#FB8C00", "600"), ("#F57C00", "700"), ("#EF6C00", "800"), ("#E65100", "900"), ("#FFD180", "A100"), ("#FFAB40", "A200"), ("#FF9100", "A400"), ("#FF6D00", "A700")
])
]
for row_palettes in [first_row_palettes, second_row_palettes, third_row_palettes, fourth_row_palettes, fifth_row_palettes]:
row_layout = QHBoxLayout()
row_layout.setSpacing(15)
for palette_name, colors in row_palettes:
column_layout = QVBoxLayout()
column_layout.setSpacing(3)
palette_label = QLabel(palette_name)
palette_label.setStyleSheet("margin-bottom: 2px;")
palette_label.setAlignment(Qt.AlignmentFlag.AlignCenter)
column_layout.addWidget(palette_label)
color_buttons_layout = QHBoxLayout()
color_buttons_layout.setSpacing(3)
for color_hex, color_name in colors:
color_btn = QPushButton()
color_btn.setFixedSize(18, 18)
is_current = color_hex == self.current_theme_color
border_style = "2px solid #fff" if is_current else "none"
color_btn.setStyleSheet(f"""
QPushButton {{
background-color: {color_hex};
border: {border_style};
border-radius: 9px;
}}
QPushButton:hover {{
border: 2px solid #fff;
}}
QPushButton:pressed {{
border: 2px solid #fff;
}}
""")
color_btn.setCursor(Qt.CursorShape.PointingHandCursor)
color_btn.setToolTip(f"{palette_name} {color_name}\n{color_hex}")
color_btn.clicked.connect(lambda checked, color=color_hex, btn=color_btn: self.change_theme_color(color, btn))
self.color_buttons[color_hex] = color_btn
color_buttons_layout.addWidget(color_btn)
column_layout.addLayout(color_buttons_layout)
row_layout.addLayout(column_layout)
grid_layout.addLayout(row_layout)
theme_layout.addLayout(grid_layout)
theme_layout.addStretch()
theme_tab.setLayout(theme_layout)
self.tab_widget.addTab(theme_tab, "Theme")
def change_theme_color(self, color, clicked_btn=None):
if hasattr(self, 'color_buttons'):
for color_hex, btn in self.color_buttons.items():
if color_hex == self.current_theme_color:
btn.setStyleSheet(f"""
QPushButton {{
background-color: {color_hex};
border: none;
border-radius: 9px;
}}
QPushButton:hover {{
border: 2px solid #fff;
}}
QPushButton:pressed {{
border: 2px solid #fff;
}}
""")
break
self.current_theme_color = color
self.settings.setValue('theme_color', color)
self.settings.sync()
if clicked_btn:
clicked_btn.setStyleSheet(f"""
QPushButton {{
background-color: {color};
border: 2px solid #fff;
border-radius: 9px;
}}
QPushButton:hover {{
border: 2px solid #fff;
}}
QPushButton:pressed {{
border: 2px solid #fff;
}}
""")
qdarktheme.setup_theme(
custom_colors={
"[dark]": {
"primary": color,
}
}
)
def setup_about_tab(self): def setup_about_tab(self):
about_tab = QWidget() about_tab = QWidget()
about_layout = QVBoxLayout() about_layout = QVBoxLayout()
about_layout.setAlignment(Qt.AlignmentFlag.AlignCenter) about_layout.setAlignment(Qt.AlignmentFlag.AlignCenter)
about_layout.setSpacing(3) about_layout.setSpacing(15)
sections = [ sections = [
("Check for Updates", "https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/releases"), ("Check for Updates", "Check", "https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/releases"),
("Report an Issue", "https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/issues"), ("Report an Issue", "Report", "https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/issues"),
("gallery-dl Repository", "https://github.com/mikf/gallery-dl") ("gallery-dl Repository", "Visit", "https://github.com/mikf/gallery-dl")
] ]
for title, url in sections: for title, button_text, url in sections:
section_widget = QWidget() section_widget = QWidget()
section_layout = QVBoxLayout(section_widget) section_layout = QVBoxLayout(section_widget)
section_layout.setSpacing(10) section_layout.setSpacing(10)
@@ -816,34 +972,18 @@ class TwitterMediaDownloaderGUI(QWidget):
label.setAlignment(Qt.AlignmentFlag.AlignCenter) label.setAlignment(Qt.AlignmentFlag.AlignCenter)
section_layout.addWidget(label) section_layout.addWidget(label)
button = QPushButton("Click Here!") button = QPushButton(button_text)
button.setFixedWidth(150) button.setFixedSize(120, 25)
button.setStyleSheet("""
QPushButton {
background-color: palette(button);
color: palette(button-text);
border: 1px solid palette(mid);
padding: 6px;
border-radius: 15px;
}
QPushButton:hover {
background-color: palette(light);
}
QPushButton:pressed {
background-color: palette(midlight);
}
""")
button.setCursor(Qt.CursorShape.PointingHandCursor) button.setCursor(Qt.CursorShape.PointingHandCursor)
button.clicked.connect(lambda _, url=url: QDesktopServices.openUrl(QUrl(url if url.startswith(('http://', 'https://')) else f'https://{url}'))) button.clicked.connect(lambda _, url=url: QDesktopServices.openUrl(QUrl(url if url.startswith(('http://', 'https://')) else f'https://{url}')))
section_layout.addWidget(button, alignment=Qt.AlignmentFlag.AlignCenter) section_layout.addWidget(button, alignment=Qt.AlignmentFlag.AlignCenter)
about_layout.addWidget(section_widget)
if sections.index((title, url)) < len(sections) - 1:
spacer = QSpacerItem(20, 6, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Fixed)
about_layout.addItem(spacer)
footer_label = QLabel("v3.1 | gallery-dl v1.30.0 | July 2025") about_layout.addWidget(section_widget)
footer_label.setStyleSheet("font-size: 12px; margin-top: 10px;")
footer_label = QLabel(f"v{self.current_version} | July 2025")
footer_label.setStyleSheet("font-size: 12px; margin-top: 20px;")
about_layout.addWidget(footer_label, alignment=Qt.AlignmentFlag.AlignCenter) about_layout.addWidget(footer_label, alignment=Qt.AlignmentFlag.AlignCenter)
about_tab.setLayout(about_layout) about_tab.setLayout(about_layout)
self.tab_widget.addTab(about_tab, "About") self.tab_widget.addTab(about_tab, "About")
@@ -1707,6 +1847,17 @@ def main():
os.chdir(os.path.dirname(sys.executable)) os.chdir(os.path.dirname(sys.executable))
app = QApplication(sys.argv) app = QApplication(sys.argv)
settings = QSettings('TwitterMediaDownloader', 'Settings')
theme_color = settings.value('theme_color', '#2196F3')
qdarktheme.setup_theme(
custom_colors={
"[dark]": {
"primary": theme_color,
}
}
)
window = TwitterMediaDownloaderGUI() window = TwitterMediaDownloaderGUI()
window.show() window.show()
sys.exit(app.exec()) sys.exit(app.exec())
+1
View File
@@ -4,3 +4,4 @@ aiohttp
imageio-ffmpeg imageio-ffmpeg
packaging packaging
gallery-dl gallery-dl
pyqtdarktheme