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. |