Skip to content

Commit 33833fc

Browse files
author
Stefan Matting
committed
Add about dialog
1 parent 202d89f commit 33833fc

File tree

2 files changed

+54
-3
lines changed

2 files changed

+54
-3
lines changed

main.py

Lines changed: 53 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import urllib
1010
import semver
1111
import textwrap
12+
import pyperclip
1213
import traceback
1314
import os
1415
import time
@@ -41,6 +42,7 @@
4142
app_name = "pointer-cc"
4243
app_author = "smatting"
4344
app_url = "https://github.com/smatting/pointer-cc/"
45+
app_email = "[email protected]"
4446
url_latest = "https://raw.githubusercontent.com/smatting/pointer-cc/main/latest_release.txt"
4547

4648
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):
918920

919921
self.EndModal(0)
920922

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+
921971
class MainWindow(wx.Frame):
922972
def __init__(self, parent, title, q, ports):
923973
wx.Frame.__init__(self, parent, title=title)
@@ -955,6 +1005,7 @@ def __init__(self, parent, title, q, ports):
9551005

9561006
filemenu= wx.Menu()
9571007

1008+
9581009
about = filemenu.Append(wx.ID_ABOUT, "&About"," Information about this program")
9591010
self.Bind(wx.EVT_MENU, self.on_about, about)
9601011

@@ -1018,9 +1069,8 @@ def on_help(self, event):
10181069
webbrowser.open(app_url)
10191070

10201071
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()
10241074

10251075
def reload_config(self, event):
10261076
self.queue.put((InternalCommand.RELOAD_ALL_CONFIGS, None))

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ pyinstaller-hooks-contrib==2024.4
3030
pyobjc-core==10.2; sys_platform == "darwin"
3131
pyobjc-framework-Cocoa==10.2; sys_platform == "darwin"
3232
pyobjc-framework-Quartz==10.2; sys_platform == "darwin"
33+
pyperclip==1.8.2
3334
PyRect==0.2.0
3435
python-rtmidi==1.5.8
3536
pywin32==306; sys_platform == "win32"

0 commit comments

Comments
 (0)