~ubuntu-branches/ubuntu/maverick/wxwidgets2.8/maverick-proposed

« back to all changes in this revision

Viewing changes to wxPython/demo/Main.py

  • Committer: Bazaar Package Importer
  • Author(s): Devid Filoni
  • Date: 2007-11-06 18:25:13 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20071106182513-809agqds6igh7mqo
Tags: 2.8.6.1-0ubuntu1
* New upstream version, based on the upstream tarball
  wxPython-src-2.8.6.1.tar.bz2, renamed debian to debian-upstream.
* Provide a get-orig-source target to do the repackaging.
* Fix "substvar-source-version-is-deprecated" lintian warnings.
* Remove duplicate Description field in debian/control.
* Add "\" at the end of line 8 in debian/python-wxtools.menu to fix
  "bad-test-in-menu-item" lintian error.
* Provide .xpm icons to fix "menu-icon-not-in-xpm-format" lintian errors,
  changed Icon field in debian/python-wxtools.menu.
* Fix "wrong-name-for-upstream-changelog" lintian warnings.
* Remove "Application;" from Categories field in debian/pycrust.desktop,
  debian/pyshell.desktop, debian/xrced.desktop.
* Switch "Apps" to "Applications" in debian/python-wxtools.menu to fix
  "menu-item-uses-apps-section" lintian warnings.
* Drop the icon extension from debian/pycrust.desktop,
  debian/pyshell.desktop, debian/xrced.desktop.
* Add dpatch support.
* Add "WX_CONFIG" patch.
* debian/rules:
  - added .xpm icons to install-gtk-py-tools target
  - added "docs/changes.txt" to dh_installchangelogs in binary-common target
  - added "\" at the end of "install-examples install-msw-dev
    install-msw-dbg install-headers-msw" line in .PHONY

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
# Author:       Robin Dunn
7
7
#
8
8
# Created:      A long time ago, in a galaxy far, far away...
9
 
# RCS-ID:       $Id: Main.py,v 1.213.2.11 2007/05/13 02:17:14 RD Exp $
 
9
# RCS-ID:       $Id: Main.py 49362 2007-10-23 19:21:03Z RD $
10
10
# Copyright:    (c) 1999 by Total Control Software
11
11
# Licence:      wxWindows license
12
12
#----------------------------------------------------------------------------
518
518
                # TODO: if this looks fine on Linux too, remove the Mac-specific case 
519
519
                # and use this whenever OS != MSW.
520
520
                self.StyleSetSpec(stc.STC_STYLE_DEFAULT, 
521
 
                                  'fore:#000000,back:#FFFFFF,face:Courier')
 
521
                                  'fore:#000000,back:#FFFFFF,face:Monaco')
522
522
            else:
523
523
                self.StyleSetSpec(stc.STC_STYLE_DEFAULT, 
524
524
                                  'fore:#000000,back:#FFFFFF,face:Courier,size:9')
667
667
    def ActiveModuleChanged(self):
668
668
        self.LoadDemoSource(self.demoModules.GetSource())
669
669
        self.UpdateControlState()
670
 
        self.mainFrame.Freeze()        
 
670
        self.mainFrame.pnl.Freeze()        
671
671
        self.ReloadDemo()
672
 
        self.mainFrame.Thaw()
 
672
        self.mainFrame.pnl.Thaw()
673
673
 
674
674
        
675
675
    def LoadDemoSource(self, source):
901
901
    def LoadDict(self, modID):
902
902
        if self.name != __name__:
903
903
            source = self.modules[modID][1]
904
 
            #description = self.modules[modID][3]
905
904
            description = self.modules[modID][2]
906
 
 
 
905
            description = description.encode(sys.getfilesystemencoding())
 
906
            
907
907
            try:
908
908
                self.modules[modID][0] = {}
909
909
                code = compile(source, description, "exec")        
1177
1177
 
1178
1178
 
1179
1179
    def OnTaskBarClose(self, evt):
1180
 
        self.frame.Close()
 
1180
        wx.CallAfter(self.frame.Close)
1181
1181
 
1182
1182
 
1183
1183
    def OnTaskBarChange(self, evt):
1206
1206
                          style=wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE)
1207
1207
 
1208
1208
        self.SetMinSize((640,480))
 
1209
 
 
1210
        # Use a panel under the AUI panes in order to work around a
 
1211
        # bug on PPC Macs
 
1212
        pnl = wx.Panel(self)
 
1213
        self.pnl = pnl
1209
1214
        
1210
1215
        self.mgr = wx.aui.AuiManager()
1211
 
        self.mgr.SetManagedWindow(self)
 
1216
        self.mgr.SetManagedWindow(pnl)
