some more fixes
This commit is contained in:
@@ -15,7 +15,7 @@ class NotesDialog(wx.Frame):
|
|||||||
parent_pos = parent.GetPosition()
|
parent_pos = parent.GetPosition()
|
||||||
pos = (parent_pos.x + 50, parent_pos.y + 50)
|
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)
|
style=wx.DEFAULT_FRAME_STYLE)
|
||||||
|
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
@@ -48,10 +48,19 @@ class NotesDialog(wx.Frame):
|
|||||||
self.status_timer = wx.Timer(self)
|
self.status_timer = wx.Timer(self)
|
||||||
self.Bind(wx.EVT_TIMER, self.on_status_update, self.status_timer)
|
self.Bind(wx.EVT_TIMER, self.on_status_update, self.status_timer)
|
||||||
self.status_timer.Start(3000) # 3 seconds
|
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
|
# Initialize status
|
||||||
self.update_status("Ready")
|
self.update_status("Ready")
|
||||||
|
|
||||||
|
def close_parent(self, pId):
|
||||||
|
if self.GetParent().GetId() == pId:
|
||||||
|
self.GetParent().Close()
|
||||||
|
|
||||||
def create_controls(self):
|
def create_controls(self):
|
||||||
# Create menu bar
|
# Create menu bar
|
||||||
self.create_menu_bar()
|
self.create_menu_bar()
|
||||||
@@ -153,7 +162,7 @@ class NotesDialog(wx.Frame):
|
|||||||
file_menu.AppendSeparator()
|
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")
|
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()
|
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")
|
menubar.Append(file_menu, "&File")
|
||||||
|
|
||||||
|
|||||||
@@ -19,18 +19,25 @@ def get_resource_path(relative_path):
|
|||||||
|
|
||||||
return os.path.join(base_path, relative_path)
|
return os.path.join(base_path, relative_path)
|
||||||
|
|
||||||
|
|
||||||
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
class PrivacyNoticeDialog(wx.Dialog):
|
class PrivacyNoticeDialog(wx.Dialog):
|
||||||
def __init__(self, parent):
|
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
|
self.parent = parent
|
||||||
|
|
||||||
# Calculate optimal dialog size based on screen size
|
# Calculate optimal dialog size based on screen size
|
||||||
screen_width, screen_height = wx.DisplaySize()
|
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.max_height = min(700, screen_height * 0.8)
|
||||||
|
|
||||||
self.SetMinSize((450, 400))
|
self.SetMinSize((450, 400))
|
||||||
@@ -63,7 +70,7 @@ class PrivacyNoticeDialog(wx.Dialog):
|
|||||||
title_text = wx.StaticText(self, label="Privacy and System Information")
|
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_font = wx.Font(14, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD)
|
||||||
title_text.SetFont(title_font)
|
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)
|
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_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_font = wx.Font(11, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD)
|
||||||
security_text.SetFont(security_font)
|
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
|
# Detect potential security features
|
||||||
security_warnings = self.get_security_warnings(system_info)
|
security_warnings = self.get_security_warnings(system_info)
|
||||||
|
logger.info(f"Security Warnings: {security_warnings}")
|
||||||
|
|
||||||
privacy_notice = (
|
privacy_notice = (
|
||||||
"wxIRC is an Open Source project and must not be distributed for commercial purposes.\n\n"
|
"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"
|
"Security Considerations:\n"
|
||||||
f"{security_warnings}\n\n"
|
f"{security_warnings}\n\n"
|
||||||
@@ -111,8 +120,10 @@ class PrivacyNoticeDialog(wx.Dialog):
|
|||||||
# System information section (moved to bottom)
|
# System information section (moved to bottom)
|
||||||
sysinfo_text = wx.StaticText(self.scrolled_win, label="System Information:")
|
sysinfo_text = wx.StaticText(self.scrolled_win, label="System Information:")
|
||||||
sysinfo_text.SetFont(security_font)
|
sysinfo_text.SetFont(security_font)
|
||||||
|
|
||||||
|
|
||||||
scrolled_sizer.Add(sysinfo_text, 0, wx.ALL, 5)
|
scrolled_sizer.Add(sysinfo_text, 0, wx.ALL, 5)
|
||||||
|
|
||||||
# System info details
|
# System info details
|
||||||
info_details = (
|
info_details = (
|
||||||
f"Operating System: {system_info['os']}\n"
|
f"Operating System: {system_info['os']}\n"
|
||||||
@@ -126,9 +137,14 @@ class PrivacyNoticeDialog(wx.Dialog):
|
|||||||
f"Hostname: {system_info['hostname']}\n"
|
f"Hostname: {system_info['hostname']}\n"
|
||||||
f"Username: {system_info['username']}\n"
|
f"Username: {system_info['username']}\n"
|
||||||
f"Python Version: {system_info['python_version']}\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)
|
self.info_text = wx.StaticText(self.scrolled_win, label=info_details)
|
||||||
scrolled_sizer.Add(self.info_text, 0, wx.ALL | wx.EXPAND, 10)
|
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)
|
main_sizer.Add(self.scrolled_win, 1, wx.EXPAND | wx.ALL, 5)
|
||||||
|
|
||||||
# Add OK button with auto-sizing
|
# 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()
|
ok_btn.SetDefault()
|
||||||
|
|
||||||
# Calculate button size based on text content
|
# Calculate button size based on text content
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import sys
|
|||||||
from PrivacyNoticeDialog import PrivacyNoticeDialog
|
from PrivacyNoticeDialog import PrivacyNoticeDialog
|
||||||
from IRCPanel import IRCPanel
|
from IRCPanel import IRCPanel
|
||||||
from AboutDialog import AboutDialog
|
from AboutDialog import AboutDialog
|
||||||
from NotesDialog import NotesDialog # Add this import
|
from NotesDialog import NotesDialog
|
||||||
|
|
||||||
# Set up logging
|
# Set up logging
|
||||||
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
||||||
@@ -358,7 +358,7 @@ class IRCFrame(wx.Frame):
|
|||||||
|
|
||||||
# Tools menu
|
# Tools menu
|
||||||
tools_menu = wx.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(201, "&WHOIS User\tCtrl+I")
|
||||||
tools_menu.Append(202, "Change &Nick\tCtrl+N")
|
tools_menu.Append(202, "Change &Nick\tCtrl+N")
|
||||||
tools_menu.AppendSeparator()
|
tools_menu.AppendSeparator()
|
||||||
@@ -1274,11 +1274,11 @@ if __name__ == "__main__":
|
|||||||
try:
|
try:
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
enable_high_dpi()
|
enable_high_dpi()
|
||||||
else:
|
|
||||||
pass
|
|
||||||
app = wx.App()
|
app = wx.App()
|
||||||
frame = IRCFrame()
|
frame = IRCFrame()
|
||||||
frame.SetIcon(wx.Icon(get_resource_path("icon.ico"), wx.BITMAP_TYPE_ICO))
|
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()
|
app.MainLoop()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.critical(f"Fatal error: {e}")
|
logger.critical(f"Fatal error: {e}")
|
||||||
|
|||||||
Reference in New Issue
Block a user