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: Arlo B. <abe...@us...> - 2004-10-24 19:43:56
|
Update of /cvsroot/pythoncard/PythonCard/tools/experimentalResourceEditor/modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32733/modules Added Files: actionBinderDialog.py actionBinderDialog.rsrc.py Log Message: Added a dialog to the resource editor that binds actions. Widget treats these bindings as extensions to the set provided by specifically-named functions on the background (the background's functions override the bindings set in the dialog). Abel, Lion --- NEW FILE: actionBinderDialog.py --- """ __version__ = "$Revision: 1.1 $" __date__ = "$Date: 2004/10/24 19:43:43 $" """ from PythonCard import model class ActionBinderDialog(model.CustomDialog): def __init__(self, parent): model.CustomDialog.__init__(self, parent) self.resource_editor = parent for inst in self.resource_editor.components.keys(): self.components.sourceComponent.append(inst) self.components.destinationComponent.append(inst) # if some special setup is necessary, do it here # example from samples/dialogs/minimalDialog.py # self.components.field1.text = txt def on_sourceComponent_select(self, wx_event): the_widget = self.resource_editor.components[wx_event.stringSelection] self.components.sourceEvent.clear() for evt in the_widget._spec.getEventNames(): self.components.sourceEvent.append(evt) self.components.sourceComponent.selected = wx_event.stringSelection def on_btnApply_mouseClick(self, wx_event): sourceComponent = self.components.sourceComponent.stringSelection sourceEvent = self.components.sourceEvent.stringSelection destinationComponent = self.components.destinationComponent.stringSelection destinationFunction = self.components.destinationFunction.text if max(len(sourceComponent), len(sourceEvent), len(destinationComponent), len(destinationFunction)) == 0: return the_widget = self.resource_editor.components[sourceComponent] actionBindings = the_widget.actionBindings actionBindings[sourceEvent] = (destinationComponent, destinationFunction) self.resource_editor.documentChanged = True def runDialog(parent): dlg = ActionBinderDialog(parent) result = dlg.showModal() # stick your results into the result dictionary here # example from samples/dialogs/minimalDialog.py # result.text = dlg.components.field1.text dlg.destroy() return result --- NEW FILE: actionBinderDialog.rsrc.py --- {'type':'CustomDialog', 'name':'Template', 'title':'Dialog Template', 'position':(41, 87), 'size':(711, 538), 'components': [ {'type':'Button', 'name':'btnApply', 'position':(596, 407), 'label':'&Apply', }, {'type':'TextField', 'name':'destinationFunction', 'position':(434, 10), 'size':(250, -1), }, {'type':'List', 'name':'destinationComponent', 'position':(300, 10), 'size':(-1, 421), 'items':[], }, {'type':'List', 'name':'sourceEvent', 'position':(155, 10), 'size':(-1, 421), 'items':[], }, {'type':'List', 'name':'sourceComponent', 'position':(10, 10), 'size':(-1, 421), 'items':[], }, ] # end components } # end CustomDialog |
From: Arlo B. <abe...@us...> - 2004-10-24 19:43:40
|
Update of /cvsroot/pythoncard/PythonCard In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32709 Modified Files: widget.py Log Message: Added a dialog to the resource editor that binds actions. Widget treats these bindings as extensions to the set provided by specifically-named functions on the background (the background's functions override the bindings set in the dialog). Abel, Lion Index: widget.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/widget.py,v retrieving revision 1.133 retrieving revision 1.134 diff -C2 -d -r1.133 -r1.134 *** widget.py 14 Sep 2004 17:28:45 -0000 1.133 --- widget.py 24 Oct 2004 19:43:31 -0000 1.134 *************** *** 34,37 **** --- 34,38 ---- 'position' : { 'presence' : 'optional', 'default' : [ -1, -1 ] }, 'size' : { 'presence' : 'optional', 'default' : [ -1, -1 ] }, + 'actionBindings' : {'presence':'optional', 'default':None}, 'userdata' : {'presence':'optional', 'default':''} } *************** *** 64,67 **** --- 65,72 ---- self._name = aResource.name self._setUserdata(self._resource.userdata) + if self._resource.actionBindings is None: + self._setActionBindings(dict()) + else: + self._setActionBindings(dict(self._resource.actionBindings.__dict__)) self._setCommand(self._resource.command) # KEA 2004-04-23 *************** *** 144,147 **** --- 149,158 ---- self.SetFont( aWxFont ) + def _getActionBindings(self): + return self._actionBindings + + def _setActionBindings(self, actionDict): + self._actionBindings = actionDict + def _getUserdata(self): return self._userdata *************** *** 228,231 **** --- 239,243 ---- size = property(_getSize, _setSize) toolTip = property(_getToolTip, _setToolTip) + actionBindings = property(_getActionBindings, _setActionBindings) userdata = property(_getUserdata, _setUserdata) visible = property(_getVisible, _setVisible) *************** *** 276,279 **** --- 288,294 ---- print "\nBINDING...", self.name + actionBindings = {} + if self.actionBindings is not None: + actionBindings = self.actionBindings for eventClass in eventList: #for eventClass in ButtonEvents: *************** *** 294,297 **** --- 309,321 ---- if not handler: handler = background.findHandler('on_' + eventClass.name) + if not handler: + handlerData = actionBindings.get(eventClass.name) + if handlerData is not None: + handlerObjectName, handlerFunction = handlerData + handlerObject = background.components.get(handlerObjectName) + if handlerObject is not None: + handler = getattr(handlerObject, handlerFunction, None) + if not handler: + handler = background.findHandler('on_' + handlerObjectName + '_' + handlerFunction) if handler or bindUnusedEvents: # only bind events that have an event handler |
From: Kevin A. <ka...@us...> - 2004-10-24 19:27:51
|
Update of /cvsroot/pythoncard/PythonCard/samples/webserver/html/cgi-bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28845/samples/webserver/html/cgi-bin Modified Files: contacts.py Log Message: made search lowercase and added company to search list Index: contacts.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/webserver/html/cgi-bin/contacts.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** contacts.py 28 Jul 2004 16:04:18 -0000 1.6 --- contacts.py 24 Oct 2004 19:27:41 -0000 1.7 *************** *** 67,73 **** form = cgi.FieldStorage() ! name = form['name'].value ! results = document.findRecords(['Name'], name) print "Content-type: text/html\r\n\r\n", --- 67,73 ---- form = cgi.FieldStorage() ! name = form['name'].value.lower() ! results = document.findRecords(['Name', 'Company'], name) print "Content-type: text/html\r\n\r\n", |
From: Arlo B. <abe...@us...> - 2004-10-24 19:21:57
|
Update of /cvsroot/pythoncard/PythonCard/tools/experimentalResourceEditor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27296 Added Files: .cvsignore readme.txt resourceEditor.py resourceEditor.rsrc.py Log Message: A clone of the original resource viewer. I will use this to add action binding, invisible components, and the widget browser. AB --- NEW FILE: .cvsignore --- .cvsignore *.pyc *.log user.config.txt .DS_Store --- NEW FILE: resourceEditor.py --- #!/usr/bin/python """ __version__ = "$Revision: 1.1 $" __date__ = "$Date: 2004/10/24 19:21:46 $" """ # TODO: Start using exceptions! import os, sys import pprint import webbrowser import wx from PythonCard import about, clipboard, configuration, dialog, graphic, log from PythonCard import menu, model, registry, resource, util from PythonCard.templates.dialogs import runOptionsDialog [...1652 lines suppressed...] event.skip() except: event.skip() def on_showPythonCardDocumentation_command(self, event): global pythoncard_url webbrowser.open(pythoncard_url) def on_showResourceEditorDocumentation_command(self, event): global resourceeditor_url webbrowser.open(resourceeditor_url) if __name__ == '__main__': # now force the property editor to be enabled #configuration('showPropertyEditor', 1) #configuration('showShell', 1) app = model.Application(ResourceEditor) app.MainLoop() --- NEW FILE: resourceEditor.rsrc.py --- {'application':{'type':'Application', 'name':'ResEdit', 'backgrounds': [ {'type':'Background', 'name':'bgDrag', 'title':'Resource Editor', 'size':(316, 166), 'style':['resizeable'], 'menubar': {'type':'MenuBar', 'menus': [ {'type':'Menu', 'name':'menuFile', 'label':'&File', 'items': [ {'type':'MenuItem', 'name':'menuFileNew', 'label':'&New...\tCtrl+N', }, {'type':'MenuItem', 'name':'menuFileOpen', 'label':'&Open...\tCtrl+O', }, {'type':'MenuItem', 'name':'menuFileSave', 'label':'Save\tCtrl+S', }, {'type':'MenuItem', 'name':'menuFileSaveAs', 'label':'Save &As...', }, {'type':'MenuItem', 'name':'menuFileRevert', 'label':'Revert', }, {'type':'MenuItem', 'name':'fileSep1', 'label':'-', }, {'type':'MenuItem', 'name':'menuFileRun', 'label':'&Run\tCtrl+R', 'command':'fileRun', }, {'type':'MenuItem', 'name':'menuFileRunWithInterpreter', 'label':'Run with &interpreter\tCtrl+Shift+R', 'command':'fileRunWithInterpreter', }, {'type':'MenuItem', 'name':'menuFileRunOptions', 'label':'Run Options...', 'command':'fileRunOptions', }, {'type':'MenuItem', 'name':'menuFilePreviewDialog', 'label':'Preview Dialog', 'command':'filePreviewDialog', }, {'type':'MenuItem', 'name':'fileSep2', 'label':'-', }, {'type':'MenuItem', 'name':'menuFileExit', 'label':'E&xit\tAlt+X', 'command':'exit', }, ] }, {'type':'Menu', 'name':'menuEdit', 'label':'&Edit', 'items': [ {'type':'MenuItem', 'name':'menuEditCut', 'label':'Cu&t\tCtrl+X', }, {'type':'MenuItem', 'name':'menuEditCopy', 'label':'&Copy\tCtrl+C', }, {'type':'MenuItem', 'name':'menuEditPaste', 'label':'&Paste\tCtrl+V', }, {'type':'MenuItem', 'name':'editSep1', 'label':'-', }, {'type':'MenuItem', 'name':'menuComponentDuplicate', 'label':'&Duplicate', 'command':'componentDuplicate', }, {'type':'MenuItem', 'name':'menuComponentDelete', 'label':'Delete\tDel', 'command':'componentDelete', }, {'type':'MenuItem', 'name':'componentSep2', 'label':'-', }, {'type':'MenuItem', 'name':'menuEditBackgroundInfo', 'label':'Background Info...', 'command':'editBackgroundInfo', }, {'type':'MenuItem', 'name':'menuEditMenubar', 'label':'Menu Editor...', 'command':'editMenubar', }, {'type':'MenuItem', 'name':'menuEditStrings', 'label':'String Editor...', 'command':'editStrings', }, {'type':'MenuItem', 'name':'menuEditDialogInfo', 'label':'Dialog Info...', 'command':'editDialogInfo', }, ] }, {'type':'Menu', 'name':'menuComponent', 'label':'&Component', 'items': [] }, {'type':'Menu', 'name':'menuOptions', 'label':'&Options', 'items': [ {'type':'MenuItem', 'name':'menuOptionsGridSize', 'label':'Grid Size...', 'command':'optionGridSize', }, {'type':'MenuItem', 'name':'menuOptionsAlignToGrid', 'label':'Align Components to Grid\tCtrl+G', 'checkable':1, }, {'type':'MenuItem', 'name':'menuOptionsShowGridLines', 'label':'Show Grid Lines', 'checkable':1, 'checked':0, }, {'type':'MenuItem', 'name':'componentSep1', 'label':'-', }, {'type':'MenuItem', 'name':'menuComponentSendBack', 'label':'Send to Back\tCtrl+1', 'command':'componentSendBack', }, {'type':'MenuItem', 'name':'menuComponentMoveBack', 'label':'Move Backward\tCtrl+2', 'command':'componentMoveBack', }, {'type':'MenuItem', 'name':'menuComponentMoveForward', 'label':'Move Forward\tCtrl+3', 'command':'componentMoveForward', }, {'type':'MenuItem', 'name':'menuComponentBringFront', 'label':'Bring to Front\tCtrl+4', 'command':'componentBringFront', }, ] }, {'type':'Menu', 'name':'menuView', 'label':'&View', 'items': [ {'type':'MenuItem', 'name':'menuViewAttributes', 'label':'&Resource...', 'command':'displayAttributes', }, {'type':'MenuItem', 'name':'menuViewSep1', 'label':'-', }, {'type':'MenuItem', 'name':'menuViewPropertyEditor', 'label':'Property Editor\tCtrl+P', 'checkable':1, 'checked':1, }, ] }, {'type':'Menu', 'name':'menuHelp', 'label':'&Help', 'items': [ {'type':'MenuItem', 'name':'menuResourceEditorDocumentation', 'label':'&resourceEditor Documentation...\tF1', 'command':'showResourceEditorDocumentation', }, {'type':'MenuItem', 'name':'menuPythonCardDocumentation', 'label':'&PythonCard Documentation...', 'command':'showPythonCardDocumentation', }, {'type':'MenuItem', 'name':'helpSep1', 'label':'-', }, {'type':'MenuItem', 'name':'menuHelpAbout', 'label':'&About resourceEditor...', }, {'type':'MenuItem', 'name':'menuHelpAboutPythonCard', 'label':'About PythonCard...', 'command':'doHelpAboutPythonCard', }, ] }, ] }, 'components': [ ] # end components } # end background ] # end backgrounds } } --- NEW FILE: readme.txt --- Last updated: 2002-04-13 This represents the beginnings of a GUI resource (layout) editor for PythonCard. You can view the attributes for all components and menus by selecting the Resource... menu item in the View menu prior to doing a Save or Save As... under the File menu to output a new file. Known Bugs and Issues: There are no constraints applied when the shift key is held down, but there is there a grid for the widgets to "snap to". You can only select one widget at a time. Sizers and anchors are not supported. It is likely anchors will be supported before sizers. Some of the components don't move or resize correctly all the time, you should report problems to the mailing list. The Choice component seems prone to this movement problem. If a component is difficult to select or move, you can always select it via the Property Editor and then change its position attribute via the Property Editor rather than trying to drag the control itself; the sizing handles should also work. There is a bug that causes the top three sizing handles to appear incorrectly, usually when the widget y position is at -1. I am trying to determine if this is actually a problem with wxPython or some rare interaction in the resourceEditor code. [I think this is fixed as of release 0.6.2 -ka] When editing a dialog or other window that doesn't have a menubar, you'll probably need to increase the vertical size of the window by 20 or 30 pixels to compensate for the resourceEditor menubar. Once your layout looks the way you want it you can subtract the pixel padding you added earlier. On Microsoft Windows, the menubar may wrap if the width of the window is not wide enough, in which case you'll need to add even more padding. The next revision of the resourceEditor will use a separate window for doing layout so that the size of a window is always accurate and shows the menubar of the app you're editing. |
From: Arlo B. <abe...@us...> - 2004-10-24 19:21:57
|
Update of /cvsroot/pythoncard/PythonCard/tools/experimentalResourceEditor/templates In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27296/templates Added Files: .cvsignore dialogTemplate.py dialogTemplate.rsrc.py template.py template.rsrc.py templateFullMenus.py templateFullMenus.rsrc.py templateNoMenus.py templateNoMenus.rsrc.py Log Message: A clone of the original resource viewer. I will use this to add action binding, invisible components, and the widget browser. AB --- NEW FILE: .cvsignore --- .cvsignore *.pyc *.log .DS_Store --- NEW FILE: templateFullMenus.rsrc.py --- { 'application':{ 'type':'Application', 'name':'Template', 'backgrounds': [ { 'type':'Background', 'name':'bgTemplate', 'title':'Standard Template with full menus', 'size':( 400, 300 ), 'style':['resizeable'], 'statusBar':1, 'menubar': { 'type':'MenuBar', 'menus': [ { 'type':'Menu', 'name':'menuFile', 'label':'&File', 'items': [ { 'type':'MenuItem', 'name':'menuFileNew', 'label':'&New\tCtrl+N' }, { 'type':'MenuItem', 'name':'menuFileOpen', 'label':'&Open\tCtrl+O' }, { 'type':'MenuItem', 'name':'menuFileSave', 'label':'&Save\tCtrl+S' }, { 'type':'MenuItem', 'name':'menuFileSaveAs', 'label':'Save &As...' }, { 'type':'MenuItem', 'name':'fileSep1', 'label':'-' }, { 'type':'MenuItem', 'name':'menuFilePageSetup', 'label':'Page Set&up...' }, { 'type':'MenuItem', 'name':'menuFilePrint', 'label':'&Print...\tCtrl+P' }, { 'type':'MenuItem', 'name':'menuFilePrintPreview', 'label':'Print Pre&view' }, { 'type':'MenuItem', 'name':'fileSep2', 'label':'-' }, { 'type':'MenuItem', 'name':'menuFileExit', 'label':'E&xit\tAlt+X', 'command':'exit', } ] }, # most of the edit menu was copied from the searchexplorer sample {'type':'Menu', 'name':'Edit', 'label':'&Edit', 'items': [ { 'type':'MenuItem', 'name':'menuEditUndo', 'label':'&Undo\tCtrl+Z'}, { 'type':'MenuItem', 'name':'menuEditRedo', 'label':'&Redo\tCtrl+Y'}, { 'type':'MenuItem', 'name':'editSep1', 'label':'-' }, { 'type':'MenuItem', 'name':'menuEditCut', 'label':'Cu&t\tCtrl+X'}, { 'type':'MenuItem', 'name':'menuEditCopy', 'label':'&Copy\tCtrl+C'}, { 'type':'MenuItem', 'name':'menuEditPaste', 'label':'&Paste\tCtrl+V'}, { 'type':'MenuItem', 'name':'editSep2', 'label':'-' }, { 'type':'MenuItem', 'name':'menuEditClear', 'label':'Cle&ar\tDel'}, { 'type':'MenuItem', 'name':'menuEditSelectAll', 'label':'Select A&ll\tCtrl+A'} ] }, { 'type':'Menu', 'name':'menuHelp', 'label':'&Help', 'items': [ { 'type':'MenuItem', 'name':'menuHelpAbout', 'label':'&About ...', 'command':'doHelpAbout'}, ] }, ] }, 'components': [ ] } ] } } --- NEW FILE: template.py --- #!/usr/bin/python """ __version__ = "$Revision: 1.1 $" __date__ = "$Date: 2004/10/24 19:21:46 $" """ from PythonCard import model class MyBackground(model.Background): def on_initialize(self, event): # if you have any initialization # including sizer setup, do it here pass if __name__ == '__main__': app = model.Application(MyBackground) app.MainLoop() --- NEW FILE: dialogTemplate.rsrc.py --- {'type':'CustomDialog', 'name':'Template', 'title':'Dialog Template', 'size':(300, 100), 'style':['resizeable'], 'components': [ {'type':'Button', 'name':'btnOK', 'position':(10, 35), 'label':'OK', 'id':5100, 'default':1, }, {'type':'Button', 'name':'btnCancel', 'position':(100, 35), 'label':'Cancel', 'id':5101, }, ] # end components } # end CustomDialog --- NEW FILE: templateNoMenus.py --- #!/usr/bin/python """ __version__ = "$Revision: 1.1 $" __date__ = "$Date: 2004/10/24 19:21:46 $" """ from PythonCard import model class MyBackground(model.Background): def on_initialize(self, event): # if you have any initialization # including sizer setup, do it here pass if __name__ == '__main__': app = model.Application(MyBackground) app.MainLoop() --- NEW FILE: templateNoMenus.rsrc.py --- { 'application':{ 'type':'Application', 'name':'Template', 'backgrounds': [ { 'type':'Background', 'name':'bgTemplate', 'title':'Standard Template with no menus', 'size':( 400, 300 ), 'components': [ ] } ] } } --- NEW FILE: dialogTemplate.py --- """ __version__ = "$Revision: 1.1 $" __date__ = "$Date: 2004/10/24 19:21:46 $" """ from PythonCard import model class MyDialog(model.CustomDialog): def __init__(self, parent, txt=''): model.CustomDialog.__init__(self, parent) # if some special setup is necessary, do it here # example from samples/dialogs/minimalDialog.py # self.components.field1.text = txt #def myDialog(parent, txt): def myDialog(parent): dlg = MyDialog(parent, txt) result = dlg.showModal() # stick your results into the result dictionary here # example from samples/dialogs/minimalDialog.py # result.text = dlg.components.field1.text dlg.destroy() return result --- NEW FILE: templateFullMenus.py --- #!/usr/bin/python """ __version__ = "$Revision: 1.1 $" __date__ = "$Date: 2004/10/24 19:21:46 $" """ import os, sys import wx from wx.html import HtmlEasyPrinting from PythonCard import configuration, dialog, model def textToHtml(txt): # the wxHTML classes don't require valid HTML # so this is enough html = txt.replace('\n\n', '<P>') html = html.replace('\n', '<BR>') return html class MyBackground(model.Background): def on_initialize(self, event): # if you have any initialization # including sizer setup, do it here self.printer = HtmlEasyPrinting() # self.loadConfig() self.startTitle = self.title self.newFile() def loadConfig(self): pass def saveConfig(self): pass def saveChanges(self): # save configuration info in the app directory #filename = os.path.basename(self.documentPath) if self.documentPath is None: filename = "Untitled" else: filename = self.documentPath msg = "The text in the %s file has changed.\n\nDo you want to save the changes?" % filename result = dialog.messageDialog(self, msg, 'textEditor', wx.ICON_EXCLAMATION | wx.YES_NO | wx.CANCEL) return result.returnedString def doExit(self): if self.documentChanged: save = self.saveChanges() if save == "Cancel": return False elif save == "No": return True else: if self.documentPath is None: return self.on_menuFileSaveAs_select(None) else: self.saveFile(self.documentPath) return True else: return 1 def on_close(self, event): if self.doExit(): # self.saveConfig() self.fileHistory = None self.printer = None event.skip() def on_menuFileSave_select(self, event): if self.documentPath is None: # this a "new" document and needs to go through Save As... self.on_menuFileSaveAs_select(None) else: self.saveFile(self.documentPath) def on_menuFileSaveAs_select(self, event): wildcard = "Text files (*.txt)|*.TXT;*.txt|All files (*.*)|*.*" if self.documentPath is None: dir = '' filename = '*.txt' else: dir = os.path.dirname(self.documentPath) filename = os.path.basename(self.documentPath) result = dialog.saveFileDialog(None, "Save As", dir, filename, wildcard) if result.accepted: path = result.paths[0] self.saveFile(path) return True else: return False def newFile(self): # change the code below for # creating a new document # the commented line is from the textEditor tool # self.components.fldDocument.text = '' self.documentPath = None self.documentChanged = 0 self.title = 'Untitled - ' + self.startTitle self.statusBar.text = 'Untitled' def openFile(self, path): # change the code below for # opening an existing document # the commented lines are from the textEditor tool try: # f = open(path) # self.components.fldDocument.text = f.read().replace('\r\n','\n') # f.close() self.documentPath = path self.documentChanged = 0 self.title = os.path.split(path)[-1] + ' - ' + self.startTitle self.statusBar.text = path except: pass def saveFile(self, path): # change the code below for # saving an existing document # the commented lines are from the textEditor tool try: # f = open(path, 'w') # f.write(self.components.fldDocument.text) # f.close() self.documentPath = path self.documentChanged = False self.title = os.path.split(path)[-1] + ' - ' + self.startTitle self.statusBar.text = path except: pass def on_menuFileNew_select(self, event): if self.documentChanged: save = self.saveChanges() if save == "Cancel": # don't do anything, just go back to editing pass elif save == "No": # any changes will be lost self.newFile() else: if self.documentPath is None: if self.on_menuFileSaveAs_select(None): self.newFile() else: self.saveFile(self.documentPath) self.newFile() else: # don't need to save self.newFile() def on_menuFileOpen_select(self, event): # should probably have an alert dialog here # warning about saving the current file before opening another one if self.documentChanged: save = self.saveChanges() if save == "Cancel": # don't do anything, just go back to editing return elif save == "No": # any changes will be lost pass else: if self.documentPath is None: # if the user cancels out of the Save As then go back to editing if not self.on_menuFileSaveAs_select(None): return else: self.saveFile(self.documentPath) # split this method into several pieces to make it more flexible wildcard = "Text files (*.txt)|*.txt;*.TXT|All files (*.*)|*.*" result = dialog.openFileDialog(wildcard=wildcard) if result.accepted: path = result.paths[0] # an error will probably occur here if the text is too large # to fit in the wxTextCtrl (TextArea) or the file is actually # binary. Not sure what happens with CR/LF versus CR versus LF # line endings either self.openFile(path) def on_menuFilePrint_select(self, event): # put your code here for print # the commented code below is from the textEditor tool # and is simply an example #source = textToHtml(self.components.fldDocument.text) #self.printer.PrintText(source) pass def on_menuFilePrintPreview_select(self, event): # put your code here for print preview # the commented code below is from the textEditor tool # and is simply an example #source = textToHtml(self.components.fldDocument.text) #self.printer.PreviewText(source) pass def on_menuFilePageSetup_select(self, event): self.printer.PageSetup() # the following was copied and pasted from the searchexplorer sample def on_menuEditUndo_select(self, event): widget = self.findFocus() if hasattr(widget, 'editable') and widget.canUndo(): widget.undo() def on_menuEditRedo_select(self, event): widget = self.findFocus() if hasattr(widget, 'editable') and widget.canRedo(): widget.redo() def on_menuEditCut_select(self, event): widget = self.findFocus() if hasattr(widget, 'editable') and widget.canCut(): widget.cut() def on_menuEditCopy_select(self, event): widget = self.findFocus() if hasattr(widget, 'editable') and widget.canCopy(): widget.copy() def on_menuEditPaste_select(self, event): widget = self.findFocus() if hasattr(widget, 'editable') and widget.canPaste(): widget.paste() def on_menuEditClear_select(self, event): widget = self.findFocus() if hasattr(widget, 'editable'): if widget.canCut(): # delete the current selection, # if we can't do a Cut we shouldn't be able to delete either # which is why i used the test above sel = widget.replaceSelection('') else: ins = widget.getInsertionPoint() try: widget.replace(ins, ins + 1, '') except: pass def on_menuEditSelectAll_select(self, event): widget = self.findFocus() if hasattr(widget, 'editable'): widget.setSelection(0, widget.getLastPosition()) def on_doHelpAbout_command(self, event): # put your About box here pass if __name__ == '__main__': app = model.Application(MyBackground) app.MainLoop() --- NEW FILE: template.rsrc.py --- { 'application':{ 'type':'Application', 'name':'Template', 'backgrounds': [ { 'type':'Background', 'name':'bgTemplate', 'title':'Standard Template with File->Exit menu', 'size':( 400, 300 ), 'style':['resizeable'], 'statusBar':0, 'menubar': { 'type':'MenuBar', 'menus': [ { 'type':'Menu', 'name':'menuFile', 'label':'&File', 'items': [ { 'type':'MenuItem', 'name':'menuFileExit', 'label':'E&xit', 'command':'exit', } ] } ] }, 'components': [ ] } ] } } |
From: Arlo B. <abe...@us...> - 2004-10-24 19:21:54
|
Update of /cvsroot/pythoncard/PythonCard/tools/experimentalResourceEditor/images In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27296/images Added Files: sizingHandle.bmp Log Message: A clone of the original resource viewer. I will use this to add action binding, invisible components, and the widget browser. AB --- NEW FILE: sizingHandle.bmp --- (This appears to be a binary file; contents omitted.) |
From: Arlo B. <abe...@us...> - 2004-10-24 19:20:16
|
Update of /cvsroot/pythoncard/PythonCard/tools/experimentalResourceEditor/templates In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26777/templates Log Message: Directory /cvsroot/pythoncard/PythonCard/tools/experimentalResourceEditor/templates added to the repository |
From: Arlo B. <abe...@us...> - 2004-10-24 19:20:16
|
Update of /cvsroot/pythoncard/PythonCard/tools/experimentalResourceEditor/modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26777/modules Log Message: Directory /cvsroot/pythoncard/PythonCard/tools/experimentalResourceEditor/modules added to the repository |
From: Arlo B. <abe...@us...> - 2004-10-24 19:20:15
|
Update of /cvsroot/pythoncard/PythonCard/tools/experimentalResourceEditor/images In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26777/images Log Message: Directory /cvsroot/pythoncard/PythonCard/tools/experimentalResourceEditor/images added to the repository |
From: Arlo B. <abe...@us...> - 2004-10-24 19:19:55
|
Update of /cvsroot/pythoncard/PythonCard/tools/experimentalResourceEditor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26674/experimentalResourceEditor Log Message: Directory /cvsroot/pythoncard/PythonCard/tools/experimentalResourceEditor added to the repository |
From: Kevin A. <ka...@us...> - 2004-10-20 22:15:17
|
Update of /cvsroot/pythoncard/PythonCard In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25457 Modified Files: component.py Log Message: cleanup import and extra spacing around parens and colon Index: component.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/component.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** component.py 5 May 2004 03:51:53 -0000 1.12 --- component.py 20 Oct 2004 22:15:07 -0000 1.13 *************** *** 5,22 **** import event, registry, log ! import inspect ! from PythonCard.event import EventLog ! class IScriptable( object ) : """ RDS - 2004-05-02 The public interface for all scriptable objects. """ ! def execute( self, name, event ) : raise NotImplementedError ! class NullScriptable( IScriptable ) : """ RDS - 2004-05-02 --- 5,21 ---- import event, registry, log ! import inspect ! class IScriptable(object): """ RDS - 2004-05-02 The public interface for all scriptable objects. """ ! def execute(self, name, event): raise NotImplementedError ! class NullScriptable(IScriptable): """ RDS - 2004-05-02 *************** *** 27,35 **** it as *not* used. """ ! def execute( self, name, event ) : ! EventLog.getInstance().log( event, '(not handled)', False ) ! class Scriptable( IScriptable ) : """ RDS - 2004-05-02 --- 26,34 ---- it as *not* used. """ ! def execute(self, name, event): ! event.EventLog.getInstance().log(event, '(not handled)', False) ! class Scriptable(IScriptable): """ RDS - 2004-05-02 *************** *** 45,50 **** if a EventHandler can't be found in this object. """ ! def __init__( self, parent=None ) : ! if parent is None : parent = NullScriptable() self._parent = parent --- 44,49 ---- if a EventHandler can't be found in this object. """ ! def __init__(self, parent=None): ! if parent is None: parent = NullScriptable() self._parent = parent *************** *** 52,56 **** self._parseHandlers() ! def _parseHandlers( self ) : """ Find all of the methods in this object that are --- 51,55 ---- self._parseHandlers() ! def _parseHandlers(self): """ Find all of the methods in this object that are *************** *** 58,104 **** """ found = [] ! methods = inspect.getmembers( self, inspect.ismethod ) ! for m in methods : ! if m[ 0 ].split( '_' )[ 0 ] == 'on' : ! found.append( m[ 1 ] ) ! map( self._addHandler, found ) ! def _isPythonCardHandler( self, aObject ) : """ Return true if the object is a PythonCard handler. """ ! return isinstance( aObject, types.FunctionType ) and aObject.__name__.split('_')[0] == 'on' ! def _addHandler( self, method ) : # Add the EventHandlers to our EventHandler list. ! if method.__name__ not in self._handlers : log.debug("_addHandler: " + method.__name__) ! self._handlers[ method.__name__ ] = event.EventHandler( method ) ! def _findHandler( self, name ) : """ Look for a EventHandlers that matches 'name' in our list of EventHandlers. """ ! handler = self._handlers.get( name, None ) ! if handler is None : # Change the handler name to target this Scriptable object # and look in our list of EventHandlers. words = name.split('_') ! s = words[ 0 ] + '_' + self.getName() + '_' + words[ len( words ) - 1 ] ! h = self._handlers.get( s, None ) ! if h is not None : ! return ( h ) else: # search for Background and Stack handlers like # on_mouseClick, on_initialize ! s = words[ 0 ] + '_' + words[ len( words ) - 1 ] ! return self._handlers.get( s, None ) return handler ! def execute( self, name, event ) : """ RDS - 2004-05-02 --- 57,103 ---- """ found = [] ! methods = inspect.getmembers(self, inspect.ismethod) ! for m in methods: ! if m[ 0 ].split('_')[ 0 ] == 'on': ! found.append(m[ 1 ]) ! map(self._addHandler, found) ! def _isPythonCardHandler(self, aObject): """ Return true if the object is a PythonCard handler. """ ! return isinstance(aObject, types.FunctionType) and aObject.__name__.split('_')[0] == 'on' ! def _addHandler(self, method): # Add the EventHandlers to our EventHandler list. ! if method.__name__ not in self._handlers: log.debug("_addHandler: " + method.__name__) ! self._handlers[ method.__name__ ] = event.EventHandler(method) ! def _findHandler(self, name): """ Look for a EventHandlers that matches 'name' in our list of EventHandlers. """ ! handler = self._handlers.get(name, None) ! if handler is None: # Change the handler name to target this Scriptable object # and look in our list of EventHandlers. words = name.split('_') ! s = words[ 0 ] + '_' + self.getName() + '_' + words[ len(words) - 1 ] ! h = self._handlers.get(s, None) ! if h is not None: ! return (h) else: # search for Background and Stack handlers like # on_mouseClick, on_initialize ! s = words[ 0 ] + '_' + words[ len(words) - 1 ] ! return self._handlers.get(s, None) return handler ! def execute(self, name, event): """ RDS - 2004-05-02 *************** *** 113,126 **** a missing handler as an error. """ ! handler = self._findHandler( name ) ! if handler is not None : ! handler.execute( event ) ! EventLog.getInstance().log( event, handler.getSourceName(), True ) ! else : ! self._parent.execute( name, event ) ! class AttributeSpec : def __init__(self, name, properties): --- 112,125 ---- a missing handler as an error. """ ! handler = self._findHandler(name) ! if handler is not None: ! handler.execute(event) ! event.EventLog.getInstance().log(event, handler.getSourceName(), True) ! else: ! self._parent.execute(name, event) ! class AttributeSpec: def __init__(self, name, properties): *************** *** 137,175 **** # PUBLIC METHODS ! def getName( self ) : return self.name ! def isRequired( self ) : return self.presence is 'mandatory' ! def isOptional( self ) : return self.presence is 'optional' ! def getDefaultValue( self ) : return self.default ! def hasDefaultValueList( self ) : return self.values is not None ! def getDefaultValueList( self ) : return self.values ! class BaseSpec : ! def __init__( self, aDictionary ) : self._name = aDictionary[ 'name' ] self._parent = None self._events = aDictionary[ 'info' ][ 'events' ] ! self._attributes = self._parseAttributes( aDictionary[ 'info' ][ 'attributes' ] ) self._requiredAttributes = self._parseRequiredAttributes() self._optionalAttributes = self._parseOptionalAttributes() ! def getName( self ) : return self._name ! def getParent( self ) : return self._parent ! def getEvents( self ) : return self._events --- 136,174 ---- # PUBLIC METHODS ! def getName(self): return self.name ! def isRequired(self): return self.presence is 'mandatory' ! def isOptional(self): return self.presence is 'optional' ! def getDefaultValue(self): return self.default ! def hasDefaultValueList(self): return self.values is not None ! def getDefaultValueList(self): return self.values ! class BaseSpec: ! def __init__(self, aDictionary): self._name = aDictionary[ 'name' ] self._parent = None self._events = aDictionary[ 'info' ][ 'events' ] ! self._attributes = self._parseAttributes(aDictionary[ 'info' ][ 'attributes' ]) self._requiredAttributes = self._parseRequiredAttributes() self._optionalAttributes = self._parseOptionalAttributes() ! def getName(self): return self._name ! def getParent(self): return self._parent ! def getEvents(self): return self._events *************** *** 180,190 **** return eventNames ! def getAttributes( self ) : return self._attributes ! def getRequiredAttributes( self ) : return self._requiredAttributes ! def getOptionalAttributes( self ) : return self._optionalAttributes --- 179,189 ---- return eventNames ! def getAttributes(self): return self._attributes ! def getRequiredAttributes(self): return self._requiredAttributes ! def getOptionalAttributes(self): return self._optionalAttributes *************** *** 213,223 **** return optional ! def __repr__( self ) : ! return str( self.__dict__ ) ! class ComponentSpec( BaseSpec ) : ! def __init__( self, name, parent, events, subclassAttributes ): # RDS - we should be calling BaseSpec.__init__(). # this is pretty messy. --- 212,222 ---- return optional ! def __repr__(self): ! return str(self.__dict__) ! class ComponentSpec(BaseSpec): ! def __init__(self, name, parent, events, subclassAttributes): # RDS - we should be calling BaseSpec.__init__(). # this is pretty messy. *************** *** 226,231 **** self._events = events attributes = { ! 'name' : { 'presence' : 'mandatory' }, ! 'command' : { 'presence' : 'optional', 'default' : None } } attributes.update(subclassAttributes) --- 225,230 ---- self._events = events attributes = { ! 'name': { 'presence': 'mandatory' }, ! 'command': { 'presence': 'optional', 'default': None } } attributes.update(subclassAttributes) *************** *** 235,291 **** ! class Component( event.EventSource ) : """ The superclass of all PythonCard components. ! Components can be visual ( extend Widget ) or ! non-visual ( extend Component ). """ _spec = None ! def getEvents( self ) : """ A convenience method to get the event classes for this component. """ ! return ComponentClassInspector( self.__class__ ).getEvents() ! def __init__( self ) : ! event.EventSource.__init__( self ) ! class ComponentInspector : """ Provides an api for introspection on Component instances. """ ! def __init__( self, component ) : self.componentClass = component.__class__ ! def getAttributes( self ) : return self.componentClass._spec.getAttributes() ! def getEvents( self ) : return self.componentClass._spec.getEvents() ! class ComponentClassInspector : """ Provides an api for introspection on Component classes. """ ! def __init__( self, componentClass ) : self.componentClass = componentClass ! def getAttributes( self ) : return self.componentClass._spec.getAttributes() ! def getEvents( self ) : return self.componentClass._spec.getEvents() ! class ComponentFactory : """ An abstract factory for creating Widgets from a Resource description. """ ! def createComponent( self, aScriptable, aParent, aResource ) : """ Find the class object based on a component's Resource definition. --- 234,290 ---- ! class Component(event.EventSource): """ The superclass of all PythonCard components. ! Components can be visual (extend Widget) or ! non-visual (extend Component). """ _spec = None ! def getEvents(self): """ A convenience method to get the event classes for this component. """ ! return ComponentClassInspector(self.__class__).getEvents() ! def __init__(self): ! event.EventSource.__init__(self) ! class ComponentInspector: """ Provides an api for introspection on Component instances. """ ! def __init__(self, component): self.componentClass = component.__class__ ! def getAttributes(self): return self.componentClass._spec.getAttributes() ! def getEvents(self): return self.componentClass._spec.getEvents() ! class ComponentClassInspector: """ Provides an api for introspection on Component classes. """ ! def __init__(self, componentClass): self.componentClass = componentClass ! def getAttributes(self): return self.componentClass._spec.getAttributes() ! def getEvents(self): return self.componentClass._spec.getEvents() ! class ComponentFactory: """ An abstract factory for creating Widgets from a Resource description. """ ! def createComponent(self, aScriptable, aParent, aResource): """ Find the class object based on a component's Resource definition. *************** *** 296,304 **** reggie = registry.Registry.getInstance() ! clazz = reggie.getComponentClass( aResource.__dict__['type'] ) # Construct a new Component. ! component = clazz( aParent, aResource ) # KEA 2004-04-20 --- 295,303 ---- reggie = registry.Registry.getInstance() ! clazz = reggie.getComponentClass(aResource.__dict__['type']) # Construct a new Component. ! component = clazz(aParent, aResource) # KEA 2004-04-20 |
From: Kevin A. <ka...@us...> - 2004-10-19 22:21:39
|
Update of /cvsroot/pythoncard/PythonCard/docs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9630/docs Modified Files: changelog.txt Log Message: added 0.8.2 section Index: changelog.txt =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/docs/changelog.txt,v retrieving revision 1.316 retrieving revision 1.317 diff -C2 -d -r1.316 -r1.317 *** changelog.txt 16 Oct 2004 17:03:37 -0000 1.316 --- changelog.txt 19 Oct 2004 22:21:23 -0000 1.317 *************** *** 7,10 **** --- 7,15 ---- http://sourceforge.net/tracker/?func=detail&aid=1024777&group_id=9863&atid=109863 + + Release 0.8.2 2004-11-?? + + + Release 0.8.1 2004-10-19 added fileMode, fillColor, logicalCopyMode attributes to BitmapCanvas |
From: Kevin A. <ka...@us...> - 2004-10-19 22:19:24
|
Update of /cvsroot/pythoncard/PythonCard In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8998 Modified Files: __version__.py Log Message: updated to 0.8.2 for next release Index: __version__.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/__version__.py,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** __version__.py 3 Oct 2004 19:42:08 -0000 1.38 --- __version__.py 19 Oct 2004 22:19:14 -0000 1.39 *************** *** 2,10 **** Created: 2001/08/03 Purpose: When a new release is made, a tag will be created in the cvs tree ! and the ver string below will be updated to match the tag and .zip release file posted. For example: ! tag: proto-0_2 ! release file on SourceForge: proto-0.2.zip __version__ = "$Revision$" --- 2,10 ---- Created: 2001/08/03 Purpose: When a new release is made, a tag will be created in the cvs tree ! and the VERSION below will be updated to match the tag and .zip release file posted. For example: ! tag: release_0_8_1 ! release file on SourceForge: PythonCard-0.8.1.zip __version__ = "$Revision$" *************** *** 13,16 **** """ ! VERSION = (0, 8, 1) VERSION_STRING = ".".join([str(digit) for digit in VERSION]) --- 13,16 ---- """ ! VERSION = (0, 8, 2) VERSION_STRING = ".".join([str(digit) for digit in VERSION]) |
From: Kevin A. <ka...@us...> - 2004-10-18 17:56:14
|
Update of /cvsroot/pythoncard/PythonCard/samples/minimalStandalone In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17327/samples/minimalStandalone Modified Files: macbuild.py Log Message: 0.8 -> 0.8.1 and 2.5.2.7 -> 2.5.2.8 Index: macbuild.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/minimalStandalone/macbuild.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** macbuild.py 18 Aug 2004 00:54:00 -0000 1.2 --- macbuild.py 18 Oct 2004 17:55:58 -0000 1.3 *************** *** 22,28 **** myapp.resources.append(os.path.join(packageroot, "minimal.rsrc.py")) ! myapp.libs.append("/usr/local/lib/wxPython-2.5.2.7/lib/libwx_macd-2.5.2.dylib") ! myapp.libs.append("/usr/local/lib/wxPython-2.5.2.7/lib/libwx_macd-2.5.2.rsrc") ! myapp.libs.append("/usr/local/lib/wxPython-2.5.2.7/lib/libwx_macd_stc-2.5.2.dylib") myapp.setup() --- 22,28 ---- myapp.resources.append(os.path.join(packageroot, "minimal.rsrc.py")) ! myapp.libs.append("/usr/local/lib/wxPython-2.5.2.8/lib/libwx_macd-2.5.2.dylib") ! myapp.libs.append("/usr/local/lib/wxPython-2.5.2.8/lib/libwx_macd-2.5.2.rsrc") ! myapp.libs.append("/usr/local/lib/wxPython-2.5.2.8/lib/libwx_macd_stc-2.5.2.dylib") myapp.setup() |
From: Kevin A. <ka...@us...> - 2004-10-18 17:56:14
|
Update of /cvsroot/pythoncard/PythonCard/samples/gravity In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17327/samples/gravity Modified Files: floatgravity.py Log Message: 0.8 -> 0.8.1 and 2.5.2.7 -> 2.5.2.8 Index: floatgravity.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/gravity/floatgravity.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** floatgravity.py 9 Oct 2004 00:33:18 -0000 1.1 --- floatgravity.py 18 Oct 2004 17:55:57 -0000 1.2 *************** *** 97,100 **** --- 97,102 ---- #self.canvas.foregroundColor = self.color ## self.canvas.drawCircle((self.x, self.y), self.radius) + # this should probably be part of move, draw with a FloatCanvas + # wouldn't need to do anything?! self.circle.SetXY(self.x, self.y) |
From: Kevin A. <ka...@us...> - 2004-10-18 17:56:14
|
Update of /cvsroot/pythoncard/PythonCard/tools/oneEditor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17327/tools/oneEditor Modified Files: macbuild.py Log Message: 0.8 -> 0.8.1 and 2.5.2.7 -> 2.5.2.8 Index: macbuild.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/tools/oneEditor/macbuild.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** macbuild.py 3 Oct 2004 23:58:01 -0000 1.1 --- macbuild.py 18 Oct 2004 17:55:59 -0000 1.2 *************** *** 44,50 **** # bundlebuilder does not yet have the capability to detect what shared libraries # are needed by your app - so in this case I am adding the wxPython libs manually ! myapp.libs.append("/usr/local/lib/wxPython-2.5.2.7/lib/libwx_macd-2.5.2.dylib") ! myapp.libs.append("/usr/local/lib/wxPython-2.5.2.7/lib/libwx_macd-2.5.2.rsrc") ! myapp.libs.append("/usr/local/lib/wxPython-2.5.2.7/lib/libwx_macd_stc-2.5.2.dylib") # Here we build the app! --- 44,50 ---- # bundlebuilder does not yet have the capability to detect what shared libraries # are needed by your app - so in this case I am adding the wxPython libs manually ! myapp.libs.append("/usr/local/lib/wxPython-2.5.2.8/lib/libwx_macd-2.5.2.dylib") ! myapp.libs.append("/usr/local/lib/wxPython-2.5.2.8/lib/libwx_macd-2.5.2.rsrc") ! myapp.libs.append("/usr/local/lib/wxPython-2.5.2.8/lib/libwx_macd_stc-2.5.2.dylib") # Here we build the app! |
From: Kevin A. <ka...@us...> - 2004-10-18 17:56:14
|
Update of /cvsroot/pythoncard/PythonCard/docs/html In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17327/docs/html Modified Files: macosx_installation.html macosx_jaguar_installation.html sidebar.php windows_installation.html Log Message: 0.8 -> 0.8.1 and 2.5.2.7 -> 2.5.2.8 Index: macosx_jaguar_installation.html =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/docs/html/macosx_jaguar_installation.html,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** macosx_jaguar_installation.html 11 Sep 2004 15:46:05 -0000 1.8 --- macosx_jaguar_installation.html 18 Oct 2004 17:55:57 -0000 1.9 *************** *** 41,45 **** <a href="http://sourceforge.net/project/showfiles.php?group_id=19015">PythonCard download page</a>. Click on this ! <a href="http://prdownloads.sourceforge.net/pythoncard/PythonCard-0.8.tar.gz">PythonCard-0.8.tar.gz</a> link to begin the download. Again, most Mac OS X browsers will save the file to your desktop.</p> --- 41,45 ---- <a href="http://sourceforge.net/project/showfiles.php?group_id=19015">PythonCard download page</a>. Click on this ! <a href="http://prdownloads.sourceforge.net/pythoncard/PythonCard-0.8.1.tar.gz">PythonCard-0.8.1.tar.gz</a> link to begin the download. Again, most Mac OS X browsers will save the file to your desktop.</p> *************** *** 61,67 **** folder.</p> <h2>Installing PythonCard</h2> ! <p>The PythonCard-0.8.tar.gz file you downloaded should automatically be decompressed by Stuffit; if the file isn't already ! decompressed, then double-click the PythonCard-0.8.tar.gz file. You should now have a PythonCard-0.8 directory on your desktop. Open the Terminal application and do a cd to that directory and then run the --- 61,67 ---- folder.</p> <h2>Installing PythonCard</h2> ! <p>The PythonCard-0.8.1.tar.gz file you downloaded should automatically be decompressed by Stuffit; if the file isn't already ! decompressed, then double-click the PythonCard-0.8.1.tar.gz file. You should now have a PythonCard-0.8 directory on your desktop. Open the Terminal application and do a cd to that directory and then run the Index: sidebar.php =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/docs/html/sidebar.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** sidebar.php 18 Sep 2004 16:55:58 -0000 1.4 --- sidebar.php 18 Oct 2004 17:55:57 -0000 1.5 *************** *** 10,14 **** <input type="submit" id="submit" name="submit" value="Search" style="margin: 0.3em;" /> </form> ! <p>Latest release: 0.8</p> <h4>General</h4> <ul> --- 10,14 ---- <input type="submit" id="submit" name="submit" value="Search" style="margin: 0.3em;" /> </form> ! <p>Latest release: 0.8.1</p> <h4>General</h4> <ul> Index: windows_installation.html =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/docs/html/windows_installation.html,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** windows_installation.html 11 Sep 2004 15:46:06 -0000 1.15 --- windows_installation.html 18 Oct 2004 17:55:57 -0000 1.16 *************** *** 41,45 **** <h2>Downloading PythonCard</h2> <p>The latest version of PythonCard is always available via the <a href="http://sourceforge.net/project/showfiles.php?group_id=19015">PythonCard download page</a>. ! Click on this <a href="http://prdownloads.sourceforge.net/pythoncard/PythonCard-0.8.win32.exe">PythonCard-0.8.win32.exe</a> link to begin the download. Tell your browser where you want the file stored and the download proceeds. Note where on your system the file is saved by --- 41,45 ---- <h2>Downloading PythonCard</h2> <p>The latest version of PythonCard is always available via the <a href="http://sourceforge.net/project/showfiles.php?group_id=19015">PythonCard download page</a>. ! Click on this <a href="http://prdownloads.sourceforge.net/pythoncard/PythonCard-0.8.1.win32.exe">PythonCard-0.8.1.win32.exe</a> link to begin the download. Tell your browser where you want the file stored and the download proceeds. Note where on your system the file is saved by Index: macosx_installation.html =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/docs/html/macosx_installation.html,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** macosx_installation.html 11 Sep 2004 15:46:05 -0000 1.20 --- macosx_installation.html 18 Oct 2004 17:55:57 -0000 1.21 *************** *** 40,44 **** <h2>Downloading PythonCard</h2> <p>The latest version of PythonCard is always available via the <a href="http://sourceforge.net/project/showfiles.php?group_id=19015">PythonCard download page</a>. ! Click on this <a href="http://prdownloads.sourceforge.net/pythoncard/PythonCard-0.8.tar.gz">PythonCard-0.8.tar.gz</a> link to begin the download. Again, most Mac OS X browsers will save the file to your desktop.</p> --- 40,44 ---- <h2>Downloading PythonCard</h2> <p>The latest version of PythonCard is always available via the <a href="http://sourceforge.net/project/showfiles.php?group_id=19015">PythonCard download page</a>. ! Click on this <a href="http://prdownloads.sourceforge.net/pythoncard/PythonCard-0.8.1.tar.gz">PythonCard-0.8.1.tar.gz</a> link to begin the download. Again, most Mac OS X browsers will save the file to your desktop.</p> *************** *** 58,64 **** folder.</p> <h2>Installing PythonCard</h2> ! <p>The PythonCard-0.8.tar.gz file you downloaded should automatically be decompressed by Stuffit; if the file isn't already ! decompressed, then double-click the PythonCard-0.8.tar.gz file. You should now have a PythonCard-0.8 directory on your desktop. Open the Terminal application and do a cd to that directory and then run the --- 58,64 ---- folder.</p> <h2>Installing PythonCard</h2> ! <p>The PythonCard-0.8.1.tar.gz file you downloaded should automatically be decompressed by Stuffit; if the file isn't already ! decompressed, then double-click the PythonCard-0.8.1.tar.gz file. You should now have a PythonCard-0.8 directory on your desktop. Open the Terminal application and do a cd to that directory and then run the |
From: Kevin A. <ka...@us...> - 2004-10-18 17:56:14
|
Update of /cvsroot/pythoncard/PythonCard/tools/findfiles In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17327/tools/findfiles Modified Files: macbuild.py Log Message: 0.8 -> 0.8.1 and 2.5.2.7 -> 2.5.2.8 Index: macbuild.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/tools/findfiles/macbuild.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** macbuild.py 18 Aug 2004 00:54:01 -0000 1.2 --- macbuild.py 18 Oct 2004 17:55:58 -0000 1.3 *************** *** 38,44 **** # bundlebuilder does not yet have the capability to detect what shared libraries # are needed by your app - so in this case I am adding the wxPython libs manually ! myapp.libs.append("/usr/local/lib/wxPython-2.5.2.7/lib/libwx_macd-2.5.2.dylib") ! myapp.libs.append("/usr/local/lib/wxPython-2.5.2.7/lib/libwx_macd-2.5.2.rsrc") ! myapp.libs.append("/usr/local/lib/wxPython-2.5.2.7/lib/libwx_macd_stc-2.5.2.dylib") # Here we build the app! --- 38,44 ---- # bundlebuilder does not yet have the capability to detect what shared libraries # are needed by your app - so in this case I am adding the wxPython libs manually ! myapp.libs.append("/usr/local/lib/wxPython-2.5.2.8/lib/libwx_macd-2.5.2.dylib") ! myapp.libs.append("/usr/local/lib/wxPython-2.5.2.8/lib/libwx_macd-2.5.2.rsrc") ! myapp.libs.append("/usr/local/lib/wxPython-2.5.2.8/lib/libwx_macd_stc-2.5.2.dylib") # Here we build the app! |
From: Kevin A. <ka...@us...> - 2004-10-18 17:56:13
|
Update of /cvsroot/pythoncard/PythonCard/tools/codeEditor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17327/tools/codeEditor Modified Files: macbuild.py Log Message: 0.8 -> 0.8.1 and 2.5.2.7 -> 2.5.2.8 Index: macbuild.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/tools/codeEditor/macbuild.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** macbuild.py 20 Aug 2004 22:01:20 -0000 1.7 --- macbuild.py 18 Oct 2004 17:55:58 -0000 1.8 *************** *** 44,50 **** # bundlebuilder does not yet have the capability to detect what shared libraries # are needed by your app - so in this case I am adding the wxPython libs manually ! myapp.libs.append("/usr/local/lib/wxPython-2.5.2.7/lib/libwx_macd-2.5.2.dylib") ! myapp.libs.append("/usr/local/lib/wxPython-2.5.2.7/lib/libwx_macd-2.5.2.rsrc") ! myapp.libs.append("/usr/local/lib/wxPython-2.5.2.7/lib/libwx_macd_stc-2.5.2.dylib") # Here we build the app! --- 44,50 ---- # bundlebuilder does not yet have the capability to detect what shared libraries # are needed by your app - so in this case I am adding the wxPython libs manually ! myapp.libs.append("/usr/local/lib/wxPython-2.5.2.8/lib/libwx_macd-2.5.2.dylib") ! myapp.libs.append("/usr/local/lib/wxPython-2.5.2.8/lib/libwx_macd-2.5.2.rsrc") ! myapp.libs.append("/usr/local/lib/wxPython-2.5.2.8/lib/libwx_macd_stc-2.5.2.dylib") # Here we build the app! |
From: Kevin A. <ka...@us...> - 2004-10-17 16:47:20
|
Update of /cvsroot/pythoncard/PythonCard/samples/testevents In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6571/samples/testevents Added Files: readme.txt Log Message: minimal readme to for developers wondering what the sample is for --- NEW FILE: readme.txt --- testevents is used to verify that background and components events fire in the same order and behave the same on all platforms. |
From: Kevin A. <ka...@us...> - 2004-10-17 16:39:22
|
Update of /cvsroot/pythoncard/PythonCard/tools/oneEditor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4080 Modified Files: tabcodeEditor.py Log Message: fixed setResourceFile Index: tabcodeEditor.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/tools/oneEditor/tabcodeEditor.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tabcodeEditor.py 11 Oct 2004 01:53:25 -0000 1.9 --- tabcodeEditor.py 17 Oct 2004 16:39:13 -0000 1.10 *************** *** 556,562 **** win = model.childWindow(self.components.notebook, codePage.CodePage) self.components.notebook.AddPage(win, "new ...", True) ! self.pages.append( win ) wx.CallAfter(win.newFile) ! self.currentPageNumber = len(self.pages)-1 wx.CallAfter(self.setResourceFile) size = self.pages[-1].size --- 556,562 ---- win = model.childWindow(self.components.notebook, codePage.CodePage) self.components.notebook.AddPage(win, "new ...", True) ! self.pages.append(win) wx.CallAfter(win.newFile) ! self.currentPageNumber = len(self.pages) - 1 wx.CallAfter(self.setResourceFile) size = self.pages[-1].size *************** *** 570,578 **** if (not self.currentPage or self.currentPage.documentPath or ! self.currentDocument.GetModify() ): win = model.childWindow(self.components.notebook, codePage.CodePage) self.components.notebook.AddPage(win, "opening ...", True) ! self.pages.append( win ) self.currentPageNumber = len(self.pages)-1 size = self.pages[-1].size --- 570,578 ---- if (not self.currentPage or self.currentPage.documentPath or ! self.currentDocument.GetModify()): win = model.childWindow(self.components.notebook, codePage.CodePage) self.components.notebook.AddPage(win, "opening ...", True) ! self.pages.append(win) self.currentPageNumber = len(self.pages)-1 size = self.pages[-1].size *************** *** 591,614 **** if self.currentPageNumber >= 0: self.currentPage = self.pages[self.currentPageNumber] ! if self.currentPage: ! try: ! self.resourceFilename = getResourceFilename(self.currentPage.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 ! items = self.rsrcComponents.keys() ! items.sort() ! self.components.popComponentNames.items = items ! self.components.popComponentNames.visible = True ! self.components.popComponentEvents.visible = False ! return ! except: ! pass # no page, or no components on page self.components.popComponentNames.visible = False --- 591,616 ---- if self.currentPageNumber >= 0: self.currentPage = self.pages[self.currentPageNumber] ! self.currentDocument = self.currentPage.components.document ! # KEA self.currentPage is always True, so why the if? ! #if self.currentPage: ! try: ! self.resourceFilename = getResourceFilename(self.currentPage.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 ! items = self.rsrcComponents.keys() ! items.sort() ! self.components.popComponentNames.items = items ! self.components.popComponentNames.visible = True ! self.components.popComponentEvents.visible = False ! return ! except: ! pass # no page, or no components on page self.components.popComponentNames.visible = False |
From: Kevin A. <ka...@us...> - 2004-10-16 17:04:20
|
Update of /cvsroot/pythoncard/PythonCard/samples In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19937/samples Modified Files: samples.rsrc.py Log Message: added flock and gravity samples Index: samples.rsrc.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/samples.rsrc.py,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** samples.rsrc.py 3 Aug 2004 17:12:20 -0000 1.60 --- samples.rsrc.py 16 Oct 2004 17:04:11 -0000 1.61 *************** *** 58,62 **** 'size':(150, 218), 'items':['addresses', 'ataxx', 'chat', 'companies', 'conversions', 'custdb', 'dbBrowser', \ ! 'dialogs', 'doodle', 'flatfileDatabase', 'gadflyDatabase', \ 'hopalong', 'jabberChat', 'life', 'lsystem', 'minimal', 'minimalList', 'minimalTree', \ 'moderator', 'montyhall', 'mp3player', 'multicolumnexample', 'noresource', \ --- 58,62 ---- 'size':(150, 218), 'items':['addresses', 'ataxx', 'chat', 'companies', 'conversions', 'custdb', 'dbBrowser', \ ! 'dialogs', 'doodle', 'flatfileDatabase', 'flock', 'gadflyDatabase', 'gravity', \ 'hopalong', 'jabberChat', 'life', 'lsystem', 'minimal', 'minimalList', 'minimalTree', \ 'moderator', 'montyhall', 'mp3player', 'multicolumnexample', 'noresource', \ |
From: Kevin A. <ka...@us...> - 2004-10-16 17:03:57
|
Update of /cvsroot/pythoncard/PythonCard/docs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19823/docs Modified Files: changelog.txt Log Message: set release date Index: changelog.txt =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/docs/changelog.txt,v retrieving revision 1.315 retrieving revision 1.316 diff -C2 -d -r1.315 -r1.316 *** changelog.txt 10 Oct 2004 01:20:20 -0000 1.315 --- changelog.txt 16 Oct 2004 17:03:37 -0000 1.316 *************** *** 7,11 **** http://sourceforge.net/tracker/?func=detail&aid=1024777&group_id=9863&atid=109863 ! Release 0.8.1 2004-10-?? added fileMode, fillColor, logicalCopyMode attributes to BitmapCanvas removed setFillMode, setFillColor, setCopyMode methods --- 7,11 ---- http://sourceforge.net/tracker/?func=detail&aid=1024777&group_id=9863&atid=109863 ! Release 0.8.1 2004-10-19 added fileMode, fillColor, logicalCopyMode attributes to BitmapCanvas removed setFillMode, setFillColor, setCopyMode methods |
From: Kevin A. <ka...@us...> - 2004-10-11 02:09:26
|
Update of /cvsroot/pythoncard/PythonCard/samples/flock In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18269 Modified Files: flock.py flock.rsrc.py Log Message: minor tweaks for pysco, using refresh, etc. Index: flock.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/flock/flock.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** flock.py 11 Oct 2004 01:56:58 -0000 1.1 --- flock.py 11 Oct 2004 02:09:12 -0000 1.2 *************** *** 15,23 **** from __future__ import division ! from PythonCard import clipboard, dialog, graphic, model, util, timer ! import wx import os import random # helper functions --- 15,30 ---- from __future__ import division ! try: ! import psyco ! psyco.full() ! except: ! pass ! import os + import wx import random + from PythonCard import clipboard, dialog, graphic, model, util, timer + # helper functions *************** *** 181,186 **** self.sprites = [] self.timer = timer.Timer(self.components.btnAnimate, -1) - ## import psyco - ## psyco.full() self.initSizers() self.components.bufOff.autoRefresh = False --- 188,191 ---- *************** *** 212,215 **** --- 217,221 ---- for b in self.sprites: b.draw() + self.components.bufOff.refresh() def on_btnAnimate_mouseClick(self, event): *************** *** 226,230 **** for b in self.sprites: b.move() ! self.components.bufOff.redraw() self.frame += 1 self.seconds = util.time() --- 232,239 ---- for b in self.sprites: b.move() ! # don't need to use redraw() on Mac because ! # we are using a timer and giving the screen ! # a chance to update it itself normally ! self.components.bufOff.refresh() self.frame += 1 self.seconds = util.time() Index: flock.rsrc.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/flock/flock.rsrc.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** flock.rsrc.py 11 Oct 2004 01:56:58 -0000 1.1 --- flock.rsrc.py 11 Oct 2004 02:09:12 -0000 1.2 *************** *** 56,60 **** 'name':'btnNewBoid', 'position':(5, 5), ! 'label':'New Ball' }, { 'type':'Button', 'name':'btnAnimate', --- 56,60 ---- 'name':'btnNewBoid', 'position':(5, 5), ! 'label':'New Boid' }, { 'type':'Button', 'name':'btnAnimate', |
From: Kevin A. <ka...@us...> - 2004-10-11 01:57:08
|
Update of /cvsroot/pythoncard/PythonCard/samples/flock In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16459 Added Files: .cvsignore flock.py flock.rsrc.py readme.txt wing1.png wing2.png Log Message: added Alex's flock example, hacked to use just bitmaps --- NEW FILE: .cvsignore --- .cvsignore *.pyc *.log .DS_Store --- NEW FILE: wing1.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: wing2.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: flock.py --- #!/usr/bin/python """ __version__ = "$Revision: 1.1 $" __date__ = "$Date: 2004/10/11 01:56:58 $" """ # KEA 2004-09-25 # based on the excellent work by Keith Peters # http://www.bit-101.com/tutorials/gravity.html # AGT 2004-10-05 # Based on Kevin's imagegravity sample - simple 2-D boids from __future__ import division from PythonCard import clipboard, dialog, graphic, model, util, timer import wx import os import random # helper functions 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 visible_radius = 1000 max_neighbours = 40 def randomColor(): return (random.randint(0, 255), random.randint(0, 255), random.randint(0, 255)) def find_nearest(this, allsprites): nearest = [] for s in allsprites: if s == this: continue if s.x < this.x-visible_radius: continue if s.x > this.x+visible_radius: continue dist = abs(s.x-this.x)+abs(s.y-this.y) if dist > visible_radius: continue nearest.append( (dist, s.x, s.y, s.xspeed, s.yspeed) ) if len(nearest) == 0: return nearest nearest.sort() del nearest[max_neighbours:] return nearest def centre_of_mass(this, allsprites, nearest): x,y = 0,0 if len(nearest) == 0: return 0,0 for nbr in nearest: x += nbr[1] y += nbr[2] num = len(nearest) return (x/num - this.x)*0.01, (y/num - this.y)* 0.01 def not_too_close(this, allsprites, nearest): x,y = 0, 0 for nbr in nearest: if nbr[0] < 16: x += this.x - nbr[1] y += this.y - nbr[2] return x,y def align_with(this, allsprites, nearest): x,y = 0,0 for nbr in nearest: x += nbr[3] y += nbr[4] num = len(nearest) return 0.125 * x/num, 0.125 * y/num class Sprite(object): def __init__(self, parent): self.parent = parent class BoidSprite(Sprite): def __init__(self, parent, name, x, y, radius, color='red'): Sprite.__init__(self, parent) self.name = name self.name2 = name+"-2" 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 = .85 self.bounce = .9 self.dragging = False self.canvas = self.parent.components.bufOff ## self.canvas = self.parent.panel x, y = self.canvas.position ## self.parent.components[name] = {'type':'Image', 'name':name, 'file':'wing1.png', 'position':(self.x + x, self.y + y)} ## self.image = self.parent.components[name] ## self.image.visible = True ## self.parent.components[self.name2] = {'type':'Image', 'name':self.name2, 'file':'wing2.png', 'position':(self.x + x, self.y + y)} ## self.image2 = self.parent.components[self.name2] ## self.image.visible = False self.image = graphic.Bitmap('wing1.png') self.image2 = graphic.Bitmap('wing2.png') self.count = 0 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: nearest = find_nearest(self, self.parent.sprites) x1, y1 = self.xspeed * self.drag, self.yspeed * self.drag if len(nearest) > 0: x2, y2 = centre_of_mass(self, self.parent.sprites, nearest) x3, y3 = not_too_close(self, self.parent.sprites, nearest) x4, y4 = align_with(self, self.parent.sprites, nearest) x1 += x2+x3+x4 y1 += y2+y3+y4 self.xspeed, self.yspeed = x1, y1 #rint self.name, (x1,y1), (x2, y2), (self.xspeed, self.yspeed) 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 self.draw() def draw(self): self.count += 1 if self.count == 5: self.count = 0 self.canvas.drawBitmap(self.image, (self.x, self.y)) else: self.canvas.drawBitmap(self.image2, (self.x, self.y)) def draw2(self): self.image.position = (self.x, self.y) self.image2.position = (self.x, self.y) self.count += 1 if self.count == 5: self.count = 0 self.image.visible = not self.image.visible self.image2.visible = not self.image2.visible class Boids(model.Background): def on_initialize(self, event): self.x = 0 self.y = 0 self.animate = False self.filename = None # leave it black for now #self.components.bufOff.foregroundColor = self.color self.sprites = [] self.timer = timer.Timer(self.components.btnAnimate, -1) ## import psyco ## psyco.full() self.initSizers() self.components.bufOff.autoRefresh = False 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.btnNewBoid, 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_btnNewBoid_mouseClick(self, event): name = 'boid' + str(len(self.sprites)) self.sprites.append(BoidSprite(self, name, 20, 20, 15, randomColor())) if not self.animate: for b in self.sprites: b.draw() def on_btnAnimate_mouseClick(self, event): event.target.enabled = False self.animate = True self.frame = 0 self.startTime = util.time() self.fps = 10 timePerFrame = 1000 / self.fps self.timer.start(timePerFrame) def on_btnAnimate_timer(self, event): self.components.bufOff.clear() for b in self.sprites: b.move() self.components.bufOff.redraw() self.frame += 1 self.seconds = util.time() self.statusBar.text = "Average FPS: %.4f Boids: %d" % (self.frame / (self.seconds - self.startTime), len(self.sprites)) def on_btnStop_mouseClick(self, event): self.animate = False self.components.btnAnimate.enabled = True self.timer.stop() def on_close(self, event): self.animate = False event.skip() if __name__ == '__main__': app = model.Application(Boids) app.MainLoop() --- NEW FILE: readme.txt --- Conversion of Flash animation to PythonCard. http://www.bit-101.com/tutorials/gravity.html --- NEW FILE: flock.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':'btnNewBoid', 'position':(5, 5), 'label':'New Ball' }, { 'type':'Button', 'name':'btnAnimate', 'position':(100, 5), 'label':'Animate' }, { 'type':'Button', 'name':'btnStop', 'position':(200, 5), 'label':'Stop' }, { 'type':'BitmapCanvas', 'name':'bufOff', 'position':(0, 30), 'visible':True, 'size':(300, 230) }, ] } ] } } |