1212
1217
 
1213
1218
        self.loaded = False
1214
1219
        self.cwd = os.getcwd()
1244
1249
        self.ReadConfigurationFile()
1245
1250
        
1246
1251
        # Create a Notebook
1247
 
        self.nb = wx.Notebook(self, -1, style=wx.CLIP_CHILDREN)
 
1252
        self.nb = wx.Notebook(pnl, -1, style=wx.CLIP_CHILDREN)
1248
1253
        imgList = wx.ImageList(16, 16)
1249
1254
        for png in ["overview", "code", "demo"]:
1250
1255
            bmp = images.catalog[png].getBitmap()
1257
1262
        self.finddata.SetFlags(wx.FR_DOWN)
1258
1263
 
1259
1264
        # Create a TreeCtrl
1260
 
        leftPanel = wx.Panel(self, style=wx.TAB_TRAVERSAL|wx.CLIP_CHILDREN)
 
1265
        leftPanel = wx.Panel(pnl, style=wx.TAB_TRAVERSAL|wx.CLIP_CHILDREN)
1261
1266
        self.treeMap = {}
1262
1267
        self.searchItems = {}
1263
1268
        
1309
1314
 
1310
1315
 
1311
1316
        # Set up a log window
1312
 
        self.log = wx.TextCtrl(self, -1,
 
1317
        self.log = wx.TextCtrl(pnl, -1,
1313
1318
                              style = wx.TE_MULTILINE|wx.TE_READONLY|wx.HSCROLL)
1314
1319
        if wx.Platform == "__WXMAC__":
1315
1320
            self.log.MacCheckSpelling(False)
1466
1471
        menu = wx.Menu()
1467
1472
        findItem = wx.MenuItem(menu, -1, '&Find\tCtrl-F', 'Find in the Demo Code')
1468
1473
        findItem.SetBitmap(images.catalog['find'].getBitmap())
1469
 
        findNextItem = wx.MenuItem(menu, -1, 'Find &Next\tF3', 'Find Next')
 
1474
        if 'wxMac' not in wx.PlatformInfo:
 
1475
            findNextItem = wx.MenuItem(menu, -1, 'Find &Next\tF3', 'Find Next')
 
1476
        else:
 
1477
            findNextItem = wx.MenuItem(menu, -1, 'Find &Next\tCtrl-G', 'Find Next')
1470
1478
        findNextItem.SetBitmap(images.catalog['findnext'].getBitmap())
1471
1479
        menu.AppendItem(findItem)
1472
1480
        menu.AppendItem(findNextItem)
1479
1487
        inspToolItem = wx.MenuItem(menu, -1, 'Open &Widget Inspector\tF6',
1480
1488
                                   'A tool that lets you browse the live widgets and sizers in an application')
1481
1489
        inspToolItem.SetBitmap(images.catalog['inspect'].getBitmap())
1482
 
        menu.AppendItem(inspToolItem)        
1483
 
        menu.AppendSeparator()
 
1490
        menu.AppendItem(inspToolItem)
 
1491
        if 'wxMac' not in wx.PlatformInfo:
 
1492
            menu.AppendSeparator()
1484
1493
        helpItem = menu.Append(-1, '&About wxPython Demo', 'wxPython RULES!!!')
1485
1494
        wx.App.SetMacAboutMenuItemId(helpItem.GetId())
1486
1495
 
1677
1686
    def LoadDemo(self, demoName):
1678
1687
        try:
1679
1688
            wx.BeginBusyCursor()
1680
 
            self.Freeze()
 
1689
            self.pnl.Freeze()
1681
1690
            
1682
1691
            os.chdir(self.cwd)
1683
1692
            self.ShutdownDemoModule()
1701
1710
                    self.UpdateNotebook(0)
1702
1711
        finally:
1703
1712
            wx.EndBusyCursor()
1704
 
            self.Thaw()
 
1713
            self.pnl.Thaw()
1705
1714
 
1706
1715
    #---------------------------------------------
1707
1716
    def LoadDemoSource(self):
1766
1775
    def UpdateNotebook(self, select = -1):
1767
1776
        nb = self.nb
1768
1777
        debug = False
1769
 
        self.Freeze()
 
1778
        self.pnl.Freeze()
1770
1779
        
1771
1780
        def UpdatePage(page, pageText):
1772
1781
            pageExists = False
1807
1816
        if select >= 0 and select < nb.GetPageCount():
1808
1817
            nb.SetSelection(select)
1809
1818
 
1810
 
        self.Thaw()
 
1819
        self.pnl.Thaw()
1811
1820
        
1812
1821
    #---------------------------------------------
1813
1822
    def SetOverview(self, name, text):