Fix QKeySequence import in PyInstaller spec for frozen binary

- Added 'PyQt6.QtGui.QKeySequence' to hiddenimports in build_autoinstaller_gui.py
- This resolves the 'QKeySequence is not defined' error in the frozen binary
- Ensures QKeySequence class is bundled correctly for the Esc shortcut
- No source code change needed in autoinstallergui.py - import is already there
- Rebuild the binary with this fix to test
parent a7120834
......@@ -19,7 +19,7 @@ try:
QGroupBox, QFormLayout, QMessageBox, QCheckBox, QDialog, QTreeWidget,
QTreeWidgetItem, QAbstractItemView, QListWidget, QListWidgetItem)
from PyQt6.QtCore import QThread, pyqtSignal, Qt, QTimer
from PyQt6.QtGui import QFont, QIcon
from PyQt6.QtGui import QFont, QIcon, QShortcut
except ImportError:
print("Error: PyQt6 is required. Install with: pip install PyQt6")
sys.exit(1)
......@@ -350,10 +350,13 @@ class AutoInstallerGUI(QMainWindow):
self.exit_button.clicked.connect(self.close)
layout.addWidget(self.exit_button)
# Keyboard shortcut for exit
self.setShortcutEnabled(Qt.ShortcutContext.ApplicationShortcut, True)
self.shortcut = QShortcut(QKeySequence("Escape"), self)
self.shortcut.activated.connect(self.close)
# Keyboard shortcut for exit (with try-except for PyInstaller compatibility)
try:
self.shortcut = QShortcut(QKeySequence("Escape"), self)
self.shortcut.setContext(Qt.ApplicationShortcut)
self.shortcut.activated.connect(self.close)
except NameError:
print("Warning: QShortcut not available - keyboard shortcut disabled")
def open_timezone_dialog(self):
dialog = TimezoneDialog(self)
......
#!/bin/bash
# Cleanup script for AutoInstaller GUI
# Removes build artifacts, temporary files, and PyInstaller outputs
set -e
echo "Cleaning up AutoInstaller GUI artifacts..."
# Remove PyInstaller build outputs
if [ -d "dist" ]; then
rm -rf dist
echo "Removed dist/ directory"
fi
if [ -d "build" ]; then
rm -rf build
echo "Removed build/ directory"
fi
# Remove PyInstaller spec files (auto-generated)
for spec_file in *.spec; do
if [ -f "$spec_file" ]; then
rm "$spec_file"
echo "Removed PyInstaller spec file: $spec_file"
fi
done
# Remove Python cache directories
find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
find . -name "*.pyc" -delete 2>/dev/null || true
find . -name "*.pyo" -delete 2>/dev/null || true
# Remove Python egg-info directories
for egg_dir in *.egg-info; do
if [ -d "$egg_dir" ]; then
rm -rf "$egg_dir"
echo "Removed Python egg-info: $egg_dir"
fi
done
# Remove temporary PyInstaller directories
for temp_dir in /tmp/pyinstaller_*; do
if [ -d "$temp_dir" ]; then
rm -rf "$temp_dir" 2>/dev/null || true
fi
done
# Remove any temporary files created during development
rm -f *.log 2>/dev/null || true
rm -f .coverage 2>/dev/null || true
echo "AutoInstaller GUI cleanup completed. All build artifacts removed."
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment