author | Edouard Tisserant <edouard.tisserant@gmail.com> |
Mon, 18 Nov 2024 13:55:51 +0100 | |
changeset 4040 | ea2db66b185f |
parent 3909 | c29a95aebfbf |
permissions | -rw-r--r-- |
1565
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
1 |
#!/usr/bin/env python |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
2 |
# -*- coding: utf-8 -*- |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
3 |
|
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
4 |
# Copyright (c) 2009, 2010 by Steven Sproat |
1628
6309efe91289
fix file header in AboutDialog.py
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1612
diff
changeset
|
5 |
# Copyright (c) 2016 by Andrey Skvortsov <andrej.skvortzov@gmail.com> |
3909
c29a95aebfbf
Shows AboutDialog even if revisions.tx is missing
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3906
diff
changeset
|
6 |
# Copyright (c) 2024 by Edouard Tisserant |
c29a95aebfbf
Shows AboutDialog even if revisions.tx is missing
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3906
diff
changeset
|
7 |
|
1628
6309efe91289
fix file header in AboutDialog.py
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1612
diff
changeset
|
8 |
# See COPYING file for copyrights details. |
3750
f62625418bff
automated conversion using 2to3-3.9 tool
GP Orcullo <kinsamanka@gmail.com>
parents:
3586
diff
changeset
|
9 |
|
1565
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
10 |
import os |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
11 |
import wx |
3570
eb915a9fdcb0
IDE: fix About dialog not showing (wxPython4 sequel), update copyright section.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
1881
diff
changeset
|
12 |
import wx.adv |
1565
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
13 |
from wx.lib.agw.hyperlink import HyperLinkCtrl |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
14 |
|
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
15 |
|
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
16 |
class AboutDialog(wx.Dialog): |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
17 |
""" |
3909
c29a95aebfbf
Shows AboutDialog even if revisions.tx is missing
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3906
diff
changeset
|
18 |
Simpler replacement of About Dialog that shows LongVersion |
1565
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
19 |
""" |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
20 |
def __init__(self, parent, info): |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
21 |
title = _("About") + " " + info.Name |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
22 |
wx.Dialog.__init__(self, parent, title=title) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
23 |
self.info = info |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
24 |
|
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
25 |
if parent and parent.GetIcon(): |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
26 |
self.SetIcon(parent.GetIcon()) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
27 |
|
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
28 |
image = None |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
29 |
if self.info.Icon: |
3586
cbc6a6ccd52e
IDE: Fixed About dialog exception on Windows, and typo in about dialog's content.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3570
diff
changeset
|
30 |
bitmap = wx.Bitmap() |
cbc6a6ccd52e
IDE: Fixed About dialog exception on Windows, and typo in about dialog's content.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3570
diff
changeset
|
31 |
bitmap.CopyFromIcon(self.info.Icon) |
1565
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
32 |
image = wx.StaticBitmap(self, bitmap=bitmap) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
33 |
|
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
34 |
name = wx.StaticText(self, label="%s %s" % (info.Name, info.Version)) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
35 |
description = wx.StaticText(self, label=info.Description) |
1589
a5fd07db1db6
make about dialog on Windows not so big
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1565
diff
changeset
|
36 |
description.Wrap(400) |
1565
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
37 |
copyright = wx.StaticText(self, label=info.Copyright) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
38 |
url = HyperLinkCtrl(self, label=info.WebSite[0], URL=info.WebSite[1]) |
3906
f831ff63ca6e
IDE: display contents of revisions.txt (put there by installer builder script) in About Dialog.
Edouard Tisserant <edouard@beremiz.fr>
parents:
3750
diff
changeset
|
39 |
long_version = wx.StaticText(self, label=info.GetLongVersion()) |
1565
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
40 |
|
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
41 |
font = name.GetClassDefaultAttributes().font |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
42 |
font.SetWeight(wx.FONTWEIGHT_BOLD) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
43 |
font.SetPointSize(18) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
44 |
name.SetFont(font) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
45 |
|
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
46 |
credits = wx.Button(self, id=wx.ID_ABOUT, label=_("C&redits")) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
47 |
license = wx.Button(self, label=_("&License")) |
1612
bd03e1217fa5
fix close button in system menu for AboutDialog on Windows
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1589
diff
changeset
|
48 |
close = wx.Button(self, id=wx.ID_CANCEL, label=_("&Close")) |
1565
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
49 |
|
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
50 |
btnSizer = wx.BoxSizer(wx.HORIZONTAL) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
51 |
btnSizer.Add(credits, flag=wx.CENTER | wx.LEFT | wx.RIGHT, border=5) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
52 |
btnSizer.Add(license, flag=wx.CENTER | wx.RIGHT, border=5) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
53 |
btnSizer.Add(close, flag=wx.CENTER | wx.RIGHT, border=5) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
54 |
|
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
55 |
sizer = wx.BoxSizer(wx.VERTICAL) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
56 |
if image: |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
57 |
sizer.Add(image, flag=wx.CENTER | wx.TOP | wx.BOTTOM, border=5) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
58 |
sizer.Add(name, flag=wx.CENTER | wx.BOTTOM, border=10) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
59 |
sizer.Add(description, flag=wx.CENTER | wx.BOTTOM, border=10) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
60 |
sizer.Add(copyright, flag=wx.CENTER | wx.BOTTOM, border=10) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
61 |
sizer.Add(url, flag=wx.CENTER | wx.BOTTOM, border=15) |
3906
f831ff63ca6e
IDE: display contents of revisions.txt (put there by installer builder script) in About Dialog.
Edouard Tisserant <edouard@beremiz.fr>
parents:
3750
diff
changeset
|
62 |
sizer.Add(long_version, flag=wx.CENTER | wx.BOTTOM, border=10) |
1565
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
63 |
sizer.Add(btnSizer, flag=wx.CENTER | wx.BOTTOM, border=5) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
64 |
|
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
65 |
container = wx.BoxSizer(wx.VERTICAL) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
66 |
container.Add(sizer, flag=wx.ALL, border=10) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
67 |
self.SetSizer(container) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
68 |
self.Layout() |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
69 |
self.Fit() |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
70 |
self.Centre() |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
71 |
self.Show(True) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
72 |
self.SetEscapeId(close.GetId()) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
73 |
|
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
74 |
credits.Bind(wx.EVT_BUTTON, self.on_credits) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
75 |
license.Bind(wx.EVT_BUTTON, self.on_license) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
76 |
close.Bind(wx.EVT_BUTTON, lambda evt: self.Destroy()) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
77 |
|
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
78 |
def on_license(self, event): |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
79 |
LicenseDialog(self, self.info) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
80 |
|
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
81 |
def on_credits(self, event): |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
82 |
CreditsDialog(self, self.info) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
83 |
|
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
84 |
|
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
85 |
class CreditsDialog(wx.Dialog): |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
86 |
def __init__(self, parent, info): |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
87 |
wx.Dialog.__init__(self, parent, title=_("Credits"), size=(475, 320), |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
88 |
style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
89 |
|
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
90 |
if parent and parent.GetIcon(): |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
91 |
self.SetIcon(parent.GetIcon()) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
92 |
|
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
93 |
self.SetMinSize((300, 200)) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
94 |
notebook = wx.Notebook(self) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
95 |
close = wx.Button(self, id=wx.ID_CLOSE, label=_("&Close")) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
96 |
close.SetDefault() |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
97 |
|
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
98 |
developer = wx.TextCtrl(notebook, style=wx.TE_READONLY | wx.TE_MULTILINE) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
99 |
translators = wx.TextCtrl(notebook, style=wx.TE_READONLY | wx.TE_MULTILINE) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
100 |
|
3750
f62625418bff
automated conversion using 2to3-3.9 tool
GP Orcullo <kinsamanka@gmail.com>
parents:
3586
diff
changeset
|
101 |
developer.SetValue('\n'.join(info.Developers)) |
f62625418bff
automated conversion using 2to3-3.9 tool
GP Orcullo <kinsamanka@gmail.com>
parents:
3586
diff
changeset
|
102 |
translators.SetValue('\n'.join(info.Translators)) |
1565
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
103 |
|
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
104 |
notebook.AddPage(developer, text=_("Written by")) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
105 |
notebook.AddPage(translators, text=_("Translated by")) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
106 |
|
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
107 |
btnSizer = wx.BoxSizer(wx.HORIZONTAL) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
108 |
btnSizer.Add(close) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
109 |
|
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
110 |
sizer = wx.BoxSizer(wx.VERTICAL) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
111 |
sizer.Add(notebook, 1, wx.EXPAND | wx.ALL, 10) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
112 |
sizer.Add(btnSizer, flag=wx.ALIGN_RIGHT | wx.RIGHT | wx.BOTTOM, border=10) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
113 |
self.SetSizer(sizer) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
114 |
self.Layout() |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
115 |
self.Show() |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
116 |
self.SetEscapeId(close.GetId()) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
117 |
|
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
118 |
close.Bind(wx.EVT_BUTTON, lambda evt: self.Destroy()) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
119 |
|
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
120 |
|
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
121 |
class LicenseDialog(wx.Dialog): |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
122 |
def __init__(self, parent, info): |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
123 |
wx.Dialog.__init__(self, parent, title=_("License"), size=(500, 400), |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
124 |
style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
125 |
|
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
126 |
if parent and parent.GetIcon(): |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
127 |
self.SetIcon(parent.GetIcon()) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
128 |
|
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
129 |
self.SetMinSize((400, 300)) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
130 |
close = wx.Button(self, id=wx.ID_CLOSE, label=_("&Close")) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
131 |
|
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
132 |
ctrl = wx.TextCtrl(self, style=wx.TE_READONLY | wx.TE_MULTILINE) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
133 |
ctrl.SetValue(info.License) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
134 |
|
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
135 |
btnSizer = wx.BoxSizer(wx.HORIZONTAL) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
136 |
btnSizer.Add(close) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
137 |
|
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
138 |
sizer = wx.BoxSizer(wx.VERTICAL) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
139 |
sizer.Add(ctrl, 1, wx.EXPAND | wx.ALL, 10) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
140 |
sizer.Add(btnSizer, flag=wx.ALIGN_RIGHT | wx.RIGHT | wx.BOTTOM, border=10) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
141 |
self.SetSizer(sizer) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
142 |
self.Layout() |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
143 |
self.Show() |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
144 |
self.SetEscapeId(close.GetId()) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
145 |
|
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
146 |
close.Bind(wx.EVT_BUTTON, lambda evt: self.Destroy()) |
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
147 |
|
1736
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1628
diff
changeset
|
148 |
|
1565
894f31f8ca64
make about dialog boxes use standard wx about dialogs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
149 |
def ShowAboutDialog(parent, info): |
3909
c29a95aebfbf
Shows AboutDialog even if revisions.tx is missing
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3906
diff
changeset
|
150 |
AboutDialog(parent, info) |