]>
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 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         ("Sarissa", "LGPL", "http://sourceforge.net/projects/sarissa/"), 
  49         ("Dynarch DHTML Calendar", "LGPL", "http://www.dynarch.com/projects/calendar/"), 
  52 if wx
.Platform 
== '__WXMSW__':  # add Windows only licenses 
  53     licenseData 
+= [("pywin32", "Python Software Foundation License", "http://sourceforge.net/projects/pywin32/")] 
  55 class AboutDialog(wx
.Dialog
): 
  57     def __init__(self
, parent
): 
  59         Initializes the about dialog. 
  61         wx
.Dialog
.__init
__(self
, parent
, -1, _("About ") + wx
.GetApp().GetAppName(), style 
= wx
.DEFAULT_DIALOG_STYLE
) 
  63         nb 
= wx
.Notebook(self
, -1) 
  65         aboutPage 
= wx
.Panel(nb
, -1) 
  66         sizer 
= wx
.BoxSizer(wx
.VERTICAL
) 
  68         if not ACTIVEGRID_BASE_IDE
: 
  69             splash_bmp 
= getSplashBitmap() 
  71             splash_bmp 
= getIDESplashBitmap() 
  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() 
  79             version 
= "".join(versionLines
) 
  81             version 
= _("Version Unknown - %s not found" % versionFilepath
) 
  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")) 
  90         licensePage 
= wx
.Panel(nb
, -1) 
  91         grid 
= wx
.grid
.Grid(licensePage
, -1) 
  92         grid
.CreateGrid(len(licenseData
), 2) 
  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")) 
 102         grid
.SetColLabelSize(maxHeight 
+ 6)  # add a 6 pixel margin 
 105         for row
, data 
in enumerate(licenseData
): 
 110                 grid
.SetRowLabelValue(row
, package
) 
 111                 w
, h 
= dc
.GetTextExtent(package
) 
 115                 grid
.SetCellValue(row
, 0, license
) 
 117                 grid
.SetCellValue(row
, 1, url
) 
 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")) 
 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")) 
 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) 
 147         grid
.ForceRefresh()  # wxBug: Get rid of unnecessary scrollbars