From e63d94e21c310fd568b648159755edae3ab0715b Mon Sep 17 00:00:00 2001 From: rattatwinko Date: Wed, 26 Nov 2025 10:02:50 +0100 Subject: [PATCH] some more fixes --- src/NotesDialog.py | 15 ++++++++++++--- src/PrivacyNoticeDialog.py | 34 +++++++++++++++++++++++++--------- src/main.py | 8 ++++---- 3 files changed, 41 insertions(+), 16 deletions(-) diff --git a/src/NotesDialog.py b/src/NotesDialog.py index c867736..39af057 100644 --- a/src/NotesDialog.py +++ b/src/NotesDialog.py @@ -15,7 +15,7 @@ class NotesDialog(wx.Frame): parent_pos = parent.GetPosition() pos = (parent_pos.x + 50, parent_pos.y + 50) - super().__init__(parent, title="IRC Notes", size=(900, 650), pos=pos, + super().__init__(parent, title="wxNotes", size=(900, 650), pos=pos, style=wx.DEFAULT_FRAME_STYLE) self.parent = parent @@ -48,10 +48,19 @@ class NotesDialog(wx.Frame): self.status_timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.on_status_update, self.status_timer) self.status_timer.Start(3000) # 3 seconds + accel_tbl = wx.AcceleratorTable([ + (wx.ACCEL_SHIFT, wx.WXK_ESCAPE, 1003), + ]) + self.SetAcceleratorTable(accel_tbl) + self.Bind(wx.EVT_MENU, lambda evt: self.close_parent(self.GetParent().GetId()), id=1003) # Initialize status self.update_status("Ready") - + + def close_parent(self, pId): + if self.GetParent().GetId() == pId: + self.GetParent().Close() + def create_controls(self): # Create menu bar self.create_menu_bar() @@ -153,7 +162,7 @@ class NotesDialog(wx.Frame): file_menu.AppendSeparator() export_text_item = file_menu.Append(wx.ID_ANY, "Export Current Note as &Text...\tCtrl+T", "Export current note as plain text") file_menu.AppendSeparator() - exit_item = file_menu.Append(wx.ID_EXIT, "&Close", "Close notes window") + exit_item = file_menu.Append(wx.ID_EXIT, "&Close\tSHIFT+ESC", "Close notes window") menubar.Append(file_menu, "&File") diff --git a/src/PrivacyNoticeDialog.py b/src/PrivacyNoticeDialog.py index d70fe78..e550725 100644 --- a/src/PrivacyNoticeDialog.py +++ b/src/PrivacyNoticeDialog.py @@ -19,18 +19,25 @@ def get_resource_path(relative_path): return os.path.join(base_path, relative_path) - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') logger = logging.getLogger(__name__) class PrivacyNoticeDialog(wx.Dialog): def __init__(self, parent): - super().__init__(parent, title="Privacy Notice", style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER) + # Initialize the Window Controls ; => RESIZE;MIN;CLOSE + super().__init__( + parent, + title="Privacy Notice", + style=wx.DEFAULT_DIALOG_STYLE + | wx.RESIZE_BORDER + | wx.MINIMIZE_BOX + ) + self.parent = parent # Calculate optimal dialog size based on screen size screen_width, screen_height = wx.DisplaySize() - self.max_width = min(400, screen_width * 0.55) + self.max_width = min(500, screen_width * 0.95) self.max_height = min(700, screen_height * 0.8) self.SetMinSize((450, 400)) @@ -63,7 +70,7 @@ class PrivacyNoticeDialog(wx.Dialog): title_text = wx.StaticText(self, label="Privacy and System Information") title_font = wx.Font(14, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD) title_text.SetFont(title_font) - header_sizer.Add(title_text, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 10) + header_sizer.Add(title_text, 0, wx.WRAPSIZER_DEFAULT_FLAGS | wx.ALIGN_LEFT,10) main_sizer.Add(header_sizer, 0, wx.EXPAND) @@ -80,13 +87,15 @@ class PrivacyNoticeDialog(wx.Dialog): security_text = wx.StaticText(self.scrolled_win, label="Security and Privacy Notice:") security_font = wx.Font(11, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD) security_text.SetFont(security_font) - scrolled_sizer.Add(security_text, 0, wx.ALL, 5) + scrolled_sizer.Add(security_text, 0, wx.EXPAND, 5) # Detect potential security features security_warnings = self.get_security_warnings(system_info) + logger.info(f"Security Warnings: {security_warnings}") privacy_notice = ( "wxIRC is an Open Source project and must not be distributed for commercial purposes.\n\n" + "If anything goes wrong or you get caught doing something you shouldnt, Shift + Esc immediatley, this works both in wxNotes and wxIRC\n\n" "Security Considerations:\n" f"{security_warnings}\n\n" @@ -111,8 +120,10 @@ class PrivacyNoticeDialog(wx.Dialog): # System information section (moved to bottom) sysinfo_text = wx.StaticText(self.scrolled_win, label="System Information:") sysinfo_text.SetFont(security_font) + + scrolled_sizer.Add(sysinfo_text, 0, wx.ALL, 5) - + # System info details info_details = ( f"Operating System: {system_info['os']}\n" @@ -126,9 +137,14 @@ class PrivacyNoticeDialog(wx.Dialog): f"Hostname: {system_info['hostname']}\n" f"Username: {system_info['username']}\n" f"Python Version: {system_info['python_version']}\n" - f"wxPython Version: {system_info['wx_version']}" + f"wxPython Version: {system_info['wx_version']}\n" + f"Type: {'Bundled' if getattr(sys, 'frozen', False) else 'Script or ran from Source Code'}\n" + f"Window HWND: {hex(self.GetHandle())}\n" + f"wxID: {self.GetId()}\n" ) - + + logger.info(f"System Information: {info_details}") + self.info_text = wx.StaticText(self.scrolled_win, label=info_details) scrolled_sizer.Add(self.info_text, 0, wx.ALL | wx.EXPAND, 10) @@ -136,7 +152,7 @@ class PrivacyNoticeDialog(wx.Dialog): main_sizer.Add(self.scrolled_win, 1, wx.EXPAND | wx.ALL, 5) # Add OK button with auto-sizing - ok_btn = wx.Button(self, wx.ID_OK, "I Understand and Continue") + ok_btn = wx.Button(self, wx.ID_OK, "I want to continue") ok_btn.SetDefault() # Calculate button size based on text content diff --git a/src/main.py b/src/main.py index 79858dd..523aa30 100644 --- a/src/main.py +++ b/src/main.py @@ -15,7 +15,7 @@ import sys from PrivacyNoticeDialog import PrivacyNoticeDialog from IRCPanel import IRCPanel from AboutDialog import AboutDialog -from NotesDialog import NotesDialog # Add this import +from NotesDialog import NotesDialog # Set up logging logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') @@ -358,7 +358,7 @@ class IRCFrame(wx.Frame): # Tools menu tools_menu = wx.Menu() - tools_menu.Append(208, "&Notes\tCtrl+T") # Add Notes menu item + tools_menu.Append(208, "&wxNotes\tCtrl+T") # Add Notes menu item tools_menu.Append(201, "&WHOIS User\tCtrl+I") tools_menu.Append(202, "Change &Nick\tCtrl+N") tools_menu.AppendSeparator() @@ -1274,11 +1274,11 @@ if __name__ == "__main__": try: if os.name == 'nt': enable_high_dpi() - else: - pass app = wx.App() frame = IRCFrame() frame.SetIcon(wx.Icon(get_resource_path("icon.ico"), wx.BITMAP_TYPE_ICO)) + logger.info(f"wxID: {frame.GetId()}") + logger.info(f"HWND: {hex(frame.GetHandle())}") app.MainLoop() except Exception as e: logger.critical(f"Fatal error: {e}")