From ed98f073c79b101209fb074aaa642c05cb511b45 Mon Sep 17 00:00:00 2001 From: LemonNexus Date: Wed, 11 Feb 2026 18:55:48 +0000 Subject: [PATCH] feat: standalone extractor - theme toggle and UI improvements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changes: - Removed "Include ALL version folders" checkbox (redundant with dropdown) - Adjusted splitter sizes: left panel 420px, right panel 400px (Available Icons list now takes less space) - Added Light/Dark theme toggle button in header - ☀️ Light / 🌙 Dark modes - Toggle switches between themes - Dark theme is default Theme support: - _toggle_theme() method switches between modes - _apply_dark_theme() - dark color scheme - _apply_light_theme() - light color scheme Code cleanup: - Removed _on_all_subfolders_changed() method - Simplified _refresh_file_list() logic --- standalone_icon_extractor.py | 192 +++++++++++++++++++++++++++++++---- 1 file changed, 172 insertions(+), 20 deletions(-) diff --git a/standalone_icon_extractor.py b/standalone_icon_extractor.py index d24efc7..cd4f999 100644 --- a/standalone_icon_extractor.py +++ b/standalone_icon_extractor.py @@ -327,6 +327,15 @@ class IconExtractorWindow(QMainWindow): header = QLabel("Entropia Universe Icon Extractor") header.setStyleSheet("font-size: 22px; font-weight: bold; color: #4caf50;") header_layout.addWidget(header, 1) + + # Theme toggle button + self.theme_btn = QPushButton("☀️ Light") + self.theme_btn.setMaximumWidth(80) + self.theme_btn.setStyleSheet("font-size: 11px; padding: 5px;") + self.theme_btn.setCheckable(True) + self.theme_btn.clicked.connect(self._toggle_theme) + header_layout.addWidget(self.theme_btn) + header_layout.addStretch() layout.addLayout(header_layout) @@ -408,13 +417,6 @@ class IconExtractorWindow(QMainWindow): cache_layout.addLayout(subfolder_layout) - # All subfolders checkbox - self.all_subfolders_check = QCheckBox("☑️ Include ALL version folders") - self.all_subfolders_check.setStyleSheet("font-size: 12px;") - self.all_subfolders_check.setToolTip("Merge icons from all game versions") - self.all_subfolders_check.stateChanged.connect(self._on_all_subfolders_changed) - cache_layout.addWidget(self.all_subfolders_check) - left_layout.addWidget(cache_group) # Output folder @@ -564,7 +566,7 @@ class IconExtractorWindow(QMainWindow): right_layout.addWidget(files_group) splitter.addWidget(right_panel) - splitter.setSizes([360, 560]) + splitter.setSizes([420, 400]) layout.addWidget(splitter, 1) @@ -687,6 +689,164 @@ class IconExtractorWindow(QMainWindow): self.header_icon.hide() return False + def _toggle_theme(self): + """Toggle between light and dark theme.""" + if self.theme_btn.isChecked(): + self._apply_light_theme() + self.theme_btn.setText("🌙 Dark") + else: + self._apply_dark_theme() + self.theme_btn.setText("☀️ Light") + + def _apply_dark_theme(self): + """Apply dark theme.""" + self.setStyleSheet(""" + QMainWindow, QDialog { + background-color: #1e1e1e; + } + QWidget { + background-color: #1e1e1e; + color: #e0e0e0; + } + QGroupBox { + font-weight: bold; + border: 1px solid #404040; + border-radius: 6px; + margin-top: 12px; + padding-top: 12px; + } + QGroupBox::title { + subcontrol-origin: margin; + left: 12px; + padding: 0 8px; + } + QPushButton { + background-color: #3d3d3d; + border: 1px solid #555; + padding: 6px 12px; + border-radius: 4px; + font-size: 12px; + } + QPushButton:hover { + background-color: #4d4d4d; + } + QComboBox { + background-color: #2d2d2d; + border: 1px solid #555; + padding: 5px; + border-radius: 4px; + } + QListWidget { + background-color: #252525; + border: 1px solid #404040; + border-radius: 4px; + } + QListWidget::item { + padding: 6px; + } + QListWidget::item:selected { + background-color: #1565c0; + } + QListWidget::item:hover { + background-color: #2a4d6e; + } + QProgressBar { + border: 1px solid #404040; + border-radius: 4px; + text-align: center; + } + QProgressBar::chunk { + background-color: #4caf50; + } + QTextEdit { + background-color: #252525; + border: 1px solid #404040; + } + QCheckBox { + font-size: 12px; + } + QLabel { + font-size: 12px; + } + """) + + def _apply_light_theme(self): + """Apply light theme.""" + self.setStyleSheet(""" + QMainWindow, QDialog { + background-color: #f5f5f5; + } + QWidget { + background-color: #f5f5f5; + color: #333333; + } + QGroupBox { + font-weight: bold; + border: 1px solid #cccccc; + border-radius: 6px; + margin-top: 12px; + padding-top: 12px; + } + QGroupBox::title { + subcontrol-origin: margin; + left: 12px; + padding: 0 8px; + } + QPushButton { + background-color: #e0e0e0; + border: 1px solid #bbbbbb; + padding: 6px 12px; + border-radius: 4px; + font-size: 12px; + color: #333333; + } + QPushButton:hover { + background-color: #d0d0d0; + } + QComboBox { + background-color: #ffffff; + border: 1px solid #bbbbbb; + padding: 5px; + border-radius: 4px; + color: #333333; + } + QListWidget { + background-color: #ffffff; + border: 1px solid #cccccc; + border-radius: 4px; + } + QListWidget::item { + padding: 6px; + color: #333333; + } + QListWidget::item:selected { + background-color: #1976d2; + color: #ffffff; + } + QListWidget::item:hover { + background-color: #e3f2fd; + } + QProgressBar { + border: 1px solid #cccccc; + border-radius: 4px; + text-align: center; + } + QProgressBar::chunk { + background-color: #4caf50; + } + QTextEdit { + background-color: #ffffff; + border: 1px solid #cccccc; + color: #333333; + } + QCheckBox { + font-size: 12px; + } + QLabel { + font-size: 12px; + } + """) + def _load_settings(self): """Load saved settings.""" # Output folder @@ -743,11 +903,6 @@ class IconExtractorWindow(QMainWindow): """Handle subfolder selection change.""" self._refresh_file_list() - def _on_all_subfolders_changed(self): - """Handle 'all subfolders' checkbox change.""" - self.subfolder_combo.setEnabled(not self.all_subfolders_check.isChecked()) - self._refresh_file_list() - def _browse_output(self): """Browse for output folder.""" folder = QFileDialog.getExistingDirectory( @@ -770,17 +925,14 @@ class IconExtractorWindow(QMainWindow): if not self.base_cache_path.exists(): return - # Determine which folders to scan - if self.all_subfolders_check.isChecked(): + # Determine which folders to scan based on dropdown selection + path_data = self.subfolder_combo.currentData() + if path_data == "all" or path_data is None: # Scan all subfolders folders_to_scan = [d for d in self.base_cache_path.iterdir() if d.is_dir()] else: # Scan selected subfolder - path_data = self.subfolder_combo.currentData() - if path_data == "all" or path_data is None: - folders_to_scan = [d for d in self.base_cache_path.iterdir() if d.is_dir()] - else: - folders_to_scan = [Path(path_data)] + folders_to_scan = [Path(path_data)] # Collect TGA files tga_files = []