70 lines
2.5 KiB
Python
70 lines
2.5 KiB
Python
import wx
|
|
import sys
|
|
import os
|
|
|
|
|
|
def get_resource_path(relative_path):
|
|
"""Get absolute path to resource, works for dev and for PyInstaller"""
|
|
try:
|
|
# PyInstaller creates a temp folder and stores path in _MEIPASS
|
|
base_path = sys._MEIPASS
|
|
except Exception:
|
|
base_path = os.path.abspath(".")
|
|
|
|
return os.path.join(base_path, relative_path)
|
|
|
|
|
|
class AboutDialog(wx.Dialog):
|
|
def __init__(self, parent):
|
|
super().__init__(parent, title="About wxIRC Client", style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
|
|
|
|
sizer = wx.BoxSizer(wx.VERTICAL)
|
|
|
|
icon_path = get_resource_path("icon.ico")
|
|
icon_bitmap = wx.Bitmap(icon_path, wx.BITMAP_TYPE_ICO)
|
|
icon_ctrl = wx.StaticBitmap(self, bitmap=icon_bitmap)
|
|
|
|
# Add the icon to the sizer
|
|
sizer.Add(icon_ctrl, 0, wx.ALL | wx.ALIGN_CENTER, 10)
|
|
|
|
# Application info
|
|
info_text = wx.StaticText(self, label="wxIRC Client")
|
|
info_font = wx.Font(14, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD)
|
|
info_text.SetFont(info_font)
|
|
|
|
import base64, hashlib
|
|
|
|
self.encoded = base64.b64encode(
|
|
hashlib.sha256(f"{self.GetId()}-{self.GetHandle()}".encode()).digest()
|
|
).decode('utf-8')
|
|
|
|
|
|
version_text = wx.StaticText(self, label=f"wxIRC V:e1")
|
|
version_font = wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL)
|
|
version_text.SetFont(version_font)
|
|
|
|
|
|
rand_hash = wx.StaticText(self, label=f"{self.encoded}")
|
|
rand_hash.SetFont(version_font)
|
|
|
|
contrubutors_text = wx.StaticText(self, label="This software may not be used for commercial purposes. \n And may not be distributed for commercial purposes.")
|
|
contrubutors_font = wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL)
|
|
contrubutors_text.SetFont(contrubutors_font)
|
|
|
|
# Add info to sizer
|
|
sizer.Add(info_text, 0, wx.ALL | wx.ALIGN_CENTER, 5)
|
|
sizer.Add(version_text, 0, wx.ALL | wx.ALIGN_CENTER, 5)
|
|
sizer.Add(rand_hash, 0, wx.ALL | wx.ALIGN_CENTER, 5)
|
|
sizer.Add(contrubutors_text, 0, wx.ALL | wx.ALIGN_CENTER, 5)
|
|
|
|
# OK button
|
|
ok_btn = wx.Button(self, wx.ID_OK, "OK")
|
|
ok_btn.SetDefault()
|
|
btn_sizer = wx.BoxSizer(wx.HORIZONTAL)
|
|
btn_sizer.Add(ok_btn, 0, wx.ALIGN_CENTER | wx.ALL, 10)
|
|
sizer.Add(btn_sizer, 0, wx.ALIGN_CENTER)
|
|
|
|
self.SetSizer(sizer)
|
|
self.Fit()
|
|
self.Centre()
|