|
9 | 9 | import urllib |
10 | 10 | import semver |
11 | 11 | import textwrap |
| 12 | +import pyperclip |
12 | 13 | import traceback |
13 | 14 | import os |
14 | 15 | import time |
|
41 | 42 | app_name = "pointer-cc" |
42 | 43 | app_author = "smatting" |
43 | 44 | app_url = "https://github.com/smatting/pointer-cc/" |
| 45 | + |
44 | 46 | url_latest = "https://raw.githubusercontent.com/smatting/pointer-cc/main/latest_release.txt" |
45 | 47 |
|
46 | 48 | InternalCommand = Enum('InternalCommand', ['QUIT', 'CHANGE_MIDI_PORT', 'CHANGE_MIDI_CHANNEL', 'UPDATE_WINDOW', 'RELOAD_ALL_CONFIGS']) |
@@ -918,6 +920,54 @@ def on_save_file_picked(self, event): |
918 | 920 |
|
919 | 921 | self.EndModal(0) |
920 | 922 |
|
| 923 | +class AboutWindow(wx.Frame): |
| 924 | + def __init__(self, parent): |
| 925 | + super(AboutWindow, self).__init__(parent) |
| 926 | + msg = f'pointer-cc, Version {version}\nby Stefan Matting\nPlease send feedback to [email protected] or the github site.' |
| 927 | + |
| 928 | + sizer = wx.BoxSizer(wx.VERTICAL) |
| 929 | + |
| 930 | + margin_outside = 20 |
| 931 | + |
| 932 | + sizer.AddSpacer(40) |
| 933 | + |
| 934 | + self.version_label = wx.StaticText(self, label=msg, style=wx.ALIGN_CENTRE_HORIZONTAL) |
| 935 | + sizer.Add(self.version_label, 0, wx.LEFT | wx.RIGHT, margin_outside) |
| 936 | + |
| 937 | + sizer.AddSpacer(10) |
| 938 | + |
| 939 | + self.go_website = wx.Button(self, label='Go to website') |
| 940 | + self.go_website.Bind(wx.EVT_BUTTON, self.on_go_website) |
| 941 | + sizer.Add(self.go_website, 0, wx.LEFT | wx.RIGHT, margin_outside) |
| 942 | + |
| 943 | + sizer.AddSpacer(10) |
| 944 | + |
| 945 | + self.copy_email = wx.Button(self, label='Copy email address to clipboard') |
| 946 | + self.copy_email.Bind(wx.EVT_BUTTON, self.on_copy_email) |
| 947 | + sizer.Add(self.copy_email, 0, wx.LEFT | wx.RIGHT, margin_outside) |
| 948 | + |
| 949 | + sizer.AddSpacer(10) |
| 950 | + |
| 951 | + self.close_button = wx.Button(self, label='Close window') |
| 952 | + self.close_button.Bind(wx.EVT_BUTTON, self.on_close) |
| 953 | + sizer.Add(self.close_button, 0, wx.LEFT | wx.RIGHT, margin_outside) |
| 954 | + |
| 955 | + sizer.AddSpacer(40) |
| 956 | + |
| 957 | + self.SetSizer(sizer) |
| 958 | + sizer.SetMinSize((300, 0)) |
| 959 | + sizer.Fit(self) |
| 960 | + |
| 961 | + def on_go_website(self, event): |
| 962 | + webbrowser.open(app_url) |
| 963 | + |
| 964 | + def on_copy_email(self, event): |
| 965 | + pyperclip.copy(app_email) |
| 966 | + |
| 967 | + def on_close(self, event): |
| 968 | + self.Destroy() |
| 969 | + |
| 970 | + |
921 | 971 | class MainWindow(wx.Frame): |
922 | 972 | def __init__(self, parent, title, q, ports): |
923 | 973 | wx.Frame.__init__(self, parent, title=title) |
@@ -955,6 +1005,7 @@ def __init__(self, parent, title, q, ports): |
955 | 1005 |
|
956 | 1006 | filemenu= wx.Menu() |
957 | 1007 |
|
| 1008 | + |
958 | 1009 | about = filemenu.Append(wx.ID_ABOUT, "&About"," Information about this program") |
959 | 1010 | self.Bind(wx.EVT_MENU, self.on_about, about) |
960 | 1011 |
|
@@ -1018,9 +1069,8 @@ def on_help(self, event): |
1018 | 1069 | webbrowser.open(app_url) |
1019 | 1070 |
|
1020 | 1071 | def on_about(self, event): |
1021 | | - msg = f'poiter-cc, Version {version}\nby Stefan Matting\nPlease send feedback to [email protected] or the github site.' |
1022 | | - dlg = wx.MessageDialog(None, msg, 'About', wx.OK | wx.ICON_INFORMATION) |
1023 | | - dlg.ShowModal() |
| 1072 | + about_window = AboutWindow(self) |
| 1073 | + about_window.Show() |
1024 | 1074 |
|
1025 | 1075 | def reload_config(self, event): |
1026 | 1076 | self.queue.put((InternalCommand.RELOAD_ALL_CONFIGS, None)) |
|
0 commit comments