Updating to fix a bug with app macros
This commit is contained in:
parent
2dcc74f9d4
commit
4aa5ce1ff2
BIN
dist/mp-server-v2.exe
vendored
BIN
dist/mp-server-v2.exe
vendored
Binary file not shown.
@ -15,6 +15,7 @@ import logging
|
|||||||
import socket
|
import socket
|
||||||
import qrcode
|
import qrcode
|
||||||
import sys
|
import sys
|
||||||
|
import time
|
||||||
|
|
||||||
class MacroPadServer:
|
class MacroPadServer:
|
||||||
def __init__(self, root):
|
def __init__(self, root):
|
||||||
@ -22,6 +23,9 @@ class MacroPadServer:
|
|||||||
self.root.title("MacroPad Server")
|
self.root.title("MacroPad Server")
|
||||||
self.root.geometry("800x600")
|
self.root.geometry("800x600")
|
||||||
self.configure_styles()
|
self.configure_styles()
|
||||||
|
|
||||||
|
# Set Version Str
|
||||||
|
self.version_str = "0.5.3 Beta"
|
||||||
|
|
||||||
# Set up directories
|
# Set up directories
|
||||||
if getattr(sys, 'frozen', False):
|
if getattr(sys, 'frozen', False):
|
||||||
@ -85,6 +89,12 @@ class MacroPadServer:
|
|||||||
right_frame = ttk.Frame(main_frame)
|
right_frame = ttk.Frame(main_frame)
|
||||||
right_frame.pack(side=tk.RIGHT, fill=tk.BOTH, expand=True, padx=(10, 0))
|
right_frame.pack(side=tk.RIGHT, fill=tk.BOTH, expand=True, padx=(10, 0))
|
||||||
|
|
||||||
|
#Set version details
|
||||||
|
version_label = tk.Label(self.root, text=self.version_str,
|
||||||
|
bg=self.bg_color, fg=self.fg_color,
|
||||||
|
font=('Helvetica', 8)) # Using smaller font for version text
|
||||||
|
version_label.pack(side=tk.BOTTOM, anchor=tk.SE, padx=5, pady=(0, 2))
|
||||||
|
|
||||||
# Button container
|
# Button container
|
||||||
button_frame = ttk.Frame(left_frame)
|
button_frame = ttk.Frame(left_frame)
|
||||||
button_frame.pack(fill=tk.X, pady=(0, 10))
|
button_frame.pack(fill=tk.X, pady=(0, 10))
|
||||||
@ -886,32 +896,26 @@ setTimeout(() => { errorStatus.style.display = 'none'; }, 2000);
|
|||||||
if macro["type"] == "text":
|
if macro["type"] == "text":
|
||||||
# Handle key modifiers
|
# Handle key modifiers
|
||||||
modifiers = macro.get("modifiers", {})
|
modifiers = macro.get("modifiers", {})
|
||||||
keys_to_press = []
|
|
||||||
|
|
||||||
# Add modifier keys if enabled
|
# Add modifier keys if enabled
|
||||||
if modifiers.get("ctrl", False):
|
if modifiers.get("ctrl", False):
|
||||||
keys_to_press.append('ctrl')
|
pyautogui.keyDown('ctrl')
|
||||||
if modifiers.get("alt", False):
|
if modifiers.get("alt", False):
|
||||||
keys_to_press.append('alt')
|
pyautogui.keyDown('alt')
|
||||||
if modifiers.get("shift", False):
|
if modifiers.get("shift", False):
|
||||||
keys_to_press.append('shift')
|
pyautogui.keyDown('shift')
|
||||||
|
if str(macro["command"]) and len(str(macro["command"])) == 1:
|
||||||
# If there are modifier keys, use hotkey functionality
|
pyautogui.keyDown(macro["command"])
|
||||||
if keys_to_press:
|
time.sleep(0.5)
|
||||||
# For single characters with modifiers, use hotkey
|
|
||||||
if len(macro["command"]) == 1:
|
|
||||||
keys_to_press.append(macro["command"])
|
|
||||||
pyautogui.hotkey(*keys_to_press)
|
|
||||||
else:
|
|
||||||
# For longer text, press modifiers, type text, then release
|
|
||||||
for key in keys_to_press:
|
|
||||||
pyautogui.keyDown(key)
|
|
||||||
pyautogui.typewrite(macro["command"], interval=0.02)
|
|
||||||
for key in reversed(keys_to_press):
|
|
||||||
pyautogui.keyUp(key)
|
|
||||||
else:
|
else:
|
||||||
# No modifiers, just type the text
|
|
||||||
pyautogui.typewrite(macro["command"], interval=0.02)
|
pyautogui.typewrite(macro["command"], interval=0.02)
|
||||||
|
# Release modifier keys in reverse order
|
||||||
|
if modifiers.get("shift", False):
|
||||||
|
pyautogui.keyUp('shift')
|
||||||
|
if modifiers.get("alt", False):
|
||||||
|
pyautogui.keyUp('alt')
|
||||||
|
if modifiers.get("ctrl", False):
|
||||||
|
pyautogui.keyUp('ctrl')
|
||||||
|
|
||||||
# Add Enter/Return if requested
|
# Add Enter/Return if requested
|
||||||
if modifiers.get("enter", False):
|
if modifiers.get("enter", False):
|
||||||
@ -943,6 +947,7 @@ setTimeout(() => { errorStatus.style.display = 'none'; }, 2000);
|
|||||||
|
|
||||||
def exit_app(self, icon=None, item=None):
|
def exit_app(self, icon=None, item=None):
|
||||||
# Actually exit the app
|
# Actually exit the app
|
||||||
|
self.stop_server()
|
||||||
self.server_running = False
|
self.server_running = False
|
||||||
if hasattr(self, 'tray_icon'):
|
if hasattr(self, 'tray_icon'):
|
||||||
self.tray_icon.stop()
|
self.tray_icon.stop()
|
||||||
|
1
version.txt
Normal file
1
version.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
0.5.3
|
Loading…
x
Reference in New Issue
Block a user