]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/samples/ide/activegrid/tool/AboutDialog.py
   1 #---------------------------------------------------------------------------- 
   3 # Purpose:      AboutBox which has copyright notice, license information, and credits 
   8 # Copyright:    (c) 2005-2006 ActiveGrid, Inc. 
  10 # License:      wxWindows License 
  11 #---------------------------------------------------------------------------- 
  15 from IDE 
import ACTIVEGRID_BASE_IDE
, getSplashBitmap
, getIDESplashBitmap
 
  16 import activegrid
.util
.sysutils 
as sysutilslib
 
  19 #---------------------------------------------------------------------------- 
  20 # Package License Data for AboutDialog 
  21 #   Package, License, URL 
  22 #   If no information is available, put a None as a place holder. 
  24 #   NO GPL Allowed.  Only LGPL, BSD, and Public Domain Based Licenses! 
  25 #---------------------------------------------------------------------------- 
  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/"), 
  38 if not ACTIVEGRID_BASE_IDE
:    # add licenses for non-base IDE features such as database connections 
  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"),         
  54 if wx
.Platform 
== '__WXMSW__':  # add Windows only licenses 
  55     licenseData 
+= [("pywin32", "Python Software Foundation License", "http://sourceforge.net/projects/pywin32/")] 
  57 class AboutDialog(wx
.Dialog
): 
  59     def __init__(self
, parent
): 
  61         Initializes the about dialog. 
  63         wx
.Dialog
.__init
__(self
, parent
, -1, _("About ") + wx
.GetApp().GetAppName(), style 
= wx
.DEFAULT_DIALOG_STYLE
) 
  65         nb 
= wx
.Notebook(self
, -1) 
  67         aboutPage 
= wx
.Panel(nb
, -1) 
  68         sizer 
= wx
.BoxSizer(wx
.VERTICAL
) 
  70         if not ACTIVEGRID_BASE_IDE
: 
  71             splash_bmp 
= getSplashBitmap() 
  73             splash_bmp 
= getIDESplashBitmap() 
  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() 
  81             version 
= "".join(versionLines
) 
  83             version 
= _("Version Unknown - %s not found" % versionFilepath
) 
  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")) 
  92         licensePage 
= wx
.Panel(nb
, -1) 
  93         grid 
= wx
.grid
.Grid(licensePage
, -1) 
  94         grid
.CreateGrid(len(licenseData
), 2) 
  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 
 106         for row
, data 
in enumerate(licenseData
): 
 111                 grid
.SetRowLabelValue(row
, package
) 
 112                 w
, h 
= dc
.GetTextExtent(package
) 
 116                 grid
.SetCellValue(row
, 0, license
) 
 118                 grid
.SetCellValue(row
, 1, url
) 
 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")) 
 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")) 
 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) 
 148         grid
.ForceRefresh()  # wxBug: Get rid of unnecessary scrollbars