@@ -28,36 +28,52 @@ class ActivityMonitor(ctk.CTk):
2828 def __init__ (self ):
2929 super ().__init__ ()
3030 self .title ("Activity Monitor" )
31- self .geometry ("300x150 " )
31+ self .geometry ("400x300 " )
3232
3333 self .is_running = False
3434 self .text_buffer = ""
3535 self .markdown_log = ""
3636
37- self .start_button = ctk .CTkButton (self , text = "Start" , command = self .start_monitoring )
37+ # Set theme and color scheme
38+ ctk .set_appearance_mode ("dark" )
39+ ctk .set_default_color_theme ("green" )
40+
41+ # Create a frame for the buttons
42+ self .button_frame = ctk .CTkFrame (self )
43+ self .button_frame .pack (pady = 20 )
44+
45+ # Create buttons with icons
46+ self .start_button = ctk .CTkButton (self .button_frame , text = "Start" , command = self .start_monitoring , width = 120 , height = 40 , font = ("Arial" , 14 ))
3847 self .start_button .pack (pady = 10 )
3948
40- self .stop_button = ctk .CTkButton (self , text = "Stop" , command = self .stop_monitoring )
49+ self .stop_button = ctk .CTkButton (self . button_frame , text = "Stop" , command = self .stop_monitoring , width = 120 , height = 40 , font = ( "Arial" , 14 ) )
4150 self .stop_button .pack (pady = 10 )
4251
43- self .ollama_button = ctk .CTkButton (self , text = "Analyze with Ollama" , command = self .analyze_with_ollama )
52+ self .ollama_button = ctk .CTkButton (self . button_frame , text = "Analyze with Ollama" , command = self .analyze_with_ollama , width = 120 , height = 40 , font = ( "Arial" , 14 ) )
4453 self .ollama_button .pack (pady = 10 )
4554
46- self .quit_button = ctk .CTkButton (self , text = "Quit" , command = self .quit_monitoring )
55+ self .quit_button = ctk .CTkButton (self . button_frame , text = "Quit" , command = self .quit_monitoring , width = 120 , height = 40 , font = ( "Arial" , 14 ) )
4756 self .quit_button .pack (pady = 10 )
4857
58+ # Create a label to display the current status
59+ self .status_label = ctk .CTkLabel (self , text = "Status: Not Running" , font = ("Arial" , 16 ))
60+ self .status_label .pack (pady = 10 )
61+
4962 def start_monitoring (self ):
5063 if not self .is_running :
5164 self .is_running = True
65+ self .status_label .configure (text = "Status: Running" )
5266 threading .Thread (target = self .monitor_activities ).start ()
5367
5468 def stop_monitoring (self ):
5569 self .is_running = False
70+ self .status_label .configure (text = "Status: Stopped" )
5671
5772 def analyze_with_ollama (self ):
58- detailed_description = generate_answers ("vicuna:13b-16k" , self .markdown_log )
73+ prompt = f"Please analyze the following activities and add your comments:\n \n { self .markdown_log } "
74+ detailed_description = generate_answers ("vicuna:13b-16k" , prompt )
5975 if detailed_description :
60- self .markdown_log = detailed_description
76+ self .markdown_log += f" \n \n ## Ollama's Analysis \n \n { detailed_description } "
6177 self .write_markdown_file ()
6278
6379 def quit_monitoring (self ):
@@ -75,7 +91,7 @@ def monitor_activities(self):
7591 # Capture clipboard content
7692 current_clipboard = clipboard .paste ()
7793 if current_clipboard != previous_clipboard :
78- self .markdown_log += f"\n - **Clipboard Changed**: ` { current_clipboard } ` "
94+ self .markdown_log += f"\n - **Clipboard Changed**:\n ``` \n { current_clipboard } \n ``` \n "
7995 previous_clipboard = current_clipboard
8096
8197 # Capture active window and screenshot
@@ -88,8 +104,8 @@ def monitor_activities(self):
88104 screenshot .save (screenshot_path )
89105
90106 # save title and screenshot in markdown log
91- window_title = active_window .title if active_window .title else "Unbekanntes Fenster "
92- self .markdown_log += f"\n - ** Window Selected** : { window_title } "
107+ window_title = active_window .title if active_window .title else "Unknown Window "
108+ self .markdown_log += f"\n ## Window Selected: { window_title } \n \n \n "
93109 previous_window = active_window
94110 except Exception as e :
95111 print (f"Error getting active window: { e } " )
@@ -98,7 +114,7 @@ def monitor_activities(self):
98114 key_events = keyboard .record (until = 'enter' )
99115 typed_text = '' .join ([event .name for event in key_events if event .event_type == 'down' and len (event .name ) == 1 or event .name == 'space' ])
100116 if typed_text :
101- self .markdown_log += f"\n - **Typed Text**: { typed_text .replace ('space' , ' ' )} "
117+ self .markdown_log += f"\n - **Typed Text**: { typed_text .replace ('space' , ' ' )} \n "
102118 self .text_buffer = ""
103119
104120 time .sleep (1 ) # Reduce CPU usage
0 commit comments