]> git.saurik.com Git - wxWidgets.git/blob - wxPython/samples/ide/activegrid/tool/AboutDialog.py
Tweaks for demos on MacOSX
[wxWidgets.git] / wxPython / samples / ide / activegrid / tool / AboutDialog.py
1 #----------------------------------------------------------------------------
2 # Name: AboutDialog.py
3 # Purpose: AboutBox which has copyright notice, license information, and credits
4 #
5 # Author: Morgan Hua
6 #
7 # Created: 3/22/05
8 # Copyright: (c) 2005 ActiveGrid, Inc.
9 # CVS-ID: $Id$
10 # License: wxWindows License
11 #----------------------------------------------------------------------------
12
13 import wx
14 import os.path
15 from IDE import ACTIVEGRID_BASE_IDE, getSplashBitmap, getIDESplashBitmap
16 import activegrid.util.sysutils as sysutilslib
17 _ = wx.GetTranslation
18
19 #----------------------------------------------------------------------------
20 # Package License Data for AboutDialog
21 # Package, License, URL
22 # If no information is available, put a None as a place holder.
23 #
24 # NO GPL Allowed. Only LGPL, BSD, and Public Domain Based Licenses!
25 #----------------------------------------------------------------------------
26
27
28 licenseData = [ # add licenses for base IDE features
29 ("ActiveGrid", "Apache License, Version 2.0", "http://apache.org/licenses/LICENSE-2.0"),
30 ("Python 2.4", "Python Software Foundation License", "http://www.python.org/2.4/license.html"),
31 ("wxPython 2.6", "wxWidgets 2 - LGPL", "http://wxwidgets.org/newlicen.htm"),
32 ("wxWidgets", "wxWindows Library License 3", "http://www.wxwidgets.org/manuals/2.6.1/wx_wxlicense.html"),
33 ("pychecker", "MetaSlash - BSD", "http://pychecker.sourceforge.net/COPYRIGHT"),
34 ("process.py", "See file", "http://starship.python.net/~tmick/"),
35 ("pysvn", "Apache License, Version 2.0", "http://pysvn.tigris.org/"),
36 ]
37
38 if not ACTIVEGRID_BASE_IDE: # add licenses for non-base IDE features such as database connections
39 licenseData += [
40 ("pydb2", "LGPL", "http://sourceforge.net/projects/pydb2"),
41 ("pysqlite", "Python License (CNRI)", "http://sourceforge.net/projects/pysqlite"),
42 ("mysql-python", "GPL, Python License (CNRI), Zope Public License", "http://sourceforge.net/projects/mysql-python"),
43 ("cx_Oracle", "Computronix", "http://www.computronix.com/download/License(cxOracle).txt"),
44 ("SQLite", "Public Domain", "http://www.sqlite.org/copyright.html"),
45 ("PyGreSQL", "BSD", "http://www.pygresql.org"),
46 ("pyXML", "CNRI Python License", "http://sourceforge.net/softwaremap/trove_list.php?form_cat=194"),
47 ("Zolera Soap Infrastructure", "Zope Public License 2.0", "http://www.zope.org/Resources/License/"),
48 ("Sarissa", "LGPL", "http://sourceforge.net/projects/sarissa/"),
49 ("Dynarch DHTML Calendar", "LGPL", "http://www.dynarch.com/projects/calendar/"),
50 ]
51
52 if wx.Platform == '__WXMSW__': # add Windows only licenses
53 licenseData += [("pywin32", "Python Software Foundation License", "http://sourceforge.net/projects/pywin32/")]
54
55 class AboutDialog(wx.Dialog):
56
57 def __init__(self, parent):
58 """
59 Initializes the about dialog.
60 """
61 wx.Dialog.__init__(self, parent, -1, _("About ") + wx.GetApp().GetAppName(), style = wx.DEFAULT_DIALOG_STYLE)
62
63 nb = wx.Notebook(self, -1)
64
65 aboutPage = wx.Panel(nb, -1)
66 sizer = wx.BoxSizer(wx.VERTICAL)
67
68 if not ACTIVEGRID_BASE_IDE:
69 splash_bmp = getSplashBitmap()
70 else:
71 splash_bmp = getIDESplashBitmap()
72
73 # find version number from
74 versionFilepath = os.path.join(sysutilslib.mainModuleDir, "version.txt")
75 if os.path.exists(versionFilepath):
76 versionfile = open(versionFilepath, 'r')
77 versionLines = versionfile.readlines()
78 versionfile.close()
79 version = "".join(versionLines)
80 else:
81 version = _("Version Unknown - %s not found" % versionFilepath)
82
83 image = wx.StaticBitmap(aboutPage, -1, splash_bmp, (0,0), (splash_bmp.GetWidth(), splash_bmp.GetHeight()))
84 sizer.Add(image, 0, wx.ALIGN_CENTER|wx.ALL, 0)
85 sizer.Add(wx.StaticText(aboutPage, -1, wx.GetApp().GetAppName() + _("\n%s\n\nCopyright (c) 2003-2005 ActiveGrid Incorporated and Contributors. All rights reserved.") % version), 0, wx.ALIGN_LEFT|wx.ALL, 10)
86 sizer.Add(wx.StaticText(aboutPage, -1, _("http://www.activegrid.com")), 0, wx.ALIGN_LEFT|wx.LEFT|wx.BOTTOM, 10)
87 aboutPage.SetSizer(sizer)
88 nb.AddPage(aboutPage, _("Copyright"))
89
90 licensePage = wx.Panel(nb, -1)
91 grid = wx.grid.Grid(licensePage, -1)
92 grid.CreateGrid(len(licenseData), 2)
93
94 dc = wx.ClientDC(grid)
95 dc.SetFont(grid.GetLabelFont())
96 grid.SetColLabelValue(0, _("License"))
97 grid.SetColLabelValue(1, _("URL"))
98 w, maxHeight = dc.GetTextExtent(_("License"))
99 w, h = dc.GetTextExtent(_("URL"))
100 if h > maxHeight:
101 maxHeight = h
102 grid.SetColLabelSize(maxHeight + 6) # add a 6 pixel margin
103
104 maxW = 0
105 for row, data in enumerate(licenseData):
106 package = data[0]
107 license = data[1]
108 url = data[2]
109 if package:
110 grid.SetRowLabelValue(row, package)
111 w, h = dc.GetTextExtent(package)
112 if w > maxW:
113 maxW = w
114 if license:
115 grid.SetCellValue(row, 0, license)
116 if url:
117 grid.SetCellValue(row, 1, url)
118
119 grid.EnableEditing(False)
120 grid.EnableDragGridSize(False)
121 grid.EnableDragColSize(False)
122 grid.EnableDragRowSize(False)
123 grid.SetRowLabelAlignment(wx.ALIGN_LEFT, wx.ALIGN_CENTRE)
124 grid.SetLabelBackgroundColour(wx.WHITE)
125 grid.AutoSizeColumn(0)
126 grid.AutoSizeColumn(1)
127 grid.SetRowLabelSize(maxW + 10)
128 sizer = wx.BoxSizer(wx.VERTICAL)
129 sizer.Add(grid, 1, wx.EXPAND|wx.ALL, 10)
130 licensePage.SetSizer(sizer)
131 nb.AddPage(licensePage, _("Licenses"))
132
133 creditsPage = wx.Panel(nb, -1)
134 sizer = wx.BoxSizer(wx.VERTICAL)
135 sizer.Add(wx.StaticText(creditsPage, -1, _("ActiveGrid Development Team:\n\nLarry Abrahams\nLawrence Bruhmuller\nEric Chu\nBeth Fryer\nMatt Fryer\nJoel Hare\nMorgan Hua\nMatt McNulty\nPratik Mehta\nAlan Mullendore\nJeff Norton\nSimon Toens\nKevin Wang\nPeter Yared")), 0, wx.ALIGN_LEFT|wx.ALL, 10)
136 creditsPage.SetSizer(sizer)
137 nb.AddPage(creditsPage, _("Credits"))
138
139 sizer = wx.BoxSizer(wx.VERTICAL)
140 sizer.Add(nb, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
141 btn = wx.Button(self, wx.ID_OK)
142 sizer.Add(btn, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
143
144 self.SetSizer(sizer)
145 self.Layout()
146 self.Fit()
147 grid.ForceRefresh() # wxBug: Get rid of unnecessary scrollbars
148
149