]> git.saurik.com Git - wxWidgets.git/blame - wxPython/samples/ide/activegrid/tool/AboutDialog.py
removed code inside USE_SIZABLE_CALENDAR, we should allow making the main calendar...
[wxWidgets.git] / wxPython / samples / ide / activegrid / tool / AboutDialog.py
CommitLineData
1f780e48
RD
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
aca310e5 8# Copyright: (c) 2005-2006 ActiveGrid, Inc.
1f780e48
RD
9# CVS-ID: $Id$
10# License: wxWindows License
11#----------------------------------------------------------------------------
12
13import wx
02b800ce
RD
14import os.path
15from IDE import ACTIVEGRID_BASE_IDE, getSplashBitmap, getIDESplashBitmap
16import activegrid.util.sysutils as sysutilslib
1f780e48
RD
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.
02b800ce
RD
23#
24# NO GPL Allowed. Only LGPL, BSD, and Public Domain Based Licenses!
1f780e48
RD
25#----------------------------------------------------------------------------
26
27
02b800ce
RD
28licenseData = [ # 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"),
aca310e5 33 ("pychecker", "MetaSlash - BSD", "http://pychecker.sourceforge.net/COPYRIGHT"),
1f780e48 34 ("process.py", "See file", "http://starship.python.net/~tmick/"),
02b800ce 35 ("pysvn", "Apache License, Version 2.0", "http://pysvn.tigris.org/"),
1f780e48
RD
36]
37
02b800ce 38if not ACTIVEGRID_BASE_IDE: # add licenses for non-base IDE features such as database connections
1f780e48 39 licenseData += [
aca310e5 40 ("pydb2", "LGPL", "http://sourceforge.net/projects/pydb2"),
1f780e48 41 ("pysqlite", "Python License (CNRI)", "http://sourceforge.net/projects/pysqlite"),
aca310e5
RD
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"),
1f780e48
RD
44 ("SQLite", "Public Domain", "http://www.sqlite.org/copyright.html"),
45 ("PyGreSQL", "BSD", "http://www.pygresql.org"),
02b800ce
RD
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/"),
aca310e5 48 ("python-ldap", "Python Software Foundation License", "http://python-ldap.sourceforge.net"),
02b800ce
RD
49 ("Sarissa", "LGPL", "http://sourceforge.net/projects/sarissa/"),
50 ("Dynarch DHTML Calendar", "LGPL", "http://www.dynarch.com/projects/calendar/"),
aca310e5 51 ("python-dateutil", "Python Software Foundation License", "http://labix.org/python-dateutil"),
1f780e48
RD
52 ]
53
02b800ce 54if wx.Platform == '__WXMSW__': # add Windows only licenses
1f780e48
RD
55 licenseData += [("pywin32", "Python Software Foundation License", "http://sourceforge.net/projects/pywin32/")]
56
57class 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)
02b800ce
RD
69
70 if not ACTIVEGRID_BASE_IDE:
71 splash_bmp = getSplashBitmap()
72 else:
73 splash_bmp = getIDESplashBitmap()
74
aca310e5 75 # find version number from
02b800ce
RD
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
1f780e48
RD
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)
aca310e5 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)
1f780e48
RD
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)
aca310e5 95
1f780e48
RD
96 dc = wx.ClientDC(grid)
97 dc.SetFont(grid.GetLabelFont())
98 grid.SetColLabelValue(0, _("License"))
99 grid.SetColLabelValue(1, _("URL"))
aca310e5
RD
100 w, h1 = dc.GetTextExtent(_("License"))
101 w, h2 = dc.GetTextExtent(_("URL"))
102 maxHeight = max(h1, h2)
1f780e48
RD
103 grid.SetColLabelSize(maxHeight + 6) # add a 6 pixel margin
104
02b800ce 105 maxW = 0
1f780e48
RD
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)
02b800ce
RD
112 w, h = dc.GetTextExtent(package)
113 if w > maxW:
114 maxW = w
1f780e48
RD
115 if license:
116 grid.SetCellValue(row, 0, license)
117 if url:
118 grid.SetCellValue(row, 1, url)
aca310e5 119
1f780e48
RD
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)
02b800ce
RD
126 grid.AutoSizeColumn(0)
127 grid.AutoSizeColumn(1)
128 grid.SetRowLabelSize(maxW + 10)
1f780e48
RD
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)
aca310e5 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)
1f780e48
RD
137 creditsPage.SetSizer(sizer)
138 nb.AddPage(creditsPage, _("Credits"))
aca310e5 139
1f780e48
RD
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)
02b800ce
RD
146 self.Layout()
147 self.Fit()
148 grid.ForceRefresh() # wxBug: Get rid of unnecessary scrollbars
aca310e5 149
1f780e48 150