pydev-cvs Mailing List for PyDev for Eclipse (Page 313)
Brought to you by:
fabioz
You can subscribe to this list here.
2004 |
Jan
|
Feb
(4) |
Mar
(48) |
Apr
(56) |
May
(64) |
Jun
(27) |
Jul
(66) |
Aug
(81) |
Sep
(148) |
Oct
(194) |
Nov
(78) |
Dec
(46) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(125) |
Feb
(126) |
Mar
(163) |
Apr
(133) |
May
(115) |
Jun
(307) |
Jul
(387) |
Aug
(417) |
Sep
(283) |
Oct
(148) |
Nov
(45) |
Dec
(53) |
2006 |
Jan
(240) |
Feb
(200) |
Mar
(267) |
Apr
(231) |
May
(245) |
Jun
(361) |
Jul
(142) |
Aug
(12) |
Sep
(210) |
Oct
(99) |
Nov
(7) |
Dec
(30) |
2007 |
Jan
(161) |
Feb
(511) |
Mar
(265) |
Apr
(74) |
May
(147) |
Jun
(151) |
Jul
(94) |
Aug
(68) |
Sep
(98) |
Oct
(144) |
Nov
(26) |
Dec
(36) |
2008 |
Jan
(98) |
Feb
(107) |
Mar
(199) |
Apr
(113) |
May
(119) |
Jun
(112) |
Jul
(92) |
Aug
(71) |
Sep
(101) |
Oct
(16) |
Nov
|
Dec
|
From: Aleksandar T. <at...@us...> - 2004-05-17 20:17:28
|
Update of /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21693/src/org/python/pydev/debug/core Modified Files: PydevDebugPlugin.java Log Message: 0.4.1 bug fixes: - urlencode file names in stack - display error dialog asynchronously Index: PydevDebugPlugin.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/core/PydevDebugPlugin.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PydevDebugPlugin.java 7 May 2004 02:03:10 -0000 1.5 --- PydevDebugPlugin.java 17 May 2004 20:17:17 -0000 1.6 *************** *** 1,4 **** --- 1,5 ---- package org.python.pydev.debug.core; + import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IWorkbenchWindow; *************** *** 63,73 **** } ! public static void errorDialog(String message, Throwable t) { ! IWorkbenchWindow window = getDefault().getWorkbench().getActiveWorkbenchWindow(); ! Shell shell = window == null ? null : window.getShell(); ! if (shell != null) { ! IStatus status= makeStatus(IStatus.ERROR, "Error logged from Pydev Debug: ", t); ! ErrorDialog.openError(shell, "Its an error", message, status); ! } } --- 64,80 ---- } ! public static void errorDialog(final String message, final Throwable t) { ! Display disp = Display.getCurrent(); ! disp.asyncExec(new Runnable() { ! public void run() { ! IWorkbenchWindow window = getDefault().getWorkbench().getActiveWorkbenchWindow(); ! Shell shell = window == null ? null : window.getShell(); ! if (shell != null) { ! IStatus status= makeStatus(IStatus.ERROR, "Error logged from Pydev Debug: ", t); ! ErrorDialog.openError(shell, "Its an error", message, status); ! } ! } ! }); ! log(IStatus.ERROR, message, t); } |
From: Aleksandar T. <at...@us...> - 2004-05-17 20:17:27
|
Update of /cvsroot/pydev/org.python.pydev.debug In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21693 Modified Files: .project plugin.xml Log Message: 0.4.1 bug fixes: - urlencode file names in stack - display error dialog asynchronously Index: .project =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/.project,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** .project 7 May 2004 02:03:11 -0000 1.4 --- .project 17 May 2004 20:17:16 -0000 1.5 *************** *** 9,12 **** --- 9,13 ---- <project>org.eclipse.core.runtime</project> <project>org.eclipse.debug.core</project> + <project>org.eclipse.debug.ui</project> <project>org.eclipse.ui</project> <project>org.eclipse.ui.views</project> Index: plugin.xml =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/plugin.xml,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** plugin.xml 7 May 2004 21:51:09 -0000 1.10 --- plugin.xml 17 May 2004 20:17:16 -0000 1.11 *************** *** 3,7 **** id="org.python.pydev.debug" name="Pydev debug" ! version="0.4.0" provider-name="Aleks Totic" class="org.python.pydev.debug.core.PydevDebugPlugin"> --- 3,7 ---- id="org.python.pydev.debug" name="Pydev debug" ! version="0.4.1" provider-name="Aleks Totic" class="org.python.pydev.debug.core.PydevDebugPlugin"> |
From: Aleksandar T. <at...@us...> - 2004-05-17 20:17:25
|
Update of /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21693/src/org/python/pydev/debug/model Modified Files: XMLUtils.java Log Message: 0.4.1 bug fixes: - urlencode file names in stack - display error dialog asynchronously Index: XMLUtils.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/XMLUtils.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** XMLUtils.java 5 May 2004 02:02:00 -0000 1.2 --- XMLUtils.java 17 May 2004 20:17:15 -0000 1.3 *************** *** 145,148 **** --- 145,150 ---- String id = attributes.getValue("id"); String file = attributes.getValue("file"); + if (file != null) + file = URLDecoder.decode(file); String line = attributes.getValue("line"); IPath filePath = new Path(file); |
From: Aleksandar T. <at...@us...> - 2004-05-17 20:17:25
|
Update of /cvsroot/pydev/org.python.pydev.debug/pysrc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21693/pysrc Modified Files: pydevd.py Log Message: 0.4.1 bug fixes: - urlencode file names in stack - display error dialog asynchronously Index: pydevd.py =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/pysrc/pydevd.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** pydevd.py 7 May 2004 21:51:00 -0000 1.5 --- pydevd.py 17 May 2004 20:17:16 -0000 1.6 *************** *** 77,81 **** __all__ = (); ! _trace = -1 def log(level, s): --- 77,81 ---- __all__ = (); ! _trace = 0 def log(level, s): *************** *** 86,90 **** """ if (level <= _trace): ! print sys.stderr, s --- 86,90 ---- """ if (level <= _trace): ! print >>sys.stderr, s *************** *** 242,246 **** # print "line is ", myLine cmdText += '<frame id="' + myId +'" name="' + myName + '" ' ! cmdText += 'file="' + myFile + '" line="' + myLine + '">"' variables = pydevd_vars.frameVarsToXML(curFrame) cmdText += variables --- 242,246 ---- # print "line is ", myLine cmdText += '<frame id="' + myId +'" name="' + myName + '" ' ! cmdText += 'file="' + urllib.quote(myFile, '/>_= \t') + '" line="' + myLine + '">"' variables = pydevd_vars.frameVarsToXML(curFrame) cmdText += variables *************** *** 611,625 **** if self.quitting: pass ! elif event == 'line': ! retVal = self.dispatch_line(frame) ! elif event == 'call': ! retVal = self.dispatch_call(frame, arg) ! elif event == 'return': ! retVal = self.dispatch_return(frame, arg) ! elif event == 'exception': ! retVal = self.dispatch_exception(frame, arg) else: retVal = self.trace_dispatch ! print 'bdb.Bdb.dispatch: unknown debugging event:', `event` # print "b", str(id(t)) return retVal --- 611,625 ---- if self.quitting: pass ! # elif event == 'line': ! # retVal = self.dispatch_line(frame) ! # elif event == 'call': ! # retVal = self.dispatch_call(frame, arg) ! # elif event == 'return': ! # retVal = self.dispatch_return(frame, arg) ! # elif event == 'exception': ! # retVal = self.dispatch_exception(frame, arg) else: retVal = self.trace_dispatch ! # print 'bdb.Bdb.dispatch: unknown debugging event:', `event` # print "b", str(id(t)) return retVal |
From: Aleksandar T. <at...@us...> - 2004-05-11 11:02:45
|
Update of /cvsroot/pydev/org.python.pydev.help/html In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27366/html Modified Files: index.html ed_prefs.html debug.html editor.html Log Message: 0.4 release Index: editor.html =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.help/html/editor.html,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** editor.html 10 Jan 2004 03:15:28 -0000 1.2 --- editor.html 11 May 2004 11:02:02 -0000 1.3 *************** *** 1,2 **** <h2>Editor</h2> ! <p>Editor works as you'd expect. You get syntax highlighting, and the parser errors get marked. The text next to the parser errors is a bit cryptic, but hey, at least you know where the error is.</p> --- 1,19 ---- <h2>Editor</h2> ! <p>Editor works as you'd expect. You get </p> ! <ul> ! <li>syntax highlighting</li> ! <li>outline view with imports/functions/classes </li> ! <li>the parser errors get marked. The text next to the parser errors is a bit cryptic, but hey, at least you know where the error is.</li> ! <li>Editor tries to deal with tabs/spaces sensibly. You can set the preference to your preferred coding style.</li> ! <li>Navigation: keyboard shortcuts to previous/next function</li> ! <li>comment/uncomment commands</li> ! <li> hyperlinks over functions//import :</li> ! </ul> ! <p>If you press CTRL while mousing over function & import names you'll get a hyperlink to their definition. The hyperlinking only works for:</p> ! <ul> ! <li>functions defined in the same file</li> ! <li>imports that are on your import path. The import path includes python.exe/Lib, if you've defined python executable in your pydev:debug preferences.</li> ! </ul> ! <p><img src="images/hyperanim.gif" width="300" height="170" border="1"> </p> ! <p> </p> ! <p> </p> Index: debug.html =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.help/html/debug.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** debug.html 10 Jan 2004 03:15:28 -0000 1.1 --- debug.html 11 May 2004 11:02:02 -0000 1.2 *************** *** 6,16 **** --> </style><h2>Pydev debugger </h2> ! <p>Debugger, one step behind the editor. The ultimate goal is a nice graphical debugger, but until then here is a small improvement to the External Tools method:</p> ! <p>There is a Python context menu in Navigator:</p> ! <p><img src="images/debug_menu.gif" width="328" height="373"></p> ! <p>If you pick "Run...", you'll get the standard Eclipse debug dialog:</p> <p><img src="images/debug_dialog.gif" width="612" height="434"> </p> <p>Here you can pick your program arguments, etc. The dialog will try to verify that your python interpreter is present. If it is not, go to Preferences:Pydev:Debug and configure a valid python executable.</p> ! <p>And when you run the program, the output is in the console. The errors in the console are hyperlinked back to the file:</p> <p><img src="images/debug_console.gif" width="600" height="498"> </p> ! <p>That's all for now, time to work on the graphical debugger. </p> --- 6,24 ---- --> </style><h2>Pydev debugger </h2> ! <p>Here it is, try it out. You have: </p> ! <ul> ! <li>breakpoints</li> ! <li>step in/out/over</li> ! <li>multiple threads</li> ! <li>variable display</li> ! </ul> ! <p>The debugger can be invoked from the standard Eclipse debugger menus in the debug perspective, or through a context menu inside Navigator:</p> ! <p><img src="images/debugdialog.jpg" width="274" height="214"> or <img src="images/debug_menu.gif" width="328" height="373"></p> ! <p>Debug settings are configured in the standard dialog </p> <p><img src="images/debug_dialog.gif" width="612" height="434"> </p> <p>Here you can pick your program arguments, etc. The dialog will try to verify that your python interpreter is present. If it is not, go to Preferences:Pydev:Debug and configure a valid python executable.</p> ! <p>The program output is displayed in the console, and the errors in the console are hyperlinked back to the file:</p> <p><img src="images/debug_console.gif" width="600" height="498"> </p> ! <p>If you are running under the debugger, you'll get the standard debug interface:</p> ! <p><img src="images/debugger.gif" width="816" height="543"> </p> ! <p>See the <a href="http://pydev.sf.net/">pydev website</a> for the latest debugging info. </p> Index: index.html =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.help/html/index.html,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** index.html 10 Jan 2004 03:15:28 -0000 1.2 --- index.html 11 May 2004 11:02:01 -0000 1.3 *************** *** 1,5 **** ! <h2>Pydev guide </h2> ! <p>Pydev is a Python development environment for Eclipse. It is an open-source one-man effort so far.</p> ! <p>The current release is 0.3. The editor is stable, and debugger is very much work in progress.</p> <ul> <li>syntax highlighting</li> --- 1,5 ---- ! <h2>Pydev manual</h2> ! <p>Pydev is a Python development environment for Eclipse. It is an open-source effort, hosted at <a href="http://pydev.sourceforge.net/">http://pydev.sourceforge.net/</a>. See the website for the up-to-date development information.</p> ! <p>Pydev consists of two main components, the editor and the debugger. The editor is stable, and provides the following features:</p> <ul> <li>syntax highlighting</li> *************** *** 7,16 **** <li>works with tabs or spaces. </li> <li>outline view that shows functions, imports, classes</li> ! <li>you can run a python script from the navigator context menu.</li> ! <li>errors in console output get hyperlinked to its file locations</li> ! <li>update site at http://pydev.sourceforge.net/updates/</li> </ul> <p>Projects home page is at: <a href="http://pydev.sourceforge.net/">http://pydev.sourceforge.net/</a></p> ! <p>Thanks to the jython team for their parsers, and OSAF for exposing me to python.</p> <p>Cheers,</p> <p><a href="mailto:at...@ya...">at...@ya...</a></p> --- 7,24 ---- <li>works with tabs or spaces. </li> <li>outline view that shows functions, imports, classes</li> ! <li>limited hyperlinks: by pressing ctrl key you can jump to functons defined inside the same file.</li> ! </ul> ! <p>This is the first public release of the debugger, so its stability is unknown. The debugger provider the following features: </p> ! <ul> ! <li>fully integrated into Eclipse's debugging framework.</li> ! <li>execution control: you can set breakpoints, step in/out/over</li> ! <li>supports python threads.</li> ! <li>variables/stack are there, just like other IDE's </li> ! <li>console traces are hyperlinked to files. Even files outside of workspace can be opened through hyperlinks. </li> </ul> + <p>Some of the advanced Eclipse features are not there: conditional breakpoints, code execution. </p> + <p>update site at http://pydev.sourceforge.net/updates/</p> <p>Projects home page is at: <a href="http://pydev.sourceforge.net/">http://pydev.sourceforge.net/</a></p> ! <p>Thanks to the jython team for their parser, OSAF for exposing me to python, and sourceforge & meer.net for hosting. </p> <p>Cheers,</p> <p><a href="mailto:at...@ya...">at...@ya...</a></p> Index: ed_prefs.html =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.help/html/ed_prefs.html,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ed_prefs.html 10 Jan 2004 03:15:28 -0000 1.2 --- ed_prefs.html 11 May 2004 11:02:02 -0000 1.3 *************** *** 4,6 **** <p><strong>Assume tab spacing when files contain tabs?</strong>: you'll like this preference if you swing both ways, and mix & match tabs and spaces, When this pref is on, if the file is tab-indented editor will do the right thing and leave your tabs alone. </p> <p><strong>Tab length</strong>: in inches </p> ! <p><strong>Colors</strong>: are self-explanatary (black, purple, olive-green, dark-red). Not a very attractive scheme, but you get used to it. </p> --- 4,6 ---- <p><strong>Assume tab spacing when files contain tabs?</strong>: you'll like this preference if you swing both ways, and mix & match tabs and spaces, When this pref is on, if the file is tab-indented editor will do the right thing and leave your tabs alone. </p> <p><strong>Tab length</strong>: in inches </p> ! <p><strong>Colors</strong>: are self-explanatary. The default colors have been borrowed from IDLE. </p> |
From: Aleksandar T. <at...@us...> - 2004-05-11 11:02:18
|
Update of /cvsroot/pydev/org.python.pydev.help In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27366 Modified Files: plugin.xml Added Files: release.txt build.xml Log Message: 0.4 release --- NEW FILE: release.txt --- Pydev is a project to create a complete python development environment for eclipse. This is the release 0.4. Both editor and debugger require Java 1.4.x. Editor runs on Eclipse 2.1.x, and 3.x, Debugger is not compatible with Eclipse 3 yet. New in this release: - we have lift-off for the debugger: breakpoints stack multiple threads variables view hyperlinks in console output work with external files too are all functional there is a lot of new code here, bugs are possible - editor new comment/uncomment actions in popup menu and source menu (thanks fabio) new previous/next function in popup menu (fabio again) editor now has a python icon .pyc files are filtered out in resource view better double-click strategy hyperlinks on functions defined within a file. Hit CTRL to see hyperlink you are mousing over. nicer tab handling IDLE-like coloring for the editor. The old color scheme was depressing. See pydev.sf.net for more info. Enjoy, Aleks Appendix: Full list of editor changes Added team file extensions for .py & .pyc, pyc files are ignored by default Added "Source" menu to the editor: comment/goto methods implemented by fabioz - Added Python nature, and nature icon. Nature get automatically added to any project that opens a python editor. - Added Python properties to projects that have Python nature - Editor now has a python icon. Icon is ugly, help! - .pyc files are filtered out in the resource view - Parsing now happens either immediately on return, or a second after input This makes error notifications nicer and more predictable - New double-clicking strategy, copied from Java - Moved debug preferences into main plugin. We need them for import paths parsing - Hyperlinks on simple imports now work. For them to find system includes, you'll need to set up the python interpreter in the preferences. active hyperlinks are: [imports] import sys: you can click on sys, and sys.py will open [local function calls]: functions defined in the same file [class constructors]: a = SomeClass() takes you to class definition [self.method calls]: self.method_name works if method is defined in the same file - When you are editing in the tab mode, paste will replace spaces with tabs - tabs/spaces conversion only takes place inside code, not inside comments - IDLE like colors for text --- NEW FILE: build.xml --- <?xml version="1.0" encoding="UTF-8"?> <project name="org.python.pydev.help" default="build.jars" basedir="."> <property name="bootclasspath" value=""/> <property name="ws" value="win32"/> <property name="os" value="win32"/> <property name="arch" value="x86"/> <property name="javacFailOnError" value="false"/> <property name="javacDebugInfo" value="on"/> <property name="javacVerbose" value="true"/> <target name="init" depends="properties"> <property name="plugin" value="org.python.pydev.help"/> <property name="version.suffix" value="_0.4.0"/> <property name="full.name" value="${plugin}${version.suffix}"/> <property name="temp.folder" value="${basedir}/temp.folder"/> <property name="plugin.destination" value="${basedir}"/> <property name="build.result.folder" value="${basedir}"/> </target> <target name="properties" if="eclipse.running"> <property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/> </target> <target name="build.update.jar" depends="init" description="Build the plug-in: org.python.pydev.help for an update site."> <delete dir="${temp.folder}"/> <mkdir dir="${temp.folder}"/> <antcall target="build.jars"/> <antcall target="gather.bin.parts"> <param name="destination.temp.folder" value="${temp.folder}/"/> </antcall> <zip zipfile="${plugin.destination}/${full.name}.jar" basedir="${temp.folder}/${full.name}" filesonly="false" update="no"/> <delete dir="${temp.folder}"/> </target> <target name="gather.bin.parts" depends="init" if="destination.temp.folder"> <mkdir dir="${destination.temp.folder}/${full.name}"/> <copy todir="${destination.temp.folder}/${full.name}"> <fileset dir="${basedir}" includes="plugin.xml,html/,toc_main.xml"/> </copy> </target> <target name="build.jars" depends="init" description="Build all the jars for the plug-in: org.python.pydev.help."> </target> <target name="build.sources" depends="init"> </target> <target name="build.zips" depends="init"> </target> <target name="gather.sources" depends="init" if="destination.temp.folder"> </target> <target name="gather.logs" depends="init" if="destination.temp.folder"> </target> <target name="clean" depends="init" description="Clean the plug-in: org.python.pydev.help of all the zips, jars and logs created."> <delete file="${plugin.destination}/${full.name}.jar"/> <delete file="${plugin.destination}/${full.name}.zip"/> <delete dir="${temp.folder}"/> </target> <target name="refresh" depends="init" if="eclipse.running"> <eclipse.convertPath fileSystemPath="D:\pydevspace2\org.python.pydev.help\" property="resourcePath"/> <eclipse.refreshLocal resource="${resourcePath}" depth="infinite"/> </target> <target name="zip.plugin" depends="init" description="Create a zip containing all the elements for the plug-in: org.python.pydev.help."> <delete dir="${temp.folder}"/> <mkdir dir="${temp.folder}"/> <antcall target="build.jars"/> <antcall target="build.sources"/> <antcall target="gather.bin.parts"> <param name="destination.temp.folder" value="${temp.folder}/"/> </antcall> <antcall target="gather.sources"> <param name="destination.temp.folder" value="${temp.folder}/"/> </antcall> <delete> <fileset dir="${temp.folder}" includes="**/*.bin.log"/> </delete> <antcall target="zip.folder"/> <delete dir="${temp.folder}"/> </target> <target name="zip.folder" depends="init"> <zip zipfile="${plugin.destination}/${full.name}.zip" basedir="${temp.folder}" filesonly="true" update="no" excludes="**/*.bin.log"/> </target> </project> Index: plugin.xml =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.help/plugin.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** plugin.xml 10 Jan 2004 03:15:28 -0000 1.2 --- plugin.xml 11 May 2004 11:02:05 -0000 1.3 *************** *** 3,7 **** id="org.python.pydev.help" name="Pydev Online Help" ! version="0.3.0" provider-name="Aleks Totic"> --- 3,7 ---- id="org.python.pydev.help" name="Pydev Online Help" ! version="0.4.0" provider-name="Aleks Totic"> *************** *** 14,18 **** <extension point="org.eclipse.help.toc"> ! <toc file="toc_main.xml" primary="true"> </toc> </extension> --- 14,20 ---- <extension point="org.eclipse.help.toc"> ! <toc ! file="toc_main.xml" ! primary="true"> </toc> </extension> |
From: Aleksandar T. <at...@us...> - 2004-05-11 11:02:18
|
Update of /cvsroot/pydev/org.python.pydev.help/pydev.sf.net In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27366/pydev.sf.net Added Files: index.html debug.html snap.gif screenshot.jpg Log Message: 0.4 release --- NEW FILE: snap.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: debug.html --- <style type="text/css"> <!-- body { background-color: #FFFFCC; } --> </style><h2>Pydev debugger </h2> <p>Debugger, one step behind the editor. The ultimate goal is a nice graphical debugger, but until then here is a small improvement to the External Tools method:</p> <p>There is a Python context menu in Navigator:</p> <p><img src="images/debug_menu.gif" width="328" height="373"></p> <p>If you pick "Run...", you'll get the standard Eclipse debug dialog:</p> <p><img src="images/debug_dialog.gif" width="612" height="434"> </p> <p>Here you can pick your program arguments, etc. The dialog will try to verify that your python interpreter is present. If it is not, go to Preferences:Pydev:Debug and configure a valid python executable.</p> <p>And when you run the program, the output is in the console. The errors in the console are hyperlinked back to the file:</p> <p><img src="images/debug_console.gif" width="600" height="498"> </p> <p>That's all for now, time to work on the graphical debugger. </p> --- NEW FILE: index.html --- <html> <head> <title>pydev - python development environment for Eclipse</title> <link rel="stylesheet" href="http://www.totic.org/main.css" type="text/css"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#FFFFFF" text="#000000"> <p><A href="http://sourceforge.net"> <IMG src="http://sourceforge.net/sflogo.php?group_id=85796&type=5" width="210" height="62" border="0" alt="SourceForge.net Logo" /> </A></p> <h1><code>PyDev</code></h1> <fieldset> <legend>About</legend> <p>Pydev is a project to create a complete python development environment for eclipse: syntax highlighting, outline view, code navigation, debugger integration. The current release is 0.4. Both editor and debugger require Java 1.4.x. Editor runs on Eclipse 2.1.x, and 3.x, while debugger is not compatible with Eclipse 3 yet. Pydev consists of 3 plugins:</p> <p><b><a href="snap.gif">Editor</a></b> (org.python.pydev): </p> <li>syntax highlighting <li>the parser errors marked in the task list <li>outline view with imports/functions/classes <li>tabs/spaces preference.</li> <li>Navigation: keyboard shortcuts to previous/next function</li> <li>comment/uncomment commands (on the popup menu) </li> <li> hyperlinks over functions//import statements</li> <p><b><a href="images/debugger.gif">Debugger</a></b> (org.python.pydev.debug)</p> <li>breakpoints</li> <li>step in/out/over</li> <li>multiple threads</li> <li>variable display</li> <li>file hyperlinks in the console output (you can click on stack traces) </li> <p><b>Help</b> (org.python.pydev.help)</p> <li>Brief documentation in Eclipse format. <p>Pydev is an open-source project, hosted at <a href='http://www.sourceforge.net/projects/pydev/'>http://www.sourceforge.net/projects/pydev/</a>. You can download the releases from there, or from an Eclipse update site <a href="http://pydev.sf.net/updates/">http://pydev.sf.net/updates/</a>. Developer issues are discussed at <a href="http://sourceforge.net/mailarchive/forum.php?forum_id=39082">pydev-code</a> mailing list. For support, try the <a href="http://sourceforge.net/forum/forum.php?forum_id=293649">users</a> bulletin board. I sometimes post tidbits about the development progress in the <a href="http://blogs.osafoundation.org/atotic/cat_work_log.html">weblog</a>. <p>Most of the pydev has been developed by Aleks Totic as a "getting to know Eclipse" project, with some wonderful help from Fabio Zadrozny. </fieldset> <p> <fieldset> <legend>Development notes</legend> <pre> <b>History</b> In 2003, I was volunteering at OSAF. OSAF was developing Chandler in Python and wxWindows. I was not a great fan of wx, so I looked around for other cross-platform GUI toolkits. That's when I discovered Eclipse and SWT, and I really liked what I saw. I am a big fan of IDEs, ever since I used ThinkPascal to teach myself Macintosh Toolbox. Poweplant & CodeWarrior are still the nicest development combo I've ever used. With Eclipse, I saw potential, Emacs for the 21st century. So I decided to see what would it take to create a Python IDE for it. The answer is, a lot of time. Eclipse's APIs are a bit convoluted, with intefaces, delagates, and adapters obscuring your vision like a San Francisco fog. Thankfully, the source code is there representing all the knowledge. It just takes a lot of time. O'Reilly editors, if you are reading this, I'd be very happy to help out with "Learning Eclipse". As an additional handicap, my last real encounter with Java was in '95, and that was with its C security APIs. Oh, and I never really coded much in Python either. In spite of all this, 0.4 is here, and I am happy with it. It has a debugger, and an editor. Both of them are not fully-featured, like its Java counterparts, but they are very usable for smaller projects. My interest in the project is starting to wane, I've done what I wanted to do, and I am ready for something new. <b>Future</b> My plans for the future are: - 0.5 will be a bug-fix release, I am sure there are a few, there has been a lot of new code between 0.3 & 0.4. - 1.0 will be an Eclipse 3.0 compatibility release. There are some new debugger features like an environment tab that are cheap to implement, and very useful. And that's it. Over & out, off to new projects. So if you like this tool, it'll be up to you to take it to where you want it to be. I am always happy to discuss design, it is much less painful than coding. Here are some of my thoughts for the future: Editor: Editor could use some minor polish, especially when it comes to spaces/tabs issues. Things like smart-indent paste, multiple-space delete when i hit delete on the blank line, etc. The most requested feature in the editor is code completion/assist/hyperlink navigation. All these depend on the good model of the underlying code. I am currently building the model myself using jython's parser. Whoever decideds to implement these should look into using more of whatever model jython uses. I think RedRobin guy is using this approach, and is having a lot of success. It would be really neat if you could use Jython to run code refactoring/error checking scripts already in common use in the Python community. For full-featured development, editor needs to understand and deal with modules. It needs knowledge of include paths, wizards to create new modules. Debugger: I am proud of this one. The debugger is written in 2 parts, java & python. The python part is yet another implementation of a remote debugger. I really tried to use what was out there, but none of it had functionality & documentation that I needed. Some feature ideas are: - extending breakpoints with watchpoints/expressions - implementing the unimplemented container variables display (you only need python knowledge for this, look at pydev_vars.py). - implementing the "change variable" API - allowing execution inside frame context. - remote debugging capabilities All of these are between 1 and 3 day tasks, if you know python & eclipse. <b>You'd like to give it a try?</b> You can download the latest source from sourceforge. To compile, you need to set the following preferences: 'Plug-In Development:Java Build Path Control:Use classpath containers' to true 'Plug-In Development:Target Platform' select "this application" and enable all plugins. Most of the code is well-documented in javadoc. I try to cc every answer to a coding question to pydev-code, so you can look there for hints too. That's it. If you have not developed Eclipse plugins before, I recommend reading the online documentation and trying out a sample plugin. Doing some prep work before jumping in will really pay off. Then, it is all up to you. As for me, I have several possible projects coming up. I might do something with Mozilla guys. I am also thinking of developing a family tree web site that my family could use. Of course, there is no web site software out there I am happy with, so it'd involve writing a whole new web ui development system. Or I might do some work with startups, or something completely different. Life is never boring. Well, coding gets boring every once in a while, but I am just such an amateur when it comes to many other things I'd like to do. </pre> </fieldset> </body> </html> --- NEW FILE: screenshot.jpg --- (This appears to be a binary file; contents omitted.) |
From: Aleksandar T. <at...@us...> - 2004-05-11 11:02:17
|
Update of /cvsroot/pydev/org.python.pydev.help/pydev.sf.net/images In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27366/pydev.sf.net/images Added Files: debugger.gif debug_console.gif ed_prefs.gif db_prefs.gif debug_dialog.gif debug_menu.gif Log Message: 0.4 release --- NEW FILE: debug_console.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: debug_dialog.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: debug_menu.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: db_prefs.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: ed_prefs.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: debugger.gif --- (This appears to be a binary file; contents omitted.) |
From: Aleksandar T. <at...@us...> - 2004-05-11 11:02:14
|
Update of /cvsroot/pydev/org.python.pydev.help/html/images In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27366/html/images Added Files: hyper2.gif hyper1.gif hyper.psd debugdialog.jpg debugger.gif hyperanim.gif Log Message: 0.4 release --- NEW FILE: hyper.psd --- (This appears to be a binary file; contents omitted.) --- NEW FILE: hyper1.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: hyper2.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: hyperanim.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: debugger.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: debugdialog.jpg --- (This appears to be a binary file; contents omitted.) |
From: Aleksandar T. <at...@us...> - 2004-05-11 11:01:04
|
Update of /cvsroot/pydev/org.python.pydev.help/pydev.sf.net/images In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27150/pydev.sf.net/images Log Message: Directory /cvsroot/pydev/org.python.pydev.help/pydev.sf.net/images added to the repository |
From: Aleksandar T. <at...@us...> - 2004-05-11 11:01:04
|
Update of /cvsroot/pydev/org.python.pydev.help/pydev.sf.net In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27150/pydev.sf.net Log Message: Directory /cvsroot/pydev/org.python.pydev.help/pydev.sf.net added to the repository |
From: Aleksandar T. <at...@us...> - 2004-05-11 06:21:28
|
Update of /cvsroot/pydev/org.python.pydev.test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8012 Added Files: bdb.py testthread.py .project dumpobj.py error.py README.txt simple.py palmFile.py Log Message: --- NEW FILE: .project --- <?xml version="1.0" encoding="UTF-8"?> <projectDescription> <name>org.python.pydev.test</name> <comment></comment> <projects> </projects> <buildSpec> </buildSpec> <natures> </natures> </projectDescription> --- NEW FILE: simple.py --- import threading import time import inspect print "I am very simple" #s = raw_input("type something now: ") #print "you've typed", s from types import * def getType(o): if isinstance(o, NoneType): return (NoneType, False) if isinstance(o, ObjectType): return (ObjectType, False) if isinstance(o, IntType): return (IntType, False) if isinstance(o, LongType): return (LongType, False) if isinstance(o, FloatType): return (FloatType, False) if isinstance(o, BooleanType): return (BooleanType, False) if isinstance(o, ComplexType): return (ComplexType, False) if isinstance(o, StringType): return (StringType, False) if isinstance(o, UnicodeType): return (UnicodeType, False) if isinstance(o, BufferType): return (BufferType, False) if isinstance(o, TupleType): return (TupleType, True) if isinstance(o, ListType): return (ListType, True) if isinstance(o, DictType): return (DictType, True) if isinstance(o, FunctionType): return (FunctionType, True) if isinstance(o, LambdaType): return (LambdaType, True) if isinstance(o, GeneratorType): return (GeneratorType, True) if isinstance(o, ClassType): return (ClassType, True) if isinstance(o, UnboundMethodType): return (UnboundMethodType, True) if isinstance(o, InstanceType): return (InstanceType, True) if isinstance(o, BuiltinFunctionType): return (BuiltinFunctionType, False) if isinstance(o, BuiltinMethodType): return (BuiltinMethodType, False) if isinstance(o, ModuleType): return (ModuleType, True) if isinstance(o, FileType): return (FileType, True) if isinstance(o, XRangeType): return (XRangeType, True) if isinstance(o, TracebackType): return (TracebackType, True) if isinstance(o, FrameType): return (FrameType, True) if isinstance(o, SliceType): return (SliceType, True) if isinstance(o, EllipsisType): return (EllipsisType, False) if isinstance(o, DictProxyType): return (DictProxyType, True) if isinstance(o, NotImplementedType): return (NotImplementedType, False) def infinite_fun(): i = 1 while True: i = 1 time.sleep(i) print "I've been asleep for " + str(i) + " sec." # infinite_fun() class SimplestThread(threading.Thread): def run(self): print "just one statement" print "and now I exit thread" import mymodule.foo mymodule.foo.bar() --- NEW FILE: testthread.py --- import threading import thread import time import bdb import sys import inspect import types class DeepThread(threading.Thread): def __init__(self): threading.Thread.__init__(self) self.setName("Deep thread") def f1(self, first): print "entering f1 with argument ", first time.sleep(1) self.f2(first, "and one more") print "leaving f1" def f2(self, one, two): print "entering f2", one, two for i in range(100): self.f3(one, two, 3) print "leaving f2" def f3(self, ein, tzwei, drei): print "entering f3" print ein print tzwei print str(drei) print "one" print "two" print "three" print "four" print "five" print "six is sleep" time.sleep(1) print "seven" print "eight" print "leaving f3" def run(self): self.f1("hello") class First(threading.Thread): def __init__(self, delay, name): threading.Thread.__init__(self) self.delay = delay self.setName(name) self.setDaemon(True) self.__verbose = True def run(self): i=4 while (i > 0): i = i - 1 # print self.getName() + str(i) time.sleep(self.delay) print >>sys.stderr, "exiting", self.getName() class KillEm(threading.Thread): def __init__(self, delay): threading.Thread.__init__(self) self.delay = delay self.setName("KillerThread") def run(self): print "coming in for a kill in " + str(self.delay) + " seconds" time.sleep(self.delay) print "Killing!" + str(self.delay) + " seconds" Tdb.instance.do_quit() class Tdb: instance = None def __init__(self): Tdb.instance = self threading.settrace(self.trace_dispatch) # for all threads def trace_dispatch(self, frame, event, arg): print frame print id(frame) if event == 'line': return self.dispatch_line(frame) if event == 'call': return self.dispatch_call(frame, arg) if event == 'return': return self.dispatch_return(frame, arg) if event == 'exception': return self.dispatch_exception(frame, arg) return self.trace_dispatch def dispatch_line(self, frame): # print id(threading.currentThread()) # print inspect.getframeinfo(frame) return self.trace_dispatch def dispatch_call(self, frame, arg): print "C " + str(frame) + " " + str(arg) return self.trace_dispatch def dispatch_return(self, frame, arg): print "R " + str(frame) + " " + str(arg) return self.trace_dispatch def dispatch_exception(self, frame, arg): print "E " + str(frame) + " " + str(arg) return self.trace_dispatch def run(self, cmd, globals=None, locals=None): if globals is None: import __main__ globals = __main__.__dict__ if locals is None: locals = globals if not isinstance(cmd, types.CodeType): cmd = cmd+'\n' try: try: exec cmd in globals, locals except: # print sys.stderr, "Debugger exiting with exception" raise finally: print "Quitting now" self.quitting = 1 def infinite_fun(): i = 1 while True: i += 10 time.sleep(i) print "I've been asleep for " + str(i) + " sec." def infinite2(): infinite_fun() def infinite_1(): infinite2() def many_threads(): print "many threads" t = First(1, "1 seconder ") t2 = First(2, "2 cool 4 you ") t3 = First(3, "3 is a magic number ") dt = DeepThread() # t.start() # t2.start() # t3.start() dt.start() # infinite_1() def test(): t = Tdb() t.run('many_threads()') if __name__ == "__main__": many_threads() raw_input("ready to quit now? ") --- NEW FILE: dumpobj.py --- def printDict(di, format="%-25s %s"): for (key, val) in di.items(): print format % (str(key)+':', val) def dumpObj(obj, maxlen=77, lindent=24, maxspew=600): """Print a nicely formatted overview of an object. The output lines will be wrapped at maxlen, with lindent of space for names of attributes. A maximum of maxspew characters will be printed for each attribute value. You can hand dumpObj any data type -- a module, class, instance, new class. Note that in reformatting for compactness the routine trashes any formatting in the docstrings it prints. Example: >>> class Foo(object): a = 30 def bar(self, b): "A silly method" return a*b ... ... ... ... >>> foo = Foo() >>> dumpObj(foo) Instance of class 'Foo' as defined in module __main__ with id 136863308 Documentation string: None Built-in Methods: __delattr__, __getattribute__, __hash__, __init__ __new__, __reduce__, __repr__, __setattr__, __str__ Methods: bar "A silly method" Attributes: __dict__ {} __weakref__ None a 30 """ import types # Formatting parameters. ltab = 2 # initial tab in front of level 2 text # There seem to be a couple of other types; gather templates of them MethodWrapperType = type(object().__hash__) # # Gather all the attributes of the object # objclass = None objdoc = None objmodule = '<None defined>' methods = [] builtins = [] classes = [] attrs = [] for slot in dir(obj): attr = getattr(obj, slot) if slot == '__class__': objclass = attr.__name__ elif slot == '__doc__': objdoc = attr elif slot == '__module__': objmodule = attr elif (isinstance(attr, types.BuiltinMethodType) or isinstance(attr, MethodWrapperType)): builtins.append( slot ) elif (isinstance(attr, types.MethodType) or isinstance(attr, types.FunctionType)): methods.append( (slot, attr) ) elif isinstance(attr, types.TypeType): classes.append( (slot, attr) ) else: attrs.append( (slot, attr) ) # # Organize them # methods.sort() builtins.sort() classes.sort() attrs.sort() # # Print a readable summary of those attributes # normalwidths = [lindent, maxlen - lindent] tabbedwidths = [ltab, lindent-ltab, maxlen - lindent - ltab] def truncstring(s, maxlen): if len(s) > maxlen: return s[0:maxlen] + ' ...(%d more chars)...' % (len(s) - maxlen) else: return s # Summary of introspection attributes if objclass == '': objclass = type(obj).__name__ intro = "Instance of class '%s' as defined in module %s with id %d" % \ (objclass, objmodule, id(obj)) print '\n'.join(prettyPrint(intro, maxlen)) # Object's Docstring if objdoc is None: objdoc = str(objdoc) else: objdoc = ('"""' + objdoc.strip() + '"""') print print prettyPrintCols( ('Documentation string:', truncstring(objdoc, maxspew)), normalwidths, ' ') # Built-in methods if builtins: bi_str = delchars(str(builtins), "[']") or str(None) print print prettyPrintCols( ('Built-in Methods:', truncstring(bi_str, maxspew)), normalwidths, ', ') # Classes if classes: print print 'Classes:' for (classname, classtype) in classes: classdoc = getattr(classtype, '__doc__', None) or '<No documentation>' print prettyPrintCols( ('', classname, truncstring(classdoc, maxspew)), tabbedwidths, ' ') # User methods if methods: print print 'Methods:' for (methodname, method) in methods: methoddoc = getattr(method, '__doc__', None) or '<No documentation>' print prettyPrintCols( ('', methodname, truncstring(methoddoc, maxspew)), tabbedwidths, ' ') # Attributes if attrs: print print 'Attributes:' for (attr, val) in attrs: print prettyPrintCols( ('', attr, truncstring(str(val), maxspew)), tabbedwidths, ' ') def prettyPrintCols(strings, widths, split=' '): """Pretty prints text in colums, with each string breaking at split according to prettyPrint. margins gives the corresponding right breaking point.""" assert len(strings) == len(widths) strings = map(nukenewlines, strings) # pretty print each column cols = [''] * len(strings) for i in range(len(strings)): cols[i] = prettyPrint(strings[i], widths[i], split) # prepare a format line format = ''.join(["%%-%ds" % width for width in widths[0:-1]]) + "%s" def formatline(*cols): return format % tuple(map(lambda s: (s or ''), cols)) # generate the formatted text return '\n'.join(map(formatline, *cols)) def prettyPrint(string, maxlen=75, split=' '): """Pretty prints the given string to break at an occurrence of split where necessary to avoid lines longer than maxlen. This will overflow the line if no convenient occurrence of split is found""" # Tack on the splitting character to guarantee a final match string += split lines = [] oldeol = 0 eol = 0 while not (eol == -1 or eol == len(string)-1): eol = string.rfind(split, oldeol, oldeol+maxlen+len(split)) lines.append(string[oldeol:eol]) oldeol = eol + len(split) return lines def nukenewlines(string): """Strip newlines and any trailing/following whitespace; rejoin with a single space where the newlines were. Bug: This routine will completely butcher any whitespace-formatted text.""" if not string: return '' lines = string.splitlines() return ' '.join( [line.strip() for line in lines] ) def delchars(str, chars): """Returns a string for which all occurrences of characters in chars have been removed.""" # Translate demands a mapping string of 256 characters; # whip up a string that will leave all characters unmolested. identity = ''.join([chr(x) for x in range(256)]) return str.translate(identity, chars) --- NEW FILE: error.py --- import sys; def mo(): print "mo crashes" a = 1/0 def minnie(): print "minnie" mo() def meenie(): print "mennie" minnie() def eenie(): print "eenie" meenie() if __name__ == "__main__": eenie() --- NEW FILE: palmFile.py --- """ Python module that parses palm files The files are parsed into list/dictionary data structure that mirrors the structure of the palm file. Thanks to Scott Leighton who provided the Palm File format at http://www.geocities.com/Heartland/Acres/3216/palmrecs.htm Usage import palmFile.py fileStruct = readPalmFile(<fileName>) the structure you get back mirrors the file structure. I use import pprint pprint.pprint(fileStruct) to make sense of the data I get back see printAWeekWorthOfCalendar and printAllNames for examples """ """ Author: at...@ya... Version 0.4 Date: 3/22/04 Accepted a patch for reading repeating events from Jeff Mikels Version 0.3 Date: 12/12/03 Patch for readRepeatEvent, from John Lim (Rainlendar guy) Date: Apr 24, 2003 Version: 0.2: fixed dateExceptionCount parsing Date: 11/21/2002 Version: 0.1, my first Python code It works on my machine, Python 2.2, I have not tried it on any others Terminology used in coding: record - a list of items in a known predefined format, not composed of fields each record read has a HEADERDEF defined in this file that describes it frecord - a special record, where each item is a *field* field - fields have type & data. The labels are implicit in their position and are defined in this file as a list items - basic units we know how to read: byte/short/long/, etc """ ### # Generic reading routines ### import struct def readCString(f): """Read in a Palm-format string.""" """ String docs off the net: Strings less than 255 bytes are stored with the length specified in the first byte followed by the actual string. Zero length strings are stored with a 0x00 byte. Strings 255 bytes or longer are stored with a flag byte set to 0xFF followed by a short (2*Byte) that specifies the length of the string, followed by the actual string. """ retVal = None (firstByte, ) = struct.unpack("B", f.read(1)) if firstByte == 0 : retVal = ""; elif firstByte == 0xFF: (length, ) = struct.unpack("H", f.read(2)) retVal = f.read(length) else: # length was in first byte retVal = f.read(firstByte) return retVal def readShort(f): """Read unsigned 2 byte value from a file f.""" (retVal,) = struct.unpack("H", f.read(2)) return retVal def readLong(f): """Read unsigned 4 byte value from a file f.""" (retVal,) = struct.unpack("L", f.read(4)) return retVal def readFloat(f): """Read float (4 byte?) from a file f.""" (retVal,) = struct.unpack("f", f.read(4)) return retVal def readRepeatEvent(f): """Read RepeatEvent, a hacky palm data structure must be read programatically due to randomness of the data structure """ event = {}; event['dateExceptionCount'] = readShort(f) dateExceptions = []; for i in range(event['dateExceptionCount']): dateExceptions.append(readLong(f)) if len(dateExceptions) > 0: event['dateExceptions'] = dateExceptions event['repeatEventFlag']= readShort(f) if event['repeatEventFlag'] == 0: return event if event['repeatEventFlag'] == 0xFFFF: classRecord = {} classRecord['constant'] = readShort(f) classRecord['nameLength'] = readShort(f) classRecord['name'] = f.read(classRecord['nameLength']) if event['repeatEventFlag'] == 0: return event event['brand'] = readLong(f) event['interval'] = readLong(f) event['endDate'] = readLong(f) event['firstDayOfWeek'] = readLong(f) if event['brand'] in (1L,2L,3L): event['brandDayIndex'] = readLong(f) if event['brand'] == 2L: event['brandDaysMask'] = f.read(1) if event['brand'] == 3L: event['brandWeekIndex'] = readLong(f) if event['brand'] in (4L, 5L): event['brandDayNumber'] = readLong(f) if event['brand'] == 5L: event['brandMonthIndex'] = readLong(f) return event def readField(f, fieldType): """Read palm record from a file f. fieldType -- integer specifying the palm field type """ retVal = None if fieldType ==0: # none retVal = None elif fieldType == 1: # integer retVal = readLong(f) elif fieldType == 2: # float retVal = readFloat(f) elif fieldType == 3: # date retVal = readLong(f) elif fieldType == 4: # alpha raise NotImplementedError elif fieldType == 5: # cstring readLong(f) # padding retVal = readCString(f) elif fieldType == 6: # boolean retVal = readLong(f) != 0 elif fieldType == 7: # bit flag retVal = readLong(f) elif fieldType == 8: # repeat event, bad hack, bad retVal = readRepeatEvent(f) else: raise ValueError return retVal def readFRecords(f, fileSoFar, labels): """reads a list of frecords from file f returns -- a list of records fileSoFar -- dictionary of data read so far, used to get the number of records to read labels -- a list of labels for the fields """ fieldsPerRecord = fileSoFar['fieldCount'] # make sure that declared if fieldsPerRecord != len(labels): raise ValueError numberOfRecords = fileSoFar['numEntries'] / fieldsPerRecord; # print "reading", str(numberOfRecords), "records" entries = [] for i in range(numberOfRecords): # print "reading record", str(i) newEntry = {} for j in labels: fieldType = readLong(f) newEntry[j] = readField(f, fieldType) entries.append(newEntry) # print "done with", str(numberOfRecords), "records" return entries def readRecords(f, fileFormat, howMany=1): """reads a list of objects from a file f fileFormat -- HEADERDEF of what format looks like howMany -- how many records to read returns a list of howMany dictionaries: [ {d1}, .... {dN}] """ retVal = [] # print "entering", str(fileFormat[0]); for i in range(howMany): entry = {} for fieldDef in fileFormat: if fieldDef[1] is "long": entry[fieldDef[0]] = readLong(f) elif fieldDef[1] is "short": entry[fieldDef[0]] = readShort(f) elif fieldDef[1] is "cstring": entry[fieldDef[0]] = readCString(f) elif fieldDef[1] is "record": entry[fieldDef[0]] = readRecords(f, eval(fieldDef[2]), entry[fieldDef[3]]) elif fieldDef[1] is "frecord": entry[fieldDef[0]] = readFRecords(f, entry, eval(fieldDef[2])) else: raise AssertionError retVal.append(entry); # print "returning", str(fileFormat[0]) return retVal # Address book defines """ HEADERDEF lists format HEADERDEF are data that represent the file format. I've tried to make all parsing data driven, and HEADERDEF structs describe the grammar. When data to be read go beyound what HEADERDEF defines, 3rd column provides the name Python to be executed. headerDef tuple columns format col 1 property name col 2 type short, long, palm cstring, record, frecord 3 additional argument: if type in col 2 is record, the name of the entry that defines the struct count if type in col 2 is frecord, the python code to execute """ """See HEADERDEF lists format above""" addressHeaderDef = ( ("versionTag", "long"), ("fileName", "cstring"), ("tableString", "cstring"), ("nextFree", "long"), ("categoryCount","long"), ("categoryList", "record", "addressCategoryEntryDef", "categoryCount"), ("resourceID", "long"), ("fieldsPerRow", "long"), ("recIDPos", "long"), ("recStatus", "long"), ("placementPos", "long"), ("fieldCount", "short"), ("fieldEntryList", "record", "addressSchemaFieldDef", "fieldCount"), ("numEntries", "long"), ("addresses", "frecord","addressEntryFields") ) """See HEADERDEF lists format above""" addressCategoryEntryDef = ( ("index", "long"), ("id", "long"), ("dirtyFlag", "long"), ("longName", "cstring"), ("shortName", "cstring") ) """See HEADERDEF lists format above""" addressSchemaFieldDef = ( ("fieldEntryType", "short"), ) """See HEADERDEF lists format above""" addressEntryFields = ( "recordID", "status", "position", "lastName", "firstName", "title", "companyName", "phone1LabelID", "phone1Text", "phone2LabelID", "phone2Text", "phone3LabelID", "phone3Text", "phone4LabelID", "phone4Text", "phone5LabelID", "phone5Text", "address", "city", "state", "zip", "country", "note", "private", "category", "custom1Text", "custom2Text", "custom3Text", "custom4Text", "displayPhone" ) """ # Calendar defines """ """See HEADERDEF lists format above""" calendarHeaderDef = ( ("versionTag", "long"), ("fileName", "cstring"), ("tableString", "cstring"), ("nextFree", "long"), ("categoryCount","long"), ("categoryList", "record", "addressCategoryEntryDef", "categoryCount"), ("resourceID", "long"), ("fieldsPerRow", "long"), ("recIDPos", "long"), ("recStatus", "long"), ("placementPos", "long"), ("fieldCount", "short"), ("fieldEntry", "record", "addressSchemaFieldDef", "fieldCount"), ("numEntries", "long"), ("datebookList", "frecord","calendarEntryFields") ) calendarEntryFields = ( "recordID", "status", "position", "startTime", "endTime", "text", "duration", "note", "untimed", "private", "category", "alarmSet", "alarmAdvUnits", "alarmAdvType", "repeatEvent" ) def getUpcomingEvents(calendar, daysAhead, traceRepeats=0): #returns a list of event dictionaries from now until daysAhead days from now import time calendarDict = calendar[0] dateList = calendarDict['datebookList'] #we don't want to change the original calendar so we create a copy startTime = time.time(); endTime = startTime + (daysAhead * 60 * 60 * 24) # converts daysAhead to seconds retVal = [] #print 'Checking for events between',time.localtime(startTime),'and',time.localtime(endTime) for event in dateList: newEvent = event.copy() if newEvent['startTime'] > startTime and newEvent['startTime'] < endTime: #print 'Adding [', newEvent['text'], '] [', time.localtime(newEvent['startTime']), ']' #pprint.pprint(event) #print '\n\n' retVal.append(newEvent.copy()) if traceRepeats and newEvent['repeatEvent']['repeatEventFlag'] and newEvent['repeatEvent']['endDate'] > startTime: newEvent = getNextRepeatedEvent(newEvent) #print 'Looking [',newEvent['text'],'] [',time.localtime(newEvent['startTime']),']' while newEvent['startTime'] < startTime: newEvent = getNextRepeatedEvent(newEvent) #print 'Looking [',newEvent['text'],'] [',time.localtime(newEvent['startTime']),']' while newEvent['startTime'] <= endTime: #print 'Adding [', newEvent['text'], '] [', time.localtime(newEvent['startTime']), ']' retVal.append(newEvent.copy()) newEvent = getNextRepeatedEvent(newEvent) return retVal def getNextRepeatedEvent(event): import time '''A sample from datebookList: 'repeatEvent': {'brand': 5L, Daily, Weekly, Monthly Date, Monthly Day, YEARLY 'brandDayNumber': 4L, 4th 'brandMonthIndex': 7L, August 'dateExceptionCount': 0, 'endDate': 1028437200L, 'firstDayOfWeek': 0L, 'interval': 1L, 'repeatEventFlag': 65535}, ''' repeatDetails = event['repeatEvent'] repeatStartDST = time.localtime(event['startTime'])[8] if repeatDetails['brand'] == 1: #daily repeat event['startTime'] = event['startTime'] + 60*60*24*repeatDetails['interval'] elif repeatDetails['brand'] == 2: # repeat weekly on specific days targetDaysMask = ord(repeatDetails['brandDaysMask']) #convert character read from file to ascii code #print 'targetDaysMask:',targetDaysMask repeatStartLocal=time.localtime(event['startTime']) if repeatStartLocal[6] == 5: # event's current start time is a Saturday '''add one day to get to Sunday, then add whole weeks according to the specified interval minus one, because we just went from Saturday to Sunday with the first addition. ''' event['startTime'] = event['startTime'] + (60*60*24) + (60*60*24*7) * (repeatDetails['interval'] - 1) repeatStartLocal=time.localtime(event['startTime']) else: event['startTime'] = event['startTime'] + (60*60*24) repeatStartLocal=time.localtime(event['startTime']) '''Python stores Wdays in element 6 of a time_struct, but stores them with Monday as 0 and Sun as 6. This line converts from the python time_struct to a WDay value with Sunday as 0 ''' rsWDay = (repeatStartLocal[6] + 1) % 7 #print time.localtime(event['startTime']),'\n\trsWDay:',rsWDay,'\n\t',2**rsWDay,'\n\t',not ((2**rsWDay) & targetDaysMask) while not ((2**rsWDay) & targetDaysMask): # targetDaysMask is sum of the following: 1 = Sunday, 2 = Monday, 4 = Tues, . . . , 64 = Saturday event['startTime'] = event['startTime'] + (60*60*24) repeatStartLocal=time.localtime(event['startTime']) rsWDay = (repeatStartLocal[6] + 1) % 7 elif repeatDetails['brand'] == 3: #repeat monthly based on day from calendar import monthrange targetDay = repeatDetails['brandDayIndex'] #returns wday according to Python standards with Monday = 0 targetWeek = repeatDetails['brandWeekIndex'] #returns week with first week = 0, fourth week = 3, and last week = 4 for interval in range(1,repeatDetails['interval'] + 1): if targetWeek == 4: #event repeats on last ?day of the month. #event['startTime'] = event['startTime'] + (60*60*24*7) #add one week to current event newTime = event['startTime'] + (60*60*24*7*4) #add four weeks to current event newLocalTime = time.localtime(newTime) monthBegins, monthLength = monthrange(newLocalTime[0],newLocalTime[1]) if (monthLength - newLocalTime[3]) >= 7: newTime = newTime + (60*60*24*7) event['startTime'] = newTime else: #repeats on 1st - 4th ?day of month newTime = event['startTime'] newLocalTime = time.localtime(newTime) oldStartTimeMonth = newLocalTime[1] #advance event until it's the first occurrence of that weekday in the next month while newLocalTime[1] == oldStartTimeMonth: newTime = newTime + (60*60*24*7) #add one week to current event newLocalTime = time.localtime(newTime) event['startTime'] = newTime + (60*60*24*7*(targetWeek)) elif repeatDetails['brand'] == 4: #repeat monthly based on date repeatStartLocal = time.localtime(event['startTime']) event['startTime'] = time.mktime((repeatStartLocal[0],repeatStartLocal[1]+repeatDetails['interval'],repeatStartLocal[2],repeatStartLocal[3],repeatStartLocal[4],repeatStartLocal[5],0,0,0)) elif repeatDetails['brand'] == 5: #repeat yearly based on date repeatStartLocal = time.localtime(event['startTime']) event['startTime'] = time.mktime((repeatStartLocal[0]+repeatDetails['interval'],repeatStartLocal[1],repeatStartLocal[2],repeatStartLocal[3],repeatStartLocal[4],repeatStartLocal[5],0,0,0)) newEventDST = time.localtime(event['startTime'])[8] correctDST = repeatStartDST - newEventDST event['startTime'] = event['startTime'] + (60*60*correctDST) return event def readPalmFile(fileName): """ Read in a Palm fileName with a specified format The type of the file is determined automatically by reading the first four bytes fileFormat -- different files have different formats (address book, calendar...) [abHeaderDef | calHeaderDef] """ retVal = None try: palmFile = open(fileName, "rb") except IOError: print "Palm file", fileName, "cannot be opened\n\n" raise IOError try: sig = palmFile.read(4) palmFile.seek(0) if sig == "\x00\x01BA": # address book fileFormat = addressHeaderDef elif sig == "\x00\x01BD": # datebook (calendar) fileFormat = calendarHeaderDef else: print "Unknown file format ", sig raise ValueError retVal = readRecords(palmFile, fileFormat, 1) except IOError: print "Unexpected error while reading Palm file" raise IOError if palmFile : palmFile.close() return retVal def printAllNames(adBook): """print all names in the address book demo of walking the address book structure """ addressDict = adBook[0] addresses = addressDict["addresses"] for address in addresses: print address["firstName"],address["lastName"] # this is a simple version that does not take repeating events # into account. See newer printAWeekWorthOfCalendar(calendar,traceRepeats=0) # for repeated events implementation def printAWeekWorthOfCalendar(calendar): """demo of walking the calendar data structure prints all events a week from now """ import time calendarDict = calendar[0] dateList = calendarDict['datebookList'] startTime = time.time(); endTime = startTime + 60*60*24*7 # a week worth of seconds print "Your schedule next week:" for event in dateList: if event['startTime'] > startTime and event['startTime'] < endTime: if event['untimed']: print time.strftime("%x ***", time.localtime(event['startTime'])), event['text'] else : print time.strftime("%c-", time.localtime(event['startTime'])), time.strftime("%X", time.localtime(event['endTime'])),event['text'] if event['note']: print event['note'] def printAWeekWorthOfCalendar(calendar,traceRepeats=0): """demo of walking the calendar data structure prints all events a week from now """ import time print "Your schedule next week:" events = getUpcomingEvents(calendar,7,traceRepeats) for event in events: if event['untimed']: print time.strftime("%x ***", time.localtime(event['startTime'])), event['text'] else : print time.strftime("%c-", time.localtime(event['startTime'])), time.strftime("%X", time.localtime(event['endTime'])),event['text'] if event['note']: print event['note'] if __name__ == "__main__": import sys import getopt try: options, args = getopt.getopt(sys.argv[1:], 'v') verbose = len(options) > 0 and options[0][0] == "-v" if (len(args) != 1): raise RuntimeError, "Missing filename" except: print "Usage: python palmFile.py [-v] <fileName>" print "-v for verbose, print all the data in the file" print "\nPrint out sample data from a palm file" sys.exit() palmData = readPalmFile(args[0]) if verbose: import pprint pprint.pprint(palmData) if palmData[0]["versionTag"] == 1094844672L: # addresses printAllNames(palmData) elif palmData[0]["versionTag"] == 1145176320L: # datebook printAWeekWorthOfCalendar(palmData, 1) --- NEW FILE: bdb.py --- """Debugger basics""" import sys import os import types __all__ = ["BdbQuit","Bdb","Breakpoint"] BdbQuit = 'bdb.BdbQuit' # Exception to give up completely class Bdb: """Generic Python debugger base class. This class takes care of details of the trace facility; a derived class should implement user interaction. The standard debugger class (pdb.Pdb) is an example. """ def __init__(self): self.breaks = {} self.fncache = {} # comment """ this line does not get indented""" def canonic(self, filename): if filename == "<" + filename[1:-1] + ">": return filename canonic = self.fncache.get(filename) if not canonic: canonic = os.path.abspath(filename) canonic = os.path.normcase(canonic) self.fncache[filename] = canonic return canonic def reset(self): import linecache linecache.checkcache() self.botframe = None self.stopframe = None self.returnframe = None self.quitting = 0 def trace_dispatch(self, frame, event, arg): if self.quitting: return # None if event == 'line': return self.dispatch_line(frame) if event == 'call': return self.dispatch_call(frame, arg) if event == 'return': return self.dispatch_return(frame, arg) if event == 'exception': return self.dispatch_exception(frame, arg) print 'bdb.Bdb.dispatch: unknown debugging event:', `event` return self.trace_dispatch def dispatch_line(self, frame): if self.stop_here(frame) or self.break_here(frame): self.user_line(frame) if self.quitting: raise BdbQuit return self.trace_dispatch def dispatch_call(self, frame, arg): # XXX 'arg' is no longer used if self.botframe is None: # First call of dispatch since reset() self.botframe = frame.f_back # (CT) Note that this may also be None! return self.trace_dispatch if not (self.stop_here(frame) or self.break_anywhere(frame)): # No need to trace this function return # None self.user_call(frame, arg) if self.quitting: raise BdbQuit return self.trace_dispatch def dispatch_return(self, frame, arg): if self.stop_here(frame) or frame == self.returnframe: self.user_return(frame, arg) if self.quitting: raise BdbQuit return self.trace_dispatch def dispatch_exception(self, frame, arg): if self.stop_here(frame): self.user_exception(frame, arg) if self.quitting: raise BdbQuit return self.trace_dispatch # Normally derived classes don't override the following # methods, but they may if they want to redefine the # definition of stopping and breakpoints. def stop_here(self, frame): # (CT) stopframe may now also be None, see dispatch_call. # (CT) the former test for None is therefore removed from here. if frame is self.stopframe: return 1 while frame is not None and frame is not self.stopframe: if frame is self.botframe: return 1 frame = frame.f_back return 0 def break_here(self, frame): filename = self.canonic(frame.f_code.co_filename) if not self.breaks.has_key(filename): return 0 lineno = frame.f_lineno if not lineno in self.breaks[filename]: return 0 # flag says ok to delete temp. bp (bp, flag) = effective(filename, lineno, frame) if bp: self.currentbp = bp.number if (flag and bp.temporary): self.do_clear(str(bp.number)) return 1 else: return 0 def do_clear(self, arg): raise NotImplementedError, "subclass of bdb must implement do_clear()" def break_anywhere(self, frame): return self.breaks.has_key( self.canonic(frame.f_code.co_filename)) # Derived classes should override the user_* methods # to gain control. def user_call(self, frame, argument_list): """This method is called when there is the remote possibility that we ever need to stop in this function.""" pass def user_line(self, frame): """This method is called when we stop or break at this line.""" pass def user_return(self, frame, return_value): """This method is called when a return trap is set here.""" pass def user_exception(self, frame, (exc_type, exc_value, exc_traceback)): """This method is called if an exception occurs, but only if we are to stop at or just below this level.""" pass # Derived classes and clients can call the following methods # to affect the stepping state. def set_step(self): """Stop after one line of code.""" self.stopframe = None self.returnframe = None self.quitting = 0 def set_next(self, frame): """Stop on the next line in or below the given frame.""" self.stopframe = frame self.returnframe = None self.quitting = 0 def set_return(self, frame): """Stop when returning from the given frame.""" self.stopframe = frame.f_back self.returnframe = frame self.quitting = 0 def set_trace(self): """Start debugging from here.""" frame = sys._getframe().f_back self.reset() while frame: frame.f_trace = self.trace_dispatch self.botframe = frame frame = frame.f_back self.set_step() sys.settrace(self.trace_dispatch) def set_continue(self): # Don't stop except at breakpoints or when finished self.stopframe = self.botframe self.returnframe = None self.quitting = 0 if not self.breaks: # no breakpoints; run without debugger overhead sys.settrace(None) frame = sys._getframe().f_back while frame and frame is not self.botframe: del frame.f_trace frame = frame.f_back def set_quit(self): self.stopframe = self.botframe self.returnframe = None self.quitting = 1 sys.settrace(None) # Derived classes and clients can call the following methods # to manipulate breakpoints. These methods return an # error message is something went wrong, None if all is well. # Set_break prints out the breakpoint line and file:lineno. # Call self.get_*break*() to see the breakpoints or better # for bp in Breakpoint.bpbynumber: if bp: bp.bpprint(). def set_break(self, filename, lineno, temporary=0, cond = None): filename = self.canonic(filename) import linecache # Import as late as possible line = linecache.getline(filename, lineno) if not line: return 'Line %s:%d does not exist' % (filename, lineno) if not self.breaks.has_key(filename): self.breaks[filename] = [] list = self.breaks[filename] if not lineno in list: list.append(lineno) bp = Breakpoint(filename, lineno, temporary, cond) def clear_break(self, filename, lineno): filename = self.canonic(filename) if not self.breaks.has_key(filename): return 'There are no breakpoints in %s' % filename if lineno not in self.breaks[filename]: return 'There is no breakpoint at %s:%d' % (filename, lineno) # If there's only one bp in the list for that file,line # pair, then remove the breaks entry for bp in Breakpoint.bplist[filename, lineno][:]: bp.deleteMe() if not Breakpoint.bplist.has_key((filename, lineno)): self.breaks[filename].remove(lineno) if not self.breaks[filename]: del self.breaks[filename] def clear_bpbynumber(self, arg): try: number = int(arg) except: return 'Non-numeric breakpoint number (%s)' % arg try: bp = Breakpoint.bpbynumber[number] except IndexError: return 'Breakpoint number (%d) out of range' % number if not bp: return 'Breakpoint (%d) already deleted' % number self.clear_break(bp.file, bp.line) def clear_all_file_breaks(self, filename): filename = self.canonic(filename) if not self.breaks.has_key(filename): return 'There are no breakpoints in %s' % filename for line in self.breaks[filename]: blist = Breakpoint.bplist[filename, line] for bp in blist: bp.deleteMe() del self.breaks[filename] def clear_all_breaks(self): if not self.breaks: return 'There are no breakpoints' for bp in Breakpoint.bpbynumber: if bp: bp.deleteMe() self.breaks = {} def get_break(self, filename, lineno): filename = self.canonic(filename) return self.breaks.has_key(filename) and \ lineno in self.breaks[filename] def get_breaks(self, filename, lineno): filename = self.canonic(filename) return self.breaks.has_key(filename) and \ lineno in self.breaks[filename] and \ Breakpoint.bplist[filename, lineno] or [] def get_file_breaks(self, filename): filename = self.canonic(filename) if self.breaks.has_key(filename): return self.breaks[filename] else: return [] def get_all_breaks(self): return self.breaks # Derived classes and clients can call the following method # to get a data structure representing a stack trace. def get_stack(self, f, t): stack = [] if t and t.tb_frame is f: t = t.tb_next while f is not None: stack.append((f, f.f_lineno)) if f is self.botframe: break f = f.f_back stack.reverse() i = max(0, len(stack) - 1) while t is not None: stack.append((t.tb_frame, t.tb_lineno)) t = t.tb_next return stack, i # def format_stack_entry(self, frame_lineno, lprefix=': '): import linecache, repr frame, lineno = frame_lineno filename = self.canonic(frame.f_code.co_filename) s = filename + '(' + `lineno` + ')' if frame.f_code.co_name: s = s + frame.f_code.co_name else: s = s + "<lambda>" if frame.f_locals.has_key('__args__'): args = frame.f_locals['__args__'] else: args = None if args: s = s + repr.repr(args) else: s = s + '()' if frame.f_locals.has_key('__return__'): rv = frame.f_locals['__return__'] s = s + '->' s = s + repr.repr(rv) line = linecache.getline(filename, lineno) if line: s = s + lprefix + line.strip() return s # The following two methods can be called by clients to use # a debugger to debug a statement, given as a string. def run(self, cmd, globals=None, locals=None): if globals is None: import __main__ globals = __main__.__dict__ if locals is None: locals = globals self.reset() sys.settrace(self.trace_dispatch) if not isinstance(cmd, types.CodeType): cmd = cmd+'\n' try: try: exec cmd in globals, locals except BdbQuit: pass finally: self.quitting = 1 sys.settrace(None) def runeval(self, expr, globals=None, locals=None): if globals is None: import __main__ globals = __main__.__dict__ if locals is None: locals = globals self.reset() sys.settrace(self.trace_dispatch) if not isinstance(expr, types.CodeType): expr = expr+'\n' try: try: return eval(expr, globals, locals) except BdbQuit: pass finally: self.quitting = 1 sys.settrace(None) def runctx(self, cmd, globals, locals): # B/W compatibility self.run(cmd, globals, locals) # This method is more useful to debug a single function call. def runcall(self, func, *args): self.reset() sys.settrace(self.trace_dispatch) res = None try: try: res = apply(func, args) except BdbQuit: pass finally: self.quitting = 1 sys.settrace(None) return res def set_trace(): Bdb().set_trace() class Breakpoint: """Breakpoint class Implements temporary breakpoints, ignore counts, disabling and (re)-enabling, and conditionals. Breakpoints are indexed by number through bpbynumber and by the file,line tuple using bplist. The former points to a single instance of class Breakpoint. The latter points to a list of such instances since there may be more than one breakpoint per line. """ # XXX Keeping state in the class is a mistake -- this means # you cannot have more than one active Bdb instance. next = 1 # Next bp to be assigned bplist = {} # indexed by (file, lineno) tuple bpbynumber = [None] # Each entry is None or an instance of Bpt # index 0 is unused, except for marking an # effective break .... see effective() def __init__(self, file, line, temporary=0, cond = None): self.file = file # This better be in canonical form! self.line = line self.temporary = temporary self.cond = cond self.enabled = 1 self.ignore = 0 self.hits = 0 self.number = Breakpoint.next Breakpoint.next = Breakpoint.next + 1 # Build the two lists self.bpbynumber.append(self) if self.bplist.has_key((file, line)): self.bplist[file, line].append(self) else: self.bplist[file, line] = [self] def deleteMe(self): index = (self.file, self.line) self.bpbynumber[self.number] = None # No longer in list self.bplist[index].remove(self) if not self.bplist[index]: # No more bp for this f:l combo del self.bplist[index] def enable(self): self.enabled = 1 def disable(self): self.enabled = 0 def bpprint(self): if self.temporary: disp = 'del ' else: disp = 'keep ' if self.enabled: disp = disp + 'yes' else: disp = disp + 'no ' print '%-4dbreakpoint %s at %s:%d' % (self.number, disp, self.file, self.line) if self.cond: print '\tstop only if %s' % (self.cond,) if self.ignore: print '\tignore next %d hits' % (self.ignore) if (self.hits): if (self.hits > 1): ss = 's' else: ss = '' print ('\tbreakpoint already hit %d time%s' % (self.hits, ss)) # -----------end of Breakpoint class---------- # Determines if there is an effective (active) breakpoint at this # line of code. Returns breakpoint number or 0 if none def effective(file, line, frame): """Determine which breakpoint for this file:line is to be acted upon. Called only if we know there is a bpt at this location. Returns breakpoint that was triggered and a flag that indicates if it is ok to delete a temporary bp. """ possibles = Breakpoint.bplist[file,line] for i in range(0, len(possibles)): b = possibles[i] if b.enabled == 0: continue # Count every hit when bp is enabled b.hits = b.hits + 1 if not b.cond: # If unconditional, and ignoring, # go on to next, else break if b.ignore > 0: b.ignore = b.ignore -1 continue else: # breakpoint and marker that's ok # to delete if temporary return (b,1) else: # Conditional bp. # Ignore count applies only to those bpt hits where the # condition evaluates to true. try: val = eval(b.cond, frame.f_globals, frame.f_locals) if val: if b.ignore > 0: b.ignore = b.ignore -1 # continue else: return (b,1) # else: # continue except: # if eval fails, most conservative # thing is to stop on breakpoint # regardless of ignore count. # Don't delete temporary, # as another hint to user. return (b,0) return (None, None) # -------------------- testing -------------------- class Tdb(Bdb): def user_call(self, frame, args): name = frame.f_code.co_name if not name: name = '???' print '+++ call', name, args def user_line(self, frame): import linecache name = frame.f_code.co_name if not name: name = '???' fn = self.canonic(frame.f_code.co_filename) line = linecache.getline(fn, frame.f_lineno) print '+++', fn, frame.f_lineno, name, ':', line.strip() def user_return(self, frame, retval): print '+++ return', retval def user_exception(self, frame, exc_stuff): print '+++ exception', exc_stuff self.set_continue() def foo(n): print 'foo(', n, ')' x = bar(n*10) print 'bar returned', x def bar(a): print 'bar(', a, ')' return a/2 def test(): t = Tdb() t.run('import bdb; bdb.foo(10)') # end --- NEW FILE: README.txt --- Directory for pydev tests. Right now it is just a collection of random tests. A good project for volunteers. |
From: Aleksandar T. <at...@us...> - 2004-05-07 21:51:42
|
Update of /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9465/src/org/python/pydev/debug/ui Modified Files: PythonConsoleLineTracker.java Log Message: Final touches. Debugger is ready to go Index: PythonConsoleLineTracker.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/PythonConsoleLineTracker.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PythonConsoleLineTracker.java 22 Apr 2004 10:56:16 -0000 1.4 --- PythonConsoleLineTracker.java 7 May 2004 21:51:01 -0000 1.5 *************** *** 84,88 **** int num = -1; try { ! num = lineNumber != null ? Integer.parseInt(lineNumber) - 1: 0; } catch (NumberFormatException e) { --- 84,88 ---- int num = -1; try { ! num = lineNumber != null ? Integer.parseInt(lineNumber) : 0; } catch (NumberFormatException e) { *************** *** 96,100 **** File realFile = new File(fileName); if (realFile.exists()) { ! ItemPointer p = new ItemPointer(realFile, new Location(num, 0), null); link = new ConsoleLink(p); } --- 96,100 ---- File realFile = new File(fileName); if (realFile.exists()) { ! ItemPointer p = new ItemPointer(realFile, new Location(num+1, 0), null); link = new ConsoleLink(p); } |
From: Aleksandar T. <at...@us...> - 2004-05-07 21:51:41
|
Update of /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/remote In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9465/src/org/python/pydev/debug/model/remote Modified Files: RemoteDebugger.java AbstractDebuggerCommand.java Added Files: RunCommand.java Log Message: Final touches. Debugger is ready to go Index: RemoteDebugger.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/remote/RemoteDebugger.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RemoteDebugger.java 7 May 2004 02:03:08 -0000 1.2 --- RemoteDebugger.java 7 May 2004 21:51:02 -0000 1.3 *************** *** 130,134 **** } catch (IOException e1) { done = true; ! } } } --- 130,137 ---- } catch (IOException e1) { done = true; ! } ! if ((socket == null) || !socket.isConnected()) { ! done = true; ! } } } *************** *** 220,225 **** t = new Thread(writer, "pydevd.writer"); t.start(); - writer.postCommand(new VersionCommand(this)); - } --- 223,226 ---- Index: AbstractDebuggerCommand.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/remote/AbstractDebuggerCommand.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AbstractDebuggerCommand.java 7 May 2004 02:03:08 -0000 1.2 --- AbstractDebuggerCommand.java 7 May 2004 21:51:02 -0000 1.3 *************** *** 33,36 **** --- 33,37 ---- public abstract class AbstractDebuggerCommand { + static public final int CMD_RUN = 101; static public final int CMD_LIST_THREADS = 102; static public final int CMD_THREAD_CREATED = 103; --- NEW FILE: RunCommand.java --- /* * Author: atotic * Created on May 7, 2004 * License: Common Public License v1.0 */ package org.python.pydev.debug.model.remote; /** * Run command */ public class RunCommand extends AbstractDebuggerCommand { public RunCommand(RemoteDebugger debugger) { super(debugger); } public String getOutgoing() { return makeCommand(CMD_RUN, sequence, ""); } } |
Update of /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9465/src/org/python/pydev/debug/model Modified Files: PyDebugModelPresentation.java PyVariable.java PyVariableCollection.java PyThread.java PySourceLocator.java PyDebugTarget.java Log Message: Final touches. Debugger is ready to go Index: PyThread.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/PyThread.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PyThread.java 5 May 2004 02:02:00 -0000 1.4 --- PyThread.java 7 May 2004 21:50:59 -0000 1.5 *************** *** 56,59 **** --- 56,63 ---- return id; } + + public boolean isPydevThread() { + return isPydevThread; + } public int getPriority() throws DebugException { *************** *** 180,184 **** public IBreakpoint[] getBreakpoints() { ! // TODO Auto-generated method stub return null; } --- 184,189 ---- public IBreakpoint[] getBreakpoints() { ! // should return breakpoint that caused this thread to suspend ! // not implementing this seems to cause no harm return null; } Index: PyVariable.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/PyVariable.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PyVariable.java 5 May 2004 02:02:00 -0000 1.1 --- PyVariable.java 7 May 2004 21:50:59 -0000 1.2 *************** *** 17,22 **** /** ! * ! * TODO Comment this class * */ --- 17,25 ---- /** ! * Represents a python variable. ! * ! * Eclipse gives you an option to separate implementation of variable ! * and its value. I've found it convenient to roll both of them into 1 ! * class. * */ *************** *** 35,38 **** --- 38,45 ---- } + public String getDetailText() throws DebugException { + return getValueString(); + } + public IValue getValue() throws DebugException { return this; *************** *** 66,70 **** /** ! * TODO valueChanging nterface has not been implemented yet. * When implemented, recently changed variables are shown in red. */ --- 73,77 ---- /** ! * LATER valueChanging nterface has not been implemented yet. * When implemented, recently changed variables are shown in red. */ *************** *** 97,103 **** return target.getAdapter(adapter); else if (adapter.equals(IPropertySource.class) || ! adapter.equals(ITaskListResourceAdapter.class)) return super.getAdapter(adapter); // ongoing, I do not fully understand all the interfaces they'd like me to support System.err.println("PyVariable Need adapter " + adapter.toString()); return super.getAdapter(adapter); --- 104,115 ---- return target.getAdapter(adapter); else if (adapter.equals(IPropertySource.class) || ! adapter.equals(ITaskListResourceAdapter.class) || ! adapter.equals(org.eclipse.ui.IContributorResourceAdapter.class) || ! adapter.equals(org.eclipse.ui.IActionFilter.class) || ! adapter.equals(org.eclipse.ui.model.IWorkbenchAdapter.class) ! ) return super.getAdapter(adapter); // ongoing, I do not fully understand all the interfaces they'd like me to support + // so I print them out as errors System.err.println("PyVariable Need adapter " + adapter.toString()); return super.getAdapter(adapter); Index: PyVariableCollection.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/PyVariableCollection.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PyVariableCollection.java 5 May 2004 02:02:00 -0000 1.1 --- PyVariableCollection.java 7 May 2004 21:50:59 -0000 1.2 *************** *** 18,23 **** /** ! * ! * TODO Comment this class */ public class PyVariableCollection extends PyVariable implements ICommandResponseListener, IVariableLocator { --- 18,25 ---- /** ! * PyVariableCollection represents container variables. ! * ! * It knows how to fetch its contents over the network. ! * */ public class PyVariableCollection extends PyVariable implements ICommandResponseListener, IVariableLocator { *************** *** 34,37 **** --- 36,54 ---- } + public String getDetailText() throws DebugException { + return super.getDetailText(); + // StringBuffer buf = new StringBuffer(); + // buf.append("{ "); + // for (int i=0; i<variables.length; i++) { + // buf.append(variables[i].getName()); + // buf.append(" : "); + // buf.append(variables[i].getValueString()); + // if (i != variables.length - 1) + // buf.append(", "); + // } + // buf.append(" }"); + // return buf.toString(); + } + public String getPyDBLocation() { return locator.getPyDBLocation() + "\t" + name; Index: PyDebugModelPresentation.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/PyDebugModelPresentation.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PyDebugModelPresentation.java 7 May 2004 02:03:07 -0000 1.1 --- PyDebugModelPresentation.java 7 May 2004 21:50:59 -0000 1.2 *************** *** 11,15 **** --- 11,18 ---- import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; + import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IStatus; + import org.eclipse.core.runtime.Path; + import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.model.IValue; import org.eclipse.debug.ui.IDebugModelPresentation; *************** *** 19,23 **** --- 22,28 ---- import org.eclipse.swt.graphics.Image; import org.eclipse.ui.IEditorInput; + import org.eclipse.ui.IEditorPart; import org.python.pydev.debug.core.PydevDebugPlugin; + import org.python.pydev.plugin.PydevPlugin; /** *************** *** 30,33 **** --- 35,39 ---- protected ListenerList fListeners= new ListenerList(); + protected boolean displayVariableTypeNames = false; // variables display attribute public Image getImage(Object element) { *************** *** 41,44 **** --- 47,54 ---- PydevDebugPlugin.log(IStatus.ERROR, "getImage error", e); } + } else if (element instanceof PyVariableCollection) { + return PydevDebugPlugin.getImageCache().get("icons/greendot_big.gif"); + } else if (element instanceof PyVariable) { + return PydevDebugPlugin.getImageCache().get("icons/greendot.gif"); } else if (element instanceof PyDebugTarget || *************** *** 78,82 **** || element instanceof PyStackFrame || element instanceof PyThread) { ! return null; } PydevDebugPlugin.log(IStatus.ERROR, "unknown debug type", null); --- 88,95 ---- || element instanceof PyStackFrame || element instanceof PyThread) { ! return null; // defaults work ! } else if (element instanceof PyVariableCollection ! || element instanceof PyVariable) { ! return null; // defaults are fine } PydevDebugPlugin.log(IStatus.ERROR, "unknown debug type", null); *************** *** 85,117 **** /** ! * override ! * TODO comment this method */ public void computeDetail(IValue value, IValueDetailListener listener) { ! // TODO Auto-generated method stub ! System.out.println("in detail"); } /** ! * override ! * TODO comment this method */ public IEditorInput getEditorInput(Object element) { ! // TODO Auto-generated method stub return null; } /** ! * override ! * TODO comment this method */ public String getEditorId(IEditorInput input, Object element) { - // TODO Auto-generated method stub return null; } public void setAttribute(String attribute, Object value) { ! // TODO Auto-generated method stub ! System.out.println("setattribute"); } --- 98,140 ---- /** ! * We've got some work to do to replicate here, because we ! * can't return null, and have LazyModel presentation do the default */ public void computeDetail(IValue value, IValueDetailListener listener) { ! if (value instanceof PyVariable) { ! try { ! ((PyVariable)value).getVariables(); ! listener.detailComputed(value, ((PyVariable)value).getDetailText()); ! } catch (DebugException e) { ! PydevDebugPlugin.errorDialog("Unexpected error fetching variable", e); ! } ! } } /** ! * Returns editor to be displayed */ public IEditorInput getEditorInput(Object element) { ! if (element instanceof PyBreakpoint) { ! String file = ((PyBreakpoint)element).getFile(); ! IPath path = new Path(file); ! IEditorPart part = PydevPlugin.doOpenEditor(path, false); ! return part.getEditorInput(); ! } return null; } /** ! * @see org.eclipse.debug.ui.ISourcePresentation#getEditorInput */ public String getEditorId(IEditorInput input, Object element) { return null; } public void setAttribute(String attribute, Object value) { ! if (attribute.equals(IDebugModelPresentation.DISPLAY_VARIABLE_TYPE_NAMES)) ! displayVariableTypeNames = ((Boolean)value).booleanValue(); ! else ! System.err.println("setattribute"); } *************** *** 127,136 **** } - public boolean isLabelProperty(Object element, String property) { // Not really sure what this does. see IBaseLabelProvider:isLabelProperty return false; } - - } --- 150,156 ---- Index: PySourceLocator.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/PySourceLocator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PySourceLocator.java 28 Apr 2004 02:49:48 -0000 1.2 --- PySourceLocator.java 7 May 2004 21:50:59 -0000 1.3 *************** *** 12,22 **** import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IEditorPart; import org.python.pydev.plugin.PydevPlugin; /** ! * ! * TODO Comment this class * - * Take a look at IDebugModelPresentation */ public class PySourceLocator implements ISourceLocator, ISourcePresentation { --- 12,21 ---- import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IEditorPart; + import org.python.pydev.editor.PyEdit; import org.python.pydev.plugin.PydevPlugin; /** ! * Locates source files from stack elements * */ public class PySourceLocator implements ISourceLocator, ISourcePresentation { *************** *** 30,34 **** IPath path = ((PyStackFrame)element).getPath(); if (path != null) { ! IEditorPart part = PydevPlugin.getDefault().doOpenEditor(path, false); if (part != null) { return part.getEditorInput(); --- 29,33 ---- IPath path = ((PyStackFrame)element).getPath(); if (path != null) { ! IEditorPart part = PydevPlugin.doOpenEditor(path, false); if (part != null) { return part.getEditorInput(); *************** *** 40,44 **** public String getEditorId(IEditorInput input, Object element) { ! return "org.python.pydev.editor.PythonEditor"; } --- 39,43 ---- public String getEditorId(IEditorInput input, Object element) { ! return PyEdit.EDITOR_ID; } Index: PyDebugTarget.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/PyDebugTarget.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PyDebugTarget.java 7 May 2004 02:03:07 -0000 1.5 --- PyDebugTarget.java 7 May 2004 21:50:59 -0000 1.6 *************** *** 10,14 **** --- 10,16 ---- import org.eclipse.core.resources.IFile; + import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IMarkerDelta; + import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.ResourcesPlugin; *************** *** 32,37 **** import org.eclipse.ui.views.tasklist.ITaskListResourceAdapter; import org.python.pydev.debug.core.PydevDebugPlugin; import org.python.pydev.debug.model.remote.*; - /** * Debugger class that represents a single python process. --- 34,39 ---- import org.eclipse.ui.views.tasklist.ITaskListResourceAdapter; import org.python.pydev.debug.core.PydevDebugPlugin; + import org.python.pydev.debug.core.PydevDebugPrefs; import org.python.pydev.debug.model.remote.*; /** * Debugger class that represents a single python process. *************** *** 66,69 **** --- 68,102 ---- } + /** + * Called after debugger has been connected. + * + * Here we send all the initialization commands + */ + public void initialize() { + // we post version command just for fun + // it establishes the connection + debugger.postCommand(new VersionCommand(debugger)); + + // now, register all the breakpoints in our project + IFile launched = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(file); + IProject project = launched.getProject(); + try { + IMarker[] markers = project.findMarkers(PyBreakpoint.PY_BREAK_MARKER, true, IResource.DEPTH_INFINITE); + IBreakpointManager breakpointManager= DebugPlugin.getDefault().getBreakpointManager(); + for (int i= 0; i < markers.length; i++) { + PyBreakpoint brk = (PyBreakpoint)breakpointManager.getBreakpoint(markers[i]); + if (brk.isEnabled()) { + SetBreakpointCommand cmd = new SetBreakpointCommand(debugger, brk.getFile(), brk.getLine()); + debugger.postCommand(cmd); + } + } + } catch (Throwable t) { + PydevDebugPlugin.errorDialog("Error setting breakpoints", t); + } + // Send the run command, and we are off + RunCommand run = new RunCommand(debugger); + debugger.postCommand(run); + } + public RemoteDebugger getDebugger() { return debugger; *************** *** 201,208 **** public void breakpointAdded(IBreakpoint breakpoint) { ! if (breakpoint instanceof PyBreakpoint) { ! PyBreakpoint b = (PyBreakpoint)breakpoint; ! SetBreakpointCommand cmd = new SetBreakpointCommand(debugger, b.getFile(), b.getLine()); ! debugger.postCommand(cmd); } } --- 234,245 ---- public void breakpointAdded(IBreakpoint breakpoint) { ! try { ! if (breakpoint instanceof PyBreakpoint && ((PyBreakpoint)breakpoint).isEnabled()) { ! PyBreakpoint b = (PyBreakpoint)breakpoint; ! SetBreakpointCommand cmd = new SetBreakpointCommand(debugger, b.getFile(), b.getLine()); ! debugger.postCommand(cmd); ! } ! } catch (CoreException e) { ! e.printStackTrace(); } } *************** *** 301,304 **** --- 338,364 ---- return; } + + // Hide Pydevd threads if requested + if (PydevDebugPrefs.getPreferences().getBoolean(PydevDebugPrefs.HIDE_PYDEVD_THREADS)) { + int removeThisMany = 0; + for (int i=0; i< newThreads.length; i++) + if (((PyThread)newThreads[i]).isPydevThread()) + removeThisMany++; + if (removeThisMany > 0) { + int newSize = newThreads.length - removeThisMany; + if (newSize == 0) // no threads to add + return; + else { + IThread[] newnewThreads = new IThread[newSize]; + int ii = 0; + for (int i =0; i< newThreads.length; i++) + if (!((PyThread)newThreads[i]).isPydevThread()) + newnewThreads[ii++] = newThreads[i]; + newThreads = newnewThreads; + } + } + } + + // add threads to the thread list, and fire event if (threads == null) threads = newThreads; *************** *** 362,366 **** } } ! static Pattern threadRunPattern = Pattern.compile("(\\d+)\\t(\\w*)"); /** --- 422,427 ---- } } ! ! // thread_id\tresume_reason static Pattern threadRunPattern = Pattern.compile("(\\d+)\\t(\\w*)"); /** |
From: Aleksandar T. <at...@us...> - 2004-05-07 21:51:40
|
Update of /cvsroot/pydev/org.python.pydev.debug/pysrc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9465/pysrc Modified Files: pydevd_vars.py pydevd.py Log Message: Final touches. Debugger is ready to go Index: pydevd.py =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/pysrc/pydevd.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** pydevd.py 7 May 2004 02:03:07 -0000 1.4 --- pydevd.py 7 May 2004 21:51:00 -0000 1.5 *************** *** 77,81 **** __all__ = (); ! _trace = 2 def log(level, s): --- 77,81 ---- __all__ = (); ! _trace = -1 def log(level, s): *************** *** 86,90 **** """ if (level <= _trace): ! print s --- 86,90 ---- """ if (level <= _trace): ! print sys.stderr, s *************** *** 108,112 **** while (buffer.find('\n') != -1): [command, buffer] = buffer.split('\n', 1) ! log(2, "received command " + command) args = command.split('\t', 2) # print "the args are", args[0], " 2 ", args[1], " 3 ", args[2] --- 108,112 ---- while (buffer.find('\n') != -1): [command, buffer] = buffer.split('\n', 1) ! log(1, "received command " + command) args = command.split('\t', 2) # print "the args are", args[0], " 2 ", args[1], " 3 ", args[2] *************** *** 136,140 **** while(True): cmd = self.cmdQueue.get(1) ! log(2, "sending cmd " + cmd.getOutgoing()) self.sock.sendall(cmd.getOutgoing()) except: --- 136,140 ---- while(True): cmd = self.cmdQueue.get(1) ! log(1, "sending cmd " + cmd.getOutgoing()) self.sock.sendall(cmd.getOutgoing()) except: *************** *** 285,289 **** def doIt(self, dbg): ! print "killing " + str(self.thread_id) cmd = dbg.cmdFactory.makeThreadKilledMessage(self.thread_id) dbg.writer.addCommand(cmd) --- 285,289 ---- def doIt(self, dbg): ! log(1, "killing " + str(self.thread_id)) cmd = dbg.cmdFactory.makeThreadKilledMessage(self.thread_id) dbg.writer.addCommand(cmd) *************** *** 303,310 **** """ Converts request into python variable """ try: - print >>sys.stderr, "getVar::doIt" xml = "<xml>" valDict = pydevd_vars.resolveCompoundVariable(self.thread, self.frame_id, self.scope, self.attributes) - print >>sys.stderr, "resolved variable" keys = valDict.keys() keys.sort() --- 303,308 ---- *************** *** 312,322 **** xml += pydevd_vars.varToXML(valDict[k], str(k)) xml += "</xml>" ! print >>sys.stderr, "done to xml" cmd = dbg.cmdFactory.makeGetVariableMessage(self.sequence, xml) ! print >>sys.stderr, "sending command" dbg.writer.addCommand(cmd) except Exception, e: ! print >>sys.stderr, "ERROR RESOLVING", str(e) ! cmd = dbg.cmdFactory.makeErrorMessage(self.sequence, "Error resolving variables" + str(e)) dbg.writer.addCommand(cmd) --- 310,319 ---- xml += pydevd_vars.varToXML(valDict[k], str(k)) xml += "</xml>" ! # print >>sys.stderr, "done to xml" cmd = dbg.cmdFactory.makeGetVariableMessage(self.sequence, xml) ! # print >>sys.stderr, "sending command" dbg.writer.addCommand(cmd) except Exception, e: ! cmd = dbg.cmdFactory.makeErrorMessage(self.sequence, "Error resolving variables " + str(e)) dbg.writer.addCommand(cmd) *************** *** 362,365 **** --- 359,363 ---- self.cmdQueue = {} # the hash of Queues. Key is thread id, value is thread self.breakpoints = {} + self.readyToRun = False def initializeNetwork(self, sock): *************** *** 424,428 **** def postInternalCommand(self, int_cmd, thread_id): """ if thread_id is *, post to all """ ! print "Posting internal command for ", str(thread_id) if (thread_id == "*"): for k in self.cmdQueue.keys(): self.cmdQueue[k].put(int_cmd) --- 422,426 ---- def postInternalCommand(self, int_cmd, thread_id): """ if thread_id is *, post to all """ ! # print "Posting internal command for ", str(thread_id) if (thread_id == "*"): for k in self.cmdQueue.keys(): self.cmdQueue[k].put(int_cmd) *************** *** 444,449 **** try: cmd = None ! # print >>sys.stderr, "processing command", id ! if (id == CMD_VERSION): # response is version number cmd = self.cmdFactory.makeVersionMessage(seq) elif (id == CMD_LIST_THREADS): # response is a list of threads --- 442,448 ---- try: cmd = None ! if (id == CMD_RUN): ! self.readyToRun = True ! elif (id == CMD_VERSION): # response is version number cmd = self.cmdFactory.makeVersionMessage(seq) elif (id == CMD_LIST_THREADS): # response is a list of threads *************** *** 453,460 **** self.postInternalCommand(int_cmd, text) elif (id == CMD_THREAD_SUSPEND): ! print >>sys.stderr, "About to suspend ", text t = findThreadById(text) if t: self.setSuspend(t, CMD_THREAD_SUSPEND) ! else: print >>sys.stderr, "Could not find thread ", t elif (id == CMD_THREAD_RUN): t = findThreadById(text) --- 452,459 ---- self.postInternalCommand(int_cmd, text) elif (id == CMD_THREAD_SUSPEND): ! # print >>sys.stderr, "About to suspend ", text t = findThreadById(text) if t: self.setSuspend(t, CMD_THREAD_SUSPEND) ! # else: print >>sys.stderr, "Could not find thread ", t elif (id == CMD_THREAD_RUN): t = findThreadById(text) *************** *** 483,488 **** # text is file\tline. Add to breakpoints dictionary (file, line) = text.split('\t', 1) - print "line is ", line - print "file is ", file if self.breakpoints.has_key(file): breakDict = self.breakpoints[file] --- 482,485 ---- *************** *** 491,495 **** breakDict[int(line)] = True self.breakpoints[file] = breakDict ! print >>sys.stderr, "Set breakpoint at ", file, line elif (id == CMD_REMOVE_BREAK): # text is file\tline. Remove from breakpoints dictionary --- 488,492 ---- breakDict[int(line)] = True self.breakpoints[file] = breakDict ! log(1, "Set breakpoint at " + file + " " + line) elif (id == CMD_REMOVE_BREAK): # text is file\tline. Remove from breakpoints dictionary *************** *** 506,510 **** else: cmd = self.cmdFactory.makeErrorMessage(seq, "unexpected command " + str(id)) ! print >>sys.stderr, "processed command", id if cmd: self.writer.addCommand(cmd) --- 503,507 ---- else: cmd = self.cmdFactory.makeErrorMessage(seq, "unexpected command " + str(id)) ! log( 1, "processed command " + str (id)) if cmd: self.writer.addCommand(cmd) *************** *** 523,527 **** thread.pydev_notify_kill = False if not wasNotified: ! log(0, "leaving stopped thread " + str(id(thread))) cmd = self.cmdFactory.makeThreadKilledMessage(id(thread)) self.writer.addCommand(cmd) --- 520,524 ---- thread.pydev_notify_kill = False if not wasNotified: ! log(1, "leaving stopped thread " + str(id(thread))) cmd = self.cmdFactory.makeThreadKilledMessage(id(thread)) self.writer.addCommand(cmd) *************** *** 561,565 **** pass ! print >>sys.stderr, "thread resumed", thread.getName() cmd = self.cmdFactory.makeThreadRunMessage(id(thread), thread.pydev_step_cmd) self.writer.addCommand(cmd) --- 558,562 ---- pass ! log(1, "thread resumed " + thread.getName()) cmd = self.cmdFactory.makeThreadRunMessage(id(thread), thread.pydev_step_cmd) self.writer.addCommand(cmd) *************** *** 590,594 **** return self.trace_dispatch except AttributeError: ! print "Attribute ERROR" t.pydev_state = PyDB.STATE_RUN # assign it to avoid future exceptions except: --- 587,591 ---- return self.trace_dispatch except AttributeError: ! # print "Attribute ERROR" t.pydev_state = PyDB.STATE_RUN # assign it to avoid future exceptions except: *************** *** 664,677 **** threading.settrace(self.trace_dispatch) # for all future threads sys.settrace(self.trace_dispatch) # for this thread try: try: - print "exec start" exec cmd in globals, locals - print >>sys.stderr, "Debugger done" except: print >>sys.stderr, "Debugger exiting with exception" raise finally: - print "Quitting now" self.quitting = 1 --- 661,672 ---- threading.settrace(self.trace_dispatch) # for all future threads sys.settrace(self.trace_dispatch) # for this thread + while not self.readyToRun: time.sleep(0.1) # busy wait until we receive run command try: try: exec cmd in globals, locals except: print >>sys.stderr, "Debugger exiting with exception" raise finally: self.quitting = 1 *************** *** 714,721 **** def quittingNow(): ! log(1, "Exit function called. Bye") if __name__ == '__main__': ! print sys.stderr, "pydev debugger" # parse the command line. --file is our last argument that is required try: --- 709,716 ---- def quittingNow(): ! log(1, "Debugger exiting. Over & out....\n") if __name__ == '__main__': ! print >>sys.stderr, "pydev debugger" # parse the command line. --file is our last argument that is required try: Index: pydevd_vars.py =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/pysrc/pydevd_vars.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pydevd_vars.py 7 May 2004 02:03:07 -0000 1.1 --- pydevd_vars.py 7 May 2004 21:51:00 -0000 1.2 *************** *** 115,126 **** # print "Calling frameVarsToXML" xml = "" ! try: ! keys = frame.f_locals.keys() ! keys.sort() ! for k in keys: ! v = frame.f_locals[k] ! xml += varToXML(v, str(k)) ! except: ! traceback.print_exc() return xml --- 115,123 ---- # print "Calling frameVarsToXML" xml = "" ! keys = frame.f_locals.keys() ! keys.sort() ! for k in keys: ! v = frame.f_locals[k] ! xml += varToXML(v, str(k)) return xml *************** *** 148,157 **** var = frame.f_locals for k in attrList: ! print >>sys.stderr, "resolving ", k ! print >>sys.stderr, "attribute is ", k (type, typeName, resolver) = getType(var) var = resolver.resolve(var, k) ! print >>sys.stderr, "Got variable", var (type, typeName, resolver) = getType(var) return resolver.getDictionary(var) --- 145,154 ---- var = frame.f_locals for k in attrList: ! # print >>sys.stderr, "resolving ", k ! # print >>sys.stderr, "attribute is ", k (type, typeName, resolver) = getType(var) var = resolver.resolve(var, k) ! # print >>sys.stderr, "Got variable", var (type, typeName, resolver) = getType(var) return resolver.getDictionary(var) |
From: Aleksandar T. <at...@us...> - 2004-05-07 21:51:40
|
Update of /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9465/src/org/python/pydev/debug/core Modified Files: PydevDebugPrefs.java Log Message: Final touches. Debugger is ready to go Index: PydevDebugPrefs.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/core/PydevDebugPrefs.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PydevDebugPrefs.java 5 May 2004 02:02:01 -0000 1.1 --- PydevDebugPrefs.java 7 May 2004 21:51:00 -0000 1.2 *************** *** 27,31 **** // Preferences public static final String GET_VARIABLE_TIMEOUT = "GET_VARIABLE_TIMEOUT";// GetVariable command timeout ! public static final int DEFAULT_GET_VARIABLE_TIMEOUT = 30; /** --- 27,33 ---- // Preferences public static final String GET_VARIABLE_TIMEOUT = "GET_VARIABLE_TIMEOUT";// GetVariable command timeout ! public static final int DEFAULT_GET_VARIABLE_TIMEOUT = 30; ! public static final String HIDE_PYDEVD_THREADS = "HIDE_PYDEVD_THREADS"; ! public static final boolean DEFAULT_HIDE_PYDEVD_THREADS = true; /** *************** *** 61,64 **** --- 63,67 ---- protected static void initializeDefaultPreferences(Preferences prefs) { prefs.setDefault(GET_VARIABLE_TIMEOUT, DEFAULT_GET_VARIABLE_TIMEOUT); + prefs.setDefault(HIDE_PYDEVD_THREADS, DEFAULT_HIDE_PYDEVD_THREADS); } } |
From: Aleksandar T. <at...@us...> - 2004-05-07 21:51:38
|
Update of /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/launching In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9465/src/org/python/pydev/debug/ui/launching Modified Files: PythonRunner.java PythonRunnerConfig.java Log Message: Final touches. Debugger is ready to go Index: PythonRunner.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/launching/PythonRunner.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PythonRunner.java 7 May 2004 02:03:06 -0000 1.6 --- PythonRunner.java 7 May 2004 21:50:59 -0000 1.7 *************** *** 78,81 **** --- 78,82 ---- launch.setSourceLocator(new PySourceLocator()); debugger.startTransmission(); // this starts reading/writing from sockets + t.initialize(); } Index: PythonRunnerConfig.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/launching/PythonRunnerConfig.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PythonRunnerConfig.java 7 May 2004 02:03:06 -0000 1.4 --- PythonRunnerConfig.java 7 May 2004 21:50:59 -0000 1.5 *************** *** 52,56 **** if (isDebug) { debugScript = getDebugScript(); - // TODO debug socket port? } // E3 String[] envp = DebugPlugin.getDefault().getLaunchManager().getEnvironment(conf); --- 52,55 ---- |
From: Aleksandar T. <at...@us...> - 2004-05-07 21:51:18
|
Update of /cvsroot/pydev/org.python.pydev.debug In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9465 Modified Files: Changes.txt plugin.xml Log Message: Final touches. Debugger is ready to go Index: Changes.txt =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/Changes.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Changes.txt 7 May 2004 02:03:11 -0000 1.2 --- Changes.txt 7 May 2004 21:51:02 -0000 1.3 *************** *** 10,12 **** Future ideas: - changing the values API inside PyVariable ! - better variable refresh \ No newline at end of file --- 10,13 ---- Future ideas: - changing the values API inside PyVariable ! - better variable refresh ! - give user an option to specify debug port (better for remote debugging) \ No newline at end of file Index: plugin.xml =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/plugin.xml,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** plugin.xml 7 May 2004 02:03:11 -0000 1.9 --- plugin.xml 7 May 2004 21:51:09 -0000 1.10 *************** *** 203,220 **** </debugModelPresentation> </extension> - <!--- breakpoint marker --> - <!--- <extension id="breakpointMarker" point="org.eclipse.core.resources.markers"> - <super type="org.eclipse.core.resources.marker"/> - <persistent value="true"/> - <attribute name="org.eclipse.debug.core.modelIdentifier"/> - <attribute name="org.eclipse.debug.core.enabled"/> - <attribute name="org.eclipse.debug.core.registered"/> - <attribute name="org.eclipse.debug.core.persisted"/> - </extension> - <extension id="lineBreakpointMarker" point="org.eclipse.core.resources.markers"> - <super type="org.eclipse.debug.core.breakpointMarker"/> - <super type="org.eclipse.core.resources.textmarker"/> - <persistent value="true"/> - </extension> --> </plugin> --- 203,206 ---- |
From: Aleksandar T. <at...@us...> - 2004-05-07 21:51:10
|
Update of /cvsroot/pydev/org.python.pydev.debug/icons In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9465/icons Added Files: greendot_big.gif greendot.gif Log Message: Final touches. Debugger is ready to go --- NEW FILE: greendot_big.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: greendot.gif --- (This appears to be a binary file; contents omitted.) |
From: Aleksandar T. <at...@us...> - 2004-05-07 21:49:09
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/plugin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9110/src/org/python/pydev/plugin Modified Files: PydevPlugin.java Log Message: Final touches. Debugger is ready to go Index: PydevPlugin.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/plugin/PydevPlugin.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** PydevPlugin.java 5 May 2004 02:05:19 -0000 1.7 --- PydevPlugin.java 7 May 2004 21:49:00 -0000 1.8 *************** *** 110,119 **** * @return part that is the editor */ ! public IEditorPart doOpenEditor(IPath path, boolean activate) { if (path == null) return null; IWorkspace w = ResourcesPlugin.getWorkspace(); IFile file = w.getRoot().getFileForLocation(path); ! IWorkbenchPage wp = getWorkbench().getActiveWorkbenchWindow().getActivePage(); try { if (file != null && file.exists()) { --- 110,119 ---- * @return part that is the editor */ ! public static IEditorPart doOpenEditor(IPath path, boolean activate) { if (path == null) return null; IWorkspace w = ResourcesPlugin.getWorkspace(); IFile file = w.getRoot().getFileForLocation(path); ! IWorkbenchPage wp = plugin.getWorkbench().getActiveWorkbenchWindow().getActivePage(); try { if (file != null && file.exists()) { |
From: Aleksandar T. <at...@us...> - 2004-05-07 21:49:08
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/actions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9110/src/org/python/pydev/editor/actions Modified Files: PyOpenAction.java Log Message: Final touches. Debugger is ready to go Index: PyOpenAction.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/actions/PyOpenAction.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PyOpenAction.java 5 May 2004 02:05:08 -0000 1.4 --- PyOpenAction.java 7 May 2004 21:48:58 -0000 1.5 *************** *** 55,65 **** IEditorPart editor = null; if (p.file instanceof IFile) ! editor = PydevPlugin.getDefault().doOpenEditor(((IFile)p.file).getFullPath(), true); else if (p.file instanceof IPath) { ! editor = PydevPlugin.getDefault().doOpenEditor((IPath)p.file, true); } else if (p.file instanceof File) { Path path = new Path(((File)p.file).getAbsolutePath()); ! editor = PydevPlugin.getDefault().doOpenEditor(path, true); } if (editor instanceof ITextEditor) { --- 55,65 ---- IEditorPart editor = null; if (p.file instanceof IFile) ! editor = PydevPlugin.doOpenEditor(((IFile)p.file).getFullPath(), true); else if (p.file instanceof IPath) { ! editor = PydevPlugin.doOpenEditor((IPath)p.file, true); } else if (p.file instanceof File) { Path path = new Path(((File)p.file).getAbsolutePath()); ! editor = PydevPlugin.doOpenEditor(path, true); } if (editor instanceof ITextEditor) { |
From: Aleksandar T. <at...@us...> - 2004-05-07 21:49:08
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9110/src/org/python/pydev/editor Modified Files: PyEdit.java Log Message: Final touches. Debugger is ready to go Index: PyEdit.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/PyEdit.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** PyEdit.java 27 Apr 2004 01:06:57 -0000 1.14 --- PyEdit.java 7 May 2004 21:48:59 -0000 1.15 *************** *** 69,72 **** --- 69,73 ---- public class PyEdit extends TextEditor implements IParserListener { + static public String EDITOR_ID = "org.python.pydev.editor.PythonEditor"; static public String ACTION_OPEN = "OpenEditor"; |
From: Aleksandar T. <at...@us...> - 2004-05-07 02:07:29
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/ui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14127/src/org/python/pydev/ui Modified Files: ImageCache.java Log Message: Breakpoints, first cut Index: ImageCache.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/ui/ImageCache.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ImageCache.java 10 Dec 2003 10:14:27 -0000 1.2 --- ImageCache.java 7 May 2004 02:07:20 -0000 1.3 *************** *** 13,17 **** import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.swt.graphics.Image; - import org.python.pydev.plugin.PydevPlugin; /** --- 13,16 ---- *************** *** 20,27 **** public class ImageCache { private HashMap imageHash = new HashMap(10); private Image missing = null; ! public ImageCache() { } --- 19,29 ---- public class ImageCache { + private HashMap imageHash = new HashMap(10); + private URL baseURL; private Image missing = null; ! public ImageCache(URL baseURL) { ! this.baseURL = baseURL; } *************** *** 65,69 **** */ public ImageDescriptor getDescriptor(String key) throws MalformedURLException { ! URL url = new URL(PydevPlugin.getDefault().getDescriptor().getInstallURL(), key); return ImageDescriptor.createFromURL(url); } --- 67,71 ---- */ public ImageDescriptor getDescriptor(String key) throws MalformedURLException { ! URL url = new URL(baseURL, key); return ImageDescriptor.createFromURL(url); } |
From: Aleksandar T. <at...@us...> - 2004-05-07 02:07:29
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/outline In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14127/src/org/python/pydev/outline Modified Files: PyOutlinePage.java Log Message: Breakpoints, first cut Index: PyOutlinePage.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/outline/PyOutlinePage.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** PyOutlinePage.java 10 Apr 2004 01:48:12 -0000 1.7 --- PyOutlinePage.java 7 May 2004 02:07:20 -0000 1.8 *************** *** 26,29 **** --- 26,30 ---- import org.python.pydev.editor.PyEdit; import org.python.pydev.editor.model.AbstractNode; + import org.python.pydev.plugin.PydevPlugin; import org.python.pydev.ui.ImageCache; import org.python.pydev.ui.UIConstants; *************** *** 51,55 **** IDocument document; IOutlineModel model; ! ImageCache imageCache = new ImageCache(); // listeners to rawPartition --- 52,56 ---- IDocument document; IOutlineModel model; ! ImageCache imageCache; // listeners to rawPartition *************** *** 59,62 **** --- 60,64 ---- super(); this.editorView = editorView; + imageCache = new ImageCache(PydevPlugin.getDefault().getDescriptor().getInstallURL()); } |