Fix PyInstaller build issues and add right-click edit
## Fixes - Web interface now loads correctly in built app (use sys._MEIPASS for bundled web files) - Macro execution no longer locks up (use pyperclip clipboard for Unicode text support) - Right-click context menu works (use Qt signals instead of fragile parent traversal) ## Changes - web_server.py: Use get_resource_path() for web directory - macro_manager.py: Use clipboard paste for text commands instead of typewrite - gui/main_window.py: Add edit_requested/delete_requested signals to MacroButton - pyproject.toml: Add pyperclip dependency - All .spec files: Add pyperclip to hidden imports 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -31,6 +31,10 @@ from web_server import WebServer
|
||||
class MacroButton(QPushButton):
|
||||
"""Custom button widget for displaying a macro."""
|
||||
|
||||
# Signals for context menu actions
|
||||
edit_requested = Signal(str)
|
||||
delete_requested = Signal(str)
|
||||
|
||||
def __init__(self, macro_id: str, macro: dict, parent=None):
|
||||
super().__init__(parent)
|
||||
self.macro_id = macro_id
|
||||
@@ -103,9 +107,9 @@ class MacroButton(QPushButton):
|
||||
|
||||
action = menu.exec_(event.globalPos())
|
||||
if action == edit_action:
|
||||
self.parent().parent().parent().parent().edit_macro(self.macro_id)
|
||||
self.edit_requested.emit(self.macro_id)
|
||||
elif action == delete_action:
|
||||
self.parent().parent().parent().parent().delete_macro(self.macro_id)
|
||||
self.delete_requested.emit(self.macro_id)
|
||||
|
||||
|
||||
class MainWindow(QMainWindow):
|
||||
@@ -441,6 +445,8 @@ class MainWindow(QMainWindow):
|
||||
for i, (macro_id, macro) in enumerate(filtered):
|
||||
btn = MacroButton(macro_id, macro)
|
||||
btn.clicked.connect(lambda checked, mid=macro_id: self.execute_macro(mid))
|
||||
btn.edit_requested.connect(self.edit_macro)
|
||||
btn.delete_requested.connect(self.delete_macro)
|
||||
layout.addWidget(btn, i // cols, i % cols)
|
||||
|
||||
def on_tab_changed(self, index):
|
||||
|
||||
Reference in New Issue
Block a user