libtextworker 0.1.4
Cross-platform, free and open library for Python projects
about.py
1 """
2 @package libtextworker.interface.wx.about
3 @brief About dialog for wxPython projects
4 """
5 
6 # A cross-platform library for Python apps.
7 # Copyright (C) 2023-2024 Le Bao Nguyen and contributors.
8 # This is a part of the libtextworker project.
9 # Licensed under the GNU General Public License version 3.0 or later.
10 
11 import wx
12 import wx.adv
13 
14 from typing import Any
15 from ...general import CraftItems
16 from ... import LICENSES
17 
18 
20  """
21  About dialog built with wxPython.
22  All self-set infomations are stored in the ```infos``` attribute.
23  Just run ShowBox() to see your work.
24  You can set the parent of the dialog if needed, use the Parent variable.
25  This class is ~~not~~ sub-class-able. (since 0.1.4)
26  """
27 
28  infos = wx.adv.AboutDialogInfo()
29  Parent: Any | None = None
30 
31  SetArtists = infos.SetArtists
32  SetCopyright = infos.SetCopyright
33  SetDescription = infos.SetDescription
34  SetDevelopers = infos.SetDevelopers
35  SetDocWriters = infos.SetDocWriters
36  SetIcon = infos.SetIcon
37  SetName = infos.SetName
38  SetTranslators = infos.SetTranslators
39  SetVersion = infos.SetVersion
40  SetWebSite = infos.SetWebSite
41 
42  def SetLicense(self, license: str, include_copyright: bool = False):
43  """
44  Set the long, multiline string containing the text of the program license.
45  @see available_licenses
46  @see SetCopyright
47  """
48  data = "" # Our result
49 
50  if include_copyright == True and self.infosinfos.GetCopyright() != "":
51  data += self.infosinfos.GetCopyright() + "\n"
52 
53  data += license
54  self.infosinfos.SetLicence(data)
55 
56  def ShowBox(self, event=None):
57  """
58  Shows a About dialog with infomations collected.
59  @param event | None: wxPython event
60  @return wx.adv.AboutBox: About window
61  """
62  return wx.adv.AboutBox(self.infosinfos, self.Parent)
def SetLicense(self, str license, bool include_copyright=False)
Definition: about.py:42