Changed the import semantics from "from wxPython import *" to "from
wxPython.wx import *" This is for people who are worried about namespace pollution, they can use "from wxPython import wx" and then prefix all the wxPython identifiers with "wx." Added wxTaskbarIcon for wxMSW. Made the events work for wxGrid. Added wxConfig. Added wxMiniFrame for wxGTK, (untested.) Changed many of the args and return values that were pointers to gdi objects to references to reflect changes in the wxWindows API. Other assorted fixes and additions. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1205 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
|
||||
from wxPython import *
|
||||
from wxPython.wx import *
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
@@ -65,7 +65,27 @@ if __name__ == '__main__':
|
||||
#----------------------------------------------------------------------------
|
||||
#
|
||||
# $Log$
|
||||
# Revision 1.3 1998/12/15 20:44:34 RD
|
||||
# Changed the import semantics from "from wxPython import *" to "from
|
||||
# wxPython.wx import *" This is for people who are worried about
|
||||
# namespace pollution, they can use "from wxPython import wx" and then
|
||||
# prefix all the wxPython identifiers with "wx."
|
||||
#
|
||||
# Added wxTaskbarIcon for wxMSW.
|
||||
#
|
||||
# Made the events work for wxGrid.
|
||||
#
|
||||
# Added wxConfig.
|
||||
#
|
||||
# Added wxMiniFrame for wxGTK, (untested.)
|
||||
#
|
||||
# Changed many of the args and return values that were pointers to gdi
|
||||
# objects to references to reflect changes in the wxWindows API.
|
||||
#
|
||||
# Other assorted fixes and additions.
|
||||
#
|
||||
# Revision 1.2 1998/10/02 06:42:27 RD
|
||||
#
|
||||
# Version 0.4 of wxPython for MSW.
|
||||
#
|
||||
# Revision 1.1 1998/08/09 08:28:05 RD
|
||||
|
@@ -12,7 +12,7 @@
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
|
||||
from wxPython import *
|
||||
from wxPython.wx import *
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
@@ -23,6 +23,7 @@ class MyCanvas(wxWindow):
|
||||
def __init__(self, parent):
|
||||
wxWindow.__init__(self, parent, -1, wxPoint(0, 0), wxPyDefaultSize, wxSUNKEN_BORDER)
|
||||
|
||||
self.SetBackgroundColour(wxNamedColor("WHITE"))
|
||||
self.Connect(-1, -1, wxEVT_LEFT_DOWN, self.OnLeftButtonEvent)
|
||||
self.Connect(-1, -1, wxEVT_LEFT_UP, self.OnLeftButtonEvent)
|
||||
self.Connect(-1, -1, wxEVT_MOTION, self.OnLeftButtonEvent)
|
||||
@@ -118,9 +119,8 @@ class MyFrame(wxFrame):
|
||||
self.Destroy()
|
||||
|
||||
def OnSize(self, event):
|
||||
w,h = self.GetClientSize()
|
||||
#self.canvas.SetSize(5, 5, w-10, h-10)
|
||||
self.canvas.SetDimensions(0, 0, w, h)
|
||||
size = self.GetClientSize()
|
||||
self.canvas.SetDimensions(5, 5, size.width-10, size.height-10)
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
@@ -152,6 +152,25 @@ if __name__ == '__main__':
|
||||
#----------------------------------------------------------------------------
|
||||
#
|
||||
# $Log$
|
||||
# Revision 1.2 1998/12/15 20:44:34 RD
|
||||
# Changed the import semantics from "from wxPython import *" to "from
|
||||
# wxPython.wx import *" This is for people who are worried about
|
||||
# namespace pollution, they can use "from wxPython import wx" and then
|
||||
# prefix all the wxPython identifiers with "wx."
|
||||
#
|
||||
# Added wxTaskbarIcon for wxMSW.
|
||||
#
|
||||
# Made the events work for wxGrid.
|
||||
#
|
||||
# Added wxConfig.
|
||||
#
|
||||
# Added wxMiniFrame for wxGTK, (untested.)
|
||||
#
|
||||
# Changed many of the args and return values that were pointers to gdi
|
||||
# objects to references to reflect changes in the wxWindows API.
|
||||
#
|
||||
# Other assorted fixes and additions.
|
||||
#
|
||||
# Revision 1.1 1998/08/09 08:28:05 RD
|
||||
# Initial version
|
||||
#
|
||||
|
@@ -12,21 +12,25 @@
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
|
||||
from wxPython import *
|
||||
from wxPython.wx import *
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class MyCanvas(wxWindow):
|
||||
def __init__(self, parent, ID):
|
||||
wxWindow.__init__(self, parent, ID)
|
||||
self.SetBackgroundColour(wxNamedColor("WHITE"))
|
||||
|
||||
def OnPaint(self, event):
|
||||
dc = wxPaintDC(self)
|
||||
dc.BeginDrawing()
|
||||
w, h = self.GetClientSize()
|
||||
size = self.GetClientSize()
|
||||
font = wxFont(42, wxSWISS, wxNORMAL, wxNORMAL)
|
||||
dc.SetFont(font)
|
||||
st = "Python Rules!"
|
||||
tw,th, d,e = dc.GetTextExtent(st)
|
||||
dc.DrawText(st, (w-tw)/2, (h-th)/2)
|
||||
dc.DrawText(st, (size.width-tw)/2, (size.height-th)/2)
|
||||
dc.EndDrawing()
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
@@ -54,7 +58,7 @@ class MyFrame(wxFrame):
|
||||
wxFrame.__init__(self, parent, id, title, wxPyDefaultPosition,
|
||||
wxSize(420, 200))
|
||||
self.canvas = MyCanvas(self, -1)
|
||||
self.CreateStatusBar(3)
|
||||
self.CreateStatusBar(2)
|
||||
mainmenu = wxMenuBar()
|
||||
menu = wxMenu()
|
||||
menu.Append(100, 'A &Menu Item', 'the help text')
|
||||
@@ -80,9 +84,9 @@ class MyFrame(wxFrame):
|
||||
|
||||
|
||||
def OnSize(self, event):
|
||||
w,h = self.GetClientSize()
|
||||
self.canvas.SetSize(wxSize(w, h))
|
||||
self.SetStatusText("hello, this is a test: (%d, %d)" % (w,h))
|
||||
size = self.GetClientSize()
|
||||
self.canvas.SetSize(size)
|
||||
self.SetStatusText("hello, this is a test: (%d, %d)" % (size.width, size.height), 1)
|
||||
|
||||
## def OnMenuHighlight(self, event):
|
||||
## mainmenu = self.GetMenuBar()
|
||||
@@ -143,6 +147,25 @@ if __name__ == '__main__':
|
||||
#----------------------------------------------------------------------------
|
||||
#
|
||||
# $Log$
|
||||
# Revision 1.3 1998/12/15 20:44:35 RD
|
||||
# Changed the import semantics from "from wxPython import *" to "from
|
||||
# wxPython.wx import *" This is for people who are worried about
|
||||
# namespace pollution, they can use "from wxPython import wx" and then
|
||||
# prefix all the wxPython identifiers with "wx."
|
||||
#
|
||||
# Added wxTaskbarIcon for wxMSW.
|
||||
#
|
||||
# Made the events work for wxGrid.
|
||||
#
|
||||
# Added wxConfig.
|
||||
#
|
||||
# Added wxMiniFrame for wxGTK, (untested.)
|
||||
#
|
||||
# Changed many of the args and return values that were pointers to gdi
|
||||
# objects to references to reflect changes in the wxWindows API.
|
||||
#
|
||||
# Other assorted fixes and additions.
|
||||
#
|
||||
# Revision 1.2 1998/08/22 19:51:17 RD
|
||||
# some tweaks for wxGTK
|
||||
#
|
||||
|
@@ -12,7 +12,7 @@
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
|
||||
from wxPython import *
|
||||
from wxPython.wx import *
|
||||
|
||||
import time
|
||||
|
||||
@@ -43,7 +43,7 @@ class TestSimpleControlsDlg(wxDialog):
|
||||
rb = wxRadioBox(self, 30, "wxRadioBox", wxPoint(80, y_pos), wxPyDefaultSize,
|
||||
sampleList, 3, wxRA_HORIZONTAL| wxNO_BORDER)
|
||||
EVT_RADIOBOX(self, 30, self.EvtRadioBox)
|
||||
width, height = rb.GetSize()
|
||||
width, height = rb.GetSizeTuple()
|
||||
y_pos = y_pos + height + 5
|
||||
|
||||
wxStaticText(self, -1, "wxChoice", wxPoint(5, y_pos), wxSize(75, 20))
|
||||
@@ -64,7 +64,7 @@ class TestSimpleControlsDlg(wxDialog):
|
||||
EVT_LISTBOX(self, 60, self.EvtListBox)
|
||||
EVT_LISTBOX_DCLICK(self, 60, self.EvtListBoxDClick)
|
||||
lb.SetSelection(0)
|
||||
width, height = lb.GetSize()
|
||||
width, height = lb.GetSizeTuple()
|
||||
y_pos = y_pos + height + 5
|
||||
|
||||
|
||||
@@ -374,7 +374,7 @@ class TestCustomStatusBar(wxFrame):
|
||||
def __init__(self, parent):
|
||||
wxFrame.__init__(self, parent, -1, 'Test Custom StatusBar',
|
||||
wxPyDefaultPosition, wxSize(500, 300))
|
||||
wxWindow(self, -1)
|
||||
wxWindow(self, -1).SetBackgroundColour(wxNamedColour("WHITE"))
|
||||
|
||||
self.sb = CustomStatusBar(self)
|
||||
self.SetStatusBar(self.sb)
|
||||
@@ -392,9 +392,9 @@ class TestToolBar(wxFrame):
|
||||
wxPyDefaultPosition, wxSize(500, 300))
|
||||
self.log = log
|
||||
|
||||
wxWindow(self, -1)
|
||||
wxWindow(self, -1).SetBackgroundColour(wxNamedColour("WHITE"))
|
||||
|
||||
tb = self.CreateToolBar()
|
||||
tb = self.CreateToolBar(wxTB_HORIZONTAL|wxNO_BORDER)
|
||||
#tb = wxToolBar(self, -1, wxPyDefaultPosition, wxPyDefaultSize,
|
||||
# wxTB_HORIZONTAL | wxNO_BORDER | wxTB_FLAT)
|
||||
#self.SetToolBar(tb)
|
||||
@@ -469,7 +469,7 @@ class TestTreeCtrlPanel(wxPanel):
|
||||
|
||||
|
||||
def OnSize(self, event):
|
||||
w,h = self.GetClientSize()
|
||||
w,h = self.GetClientSizeTuple()
|
||||
self.tree.SetDimensions(0, 0, w, h)
|
||||
|
||||
|
||||
@@ -616,7 +616,7 @@ class AppFrame(wxFrame):
|
||||
def WriteText(self, str):
|
||||
self.log.WriteText(str)
|
||||
if wxPlatform == '__WXMSW__':
|
||||
w, h = self.log.GetClientSize()
|
||||
w, h = self.log.GetClientSizeTuple()
|
||||
numLines = h/self.charHeight
|
||||
x, y = self.log.PositionToXY(self.log.GetLastPosition())
|
||||
self.log.ShowPosition(self.log.XYToPosition(x, y-numLines+1))
|
||||
@@ -803,7 +803,27 @@ if __name__ == '__main__':
|
||||
#----------------------------------------------------------------------------
|
||||
#
|
||||
# $Log$
|
||||
# Revision 1.9 1998/12/15 20:44:35 RD
|
||||
# Changed the import semantics from "from wxPython import *" to "from
|
||||
# wxPython.wx import *" This is for people who are worried about
|
||||
# namespace pollution, they can use "from wxPython import wx" and then
|
||||
# prefix all the wxPython identifiers with "wx."
|
||||
#
|
||||
# Added wxTaskbarIcon for wxMSW.
|
||||
#
|
||||
# Made the events work for wxGrid.
|
||||
#
|
||||
# Added wxConfig.
|
||||
#
|
||||
# Added wxMiniFrame for wxGTK, (untested.)
|
||||
#
|
||||
# Changed many of the args and return values that were pointers to gdi
|
||||
# objects to references to reflect changes in the wxWindows API.
|
||||
#
|
||||
# Other assorted fixes and additions.
|
||||
#
|
||||
# Revision 1.8 1998/11/25 08:47:11 RD
|
||||
#
|
||||
# Added wxPalette, wxRegion, wxRegionIterator, wxTaskbarIcon
|
||||
# Added events for wxGrid
|
||||
# Other various fixes and additions
|
||||
|
@@ -12,7 +12,7 @@
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
|
||||
from wxPython import *
|
||||
from wxPython.wx import *
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
@@ -91,7 +91,27 @@ if __name__ == '__main__':
|
||||
#----------------------------------------------------------------------------
|
||||
#
|
||||
# $Log$
|
||||
# Revision 1.2 1998/12/15 20:44:36 RD
|
||||
# Changed the import semantics from "from wxPython import *" to "from
|
||||
# wxPython.wx import *" This is for people who are worried about
|
||||
# namespace pollution, they can use "from wxPython import wx" and then
|
||||
# prefix all the wxPython identifiers with "wx."
|
||||
#
|
||||
# Added wxTaskbarIcon for wxMSW.
|
||||
#
|
||||
# Made the events work for wxGrid.
|
||||
#
|
||||
# Added wxConfig.
|
||||
#
|
||||
# Added wxMiniFrame for wxGTK, (untested.)
|
||||
#
|
||||
# Changed many of the args and return values that were pointers to gdi
|
||||
# objects to references to reflect changes in the wxWindows API.
|
||||
#
|
||||
# Other assorted fixes and additions.
|
||||
#
|
||||
# Revision 1.1 1998/11/25 08:47:12 RD
|
||||
#
|
||||
# Added wxPalette, wxRegion, wxRegionIterator, wxTaskbarIcon
|
||||
# Added events for wxGrid
|
||||
# Other various fixes and additions
|
||||
|
103
utils/wxPython/tests/test6.py
Normal file
103
utils/wxPython/tests/test6.py
Normal file
@@ -0,0 +1,103 @@
|
||||
#!/bin/env python
|
||||
#----------------------------------------------------------------------------
|
||||
# Name: test6.py
|
||||
# Purpose: Testing wxConfig
|
||||
#
|
||||
# Author: Robin Dunn
|
||||
#
|
||||
# Created: 26-Nov-1998
|
||||
# RCS-ID: $Id$
|
||||
# Copyright: (c) 1998 by Total Control Software
|
||||
# Licence: wxWindows license
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
import sys
|
||||
from wxPython.wx import wxConfig
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
def main():
|
||||
|
||||
cfg = wxConfig('test6', 'TCS')
|
||||
|
||||
cmd = ''
|
||||
if len(sys.argv) > 1:
|
||||
cmd = sys.argv[1]
|
||||
|
||||
if cmd == 'add':
|
||||
cfg.SetPath('one/two/three')
|
||||
cfg.Flush()
|
||||
|
||||
cfg.Write('aaa', 'The quick brown fox jummped over the lazy dog.')
|
||||
cfg.Write('bbb', 'This is a test of the emergency broadcast system')
|
||||
|
||||
aList = ['one', 'two', 'buckle', 'my', 'shoe', 1966]
|
||||
cfg.Write('ccc', str(aList))
|
||||
|
||||
cfg.Write('zzz/yyy', 'foobar')
|
||||
cfg.Write('zzz/xxx', 'spam and eggs')
|
||||
|
||||
cfg.Flush()
|
||||
|
||||
elif cmd == 'enum':
|
||||
traverse(cfg, '/')
|
||||
|
||||
elif cmd == 'del':
|
||||
cfg.DeleteAll()
|
||||
|
||||
else:
|
||||
print 'Specify command: add, enum, or del.'
|
||||
|
||||
|
||||
|
||||
def traverse(cfg, path):
|
||||
print path
|
||||
cont, val, idx = cfg.GetFirstEntry()
|
||||
while cont:
|
||||
print "%s/%s = %s" % (path, val, cfg.Read(val))
|
||||
cont, val, idx = cfg.GetNextEntry(idx)
|
||||
|
||||
cont, val, idx = cfg.GetFirstGroup()
|
||||
while cont:
|
||||
if path == '/':
|
||||
newpath = path+val
|
||||
else:
|
||||
newpath = path+'/'+val
|
||||
|
||||
cfg.SetPath(newpath)
|
||||
traverse(cfg, newpath)
|
||||
cfg.SetPath(path)
|
||||
cont, val, idx = cfg.GetNextGroup(idx)
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
#import pdb
|
||||
#pdb.run('main()')
|
||||
main()
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
#
|
||||
# $Log$
|
||||
# Revision 1.1 1998/12/15 20:44:37 RD
|
||||
# Changed the import semantics from "from wxPython import *" to "from
|
||||
# wxPython.wx import *" This is for people who are worried about
|
||||
# namespace pollution, they can use "from wxPython import wx" and then
|
||||
# prefix all the wxPython identifiers with "wx."
|
||||
#
|
||||
# Added wxTaskbarIcon for wxMSW.
|
||||
#
|
||||
# Made the events work for wxGrid.
|
||||
#
|
||||
# Added wxConfig.
|
||||
#
|
||||
# Added wxMiniFrame for wxGTK, (untested.)
|
||||
#
|
||||
# Changed many of the args and return values that were pointers to gdi
|
||||
# objects to references to reflect changes in the wxWindows API.
|
||||
#
|
||||
# Other assorted fixes and additions.
|
||||
#
|
||||
#
|
Reference in New Issue
Block a user