]>
Commit | Line | Data |
---|---|---|
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-2006 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 | ("python-ldap", "Python Software Foundation License", "http://python-ldap.sourceforge.net"), | |
49 | ("Sarissa", "LGPL", "http://sourceforge.net/projects/sarissa/"), | |
50 | ("Dynarch DHTML Calendar", "LGPL", "http://www.dynarch.com/projects/calendar/"), | |
51 | ("python-dateutil", "Python Software Foundation License", "http://labix.org/python-dateutil"), | |
52 | ] | |
53 | ||
54 | if wx.Platform == '__WXMSW__': # add Windows only licenses | |
55 | licenseData += [("pywin32", "Python Software Foundation License", "http://sourceforge.net/projects/pywin32/")] | |
56 | ||
57 | class AboutDialog(wx.Dialog): | |
58 | ||
59 | def __init__(self, parent): | |
60 | """ | |
61 | Initializes the about dialog. | |
62 | """ | |
63 | wx.Dialog.__init__(self, parent, -1, _("About ") + wx.GetApp().GetAppName(), style = wx.DEFAULT_DIALOG_STYLE) | |
64 | ||
65 | nb = wx.Notebook(self, -1) | |
66 | ||
67 | aboutPage = wx.Panel(nb, -1) | |
68 | sizer = wx.BoxSizer(wx.VERTICAL) | |
69 | ||
70 | if not ACTIVEGRID_BASE_IDE: | |
71 | splash_bmp = getSplashBitmap() | |
72 | else: | |
73 | splash_bmp = getIDESplashBitmap() | |
74 | ||
75 | # find version number from | |
76 | versionFilepath = os.path.join(sysutilslib.mainModuleDir, "version.txt") | |
77 | if os.path.exists(versionFilepath): | |
78 | versionfile = open(versionFilepath, 'r') | |
79 | versionLines = versionfile.readlines() | |
80 | versionfile.close() | |
81 | version = "".join(versionLines) | |
82 | else: | |
83 | version = _("Version Unknown - %s not found" % versionFilepath) | |
84 | ||
85 | image = wx.StaticBitmap(aboutPage, -1, splash_bmp, (0,0), (splash_bmp.GetWidth(), splash_bmp.GetHeight())) | |
86 | sizer.Add(image, 0, wx.ALIGN_CENTER|wx.ALL, 0) | |
87 | sizer.Add(wx.StaticText(aboutPage, -1, wx.GetApp().GetAppName() + _("\n%s\n\nCopyright (c) 2003-2006 ActiveGrid Incorporated and Contributors. All rights reserved.") % version), 0, wx.ALIGN_LEFT|wx.ALL, 10) | |
88 | sizer.Add(wx.StaticText(aboutPage, -1, _("http://www.activegrid.com")), 0, wx.ALIGN_LEFT|wx.LEFT|wx.BOTTOM, 10) | |
89 | aboutPage.SetSizer(sizer) | |
90 | nb.AddPage(aboutPage, _("Copyright")) | |
91 | ||
92 | licensePage = wx.Panel(nb, -1) | |
93 | grid = wx.grid.Grid(licensePage, -1) | |
94 | grid.CreateGrid(len(licenseData), 2) | |
95 | ||
96 | dc = wx.ClientDC(grid) | |
97 | dc.SetFont(grid.GetLabelFont()) | |
98 | grid.SetColLabelValue(0, _("License")) | |
99 | grid.SetColLabelValue(1, _("URL")) | |
100 | w, h1 = dc.GetTextExtent(_("License")) | |
101 | w, h2 = dc.GetTextExtent(_("URL")) | |
102 | maxHeight = max(h1, h2) | |
103 | grid.SetColLabelSize(maxHeight + 6) # add a 6 pixel margin | |
104 | ||
105 | maxW = 0 | |
106 | for row, data in enumerate(licenseData): | |
107 | package = data[0] | |
108 | license = data[1] | |
109 | url = data[2] | |
110 | if package: | |
111 | grid.SetRowLabelValue(row, package) | |
112 | w, h = dc.GetTextExtent(package) | |
113 | if w > maxW: | |
114 | maxW = w | |
115 | if license: | |
116 | grid.SetCellValue(row, 0, license) | |
117 | if url: | |
118 | grid.SetCellValue(row, 1, url) | |
119 | ||
120 | grid.EnableEditing(False) | |
121 | grid.EnableDragGridSize(False) | |
122 | grid.EnableDragColSize(False) | |
123 | grid.EnableDragRowSize(False) | |
124 | grid.SetRowLabelAlignment(wx.ALIGN_LEFT, wx.ALIGN_CENTRE) | |
125 | grid.SetLabelBackgroundColour(wx.WHITE) | |
126 | grid.AutoSizeColumn(0) | |
127 | grid.AutoSizeColumn(1) | |
128 | grid.SetRowLabelSize(maxW + 10) | |
129 | sizer = wx.BoxSizer(wx.VERTICAL) | |
130 | sizer.Add(grid, 1, wx.EXPAND|wx.ALL, 10) | |
131 | licensePage.SetSizer(sizer) | |
132 | nb.AddPage(licensePage, _("Licenses")) | |
133 | ||
134 | creditsPage = wx.Panel(nb, -1) | |
135 | sizer = wx.BoxSizer(wx.VERTICAL) | |
136 | sizer.Add(wx.StaticText(creditsPage, -1, _("ActiveGrid Development Team:\n\nLarry Abrahams\nLawrence Bruhmuller\nEric Chu\nBeth Fryer\nMatt Fryer\nFrankie Fu\nJoel Hare\nMorgan Hua\nMatt McNulty\nPratik Mehta\nAlan Mullendore\nJeff Norton\nKevin Ollivier\nMatt Small\nSimon Toens\nKevin Wang\nPeter Yared\nJeremy Yun")), 0, wx.ALIGN_LEFT|wx.ALL, 10) | |
137 | creditsPage.SetSizer(sizer) | |
138 | nb.AddPage(creditsPage, _("Credits")) | |
139 | ||
140 | sizer = wx.BoxSizer(wx.VERTICAL) | |
141 | sizer.Add(nb, 0, wx.ALIGN_CENTRE|wx.ALL, 5) | |
142 | btn = wx.Button(self, wx.ID_OK) | |
143 | sizer.Add(btn, 0, wx.ALIGN_CENTRE|wx.ALL, 5) | |
144 | ||
145 | self.SetSizer(sizer) | |
146 | self.Layout() | |
147 | self.Fit() | |
148 | grid.ForceRefresh() # wxBug: Get rid of unnecessary scrollbars | |
149 | ||
150 |