Skip to content

Commit a8ef3fc

Browse files
authored
Update app.py
Fixed issue where the app wasn't allowing you to name a recording. Improved opening disclaimer UI.
1 parent b789e25 commit a8ef3fc

File tree

1 file changed

+48
-21
lines changed

1 file changed

+48
-21
lines changed

app.py

Lines changed: 48 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -597,8 +597,23 @@ def save_recording(self):
597597
if not self.recorder.events:
598598
messagebox.showwarning("Warning", "No events to save. Please record actions first.")
599599
return
600+
601+
# Temporarily stop hotkey listeners
602+
if hasattr(self, 'stop_listener') and self.stop_listener and hasattr(self.stop_listener, 'listener'):
603+
self.stop_listener.listener.stop()
604+
if hasattr(self, 'start_listener') and self.start_listener and hasattr(self.start_listener, 'listener'):
605+
self.start_listener.listener.stop()
606+
600607
# Prompt user for a recording name
601608
name = simpledialog.askstring("Save Recording", "Enter a name for the recording:")
609+
610+
# Restart hotkey listeners
611+
if not self.recorder.recording and not (self.player and self.player.playing):
612+
# Only restart listeners if we're not recording or playing
613+
self.stop_listener = HotkeyListener(self.stop_current_action, STOP_HOTKEY)
614+
START_HOTKEY = {KeyCode.from_char('r')}
615+
self.start_listener = HotkeyListener(self.start_recording_if_idle, START_HOTKEY)
616+
602617
if name:
603618
# Sanitize and check for duplicates
604619
safe_name = "".join([c for c in name if c.isalpha() or c.isdigit() or c in (' ', '_', '-')]).rstrip()
@@ -782,56 +797,68 @@ def show_disclaimer(self):
782797
"""Show the disclaimer window if not already agreed."""
783798
disclaimer_window = tk.Toplevel(self)
784799
disclaimer_window.title("Disclaimer - AutoWiz")
785-
disclaimer_window.geometry("600x400")
800+
disclaimer_window.geometry("700x500") # Increased size
786801
disclaimer_window.configure(bg="#ffffff")
787802
disclaimer_window.transient(self) # Set to be on top of the main window
788803
disclaimer_window.grab_set() # Make it modal
789-
self.center_child_window(disclaimer_window, 600, 400)
804+
self.center_child_window(disclaimer_window, 700, 500)
790805

791-
# Use a professional font
792-
header_font = font.Font(family="Helvetica", size=16, weight="bold")
793-
text_font = font.Font(family="Helvetica", size=10)
806+
# Create main content frame with padding
807+
content_frame = tk.Frame(disclaimer_window, bg="#ffffff", padx=40, pady=30)
808+
content_frame.pack(fill="both", expand=True)
794809

795810
# Header
796-
disclaimer_label = tk.Label(disclaimer_window, text="Disclaimer", font=header_font, bg="#ffffff", fg="#333333")
797-
disclaimer_label.pack(pady=(20, 10))
811+
header_font = font.Font(family="Helvetica", size=18, weight="bold")
812+
disclaimer_label = tk.Label(content_frame, text="Disclaimer", font=header_font, bg="#ffffff", fg="#333333")
813+
disclaimer_label.pack(pady=(0, 20))
798814

799815
# Disclaimer Text
816+
text_font = font.Font(family="Helvetica", size=11)
800817
disclaimer_text = (
801818
"By using AutoWiz, you agree to the following terms:\n\n"
802-
"1. Responsibility: You are solely responsible for how you use this tool.\n"
803-
"2. Compliance: Ensure that your use of AutoWiz complies with all applicable laws and regulations.\n"
804-
"3. Ethical Use: Do not use AutoWiz for malicious purposes, such as automating actions to deceive or harm others.\n"
819+
"1. Responsibility: You are solely responsible for how you use this tool.\n\n"
820+
"2. Compliance: Ensure that your use of AutoWiz complies with all applicable laws and regulations.\n\n"
821+
"3. Ethical Use: Do not use AutoWiz for malicious purposes, such as automating actions to deceive or harm others.\n\n"
805822
"4. Permissions: Ensure that AutoWiz has the necessary permissions to control your keyboard and mouse.\n\n"
806823
"Do you agree to these terms?"
807824
)
808-
disclaimer_label = tk.Label(disclaimer_window, text=disclaimer_text, justify="left", bg="#ffffff", fg="#333333", font=text_font, wraplength=560)
809-
disclaimer_label.pack(padx=30, pady=(0, 20))
825+
826+
# Create Text widget for better text display
827+
text_widget = tk.Text(content_frame, wrap="word", bg="#ffffff", fg="#333333",
828+
font=text_font, width=50, height=12, relief="flat",
829+
padx=20, pady=20)
830+
text_widget.insert("1.0", disclaimer_text)
831+
text_widget.configure(state="disabled") # Make text read-only
832+
text_widget.pack(fill="both", expand=True, pady=(0, 20))
810833

811-
# Buttons
812-
button_frame = tk.Frame(disclaimer_window, bg="#ffffff")
813-
button_frame.pack(pady=10)
834+
# Buttons frame with padding
835+
button_frame = tk.Frame(content_frame, bg="#ffffff")
836+
button_frame.pack(pady=(0, 20))
814837

838+
# Style buttons
839+
button_font = font.Font(family="Helvetica", size=10, weight="bold")
815840
agree_button = tk.Button(
816841
button_frame,
817-
text="Agree",
842+
text="I Agree",
818843
command=lambda: self.agree_disclaimer(disclaimer_window),
819-
width=12,
844+
width=15,
845+
height=2,
820846
bg="#4CAF50",
821847
fg="white",
822-
font=("Helvetica", 10, "bold"),
848+
font=button_font,
823849
cursor="hand2"
824850
)
825851
agree_button.pack(side="left", padx=20)
826852

827853
decline_button = tk.Button(
828854
button_frame,
829-
text="Decline",
855+
text="I Decline",
830856
command=self.decline_disclaimer,
831-
width=12,
857+
width=15,
858+
height=2,
832859
bg="#f44336",
833860
fg="white",
834-
font=("Helvetica", 10, "bold"),
861+
font=button_font,
835862
cursor="hand2"
836863
)
837864
decline_button.pack(side="left", padx=20)

0 commit comments

Comments
 (0)