You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
(45) |
May
(185) |
Jun
|
Jul
(36) |
Aug
(205) |
Sep
(98) |
Oct
(107) |
Nov
(6) |
Dec
(3) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(1) |
Feb
(2) |
Mar
(19) |
Apr
(26) |
May
(18) |
Jun
|
Jul
(12) |
Aug
(16) |
Sep
(22) |
Oct
(7) |
Nov
(11) |
Dec
(74) |
2006 |
Jan
(14) |
Feb
(1) |
Mar
(3) |
Apr
(3) |
May
(14) |
Jun
(5) |
Jul
(20) |
Aug
(10) |
Sep
(1) |
Oct
|
Nov
(4) |
Dec
(1) |
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(3) |
Jul
(14) |
Aug
|
Sep
|
Oct
(6) |
Nov
(1) |
Dec
|
From: Kevin A. <ka...@us...> - 2004-09-25 21:12:27
|
Update of /cvsroot/pythoncard/PythonCard/samples/gravity In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27398 Modified Files: gravity.py Log Message: fixed zero division bug, added tweak code for Mac Index: gravity.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/gravity/gravity.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** gravity.py 25 Sep 2004 20:45:47 -0000 1.1 --- gravity.py 25 Sep 2004 21:12:12 -0000 1.2 *************** *** 128,137 **** avgfps = 0 frame = 0 ! startTime = time.time() while self.animate: canvas.clear() for ball in self.sprites: ball.move() ! canvas.redraw() #time.sleep(.01) # give the user a chance to click Stop --- 128,144 ---- avgfps = 0 frame = 0 ! # hack to force a difference ! # between time.time() and startTime ! # to avoid a division by zero exception on fast machines ! # aka my Windows box ;-) ! startTime = time.time() - 0.001 while self.animate: canvas.clear() for ball in self.sprites: ball.move() ! if wx.Platform == '__WXMAC__': ! canvas.redraw() ! else: ! canvas.refresh() #time.sleep(.01) # give the user a chance to click Stop *************** *** 189,193 **** for ball in self.sprites: ball.move() ! self.components.bufOff.redraw() def on_bufOff_mouseUp(self, event): --- 196,204 ---- for ball in self.sprites: ball.move() ! if wx.Platform == '__WXMAC__': ! self.components.bufOff.redraw() ! else: ! self.components.bufOff.refresh() ! def on_bufOff_mouseUp(self, event): |
From: Kevin A. <ka...@us...> - 2004-09-25 20:46:00
|
Update of /cvsroot/pythoncard/PythonCard/samples/gravity In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21259 Added Files: .cvsignore gravity.py gravity.rsrc.py Log Message: added gravity sample --- NEW FILE: .cvsignore --- .cvsignore *.pyc *.log .DS_Store --- NEW FILE: gravity.py --- #!/usr/bin/python """ __version__ = "$Revision: 1.1 $" __date__ = "$Date: 2004/09/25 20:45:47 $" """ # KEA 2004-09-25 # based on the excellent work by Keith Peters # http://www.bit-101.com/tutorials/gravity.html # I started with the doodle sample, so this sample still # contains some cruft from PythonCard import clipboard, dialog, graphic, model import wx import os import random import time def pointInRect(xy, rect): x, y = xy left, top, right, bottom = rect if x >= left and x <= right and y >= top and y <= bottom: return True else: return False class Sprite(object): def __init__(self, canvas): self.canvas = canvas class BallSprite(Sprite): def __init__(self, canvas, x, y, radius, color='red'): Sprite.__init__(self, canvas) self.x = x self.y = y self.oldx = x self.oldy = y self.radius = radius self.color = color self.xspeed = random.random() * 30 self.yspeed = random.random() * 30 self.gravity = 2 self.drag = .98 self.bounce = .9 self.dragging = False def move(self): # this is sort of pointless right now # but maybe the dragging code could be moved # into the class in which case we might need # to know if we're dragging if not self.dragging: self.x += self.xspeed self.y += self.yspeed rightedge, bottomedge = self.canvas.size # bounce when we hit the edge if (self.x - self.radius) < 0: self.x = self.radius self.xspeed = -self.xspeed * self.bounce elif (self.x + self.radius) > rightedge: self.x = rightedge - self.radius self.xspeed = -self.xspeed * self.bounce if (self.y - self.radius) < 0: self.y = self.radius self.yspeed = -self.yspeed * self.bounce elif (self.y + self.radius) > bottomedge: self.y = bottomedge - self.radius self.yspeed = -self.yspeed * self.bounce self.xspeed = self.xspeed * self.drag self.yspeed = self.yspeed * self.drag + self.gravity else: self.xspeed = self.x - self.oldx self.yspeed = self.y - self.oldy self.oldx = self.x self.oldy = self.y #print "speed", self.xspeed, self.yspeed self.draw() def draw(self): self.canvas.setFillColor(self.color) #self.canvas.foregroundColor = self.color self.canvas.drawCircle((self.x, self.y), self.radius) class Gravity(model.Background): def on_initialize(self, event): self.x = 0 self.y = 0 self.dragging = False self.animate = False self.filename = None self.color = self.components.btnColor.backgroundColor # leave it black for now #self.components.bufOff.foregroundColor = self.color self.sprites = [] self.initSizers() def initSizers(self): sizer1 = wx.BoxSizer(wx.VERTICAL) sizer2 = wx.BoxSizer(wx.HORIZONTAL) comp = self.components flags = wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.ALIGN_BOTTOM # Mac wxButton needs 7 pixels on bottom and right macPadding = 7 sizer2.Add(comp.btnColor, 0, flags, macPadding) sizer2.Add(comp.btnAnimate, 0, flags, macPadding) sizer2.Add(comp.btnStop, 0, flags, macPadding) sizer1.Add(sizer2, 0) sizer1.Add(comp.bufOff, 1, wx.EXPAND) sizer1.Fit(self) sizer1.SetSizeHints(self) self.panel.SetSizer(sizer1) self.panel.SetAutoLayout(1) self.panel.Layout() def on_btnAnimate_mouseClick(self, event): event.target.enabled = False canvas = self.components.bufOff canvas.autoRefresh = False self.sprites.append(BallSprite(self.components.bufOff, 20, 20, 14, self.color)) # use the last ball added self.animate = True avgfps = 0 frame = 0 startTime = time.time() while self.animate: canvas.clear() for ball in self.sprites: ball.move() canvas.redraw() #time.sleep(.01) # give the user a chance to click Stop frame += 1 self.statusBar.text = "Average FPS: %f" % (frame / (time.time() - startTime)) wx.Yield() def on_btnStop_mouseClick(self, event): self.animate = False self.components.btnAnimate.enabled = True def on_close(self, event): self.animate = False event.skip() def on_bufOff_mouseDown(self, event): #event.target.drawLine((self.x, self.y), (self.x + 1, self.y + 1)) # figure out which ball the user clicked on, if any # i want to search the list from back to front # but I don't change the list in place, so I make a copy # is there a way to iterate over a list in reverse without # using something awkward like # for i in range(len(self.sprites) - 1, -1, -1): sprites = self.sprites[:] sprites.reverse() for ball in sprites: radius = ball.radius x = ball.x y = ball.y #print "point", event.position #print "rect", x - radius, y - radius, x + radius, y + radius if pointInRect(event.position, (x - radius, y - radius, x + radius, y + radius)): self.dragging = ball ball.dragging = True x, y = event.position self.dx = ball.x - x self.dy = ball.y - y #print self.dx, self.dy break # on a mouseLeave we will no longer # get drag messages, so we could end dragging # at that point, just keep the current behavior def on_bufOff_mouseDrag(self, event): if self.dragging: x, y = event.position ball = self.dragging ball.x = x + self.dx ball.y = y + self.dy # reraw all the objects self.components.bufOff.clear() for ball in self.sprites: ball.move() self.components.bufOff.redraw() def on_bufOff_mouseUp(self, event): if self.dragging: self.dragging.dragging = False self.dragging = None # older Doodle code # I'm keeping it around in case I need it later def on_bufOff_mouseEnter(self, event): self.x, self.y = event.position ## def on_bufOff_mouseDown(self, event): ## self.x, self.y = event.position ## event.target.drawLine((self.x, self.y), (self.x + 1, self.y + 1)) ## ## def on_bufOff_mouseDrag(self, event): ## x, y = event.position ## event.target.drawLine((self.x, self.y), (x, y)) ## self.x = x ## self.y = y def on_btnColor_mouseClick(self, event): result = dialog.colorDialog(self, color=self.color) if result.accepted: #self.components.bufOff.foregroundColor = result.color event.target.backgroundColor = result.color self.color = result.color def openFile(self): result = dialog.openFileDialog(None, "Import which file?") if result.accepted: path = result.paths[0] os.chdir(os.path.dirname(path)) self.filename = path bmp = graphic.Bitmap(self.filename) self.components.bufOff.drawBitmap(bmp, (0, 0)) def on_menuFileOpen_select(self, event): self.openFile() def on_menuFileSaveAs_select(self, event): if self.filename is None: path = '' filename = '' else: path, filename = os.path.split(self.filename) result = dialog.saveFileDialog(None, "Save As", path, filename) if result.accepted: path = result.paths[0] fileType = graphic.bitmapType(path) print fileType, path try: bmp = self.components.bufOff.getBitmap() bmp.SaveFile(path, fileType) return 1 except: return 0 else: return 0 def on_menuEditCopy_select(self, event): clipboard.setClipboard(self.components.bufOff.getBitmap()) def on_menuEditPaste_select(self, event): bmp = clipboard.getClipboard() if isinstance(bmp, wx.Bitmap): self.components.bufOff.drawBitmap(bmp) def on_editClear_command(self, event): self.components.bufOff.clear() if __name__ == '__main__': app = model.Application(Gravity) app.MainLoop() --- NEW FILE: gravity.rsrc.py --- { 'application':{ 'type':'Application', 'name':'Doodle', 'backgrounds': [ { 'type':'Background', 'name':'bgDoodle', 'title':'Doodle PythonCard Application', 'size':( 310, 300 ), 'style':['resizeable'], 'statusBar':1, 'menubar': { 'type':'MenuBar', 'menus': [ { 'type':'Menu', 'name':'menuFile', 'label':'&File', 'items': [ { 'type':'MenuItem', 'name':'menuFileOpen', 'label':'&Open...\tCtrl+O' }, { 'type':'MenuItem', 'name':'menuFileSaveAs', 'label':'Save &As...' }, { 'type':'MenuItem', 'name':'fileSep1', 'label':'-' }, { 'type':'MenuItem', 'name':'menuFileExit', 'label':'E&xit\tAlt+X', 'command':'exit' } ] }, { 'type':'Menu', 'name':'menuEdit', 'label':'&Edit', 'items': [ { 'type':'MenuItem', 'name':'menuEditCopy', 'label':'&Copy\tCtrl+C'}, { 'type':'MenuItem', 'name':'menuEditPaste', 'label':'&Paste\tCtrl+V'}, { 'type':'MenuItem', 'name':'editSep1', 'label':'-' }, { 'type':'MenuItem', 'name':'menuEditClear', 'label':'&Clear', 'command':'editClear'} ] } ] }, 'components': [ { 'type':'Button', 'name':'btnColor', 'position':(0, 0), 'label':'Color', 'backgroundColor':'blue', }, { 'type':'Button', 'name':'btnAnimate', 'position':(100, 0), 'label':'Animate' }, { 'type':'Button', 'name':'btnStop', 'position':(200, 0), 'label':'Stop' }, { 'type':'BitmapCanvas', 'name':'bufOff', 'position':(0, 30), 'size':(300, 230) }, ] } ] } } |
From: Kevin A. <ka...@us...> - 2004-09-25 20:44:32
|
Update of /cvsroot/pythoncard/PythonCard/samples/gravity In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20825/gravity Log Message: Directory /cvsroot/pythoncard/PythonCard/samples/gravity added to the repository |
From: Kevin A. <ka...@us...> - 2004-09-25 16:14:31
|
Update of /cvsroot/pythoncard/PythonCard/tools/resourceEditor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26138/tools/resourceEditor Modified Files: resourceEditor.py Log Message: force panel refresh if grid size changes Index: resourceEditor.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/tools/resourceEditor/resourceEditor.py,v retrieving revision 1.217 retrieving revision 1.218 diff -C2 -d -r1.217 -r1.218 *** resourceEditor.py 25 Sep 2004 15:05:08 -0000 1.217 --- resourceEditor.py 25 Sep 2004 16:14:21 -0000 1.218 *************** *** 1434,1437 **** --- 1434,1439 ---- self.xGridSize = size self.yGridSize = size + if self.showGridLines: + self.panel.Refresh() except: # should probably do an alert dialog here |
From: Kevin A. <ka...@us...> - 2004-09-25 15:37:52
|
Update of /cvsroot/pythoncard/PythonCard In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17862 Modified Files: dialog.py model.py Log Message: bumped minimum requirement to wxPython 2.5.2.8 removed 2.5.2.7 workarounds in dialog.py added passwordTextEntryDialog, multilineTextEntryDialog Index: model.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/model.py,v retrieving revision 1.188 retrieving revision 1.189 diff -C2 -d -r1.188 -r1.189 *** model.py 25 Sep 2004 03:19:23 -0000 1.188 --- model.py 25 Sep 2004 15:37:40 -0000 1.189 *************** *** 20,24 **** import wx ! assert wx.VERSION >= (2, 5, 2) except: from wxPython.wx import wxPySimpleApp, wxFrame, wxMessageDialog, wxICON_EXCLAMATION, wxOK, wxVERSION_STRING --- 20,24 ---- import wx ! assert wx.VERSION >= (2, 5, 2, 8) except: from wxPython.wx import wxPySimpleApp, wxFrame, wxMessageDialog, wxICON_EXCLAMATION, wxOK, wxVERSION_STRING *************** *** 26,30 **** frame = wxFrame(None, -1, "Minimum Requirements Not Met") #frame.Show(1) ! message = "PythonCard minimum requirements:\nPython 2.3 and wxPython 2.5.2\n\n" + \ "You are using Python %s\nand wxPython %s.\n\nClick OK to exit." % (sys.version, wxVERSION_STRING) dialog = wxMessageDialog(frame, message, --- 26,30 ---- frame = wxFrame(None, -1, "Minimum Requirements Not Met") #frame.Show(1) ! message = "PythonCard minimum requirements:\nPython 2.3 and wxPython 2.5.2.8\n\n" + \ "You are using Python %s\nand wxPython %s.\n\nClick OK to exit." % (sys.version, wxVERSION_STRING) dialog = wxMessageDialog(frame, message, Index: dialog.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/dialog.py,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** dialog.py 17 Aug 2004 19:11:43 -0000 1.38 --- dialog.py 25 Sep 2004 15:37:40 -0000 1.39 *************** *** 12,86 **** DialogResults = dialogs.DialogResults ! #findDialog = dialogs.findDialog ! # KEA 2004-08-17 ! # need input and result arg names to match ! # so workaround the way it works in 2.5.2.7 ! def findDialog(parent=None, searchText='', wholeWordsOnly=False, caseSensitive=False): ! dlg = wx.Dialog(parent, -1, "Find", wx.DefaultPosition, (380, 120)) ! ! wx.StaticText(dlg, -1, 'Find what:', (7, 10)) ! wSearchText = wx.TextCtrl(dlg, -1, searchText, (80, 7), (195, -1)) ! wSearchText.SetValue(searchText) ! wx.Button(dlg, wx.ID_OK, "Find Next", (285, 5), wx.DefaultSize).SetDefault() ! wx.Button(dlg, wx.ID_CANCEL, "Cancel", (285, 35), wx.DefaultSize) ! ! wWholeWord = wx.CheckBox(dlg, -1, 'Match whole word only', ! (7, 35), wx.DefaultSize, wx.NO_BORDER) ! ! if wholeWordsOnly: ! wWholeWord.SetValue(1) ! ! wCase = wx.CheckBox(dlg, -1, 'Match case', (7, 55), wx.DefaultSize, wx.NO_BORDER) ! ! if caseSensitive: ! wCase.SetValue(1) ! ! wSearchText.SetSelection(0, len(wSearchText.GetValue())) ! wSearchText.SetFocus() ! ! result = DialogResults(dlg.ShowModal()) ! result.searchText = wSearchText.GetValue() ! result.wholeWordsOnly = wWholeWord.GetValue() ! result.caseSensitive = wCase.GetValue() ! dlg.Destroy() ! return result ! ! colorDialog = dialogs.colorDialog - # KEA 2004-08-14 - # due to a typo of mine in wx.lib.fontDialog - # I have to include the full version of the function here - def wxFontDialog(parent=None, fontData=None, font=None): - if fontData is None: - fontData = wx.FontData() - fontData.SetColour(wx.BLACK) - fontData.SetInitialFont(wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT)) - - if font is not None: - fontData.SetInitialFont(font) - - dialog = wx.FontDialog(parent, fontData) - result = DialogResults(dialog.ShowModal()) - - if result.accepted: - fontData = dialog.GetFontData() - result.fontData = fontData - result.color = fontData.GetColour().Get() - result.colour = result.color - result.font = fontData.GetChosenFont() - else: - result.color = None - result.colour = None - result.font = None - - dialog.Destroy() - return result - def fontDialog(parent, aFont=None): if aFont is not None: aFont = aFont._getFont() ! result = wxFontDialog(parent, font=aFont) ! #result = dialogs.fontDialog(parent, font=aFont) if result.accepted: fontData = result.fontData --- 12,22 ---- DialogResults = dialogs.DialogResults ! findDialog = dialogs.findDialog colorDialog = dialogs.colorDialog def fontDialog(parent, aFont=None): if aFont is not None: aFont = aFont._getFont() ! result = dialogs.fontDialog(parent, font=aFont) if result.accepted: fontData = result.fontData *************** *** 92,99 **** return result ! # KEA 2004-08-15 ! # should we have a passwordEntryDialog and multilineEntryDialog ! # for convenience rather than requiring the use of ! # wx.TE_PASSWORD or wx.TE_MULTILINE styles? textEntryDialog = dialogs.textEntryDialog messageDialog = dialogs.messageDialog --- 28,42 ---- return result ! def passwordTextEntryDialog(parent=None, message='', title='', defaultText='', ! style=wx.TE_PASSWORD | wx.OK | wx.CANCEL): ! return dialogs.textEntryDialog(parent, message, title, defaultText, style) ! ! def multilineTextEntryDialog(parent=None, message='', title='', defaultText='', ! style=wx.TE_MULTILINE | wx.OK | wx.CANCEL): ! result = dialogs.textEntryDialog(parent, message, title, defaultText, style) ! # workaround for Mac OS X ! result.text = '\n'.join(result.text.splitlines()) ! return result ! textEntryDialog = dialogs.textEntryDialog messageDialog = dialogs.messageDialog *************** *** 104,115 **** saveFileDialog = dialogs.saveFileDialog directoryDialog = dialogs.directoryDialog ! ! #singleChoiceDialog = dialogs.singleChoiceDialog ! # KEA 2004-08-15 ! # another workaround for 2.5.2.7 ! def singleChoiceDialog(parent=None, message='', title='', lst=[], ! style=wx.OK | wx.CANCEL | wx.CENTRE): ! return dialogs.singleChoiceDialog(parent, message, title, list(lst), style | wx.DEFAULT_DIALOG_STYLE) ! multipleChoiceDialog = dialogs.multipleChoiceDialog --- 47,51 ---- saveFileDialog = dialogs.saveFileDialog directoryDialog = dialogs.directoryDialog ! singleChoiceDialog = dialogs.singleChoiceDialog multipleChoiceDialog = dialogs.multipleChoiceDialog |
From: Kevin A. <ka...@us...> - 2004-09-25 15:37:51
|
Update of /cvsroot/pythoncard/PythonCard/docs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17862/docs Modified Files: changelog.txt Log Message: bumped minimum requirement to wxPython 2.5.2.8 removed 2.5.2.7 workarounds in dialog.py added passwordTextEntryDialog, multilineTextEntryDialog Index: changelog.txt =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/docs/changelog.txt,v retrieving revision 1.307 retrieving revision 1.308 diff -C2 -d -r1.307 -r1.308 *** changelog.txt 15 Sep 2004 15:52:04 -0000 1.307 --- changelog.txt 25 Sep 2004 15:37:40 -0000 1.308 *************** *** 1,6 **** Changelog for PythonCard ! Release 0.8.1 2004-09-?? added cursor key support in resourceEditor for moving components added FloatCanvas component and sample --- 1,16 ---- Changelog for PythonCard + SPECIAL NOTE: at least as of wxPython 2.5.2.8 you must still + use a GTK1 build of wxWidgets/wxPython on Linux in order for + component dragging to work in the resourceEditor. You can track + the following bug report to be notified when this issue is fixed. + http://sourceforge.net/tracker/?func=detail&aid=1024777&group_id=9863&atid=109863 ! Release 0.8.1 2004-10-?? ! minimum requirement changed to wxPython 2.5.2.8 ! added passwordTextEntryDialog and multilineTextEntryDialog to dialog.py ! many minor bug fixes ! reworked dialogs sample interface ! added Show Grid Lines option to resourceEditor added cursor key support in resourceEditor for moving components added FloatCanvas component and sample |
From: Kevin A. <ka...@us...> - 2004-09-25 15:13:35
|
Update of /cvsroot/pythoncard/PythonCard/tools/resourceEditor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12321/tools/resourceEditor Modified Files: resourceEditor.rsrc.py Log Message: added Show Grid Lines menu item Index: resourceEditor.rsrc.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/tools/resourceEditor/resourceEditor.rsrc.py,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** resourceEditor.rsrc.py 27 Jul 2004 15:43:14 -0000 1.53 --- resourceEditor.rsrc.py 25 Sep 2004 15:13:25 -0000 1.54 *************** *** 145,148 **** --- 145,154 ---- }, {'type':'MenuItem', + 'name':'menuOptionsShowGridLines', + 'label':'Show Grid Lines', + 'checkable':1, + 'checked':0, + }, + {'type':'MenuItem', 'name':'componentSep1', 'label':'-', |
From: Kevin A. <ka...@us...> - 2004-09-25 15:05:18
|
Update of /cvsroot/pythoncard/PythonCard/tools/resourceEditor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10537/tools/resourceEditor Modified Files: resourceEditor.py Log Message: added Show Grid Lines option to resourceEditor Index: resourceEditor.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/tools/resourceEditor/resourceEditor.py,v retrieving revision 1.216 retrieving revision 1.217 diff -C2 -d -r1.216 -r1.217 *** resourceEditor.py 25 Sep 2004 14:27:07 -0000 1.216 --- resourceEditor.py 25 Sep 2004 15:05:08 -0000 1.217 *************** *** 141,144 **** --- 141,145 ---- self.yGridSize = 5 self.alignToGrid = self.menuBar.getChecked('menuOptionsAlignToGrid') + self.showGridLines = self.menuBar.getChecked('menuOptionsShowGridLines') path = os.path.join(self.application.applicationDirectory, 'templates', \ *************** *** 1233,1236 **** --- 1234,1241 ---- self.editingDialog = True + # unhook the grid drawing and then rebind later if necessary + if self.showGridLines: + self.panel.Unbind(wx.EVT_ERASE_BACKGROUND) + if self.editingDialog: self.menuBar.setEnabled('menuFileRun', False) *************** *** 1286,1296 **** self.panel.Disconnect(-1, -1, wx.wxEVT_ERASE_BACKGROUND) self.panel._bitmap = None - # KEA 2004-09-25 - # test drawing grid lines, this may become an option in the future - # wx.EVT_ERASE_BACKGROUND( self.panel, self.drawPanelGridLines) self.movingComponent = False self.resizingHandleTarget = None def drawPanelGridLines(self, event): dc = event.GetDC() --- 1291,1302 ---- self.panel.Disconnect(-1, -1, wx.wxEVT_ERASE_BACKGROUND) self.panel._bitmap = None self.movingComponent = False self.resizingHandleTarget = None + if self.showGridLines: + self.panel.Bind(wx.EVT_ERASE_BACKGROUND, self.drawPanelGridLines) + self.panel.Refresh() + def drawPanelGridLines(self, event): dc = event.GetDC() *************** *** 1435,1438 **** --- 1441,1452 ---- self.alignToGrid = self.menuBar.getChecked('menuOptionsAlignToGrid') + def on_menuOptionsShowGridLines_select(self, event): + self.showGridLines = self.menuBar.getChecked('menuOptionsShowGridLines') + if self.showGridLines: + self.panel.Bind(wx.EVT_ERASE_BACKGROUND, self.drawPanelGridLines) + else: + self.panel.Unbind(wx.EVT_ERASE_BACKGROUND) + self.panel.Refresh() + def getCommandLineArgs(self): args = ' ' |
From: Kevin A. <ka...@us...> - 2004-09-25 14:27:25
|
Update of /cvsroot/pythoncard/PythonCard/tools/resourceEditor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2035/resourceEditor Modified Files: resourceEditor.py Log Message: added drawPanelGridLines but the event binding is commented out uncommment to test, needs a menu item to toggle it, before finalizing Index: resourceEditor.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/tools/resourceEditor/resourceEditor.py,v retrieving revision 1.215 retrieving revision 1.216 diff -C2 -d -r1.215 -r1.216 *** resourceEditor.py 15 Sep 2004 17:43:29 -0000 1.215 --- resourceEditor.py 25 Sep 2004 14:27:07 -0000 1.216 *************** *** 1286,1293 **** --- 1286,1320 ---- self.panel.Disconnect(-1, -1, wx.wxEVT_ERASE_BACKGROUND) self.panel._bitmap = None + # KEA 2004-09-25 + # test drawing grid lines, this may become an option in the future + # wx.EVT_ERASE_BACKGROUND( self.panel, self.drawPanelGridLines) self.movingComponent = False self.resizingHandleTarget = None + def drawPanelGridLines(self, event): + dc = event.GetDC() + if not dc : + dc = wx.ClientDC(self.panel) + r = self.panel.GetUpdateRegion().GetBox() + dc.SetClippingRegion(r.x, r.y, r.width, r.height) + # need to set the background color to the default panel color + brush = dc.GetBackground() + brush.SetColour(self.panel.GetBackgroundColour()) + dc.SetBackground(brush) + dc.Clear() + # should the color be settable by the user and then save + # that in the prefs? + dc.SetPen(wx.Pen('darkgray', 1, wx.SOLID)) + w, h = self.panel.size + xgrid = self.xGridSize + ygrid = self.yGridSize + nx = w / xgrid + ny = h / ygrid + for x in range(1, nx + 1): + dc.DrawLine(x * xgrid, 0, x * xgrid, h) + for y in range(1, ny + 1): + dc.DrawLine(0, y * ygrid, w, y * ygrid) + def rebindEventsForDragging(self): for name in self.components.order: |
From: Kevin A. <ka...@us...> - 2004-09-25 03:21:36
|
Update of /cvsroot/pythoncard/PythonCard/components In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3726 Modified Files: passwordfield.py textarea.py textfield.py Log Message: changed to delaying binding of events with wx.CallAfter Index: textfield.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/components/textfield.py,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** textfield.py 13 May 2004 02:40:24 -0000 1.29 --- textfield.py 25 Sep 2004 03:21:20 -0000 1.30 *************** *** 96,100 **** #adapter = TextFieldEventBinding(self) #adapter.bindEvents() ! self._bindEvents(event.WIDGET_EVENTS + TextFieldEvents) def _getAlignment(self): --- 96,104 ---- #adapter = TextFieldEventBinding(self) #adapter.bindEvents() ! ## self._bindEvents(event.WIDGET_EVENTS + TextFieldEvents) ! # KEA 2004-09-24 ! # changing to CallAfter to force the gainFocus ! # event to occur after the initialize event ! wx.CallAfter(self._bindEvents, event.WIDGET_EVENTS + TextFieldEvents) def _getAlignment(self): Index: passwordfield.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/components/passwordfield.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** passwordfield.py 2 May 2004 22:03:06 -0000 1.21 --- passwordfield.py 25 Sep 2004 03:20:57 -0000 1.22 *************** *** 62,66 **** #adapter = textfield.TextFieldEventBinding(self) #adapter.bindEvents() ! self._bindEvents(event.WIDGET_EVENTS + textfield.TextFieldEvents) --- 62,70 ---- #adapter = textfield.TextFieldEventBinding(self) #adapter.bindEvents() ! ## self._bindEvents(event.WIDGET_EVENTS + textfield.TextFieldEvents) ! # KEA 2004-09-24 ! # changing to CallAfter to force the gainFocus ! # event to occur after the initialize event ! wx.CallAfter(self._bindEvents, event.WIDGET_EVENTS + textfield.TextFieldEvents) Index: textarea.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/components/textarea.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** textarea.py 19 Jul 2004 17:40:44 -0000 1.26 --- textarea.py 25 Sep 2004 03:21:20 -0000 1.27 *************** *** 66,70 **** self.SetBackgroundColour(self.GetParent().GetBackgroundColour()) ! self._bindEvents(event.WIDGET_EVENTS + textfield.TextFieldEvents) # KEA 2004-04-20 --- 66,74 ---- self.SetBackgroundColour(self.GetParent().GetBackgroundColour()) ! ## self._bindEvents(event.WIDGET_EVENTS + textfield.TextFieldEvents) ! # KEA 2004-09-24 ! # changing to CallAfter to force the gainFocus ! # event to occur after the initialize event ! wx.CallAfter(self._bindEvents, event.WIDGET_EVENTS + textfield.TextFieldEvents) # KEA 2004-04-20 |
From: Kevin A. <ka...@us...> - 2004-09-25 03:19:53
|
Update of /cvsroot/pythoncard/PythonCard In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2955 Modified Files: model.py Log Message: changed on_initialize to just use wx.CallAfter Index: model.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/model.py,v retrieving revision 1.187 retrieving revision 1.188 diff -C2 -d -r1.187 -r1.188 *** model.py 24 Sep 2004 22:51:58 -0000 1.187 --- model.py 25 Sep 2004 03:19:23 -0000 1.188 *************** *** 626,629 **** --- 626,641 ---- aBgRsrc.name) + # KEA 2004-09-24 + # experiment to see if initialize event will + # fire before all other events + # also see change to wx.CallAfter in textfield, passwordfield, and textarea + evt = wx.PyEvent() + # this is sort of pointless, the target is always self + # do any samples or tool refer to the target? + evt.target = self + wx.CallAfter(self.on_initialize, evt) + # also changing how other background events are hooked up + wx.CallAfter(self.OnLatentBackgroundBind, None) + self._initLayout(aBgRsrc.components) *************** *** 657,674 **** # Post the Background initialization event. ! self.EVT_OPEN_BACKGROUND_TYPE = wx.NewEventType() ! self.id = wx.NewId() ! self.Connect(self.GetId(), -1, ! self.EVT_OPEN_BACKGROUND_TYPE, ! self.on_initialize) ! #self._dispatchOpenBackground ) ! evt = wx.PyCommandEvent(self.EVT_OPEN_BACKGROUND_TYPE, self.GetId()) ! evt.target = self ! wx.PostEvent(self, evt) ! EVT_LATENT_BACKGROUNDBIND(self, self.OnLatentBackgroundBind) ! wx.PostEvent(self, wxLatentBackgroundBindEvent()) ! # for some reason the Message Watcher isn't a listener yet ! # so calling EventLog doesn't do anything ! #event.EventLog.getInstance().log('initialize', self.name, True) self._bindWindowEvents() --- 669,687 ---- # Post the Background initialization event. ! ## self.EVT_OPEN_BACKGROUND_TYPE = wx.NewEventType() ! ## self.id = wx.NewId() ! ## self.Connect(self.GetId(), -1, ! ## self.EVT_OPEN_BACKGROUND_TYPE, ! ## self.on_initialize) ! ## #self._dispatchOpenBackground ) ! ## evt = wx.PyCommandEvent(self.EVT_OPEN_BACKGROUND_TYPE, self.GetId()) ! ## evt.target = self ! ## wx.PostEvent(self, evt) ! ## EVT_LATENT_BACKGROUNDBIND(self, self.OnLatentBackgroundBind) ! ## wx.PostEvent(self, wxLatentBackgroundBindEvent()) ! ## # for some reason the Message Watcher isn't a listener yet ! ## # so calling EventLog doesn't do anything ! ## #event.EventLog.getInstance().log('initialize', self.name, True) ! self._bindWindowEvents() |
From: Kevin A. <ka...@us...> - 2004-09-24 22:52:09
|
Update of /cvsroot/pythoncard/PythonCard In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19393 Modified Files: model.py Log Message: added experimental fitToComponents method for testing Index: model.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/model.py,v retrieving revision 1.186 retrieving revision 1.187 diff -C2 -d -r1.186 -r1.187 *** model.py 15 Sep 2004 19:25:06 -0000 1.186 --- model.py 24 Sep 2004 22:51:58 -0000 1.187 *************** *** 698,701 **** --- 698,732 ---- self.panel.Layout() + # KEA 2004-09-24 + # experiment to see if we could fit the panel + # to the boundaries of the components with a little + # padding to get around the problem of a static layout + # having too much vertical space on GTK and Mac or not + # enough vertical space on Windows if the layout was designed + # for GTK or Mac... + # the idea is that this would become an option in the resource + # that could be called automatically + # but I'm just testing now to see if it actually produces good results + def fitToComponents(self, widthPadding=None, heightPadding=5): + print "self.size:", self.size + print "self.panel.size:", self.panel.size + width = 0 + height = 0 + # height = self.panel.size + for c in self.components.itervalues(): + print " ", c.name, c.position, c.size + x, y = c.position + w, h = c.size + width = max(x + w, width) + height = max(y + h, height) + print "width, height", width, height + newWidth, newHeight = self.panel.size + if widthPadding is not None: + newWidth = width + widthPadding + if heightPadding is not None: + newHeight = height + heightPadding + print "newWidth, newHeight", newWidth, newHeight + self.panel.SetSize((newWidth, newHeight)) + self.SetClientSize((newWidth, newHeight)) # KEA 2004-05-09 |
From: Kevin A. <ka...@us...> - 2004-09-23 21:16:41
|
Update of /cvsroot/pythoncard/PythonCard/docs/html In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16687/docs/html Modified Files: faq.html Log Message: added navigation key example Index: faq.html =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/docs/html/faq.html,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** faq.html 14 Aug 2004 21:25:46 -0000 1.11 --- faq.html 23 Sep 2004 21:16:32 -0000 1.12 *************** *** 43,46 **** --- 43,64 ---- A. Yes, using <a href="http://starship.python.net/crew/theller/py2exe/">py2exe</a> or Gordon McMillan's installer. On Mac OS X, you can use <a href="http://www.python.org/moin/BundleBuilder">BundleBuilder</a> to make standalones. The minimalStandalone sample includes example scripts for all of them.</p> + <p>Q. How can I make the Return key act like the Tab key in a field, so that pressing Return navigates to the next component?<br /> + A. The wxPython 2.5.2.x MigrationGuide.html document has an example using wx.NavigationKeyEvent, + which is new in wxPython 2.5.2. Adapting that to cause the Return key to behave the same as the Tab key using PythonCard event + attribute names gives us this example:</p> + <pre> + def on_keyDown(self, event): + # wx.WXK_RETURN is 13 + if event.keyCode == wx.WXK_RETURN: + if event.shiftDown: + flags = wx.NavigationKeyEvent.IsBackward + else: + flags = wx.NavigationKeyEvent.IsForward + if event.controlDown: + flags |= wx.NavigationKeyEvent.WinChange + event.target.Navigate(flags) + else: + event.skip() + </pre> <p>Q. Where is the home page?<br /> A. <a href="http://pythoncard.sourceforge.net/">http://pythoncard.sourceforge.net/</a></p> |
From: Kevin A. <ka...@us...> - 2004-09-22 16:17:40
|
Update of /cvsroot/pythoncard/PythonCard/samples/dialogs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5207/samples/dialogs Modified Files: dialogs.rsrc.py Log Message: sigh, more tweaking for Windows Index: dialogs.rsrc.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/dialogs/dialogs.rsrc.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** dialogs.rsrc.py 18 Sep 2004 21:05:57 -0000 1.17 --- dialogs.rsrc.py 22 Sep 2004 16:17:31 -0000 1.18 *************** *** 5,9 **** 'name':'bg1', 'title':'Dialogs', ! 'size':(403, 325), 'menubar': {'type':'MenuBar', --- 5,9 ---- 'name':'bg1', 'title':'Dialogs', ! 'size':(403, 343), 'menubar': {'type':'MenuBar', |
From: Kevin A. <ka...@us...> - 2004-09-21 14:26:05
|
Update of /cvsroot/pythoncard/PythonCard/samples/widgets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2286/samples/widgets Modified Files: readme.txt Log Message: closing out bug # 1020942 Index: readme.txt =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/widgets/readme.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** readme.txt 15 Jan 2003 18:22:33 -0000 1.3 --- readme.txt 21 Sep 2004 14:25:55 -0000 1.4 *************** *** 4,8 **** The "Create Component Docs..." menu item lets you choose a directory to save a set of HTML documentation for the PythonCard components. A ! "component_documentation" directory will be created in the directory you choose with a file for each component that contains the list of ! attributes and events. --- 4,10 ---- The "Create Component Docs..." menu item lets you choose a directory to save a set of HTML documentation for the PythonCard components. A ! "components" directory will be created in the directory you choose with a file for each component that contains the list of ! attributes and events. You should choose the ! PythonCard/docs/html/framework directory as the save directory if you want ! to be able to follow links from the components.html file. |
From: Kevin A. <ka...@us...> - 2004-09-18 21:06:07
|
Update of /cvsroot/pythoncard/PythonCard/samples/dialogs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16916/samples/dialogs Modified Files: dialogs.rsrc.py Log Message: updated resource for Mac Index: dialogs.rsrc.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/dialogs/dialogs.rsrc.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** dialogs.rsrc.py 18 Sep 2004 18:20:35 -0000 1.16 --- dialogs.rsrc.py 18 Sep 2004 21:05:57 -0000 1.17 *************** *** 5,9 **** 'name':'bg1', 'title':'Dialogs', ! 'size':(409, 311), 'menubar': {'type':'MenuBar', --- 5,9 ---- 'name':'bg1', 'title':'Dialogs', ! 'size':(403, 325), 'menubar': {'type':'MenuBar', *************** *** 26,31 **** {'type':'List', 'name':'listDialogs', ! 'position':(4, 5), ! 'size':(141, 219), 'items':['alert', 'color', 'directory', 'file', 'find', 'font', 'message', 'multiple choice', 'open file', 'save file', 'single choice', 'scrolled message', 'text entry', 'minimal'], }, --- 26,31 ---- {'type':'List', 'name':'listDialogs', ! 'position':(5, 5), ! 'size':(145, 290), 'items':['alert', 'color', 'directory', 'file', 'find', 'font', 'message', 'multiple choice', 'open file', 'save file', 'single choice', 'scrolled message', 'text entry', 'minimal'], }, *************** *** 33,38 **** {'type':'TextArea', 'name':'fldResults', ! 'position':(151, 5), ! 'size':(240, 219), }, --- 33,38 ---- {'type':'TextArea', 'name':'fldResults', ! 'position':(155, 5), ! 'size':(240, 290), }, |
From: Kevin A. <ka...@us...> - 2004-09-18 18:21:09
|
Update of /cvsroot/pythoncard/PythonCard In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17102 Modified Files: event.py Log Message: changed dialogs sample to just use a list added selection and stringSelection attributes to SelectEvent Index: event.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/event.py,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** event.py 9 May 2004 18:50:58 -0000 1.68 --- event.py 18 Sep 2004 18:20:28 -0000 1.69 *************** *** 275,278 **** --- 275,290 ---- name = 'select' + def decorate(self, aWxEvent, source): + aWxEvent = Event.decorate(self, aWxEvent, source) + try: + aWxEvent.selection = aWxEvent.GetSelection() + except: + pass + try: + aWxEvent.stringSelection = aWxEvent.GetString() + except: + pass + return aWxEvent + # KEA 2004-05-09 # this is referenced in debug.py |
From: Kevin A. <ka...@us...> - 2004-09-18 18:20:45
|
Update of /cvsroot/pythoncard/PythonCard/samples/dialogs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17102/samples/dialogs Modified Files: dialogs.py dialogs.rsrc.py Log Message: changed dialogs sample to just use a list added selection and stringSelection attributes to SelectEvent Index: dialogs.rsrc.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/dialogs/dialogs.rsrc.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** dialogs.rsrc.py 18 Sep 2004 17:04:21 -0000 1.15 --- dialogs.rsrc.py 18 Sep 2004 18:20:35 -0000 1.16 *************** *** 1,69 **** ! # position and size don't seem to do anything for the stack ! # only the background position and size matter ?! ! ! { 'application':{ 'type':'Application', ! 'name':'Dialogs', ! 'backgrounds': ! [ ! { 'type':'Background', ! 'name':'bg1', ! 'title':'Dialogs', ! 'position':( 5, 5 ), ! 'size':( 500, 410 ), ! 'menubar': ! { ! 'type':'MenuBar', ! 'menus': ! [ ! { 'type':'Menu', ! 'name':'File', ! 'label':'&File', ! 'items': [ ! { 'type':'MenuItem', ! 'name':'menuFileExit', ! 'label':'E&xit\tAlt+X', ! 'command':'exit'} ] } ! ] }, ! 'components': ! [ ! { 'type':'StaticText', 'name':'static1', 'position':( 150, 230 ), 'size':( -1, -1 ), 'text':'' }, ! ! { 'type':'TextArea', 'name':'fldResults', 'position':( 150, 4 ), 'size':( 200, 150 ), 'text':'' }, ! ! #{ 'class':'Button', 'name':'button1', 'position':( 5, 50 ), 'size':( 80, 20 ), 'label':'Button 1' }, ! ! #{ 'type':'Button', 'name':'buttonQuit', 'position':( 5, 5 ), 'size':( 80, 20 ), 'label':'Quit' }, ! { 'type':'Button', 'name':'buttonColor', 'position':( 5, 5 ), 'size':( 80, 20 ), 'label':'Color' }, ! { 'type':'Button', 'name':'buttonFont', 'position':( 5, 35 ), 'size':( 80, 20 ), 'label':'Font' }, ! ! { 'type':'Button', 'name':'buttonTextEntry', 'position':( 5, 160 ), 'size':( 80, 20 ), 'label':'Text Entry' }, ! ! #{ 'class':'Button', 'name':'buttonConfirmation', 'position':( 5, 40 ), 'size':( 80, 20 ), 'label':'Confirmation' }, ! ! { 'type':'Button', 'name':'buttonMessage', 'position':( 5, 70 ), 'size':( 80, 20 ), 'label':'Message' }, ! ! { 'type':'Button', 'name':'buttonFile', 'position':( 5, 100 ), 'size':( 80, 20 ), 'label':'File' }, ! ! { 'type':'Button', 'name':'buttonDir', 'position':( 5, 130 ), 'size':( 80, 20 ), 'label':'Directory' }, ! ! { 'type':'Button', 'name':'buttonScrolledMessage', 'position':( 5, 190 ), 'size':( -1, -1 ), 'label':'Scrolled Message' }, ! ! { 'type':'Button', 'name':'buttonAlert', 'position':( 5, 220 ), 'size':( -1, -1 ), 'label':'Alert' }, ! ! { 'type':'Button', 'name':'buttonFind', 'position':( 5, 250 ), 'size':( -1, -1 ), 'label':'Find' }, ! ! { 'type':'Button', 'name':'buttonSingleChoice', 'position':( 5, 280 ), 'size':( -1, -1 ), 'label':'Single Choice' }, ! ! { 'type':'Button', 'name':'buttonMultipleChoice', 'position':( 5, 310 ), 'size':( -1, -1 ), 'label':'Multiple Choice' }, ! ! { 'type':'Button', 'name':'buttonMinimalDialog', 'position':( 5, 340 ), 'size':( -1, -1 ), 'label':'Minimal Dialog' }, ! ] ! } ! ] ! } ! } --- 1,42 ---- ! {'application':{'type':'Application', ! 'name':'Dialogs', ! 'backgrounds': [ ! {'type':'Background', ! 'name':'bg1', ! 'title':'Dialogs', ! 'size':(409, 311), ! 'menubar': {'type':'MenuBar', ! 'menus': [ ! {'type':'Menu', ! 'name':'File', ! 'label':'&File', ! 'items': [ ! {'type':'MenuItem', ! 'name':'menuFileExit', ! 'label':'E&xit\tAlt+X', ! 'command':'exit', ! }, ! ] ! }, ! ] ! }, ! 'components': [ ! {'type':'List', ! 'name':'listDialogs', ! 'position':(4, 5), ! 'size':(141, 219), ! 'items':['alert', 'color', 'directory', 'file', 'find', 'font', 'message', 'multiple choice', 'open file', 'save file', 'single choice', 'scrolled message', 'text entry', 'minimal'], }, ! {'type':'TextArea', ! 'name':'fldResults', ! 'position':(151, 5), ! 'size':(240, 219), ! }, + ] # end components + } # end background + ] # end backgrounds + } } Index: dialogs.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/dialogs/dialogs.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** dialogs.py 17 Aug 2004 19:11:51 -0000 1.25 --- dialogs.py 18 Sep 2004 18:20:30 -0000 1.26 *************** *** 4,15 **** __version__ = "$Revision$" __date__ = "$Date$" - - Note that there is a window refresh issue with the code below. - I'm setting a multiline static text field, which is dynamically - resizing the static text field to fit the content. If you resize - or hide the window then the text appears okay. """ - import time from PythonCard import dialog, model import os, sys --- 4,9 ---- *************** *** 17,25 **** import minimalDialog - # KEA what kind of name conflicts do we need to watch for - # with the class name? the class was called Proof, but I renamed - # it Dialogs class Dialogs(model.Background): def on_buttonMultipleChoice_mouseClick(self, event): result = dialog.multipleChoiceDialog(self, "message", "title", ['one', 'two', 'three']) --- 11,37 ---- import minimalDialog class Dialogs(model.Background): + def on_listDialogs_select(self, event): + name = event.stringSelection + handlers = { + 'alert':self.on_buttonAlert_mouseClick, + 'color':self.on_buttonColor_mouseClick, + 'directory':self.on_buttonDir_mouseClick, + 'file':self.on_buttonFile_mouseClick, + 'find':self.on_buttonFind_mouseClick, + 'font':self.on_buttonFont_mouseClick, + 'message':self.on_buttonMessage_mouseClick, + 'multiple choice':self.on_buttonMultipleChoice_mouseClick, + 'scrolled message':self.on_buttonScrolledMessage_mouseClick, + 'single choice':self.on_buttonSingleChoice_mouseClick, + 'open file':self.on_buttonOpenFile_mouseClick, + 'save file':self.on_buttonSaveFile_mouseClick, + 'text entry':self.on_buttonTextEntry_mouseClick, + 'minimal':self.on_buttonMinimalDialog_mouseClick, + } + # call the appropriate handler + handlers[name](None) + def on_buttonMultipleChoice_mouseClick(self, event): result = dialog.multipleChoiceDialog(self, "message", "title", ['one', 'two', 'three']) |
From: Kevin A. <ka...@us...> - 2004-09-18 17:04:29
|
Update of /cvsroot/pythoncard/PythonCard/samples/dialogs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv983/samples/dialogs Modified Files: dialogs.rsrc.py Log Message: changed label attribute to text - wow, very old bug Index: dialogs.rsrc.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/dialogs/dialogs.rsrc.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** dialogs.rsrc.py 10 May 2004 05:02:07 -0000 1.14 --- dialogs.rsrc.py 18 Sep 2004 17:04:21 -0000 1.15 *************** *** 31,35 **** 'components': [ ! { 'type':'StaticText', 'name':'static1', 'position':( 150, 230 ), 'size':( -1, -1 ), 'label':'' }, { 'type':'TextArea', 'name':'fldResults', 'position':( 150, 4 ), 'size':( 200, 150 ), 'text':'' }, --- 31,35 ---- 'components': [ ! { 'type':'StaticText', 'name':'static1', 'position':( 150, 230 ), 'size':( -1, -1 ), 'text':'' }, { 'type':'TextArea', 'name':'fldResults', 'position':( 150, 4 ), 'size':( 200, 150 ), 'text':'' }, |
From: Kevin A. <ka...@us...> - 2004-09-18 16:59:24
|
Update of /cvsroot/pythoncard/PythonCard/docs/html/dialogs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32412 Modified Files: filedialog.html Log Message: fixed reference to results Index: filedialog.html =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/docs/html/dialogs/filedialog.html,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** filedialog.html 17 Aug 2004 19:09:43 -0000 1.5 --- filedialog.html 18 Sep 2004 16:59:15 -0000 1.6 *************** *** 117,122 **** confirmed with a prompt dialog.</p> <h2>Interacting With the Dialog</h2> ! The fileDialog component returns two values, stored as elements ! of the Python dictionary called "results" returned by all PythonCard dialogs. These results are as shown in the following table.<br> <br> --- 117,122 ---- confirmed with a prompt dialog.</p> <h2>Interacting With the Dialog</h2> ! The fileDialog component returns its values, stored as attributes ! of an instance of the DialogResults class called "results" returned by all PythonCard dialogs. These results are as shown in the following table.<br> <br> |
From: Kevin A. <ka...@us...> - 2004-09-18 16:56:19
|
Update of /cvsroot/pythoncard/PythonCard/docs/html In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31788 Modified Files: sidebar.php walkthrough3.html Log Message: updated sidebar with gmane archive updated walkthrough for release 0.8 Index: walkthrough3.html =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/docs/html/walkthrough3.html,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** walkthrough3.html 26 Jul 2004 15:35:32 -0000 1.7 --- walkthrough3.html 18 Sep 2004 16:55:59 -0000 1.8 *************** *** 18,25 **** to help newcomers get started using PythonCard.</p> <h2>Overview, Scope and Purpose</h2> ! <p>This walkthrough covers PythonCard Version 0.6.7. Since PythonCard is ! still very much a prototype, you should expect that things will undoubtedly ! evolve over the next few releases of the product before its 1.0 release some ! time before the end of 2002.</p> <p>The first two PythonCard walkthrough tutorials (which can be found, like this one, in the docs/html directory of your PythonCard installation) --- 18,22 ---- to help newcomers get started using PythonCard.</p> <h2>Overview, Scope and Purpose</h2> ! <p>This walkthrough covers PythonCard Version 0.8.</p> <p>The first two PythonCard walkthrough tutorials (which can be found, like this one, in the docs/html directory of your PythonCard installation) *************** *** 27,31 **** to create applications with multiple windows. Adding another background as a child window will allow you to modularize your application. You can allow ! users to turn on and off windows (by using show()), and you can clean up your user interface and split widgets off into logical groups.</p> <p>In this walkthrough, we will extend our simple Counter application (the --- 24,28 ---- to create applications with multiple windows. Adding another background as a child window will allow you to modularize your application. You can allow ! users to hide and show windows (by using the visible attribute), and you can clean up your user interface and split widgets off into logical groups.</p> <p>In this walkthrough, we will extend our simple Counter application (the *************** *** 57,61 **** basically encapsulates a wxFrame and a wxPanel. Each PythonCard application is a class that derives from model.Background. You can't make a class derived ! from model.Background modal. That is a wxWindows limitation, not PythonCard. If you want a modal dialog then your class has to be derived from model.CustomDialog. They are similar, but different and the resource format --- 54,58 ---- basically encapsulates a wxFrame and a wxPanel. Each PythonCard application is a class that derives from model.Background. You can't make a class derived ! from model.Background modal. That is a wxWidgets limitation, not PythonCard. If you want a modal dialog then your class has to be derived from model.CustomDialog. They are similar, but different and the resource format *************** *** 117,128 **** <p>Next we'll add an event handler to be executed when the Counter application is started. This handler acts something like autoexec.bat on a PC or .login ! in a Unix shell. Place an on_openBackground handler right below the class definition. (Placement isn't important but following this convention will make it easier for you to work through and maintain multi-window applications.) Here is the class declaration of our Counter application with ! on_openBackground added:</p> <p class="code">class Counter(model.Background):<br /> ! def on_openBackground(self, event):</p> ! <p>and here is the code that we will add to the on_openBackgound method:</p> <p class="code"> self.minimalWindow = model.childWindow(self, minimal.Minimal)</p> <p>We create a minimal window object uisng the <span class="code">childWindow --- 114,125 ---- <p>Next we'll add an event handler to be executed when the Counter application is started. This handler acts something like autoexec.bat on a PC or .login ! in a Unix shell. Place an on_initialize handler right below the class definition. (Placement isn't important but following this convention will make it easier for you to work through and maintain multi-window applications.) Here is the class declaration of our Counter application with ! on_initialize added:</p> <p class="code">class Counter(model.Background):<br /> ! def on_initialize(self, event):</p> ! <p>and here is the code that we will add to the on_initialize method:</p> <p class="code"> self.minimalWindow = model.childWindow(self, minimal.Minimal)</p> <p>We create a minimal window object uisng the <span class="code">childWindow *************** *** 133,142 **** it is still hidden and not much good to us.</p> <h2>Communicating With Your Child Window</h2> ! <p>Continuing in the on_openBackground handler, we make calls to set the position and visibility of the new window:</p> <p class="code"> ! # override resource position ! self.minimalWindow.SetPosition((200, 5)) ! self.minimalWindow.Show()</p> <p>We now have a window that is an attribute of our main background, just like any of the menus or buttons that are already a part of Counter.</p> --- 130,139 ---- it is still hidden and not much good to us.</p> <h2>Communicating With Your Child Window</h2> ! <p>Continuing in the on_initialize handler, we make calls to set the position and visibility of the new window:</p> <p class="code"> ! # override resource position<br /> ! self.minimalWindow.position = (200, 5)<br /> ! self.minimalWindow.visible = True</p> <p>We now have a window that is an attribute of our main background, just like any of the menus or buttons that are already a part of Counter.</p> *************** *** 170,174 **** event handler directly. If you are interested in passing an arbitrary event such as a mouseClick, that will require creating the event and then posting ! it using wxPostEvent. Custom events are beyond the scope of this tutorial. However, the child window is able to access the parent window directly by traversing up the stack of windows.</p> --- 167,171 ---- event handler directly. If you are interested in passing an arbitrary event such as a mouseClick, that will require creating the event and then posting ! it using wx.PostEvent. Custom events are beyond the scope of this tutorial. However, the child window is able to access the parent window directly by traversing up the stack of windows.</p> *************** *** 178,189 **** minimal.py</p> <p class="code"> ! def on_openBackground(self, event):<br /> ! self.parent = self.GetParent()<br /> <br /> def on_btnReset_mouseClick(self, event): self.parent.components.field1.text = "0"</p> ! <p>When our child window it initialized, it calls GetParent() to get a reference to its parent window, and then stores that reference. We place the ! code that handles this task in the on_openBackground handler so that the reference is available to all handlers in the application.</p> <p>You'll notice that the text field on the Counter background is reset to --- 175,186 ---- minimal.py</p> <p class="code"> ! def on_initialize(self, event):<br /> ! self.parent = self.getParent()<br /> <br /> def on_btnReset_mouseClick(self, event): self.parent.components.field1.text = "0"</p> ! <p>When our child window it initialized, it calls getParent() to get a reference to its parent window, and then stores that reference. We place the ! code that handles this task in the on_initialize handler so that the reference is available to all handlers in the application.</p> <p>You'll notice that the text field on the Counter background is reset to *************** *** 194,198 **** itself, self.parent is set to None. If you were using the child window in other roles or wanted to make it multi-purpose, you could place the ! self.GetParent() call in a try...except block.</p> <h2>Closing the Child Window</h2> <p>Your main application window will clean up the child window when your app --- 191,195 ---- itself, self.parent is set to None. If you were using the child window in other roles or wanted to make it multi-purpose, you could place the ! self.getParent() call in a try...except block.</p> <h2>Closing the Child Window</h2> <p>Your main application window will clean up the child window when your app *************** *** 207,211 **** <p>We do this by overriding the on_close event handler. on_close would normally destroy the window but we change it so it hides the window by ! calling the Show method with a parameter of zero, hiding the window. Just to make things a little more interesting, we've also added a custom doExit function that sets the counter's field1 to an arbitrary value just to confirm --- 204,208 ---- <p>We do this by overriding the on_close event handler. on_close would normally destroy the window but we change it so it hides the window by ! setting the visible attribute to False, hiding the window. Just to make things a little more interesting, we've also added a custom doExit function that sets the counter's field1 to an arbitrary value just to confirm *************** *** 217,228 **** def on_close(self, event):<br /> self.doExit()<br /> ! self.Show(0)<br /> <br /> def on_menuFileExit_select(self, event):<br /> ! self.Close() </p> <p>As the above code shows, the File->Exit menu item just calls the ! wxPython method Close() to close the window. (This is one of the wxPython ! events that PythonCard does not yet wrap in its own calls, so we have to make ! the call directly to the wxPython method.) That is the same as clicking the close box on the window and triggers the close window event, so that on_close is called. We placed the work to be done when the document is closing in the --- 214,223 ---- def on_close(self, event):<br /> self.doExit()<br /> ! self.visible = False<br /> <br /> def on_menuFileExit_select(self, event):<br /> ! self.close() </p> <p>As the above code shows, the File->Exit menu item just calls the ! close() to close the window. That is the same as clicking the close box on the window and triggers the close window event, so that on_close is called. We placed the work to be done when the document is closing in the *************** *** 235,239 **** the parent. The code would look something like this:</p> <p class="code"> ! self.parent.menuBar.setChecked('menuViewMinimalWindow', 0)</p> <?php include "footer.php" ?> <p>$Revision$ : $Author$ : Last update $Date$</p> --- 230,234 ---- the parent. The code would look something like this:</p> <p class="code"> ! self.parent.menuBar.setChecked('menuViewMinimalWindow', False)</p> <?php include "footer.php" ?> <p>$Revision$ : $Author$ : Last update $Date$</p> Index: sidebar.php =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/docs/html/sidebar.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** sidebar.php 14 Aug 2004 21:15:21 -0000 1.3 --- sidebar.php 18 Sep 2004 16:55:58 -0000 1.4 *************** *** 21,24 **** --- 21,25 ---- <li><a href="http://lists.sourceforge.net/lists/listinfo/pythoncard-users">Mailing list</a></li> <li> <a href="http://aspn.activestate.com/ASPN/Mail/Browse/Threaded/PythonCard">Archive @ ASPN</a></li> + <li> <a href="http://news.gmane.org/gmane.comp.python.pythoncard">Archive @ gmane</a></li> <li> <a href="http://sourceforge.net/mailarchive/forum.php?forum=pythoncard-users">Archive @ SF</a></li> <li><a href="/samples/samples.html">Samples (screenshots)</a></li> |
From: Kevin A. <ka...@us...> - 2004-09-18 16:26:05
|
Update of /cvsroot/pythoncard/PythonCard In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26258 Modified Files: resource.py Log Message: removed unused unit test from main block Index: resource.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/resource.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** resource.py 26 Apr 2004 20:55:56 -0000 1.5 --- resource.py 18 Sep 2004 16:25:45 -0000 1.6 *************** *** 215,244 **** parentAttributes = parent[ 'info' ][ 'attributes' ] childAttributes.update( parentAttributes ) - - - - # Unit Test - - if __name__ == '__main__' : - - #SpecDoc( 'spec.py', 'ComponentSpecTextFormat' ) - SpecDoc( 'spec.py', 'ComponentSpecHtmlFormat' ) - - import sys - sys.exit(1) - - if len( sys.argv ) is 2 : - s = None - d = util.readAndEvalFile(sys.argv[ 1 ] ) - else : - s = util.readAndEvalFile( sys.argv[ 1 ] ) - d = util.readAndEvalFile( sys.argv[ 2 ] ) - - spec = Spec( s ) - - print 'PasswordField spec = ', spec.getEntry( 'PasswordField' )[ 'info' ][ 'attributes' ] - - #print spec - - r = Resource( d ) - --- 215,216 ---- |
From: Kevin A. <ka...@us...> - 2004-09-16 21:11:45
|
Update of /cvsroot/pythoncard/PythonCard/tools/codeEditor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1751/tools/codeEditor Modified Files: codeEditorR.py Log Message: fixed CustomDialog check Index: codeEditorR.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/tools/codeEditor/codeEditorR.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** codeEditorR.py 16 Sep 2004 19:04:21 -0000 1.13 --- codeEditorR.py 16 Sep 2004 21:11:33 -0000 1.14 *************** *** 109,125 **** self.components.popComponentNames.items = [] self.components.popComponentEvents.items = [] - try: - background = rsrc.application.backgrounds[0] - editingDialog = False - except: - editingDialog = True try: self.resourceFilename = getResourceFilename(self.documentPath) self.rsrc = resource.ResourceFile(self.resourceFilename).getResource() self.rsrcComponents = {} ! if editingDialog: ! components = self.rsrc.components ! else: components = self.rsrc.application.backgrounds[0].components for c in components: self.rsrcComponents[c.name] = c.type --- 109,121 ---- self.components.popComponentNames.items = [] self.components.popComponentEvents.items = [] try: self.resourceFilename = getResourceFilename(self.documentPath) self.rsrc = resource.ResourceFile(self.resourceFilename).getResource() self.rsrcComponents = {} ! if hasattr(self.rsrc, 'application'): components = self.rsrc.application.backgrounds[0].components + else: + # CustomDialog + components = self.rsrc.components for c in components: self.rsrcComponents[c.name] = c.type |
From: Kevin A. <ka...@us...> - 2004-09-16 19:04:31
|
Update of /cvsroot/pythoncard/PythonCard/tools/codeEditor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9285/tools/codeEditor Modified Files: codeEditorR.py Log Message: fixed resource loading for CustomDialogs Index: codeEditorR.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/tools/codeEditor/codeEditorR.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** codeEditorR.py 4 Sep 2004 22:47:23 -0000 1.12 --- codeEditorR.py 16 Sep 2004 19:04:21 -0000 1.13 *************** *** 109,117 **** self.components.popComponentNames.items = [] self.components.popComponentEvents.items = [] try: self.resourceFilename = getResourceFilename(self.documentPath) self.rsrc = resource.ResourceFile(self.resourceFilename).getResource() self.rsrcComponents = {} ! for c in self.rsrc.application.backgrounds[0].components: self.rsrcComponents[c.name] = c.type items = self.rsrcComponents.keys() --- 109,126 ---- self.components.popComponentNames.items = [] self.components.popComponentEvents.items = [] + try: + background = rsrc.application.backgrounds[0] + editingDialog = False + except: + editingDialog = True try: self.resourceFilename = getResourceFilename(self.documentPath) self.rsrc = resource.ResourceFile(self.resourceFilename).getResource() self.rsrcComponents = {} ! if editingDialog: ! components = self.rsrc.components ! else: ! components = self.rsrc.application.backgrounds[0].components ! for c in components: self.rsrcComponents[c.name] = c.type items = self.rsrcComponents.keys() |
From: Kevin A. <ka...@us...> - 2004-09-16 16:11:44
|
Update of /cvsroot/pythoncard/PythonCard/samples/testNotebook In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1381 Modified Files: testNotebook.py testNotebook.rsrc.py Added Files: doodle.py doodle.rsrc.py Log Message: made sample resizeable and added doodle as a sizer test --- NEW FILE: doodle.py --- #!/usr/bin/python """ __version__ = "$Revision: 1.1 $" __date__ = "$Date: 2004/09/16 16:11:34 $" """ from PythonCard import clipboard, dialog, graphic, model import wx import os class Doodle(model.PageBackground): def on_initialize(self, event): self.x = 0 self.y = 0 self.filename = None sizer1 = wx.BoxSizer(wx.VERTICAL) comp = self.components flags = wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.ALIGN_BOTTOM # Mac wxButton needs 7 pixels on bottom and right macPadding = 7 sizer1.Add(comp.btnColor, 0, flags, macPadding) sizer1.Add(comp.bufOff, 1, wx.EXPAND) sizer1.Fit(self) sizer1.SetSizeHints(self) self.panel.SetSizer(sizer1) self.panel.SetAutoLayout(1) self.panel.Layout() def on_bufOff_mouseEnter(self, event): self.x, self.y = event.position def on_bufOff_mouseDown(self, event): self.x, self.y = event.position event.target.drawLine((self.x, self.y), (self.x + 1, self.y + 1)) def on_bufOff_mouseDrag(self, event): x, y = event.position event.target.drawLine((self.x, self.y), (x, y)) self.x = x self.y = y def on_btnColor_mouseClick(self, event): result = dialog.colorDialog(self) if result.accepted: self.components.bufOff.foregroundColor = result.color event.target.backgroundColor = result.color def openFile(self): result = dialog.openFileDialog(None, "Import which file?") if result.accepted: path = result.paths[0] os.chdir(os.path.dirname(path)) self.filename = path bmp = graphic.Bitmap(self.filename) self.components.bufOff.drawBitmap(bmp, (0, 0)) def on_menuFileOpen_select(self, event): self.openFile() def on_menuFileSaveAs_select(self, event): if self.filename is None: path = '' filename = '' else: path, filename = os.path.split(self.filename) result = dialog.saveFileDialog(None, "Save As", path, filename) if result.accepted: path = result.paths[0] fileType = graphic.bitmapType(path) print fileType, path try: bmp = self.components.bufOff.getBitmap() bmp.SaveFile(path, fileType) return 1 except: return 0 else: return 0 def on_menuEditCopy_select(self, event): clipboard.setClipboard(self.components.bufOff.getBitmap()) def on_menuEditPaste_select(self, event): bmp = clipboard.getClipboard() if isinstance(bmp, wx.Bitmap): self.components.bufOff.drawBitmap(bmp) def on_editClear_command(self, event): self.components.bufOff.clear() if __name__ == '__main__': app = model.Application(Doodle) app.MainLoop() --- NEW FILE: doodle.rsrc.py --- { 'application':{ 'type':'Application', 'name':'Doodle', 'backgrounds': [ { 'type':'Background', 'name':'bgDoodle', 'title':'Doodle PythonCard Application', 'size':( 310, 300 ), 'style':['resizeable'], 'menubar': { 'type':'MenuBar', 'menus': [ { 'type':'Menu', 'name':'menuFile', 'label':'&File', 'items': [ { 'type':'MenuItem', 'name':'menuFileOpen', 'label':'&Open...\tCtrl+O' }, { 'type':'MenuItem', 'name':'menuFileSaveAs', 'label':'Save &As...' }, { 'type':'MenuItem', 'name':'fileSep1', 'label':'-' }, { 'type':'MenuItem', 'name':'menuFileExit', 'label':'E&xit\tAlt+X', 'command':'exit' } ] }, { 'type':'Menu', 'name':'menuEdit', 'label':'&Edit', 'items': [ { 'type':'MenuItem', 'name':'menuEditCopy', 'label':'&Copy\tCtrl+C'}, { 'type':'MenuItem', 'name':'menuEditPaste', 'label':'&Paste\tCtrl+V'}, { 'type':'MenuItem', 'name':'editSep1', 'label':'-' }, { 'type':'MenuItem', 'name':'menuEditClear', 'label':'&Clear', 'command':'editClear'} ] } ] }, 'components': [ { 'type':'Button', 'name':'btnColor', 'position':(0, 0), 'label':'Color' }, { 'type':'BitmapCanvas', 'name':'bufOff', 'position':(0, 30), 'size':(300, 230) }, ] } ] } } Index: testNotebook.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/testNotebook/testNotebook.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** testNotebook.py 16 Sep 2004 04:42:30 -0000 1.5 --- testNotebook.py 16 Sep 2004 16:11:34 -0000 1.6 *************** *** 11,18 **** --- 11,26 ---- import minimal import widgets + import doodle class TestNotebook(model.Background): def on_initialize(self, event): + # KEA 2004-09-16 + # if we don't set a min size then the window is + # very small. this may not be the correct way to + # solve the problem... + self.components.notebook.SetMinSize(self.components.notebook.size) + self.singleItemExpandingSizerLayout() + panel = wx.Panel(self.components.notebook, -1) panel.text1 = wx.TextCtrl(panel, -1, 'Hello Notebook', (5, 5)) *************** *** 56,59 **** --- 64,84 ---- self.components.notebook.AddPage(win2, 'widgets', True) + win3 = model.childWindow(self.components.notebook, doodle.Doodle) + self.components.notebook.AddPage(win3, 'doodle', True) + page = self.components.notebook.getPage(3) + # it appears that since on_initialize hasn't run yet + # after adding the page, the sizer code in doodle + # in on_initialize hasn't been run so the page size + # below is what we want but after the sizer code runs it + # will be (300, 260) + # if the user resizes the window, the sizer works as expected + # but if the window hasn't been resized, then when you click + # on the doodle tab the page doesn't fill the whole window + # I don't know what the correct solution is yet, but this seems + # to work. i have to use a method with CallAfter + # so that's why we aren't just using the attribute + size = page.size + wx.CallAfter(page.SetSize, size) + print "number of pages:", self.components.notebook.getPageCount() print "last page text: %s\n" % \ Index: testNotebook.rsrc.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/testNotebook/testNotebook.rsrc.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** testNotebook.rsrc.py 14 Sep 2004 17:28:46 -0000 1.1 --- testNotebook.rsrc.py 16 Sep 2004 16:11:34 -0000 1.2 *************** *** 9,12 **** --- 9,13 ---- 'title':'Notebook Test', 'size':( 800, 600 ), + 'style':['resizeable'], 'menubar': |