pydev-code Mailing List for PyDev for Eclipse (Page 34)
Brought to you by:
fabioz
You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
(14) |
Apr
(18) |
May
(12) |
Jun
(34) |
Jul
(31) |
Aug
(37) |
Sep
(22) |
Oct
(2) |
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(1) |
Feb
(4) |
Mar
(9) |
Apr
(1) |
May
|
Jun
(2) |
Jul
(24) |
Aug
(3) |
Sep
(5) |
Oct
(3) |
Nov
(3) |
Dec
(5) |
2006 |
Jan
(5) |
Feb
(23) |
Mar
(5) |
Apr
(80) |
May
(26) |
Jun
(13) |
Jul
(13) |
Aug
(4) |
Sep
(31) |
Oct
(24) |
Nov
(6) |
Dec
(2) |
2007 |
Jan
(7) |
Feb
|
Mar
(26) |
Apr
(3) |
May
(8) |
Jun
(6) |
Jul
(11) |
Aug
(2) |
Sep
(4) |
Oct
|
Nov
(9) |
Dec
(3) |
2008 |
Jan
(7) |
Feb
(1) |
Mar
(6) |
Apr
(7) |
May
(9) |
Jun
(14) |
Jul
(9) |
Aug
(6) |
Sep
(10) |
Oct
(5) |
Nov
(8) |
Dec
(5) |
2009 |
Jan
(8) |
Feb
(10) |
Mar
(10) |
Apr
(1) |
May
(3) |
Jun
(5) |
Jul
(10) |
Aug
(3) |
Sep
(12) |
Oct
(6) |
Nov
(22) |
Dec
(12) |
2010 |
Jan
(10) |
Feb
(17) |
Mar
(5) |
Apr
(9) |
May
(8) |
Jun
(2) |
Jul
(4) |
Aug
(12) |
Sep
(1) |
Oct
(1) |
Nov
(8) |
Dec
|
2011 |
Jan
(14) |
Feb
(8) |
Mar
(3) |
Apr
(11) |
May
(6) |
Jun
(5) |
Jul
(10) |
Aug
(7) |
Sep
|
Oct
(4) |
Nov
(4) |
Dec
(8) |
2012 |
Jan
|
Feb
(8) |
Mar
(10) |
Apr
(5) |
May
(4) |
Jun
(10) |
Jul
|
Aug
(2) |
Sep
(2) |
Oct
(11) |
Nov
(1) |
Dec
|
2013 |
Jan
(1) |
Feb
(2) |
Mar
(11) |
Apr
(10) |
May
(7) |
Jun
(9) |
Jul
(13) |
Aug
(20) |
Sep
(4) |
Oct
(18) |
Nov
(5) |
Dec
(7) |
2014 |
Jan
(3) |
Feb
(5) |
Mar
(7) |
Apr
(5) |
May
(10) |
Jun
(2) |
Jul
|
Aug
(1) |
Sep
(7) |
Oct
(1) |
Nov
(1) |
Dec
(1) |
2015 |
Jan
(1) |
Feb
(1) |
Mar
(8) |
Apr
(3) |
May
(1) |
Jun
(2) |
Jul
(1) |
Aug
(2) |
Sep
(1) |
Oct
(3) |
Nov
(5) |
Dec
(1) |
2016 |
Jan
(26) |
Feb
(10) |
Mar
(4) |
Apr
|
May
(4) |
Jun
(3) |
Jul
|
Aug
(1) |
Sep
|
Oct
(1) |
Nov
(4) |
Dec
(3) |
2017 |
Jan
(3) |
Feb
|
Mar
(9) |
Apr
(2) |
May
|
Jun
(1) |
Jul
|
Aug
(9) |
Sep
(1) |
Oct
|
Nov
(2) |
Dec
|
2018 |
Jan
|
Feb
(2) |
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
(4) |
Oct
(2) |
Nov
(1) |
Dec
(3) |
2019 |
Jan
(4) |
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
(4) |
Aug
|
Sep
|
Oct
(3) |
Nov
|
Dec
|
2020 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
(4) |
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
(11) |
2021 |
Jan
(3) |
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2022 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
(3) |
Sep
|
Oct
|
Nov
|
Dec
|
2023 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
2024 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(3) |
Oct
|
Nov
|
Dec
|
From: Fabio Z. <fa...@gm...> - 2006-09-26 19:56:36
|
Pydev and Pydev Extensions 1.2.4 have been released Details on Pydev Extensions: http://www.fabioz.com/pydev Details on Pydev: http://pydev.sf.net Details on its development: http://pydev.blogspot.com Release Highlights in Pydev Extensions: ----------------------------------------------------------------- * Code analysis: analysis on imported modules do no longer give you errors on * classes that have __getattribute__ or __getattr__ overriden * assigns that are initially None * assigns to a function call and not a class definition * Completions for parameters in a context-insensitive way, looking for all the methods/attributes declared in classes available to the project (after 3 chars) Release Highlights in Pydev: ---------------------------------------------- * Completions for parameters based on the tokens that were defined for it in a given context * Removed the default PyLint options, because its command-line interface changed (that was crashing PyLint in newer versions) * Changed the grammar so that 'yield' is correctly parsed as an expression * Giving better error message when external file is opened without any interpreter selected * Icons for the builtins gotten on large libraries (such as wx -- it was optimized not to do that before) * Adding jars relative to the project now works correctly * Patched (Kovan): The debugger is now able to get the variables in a context when handling negative payloads What is PyDev? --------------------------- PyDev is a plugin that enables users to use Eclipse for Python and Jython development -- making Eclipse a first class Python IDE -- It comes with many goodies such as code completion, syntax highlighting, syntax analysis, refactor, debug and many others. Cheers, -- Fabio Zadrozny ------------------------------------------------------ Software Developer ESSS - Engineering Simulation and Scientific Software http://www.esss.com.br Pydev Extensions http://www.fabioz.com/pydev Pydev - Python Development Enviroment for Eclipse http://pydev.sf.net http://pydev.blogspot.com |
From: dperez <cra...@ya...> - 2006-09-26 12:31:14
|
Wow, this is a quick feedback! Thanks Fabio, keep the good job!. Fabio Zadrozny-2 wrote: > > It's a bug... if you add the jar as an external jar it works (it should > show > the path with the name of the project... I've just fixed it and it is > already available in the cvs -- and will be released in 1.2.4 -- hopefully > later today). > -- View this message in context: http://www.nabble.com/Setting-PYTHONPATH-tf2317066.html#a6505723 Sent from the pydev-code mailing list archive at Nabble.com. |
From: Fabio Z. <fa...@gm...> - 2006-09-26 11:29:31
|
On 9/22/06, dperez <cra...@ya...> wrote: > > > I'll give more details. > My project is called "servidor-ima" > > I select this file: "/servidor-ima/lib/common-logging.jar", it is shown > as: > "/lib/common-logging.jar" in the list. > If I hit the Apply button, then this error is shown in the error log: > > Unable to find the path /servidor-ima/commons-logging-1.0.2.jar in the > project were it > is added as a source folder for pydev (project: servidor-ima) > > It's a bug... if you add the jar as an external jar it works (it should show the path with the name of the project... I've just fixed it and it is already available in the cvs -- and will be released in 1.2.4 -- hopefully later today). Cheers, Fabio |
From: Fabio Z. <fa...@gm...> - 2006-09-26 10:47:16
|
> > > I think that it would be very nice, if PyDev had the feature of evaluating > expressions while debugging. > Currently only variables can be seen. > It has: http://fabioz.com/pydev/manual_adv_debug_console.html And you can also add a 'watch' for an expression. Cheers, Fabio |
From: Fabio Z. <fa...@gm...> - 2006-09-26 10:45:52
|
> > > I'm evaluating PyDev and like it. > But I wonder if I can debug Jython code when the jython code is called > from > Java code (e.g. a web server). > > You should be able to do it with the remote debugger: http://fabioz.com/pydev/manual_adv_remote_debugger.html Cheers, Fabio |
From: dperez <cra...@ya...> - 2006-09-26 07:44:42
|
Hi, I think that it would be very nice, if PyDev had the feature of evaluating expressions while debugging. Currently only variables can be seen. Regards David -- View this message in context: http://www.nabble.com/Evaluate-expressions-while-debugging-tf2336853.html#a6502001 Sent from the pydev-code mailing list archive at Nabble.com. |
From: dperez <cra...@ya...> - 2006-09-26 07:26:21
|
Hi, I'm evaluating PyDev and like it. But I wonder if I can debug Jython code when the jython code is called from Java code (e.g. a web server). Thanks in advance for any hint. Cheers, David -- View this message in context: http://www.nabble.com/Debugging-jython-called-from-Java-tf2317042.html#a6444665 Sent from the pydev-code mailing list archive at Nabble.com. |
From: dperez <cra...@ya...> - 2006-09-26 07:25:52
|
I'll give more details. My project is called "servidor-ima" I select this file: "/servidor-ima/lib/common-logging.jar", it is shown as: "/lib/common-logging.jar" in the list. If I hit the Apply button, then this error is shown in the error log: Unable to find the path /servidor-ima/commons-logging-1.0.2.jar in the project were it is added as a source folder for pydev (project: servidor-ima) dperez wrote: > > Hi, > > I think I have found a possible bug. > I have a Java project. I have added to it successfully a Python nature > (using jython 2.1). > Now open the project properties and set the PYTHONPATH property. > I select several *.jar files and folders that contain *.py or *.class > folders. > > The problem is that if I select this: > myfolder/subfolder1/subfolder2/myjar.jar > PyDev stores as: > myfolder/subfolder2/myjar.jar > It strips some subfolder, so the path is invalid..... > > Am I missing something? > I'm using Eclipse 3.2 with the latest PyDev version > > Thanks for your time and patience. > > Regards, > David > > -- View this message in context: http://www.nabble.com/Setting-PYTHONPATH-tf2317066.html#a6444966 Sent from the pydev-code mailing list archive at Nabble.com. |
From: dperez <cra...@ya...> - 2006-09-26 07:25:39
|
Hi, I think I have found a possible bug. I have a Java project. I have added to it successfully a Python nature (using jython 2.1). Now open the project properties and set the PYTHONPATH property. I select several *.jar files and folders that contain *.py or *.class folders. The problem is that if I select this: myfolder/subfolder1/subfolder2/myjar.jar PyDev stores as: myfolder/subfolder2/myjar.jar It strips some subfolder, so the path is invalid..... Am I missing something? I'm using Eclipse 3.2 with the latest PyDev version Thanks for your time and patience. Regards, David -- View this message in context: http://www.nabble.com/Setting-PYTHONPATH-tf2317066.html#a6444732 Sent from the pydev-code mailing list archive at Nabble.com. |
From: Joel H. <yo...@if...> - 2006-09-19 22:04:58
|
> > What do you think? > > Shouldn't be too hard. I'll see if I can find the time to implement > it. There. I've put together a prototype implementation. But whatever you do, do not commit this one yet! It's still way too immature, and I'd appreciate some feedback before I finish up on this one. My thoughts: * Is the constructor / other method separation a good idea? I think so, but I'm not sure... I can't think of any rational examples for why it would be a bad idea... I don't think I'd ever want empty mutables as default arg values to my methods... * My old script assign parameters to attributes should not move the cursor after inserting the new lines. If it would leave the cursor alone, it would work better in conjunction with these and other context sensitive assistants that operate on method def lines. * For constructors, should I combine this with my old hack, so that one assist proposal does all the arg None checking and assignment to attributes? Is it a clever idea to let one propsal do so much? Next question: What should I name such a monster? "Do the usual thing"? * I also noticed a design flaw in RegexBasedAssistProposal. The newline delimiter should be added to self.vars already in the isValid() method. This is fixed in the attached implementation. Any pointers and suggestions are welcome. Cheers! /Joel |
From: Fabio Z. <fa...@gm...> - 2006-09-19 15:46:31
|
Hi All, Pydev and Pydev Extensions 1.2.3 have been released Details on Pydev Extensions: http://www.fabioz.com/pydev Details on Pydev: http://pydev.sf.net Details on its development: http://pydev.blogspot.com Release Highlights in Pydev Extensions: ----------------------------------------------------------------- * Support for python 2.5 has been added * Some minor issues on mark occurrences when the definition for something could not be found were fixed Release Highlights in Pydev: ---------------------------------------------- * When the user specifies an invalid interpreter, a better error report is given (previously it was only shown in the error log) * When threads die, the debugger is notified about it (so that they are removed from the stack) * Writing the preferences to the disk is now buffered * Fixed problem when debugging in jython with the statement "from xxx import *" * Fixed one issue with the indentation engine * Commenting a line does not remove a blank line in the end anymore * Added debug mode for unit-test * Added the possibility of setting the -Dpython.cachedir for running the jython shell (errors can arise in unix-based machines if jython is not able to write its cache) Contributions o Darrell Maples: + Unit-test refactoring + Run as jython unit-test + Filter test methods to run o Joel Hedlund + Added a support to ease adding options to Ctrl+1 in the scripting engine + Added a ctrl+1 for the case: def m1(self, arg=None): arg |<-- Ctrl+1 shows option to do: def m1(self, arg=None): if arg is None: arg = [] Support for python 2.5 o Added the new relative import o Added the new if expression o Added the unified try..except..finally statement o Added the with x:... statement o Indenting after the new with statement o Recognizing 'with' as a keyword in syntax highlighting What is PyDev? --------------------------- PyDev is a plugin that enables users to use Eclipse for Python and Jython development -- making Eclipse a first class Python IDE -- It comes with many goodies such as code completion, syntax highlighting, syntax analysis, refactor, debug and many others. Cheers, -- Fabio Zadrozny ------------------------------------------------------ Software Developer ESSS - Engineering Simulation and Scientific Software http://www.esss.com.br Pydev Extensions http://www.fabioz.com/pydev Pydev - Python Development Enviroment for Eclipse http://pydev.sf.net http://pydev.blogspot.com |
From: Joel H. <yo...@if...> - 2006-09-19 11:56:59
|
> def met1(self, arg=None): |<-- ctrl+1 here would bring the suggestion, > instead of having to create another line with arg to make the choice > (and if more than one argument had '=None', add one option for each). > > What do you think? I also think that this could have several benefits to it, as you could probably quite easily implement separate behaviors for constructors and conventional methods. This would probably be the most useful pattern for constructors: class MyClass: def __init__(self, arg = None): if arg is None: arg = list() self.arg = arg while you probably would want to do this for other methods: class MyClass: def method(self, arg = None): if arg is None: arg = self.arg How does that sound to you? Is it reasonable? It's certainly true for my style of coding anyway. I elaborated on the rationale for doing things this way in the use case docs for AssignToAttributeOfSelf (if I'm allowed to repeat myself... :-) '''It's often a good idea to use the same names in args, variables and data members. This keeps the terminology consistent. This way customer_id should always contain a customer id, and any other variants are misspellings that probably will lead to bugs.''' What do you think? Cheers! /Joel |
From: Joel H. <yo...@if...> - 2006-09-19 10:45:08
|
> Nice touch... Thanks! :-) > I've just commited your code, but I did do one change: Cool! I also made one change, though... AssistProposal now also has a priority attribute, so you can move the 'chattier' ones down to the bottom of the list (i.e: assign dict and list) while keeping the more specialized at the top (i.e: create error message, attached). > instead of > letting 3 options: for list(), dict() or self.var_value, I've only let > one that does: > <snip> > and let the '[]' selected for the user to change it. Yeah... That should be reasonable for most users. I do this a lot though, so I like my 'usual suspects' to be there from the start. That's also the reason I split the actual incorporation into the assistant into three separate pyedit_*.py scripts, so that people could decide for themselves which ones that they would want to use. Perhaps I should have put a Bool check at the top of the scripts to help people turn it on or off? Say for example: USE_THIS_ASSISTANT_PROPOSAL = True if not USE_THIS_ASSISTANT_PROPOSAL: raise ExitScriptException() Furthermore, I intentionally used list() instead of [], so that you reuse the parantheses for function calls, like so: class MyClass: def method(self, arg = None): if arg is None: arg = self._get_value() ... Oh, and speaking of selected things, I was wondering how do you do those tabbed field things that you get if you type 'inip' or 'classs' and then hit Ctrl-Space? I've whipped up a proposal for creating error messages (attached), and it would have been so much better if I could have tabbed fields for the message template, formatting vars and exception class. I suppose I could have done this by just adding a code completion template for it, but since there are no code completion variables for 'initial indent' and 'additional indent', the result would just be messy. > I did it mostly because I think that presenting too many options for a > very similar thing makes things a bit confusing (so, you actually have > to stop for a moment and read each option carefully Yeah, I see your point. In fact, I already did before I read this mail :-) But since I use those similar ones a lot and didn't want to get rid of them, I hacked up that priority thing as a workaround which at least works well for me. I find that by stuffing the similar ones further down the list, you will in fact rarely read them if you're not actively looking for them, simply because the more specialized proposals will always be readily available at the top. > def met1(self, arg=None): |<-- ctrl+1 here would bring the suggestion, > instead of having to create another line with arg to make the choice > (and if more than one argument had '=None', add one option for each). > > What do you think? Shouldn't be too hard. I'll see if I can find the time to implement it. > As for the assign code, I didn't add it because there was an option to > do it already (I've just relaxed the restriction of just doing it on a > call). That's probably for the best. Take care! /Joel |
From: Fabio Z. <fa...@gm...> - 2006-09-18 23:53:08
|
On 9/13/06, Joel Hedlund <yo...@if...> wrote: > Use assist_regex_based_proposal.RegexBasedProposal() to get going real > quick. Use assist_proposal.AssistProposal() for a higher degree of control. > > BTW: I'm really starting to see the possibilities with scripting Pydev > now... > > What do you think about this? Hi Joel, Nice touch...and possibilities are endless ;-) I've just commited your code, but I did do one change: instead of letting 3 options: for list(), dict() or self.var_value, I've only let one that does: if value is None: value = [] and let the '[]' selected for the user to change it. I did it mostly because I think that presenting too many options for a very similar thing makes things a bit confusing (so, you actually have to stop for a moment and read each option carefully). One thing I didn't change but thought would be nice (if you're up to it) would be doing it at the line: def met1(self, arg=None): |<-- ctrl+1 here would bring the suggestion, instead of having to create another line with arg to make the choice (and if more than one argument had '=None', add one option for each). What do you think? As for the assign code, I didn't add it because there was an option to do it already (I've just relaxed the restriction of just doing it on a call). Cheers, Fabio |
From: Joel H. <yo...@if...> - 2006-09-13 22:41:33
|
Bah... already I've found an error. All of the pyedit_*.py scripts are missing an import, namely this one: from org.python.pydev.jython import ExitScriptException The import should go in right before the line that says: raise ExitScriptException() Cheers! /Joel |
From: Joel H. <yo...@if...> - 2006-09-13 16:43:18
|
> Ok, I'll be looking forward to it ;-) Look no further! https://sourceforge.net/tracker/?func=detail&atid=577329&aid=1558025&group_id=85796 Use assist_regex_based_proposal.RegexBasedProposal() to get going real quick. Use assist_proposal.AssistProposal() for a higher degree of control. BTW: I'm really starting to see the possibilities with scripting Pydev now... What do you think about this? /Joel |
From: Fabio Z. <fa...@gm...> - 2006-09-13 13:33:28
|
Ok, I'll be looking forward to it ;-) On 9/13/06, Joel Hedlund <yo...@if...> wrote: > > > Fabio >> Is there any chance that you'll be able to pop these into the > > quick assistant? > > No, wait! Don't do anything just yet. I think I can handle this one. > I'll repost with an update. > > /Joel > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > pydev-code mailing list > pyd...@li... > https://lists.sourceforge.net/lists/listinfo/pydev-code > |
From: Joel H. <yo...@if...> - 2006-09-13 13:22:58
|
> Fabio >> Is there any chance that you'll be able to pop these into the > quick assistant? No, wait! Don't do anything just yet. I think I can handle this one. I'll repost with an update. /Joel |
From: Joel H. <yo...@if...> - 2006-09-12 13:15:44
|
Hi! I hacked up a couple more little code generators for stuff that I seem to do over and over again. 1) Check variable and assign list() to it if it is None. 2) Check variable and assign dict() to it if it is None. 3) Check variable and assign an attribute of self with same name to it if it is None. I've bound the scripts like so: 1) "Ctrl-2 l" (for List) 2) "Ctrl-2 d" (for Dictionary) 3) "Ctrl-2 s" (for Self) Pop them in your Pydev Jython script dir, open a new editor and assign away! They should be self explanatory, and I've done all I can to prevent them from messing up your code. The docs are in the sources if you need them. Let me know what you think about them! Motivation and use cases follow below. Fabio >> Is there any chance that you'll be able to pop these into the quick assistant? Cheers! /Joel Motivation and use cases: The first 2 i frequently use to avoid having mutable default values in methods/functions. Example: # BAD! DANGER! Default arg value may change between calls! def fcn(arg = list()): do_stuff_with_arg # Good: def fcn(arg = None): if arg is None: arg = list() do_stuff_with_arg Writing those "if arg..." constructs quickly gets boring if there are many args. Scripts 1 and 2 will do those for you if you just write "arg" and hit "Ctrl-2" followed by "d" or "l" depending on if you want a dict or a list. The third is good for generalized methods. That is, those that are supposed to do something using a data member, but also just as well could do the same thing to an argument of the proper type. # Good: class GPS(object): def to_str(self): return "Long: %s, Lat:%s" % (coord.x, coord.y) # Better: class GPS(object): def to_str(self, coord = None): if coord is None: coord = self.coord return "Long: %s, Lat:%s" % (coord.x, coord.y) Just as for the first two, the third one will do those "if coord..." for you if you just write "coord" and hit "Ctrl-2" followed by "s". |
From: Joel H. <yo...@if...> - 2006-09-10 21:43:37
|
> Actually, there should be such a feature already in pydev ( > http://fabioz.com./pydev/manual_adv_assistants.html), which works with > ctrl+1, but it only does it when there is a call. Yeah, I know. > I think that instead of replacing it altoghether, I'll add the part of > the behaviour from your implementation so that it does not require a > method call, and make a bind to ctrl+2+a for that action. Hmm... I think the coolest way would be to simply strip the call requirement for the "assign to field" part (using my code if you like :-) and just keep it bound to Ctrl-1. If it's possible? I like the concept of pressing something that says "gimme scripts", which then presents me with a menu of the applicable ones, preferably using intelligible names/descriptions. Just as Ctrl-1 does. > p.s. thanks for the code ;-) No sweat man. By the way, 1.2.2 looks really good. I made the switch from 1.1 just recently when I upgraded to eclipse 3.2. Keep up the good work! Cheers! /Joel |
From: Fabio Z. <fa...@gm...> - 2006-09-10 21:03:00
|
Hi Joel, Actually, there should be such a feature already in pydev ( http://fabioz.com./pydev/manual_adv_assistants.html), which works with ctrl+1, but it only does it when there is a call. E.g.: msg() <-- ctrl+1 will show you 2 options: assign to field and assign to local (and they have a 'linked behaviour'). I think that instead of replacing it altoghether, I'll add the part of the behaviour from your implementation so that it does not require a method call, and make a bind to ctrl+2+a for that action. Cheers, Fabio p.s. thanks for the code ;-) On 9/8/06, Joel Hedlund <yo...@if...> wrote: > > Hello! > > I've dropped from radar for a while since I've been busy coding stuff > for my work, but I figured I should share a litte pydev jython hack that > I whipped up. This one lets you assign the value of a variable to an > attribute of self with the same name, pretty much as you could do with > method parameters using my old "Assign params to attribs of self" hack > that was included in pydev 1.0.6. > > The old one was good for avoiding repetitive typing when coding large > constructors and such. This one comes in handy for smaller changes, say > when you add a parameter to the constructor. It's nothing major, but > along with code completion, it saves more typing than you'd think. > > In the attached code I've bound the jython script to 'a' ('a' for > 'assign'), which is the same letter as my old hack. I figured that > letter would be up for grabs now that my old hack has been integrated > into the quick code assistant. > > So copy it to your pydev jython script dir, open a new editor and hit > "Ctrl-2 a" and see what you make of it. Let me know what you think! > > Cheers! > /Joel > > > """Assign variable to attribute of self with same name. > > Pydev script for generating code that assigns a variable to an attribute > of > self with the same name. > > This script is bound to "Ctrl-2 a" in PyDev by default, and must be > executed at an indented line containing only one alphanumeric word in > order > to have any effect. Otherwise the script will just fling a popup at you > and > make no changes to your code. > > Example: > ------------------------------------------------------ > class Cow(object): > def moo(self, msg): > '''Deliver wisdom verbally, bovine style.''' > msg > ------------------------------------------------------ > > Executing this script at the "msg" line will replace the word "msg" with > an assignment statement such as this: "self.msg = msg". > > Note that this script does not check if msg is defined or if the name is > valid in any other way. > > """ > > __author__ = "Joel Hedlund <joe...@gm...>" > > __version__ = "1.0.0" > > __copyright__ = """\ > This script is available under the same conditions as PyDev. > > See PyDev license for details. > > """ > > __support__ = """Contact the author for bug reports/feature requests.""" > > # This is a magic trick that tells the PyDev Extensions editor > # about the namespace provided for pydev scripts: > if False: > from org.python.pydev.editor import PyEdit #@UnresolvedImport > cmd = 'command string' > editor = PyEdit > > assert cmd is not None > assert editor is not None > > from org.python.pydev.jython import ExitScriptException > > # 'onSave' can be added to the list for developing purposes. > if cmd not in ['onCreateActions']: > raise ExitScriptException > > import re > from java.lang import StringBuffer > from org.eclipse.jface.action import Action #@UnresolvedImport > from org.eclipse.jface.dialogs import MessageDialog #@UnresolvedImport > from org.python.pydev.core.docutils import PySelection #@UnresolvedImport > from org.python.pydev.editor.actions import PyAction #@UnresolvedImport > from org.python.pydev.core.docutils import ParsingUtils #@UnresolvedImport > > class ScriptUnapplicableError(Exception): > """Raised when the script is unapplicable to the current line.""" > def __init__(self, msg): > self.msg = msg > def __str__(self): > return self.msg > > class AssignToAttribOfSelf(Action): > """Assign variable to attribute of self with same name. > > See module docs for details. > > """ > _rName = re.compile(r'^ {8} *(\w+)\s*$') > _sNewline = '\r\n' > > def _scriptApplicable(self, selection): > """Raise ScriptUnapplicableError if the script is unapplicable. > > @param selection: The current selection as a PySelection. > > """ > sCurrentLine = selection.getCursorLineContents() > if not self._rName.match(sCurrentLine): > sTitle = "Script Unapplicable" > sHeader = "Script: Assign Variable to Attribute of self" > sExample = "Example: 'length' => 'self.length = length'." > sBody = ("This script can only be run if the current line " > "contains exactly one alphanumeric word indented by > at " > "least 8 spaces. ") > lsText = [sHeader, '', sExample, '', 'Error:', sBody] > sDialogText = self._sNewline.join(lsText) > oShell = editor.getSite().getShell() > MessageDialog.openInformation(oShell, sTitle, sDialogText) > return False > return True > > def run(self): > oSelection = PySelection(editor) > oDocument = editor.getDocument() > self._sNewLine = PyAction.getDelimiter(oDocument) > if not self._scriptApplicable(oSelection): > return None > > # Build assignment expression: > sOldLine = oSelection.getCursorLineContents() > sName = self._rName.match(sOldLine).group(1) > sIndent = PySelection.getIndentationFromLine(sOldLine) > sAssignmentLine = sIndent + "self.%s = %s" % (sName, sName) > > # Move to insert point: > iStartLineOffset = oSelection.getLineOffset() > iEndLineOffset = iStartLineOffset + len(sOldLine) > editor.setSelection(iEndLineOffset, 0) > oSelection = PySelection(editor) > > # Replace the old line with the new assignment expression: > oSelection.replaceLineContentsToSelection(sAssignmentLine) > del oSelection > > sDescription = 'Assign variable to attribute of self' > editor.addOfflineActionListener("a", AssignToAttribOfSelf(), sDescription, > False) > > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > _______________________________________________ > pydev-code mailing list > pyd...@li... > https://lists.sourceforge.net/lists/listinfo/pydev-code > > > |
From: Joel H. <yo...@if...> - 2006-09-08 15:53:56
|
Hello! I've dropped from radar for a while since I've been busy coding stuff for my work, but I figured I should share a litte pydev jython hack that I whipped up. This one lets you assign the value of a variable to an attribute of self with the same name, pretty much as you could do with method parameters using my old "Assign params to attribs of self" hack that was included in pydev 1.0.6. The old one was good for avoiding repetitive typing when coding large constructors and such. This one comes in handy for smaller changes, say when you add a parameter to the constructor. It's nothing major, but along with code completion, it saves more typing than you'd think. In the attached code I've bound the jython script to 'a' ('a' for 'assign'), which is the same letter as my old hack. I figured that letter would be up for grabs now that my old hack has been integrated into the quick code assistant. So copy it to your pydev jython script dir, open a new editor and hit "Ctrl-2 a" and see what you make of it. Let me know what you think! Cheers! /Joel |
From: Dana M. <dan...@ya...> - 2006-08-18 12:25:18
|
--- Albert Chin <pyd...@ml...> wrote: > On Thu, Aug 17, 2006 at 01:03:00PM -0700, Dana Moore wrote: > > Unzipping the bundles you have and laying them into the > > <eclipse_home>/plugins will certainly work non-destructively, but a > > better way is to use the Eclips -->Help -->Software Updates-->find > and > > Install menu will work even better. > > the site you want to use for automatic update is: > > http://pydev.sf.net/updates/ > > So I don't need to "compile" the pydev plugin like I do the CDT > plugin? > the PyDev capability for Eclipse is supplied in a set of precompiled Java jars in several subfolders which will be located in the <eclipse_home>/plugins folder. After you use either the Eclipse software update manager to install from the sourceforge repository 9or even unzip them youself,) you should now see several subfolders like: org.python.pydev.ast_x.y.z org.python.pydev.core_x.y.z org.python.pydev.debug_x.y.z org.python.pydev.help_x.y.z org.python.pydev.jython_x.y.z org.python.pydev.parser_x.y.z org.python.pydev.templates_x.y.z org.python.pydev_x.y.z where x.y.z is the release number. > > Hope this helps > > > > --- Albert Chin <pyd...@ml...> wrote: > > > > > I'm building Eclipse from scratch and need to build some plugins > to > > > add to the version of Eclipse I'm building (3.2). How do I check > out > > > the pydev code and build it from scratch? > > > > > > I downloaded org.python.pydev.feature-src-1_2_2.zip but don't > know > > > what to do after that. I presume if I have > > > org.python.pydev.feature-src-1_2_2.zip I don't need to check out > the > > > 1.2.2 version from CVS? > > > > > > I cannot find documentation on the web site on how to build from > > > scratch. > > > > > > -- > > > albert chin (ch...@th...) > > > > > > > > > ------------------------------------------------------------------------- > > > Using Tomcat but need to do more? Need to support web services, > > > security? > > > Get stuff done quickly with pre-integrated technology to make > your > > > job easier > > > Download IBM WebSphere Application Server v.1.0.1 based on Apache > > > Geronimo > > > > > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > > _______________________________________________ > > > pydev-code mailing list > > > pyd...@li... > > > https://lists.sourceforge.net/lists/listinfo/pydev-code > > > > > > > > > > > > > __________________________________________________ > > Do You Yahoo!? > > Tired of spam? Yahoo! Mail has the best spam protection around > > http://mail.yahoo.com > > > > > ------------------------------------------------------------------------- > > Using Tomcat but need to do more? Need to support web services, > security? > > Get stuff done quickly with pre-integrated technology to make your > job easier > > Download IBM WebSphere Application Server v.1.0.1 based on Apache > Geronimo > > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > _______________________________________________ > > pydev-code mailing list > > pyd...@li... > > https://lists.sourceforge.net/lists/listinfo/pydev-code > > > > > > -- > albert chin (ch...@th...) > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, > security? > Get stuff done quickly with pre-integrated technology to make your > job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache > Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > pydev-code mailing list > pyd...@li... > https://lists.sourceforge.net/lists/listinfo/pydev-code > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |
From: Albert C. <pyd...@ml...> - 2006-08-18 00:01:25
|
On Thu, Aug 17, 2006 at 01:03:00PM -0700, Dana Moore wrote: > Unzipping the bundles you have and laying them into the > <eclipse_home>/plugins will certainly work non-destructively, but a > better way is to use the Eclips -->Help -->Software Updates-->find and > Install menu will work even better. > the site you want to use for automatic update is: > http://pydev.sf.net/updates/ So I don't need to "compile" the pydev plugin like I do the CDT plugin? > Hope this helps > > --- Albert Chin <pyd...@ml...> wrote: > > > I'm building Eclipse from scratch and need to build some plugins to > > add to the version of Eclipse I'm building (3.2). How do I check out > > the pydev code and build it from scratch? > > > > I downloaded org.python.pydev.feature-src-1_2_2.zip but don't know > > what to do after that. I presume if I have > > org.python.pydev.feature-src-1_2_2.zip I don't need to check out the > > 1.2.2 version from CVS? > > > > I cannot find documentation on the web site on how to build from > > scratch. > > > > -- > > albert chin (ch...@th...) > > > > > ------------------------------------------------------------------------- > > Using Tomcat but need to do more? Need to support web services, > > security? > > Get stuff done quickly with pre-integrated technology to make your > > job easier > > Download IBM WebSphere Application Server v.1.0.1 based on Apache > > Geronimo > > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > _______________________________________________ > > pydev-code mailing list > > pyd...@li... > > https://lists.sourceforge.net/lists/listinfo/pydev-code > > > > > > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > pydev-code mailing list > pyd...@li... > https://lists.sourceforge.net/lists/listinfo/pydev-code > > -- albert chin (ch...@th...) |
From: Dana M. <dan...@ya...> - 2006-08-17 20:03:08
|
Albert, Unzipping the bundles you have and laying them into the <eclipse_home>/plugins will certainly work non-destructively, but a better way is to use the Eclips -->Help -->Software Updates-->find and Install menu will work even better. the site you want to use for automatic update is: http://pydev.sf.net/updates/ Hope this helps --- Albert Chin <pyd...@ml...> wrote: > I'm building Eclipse from scratch and need to build some plugins to > add to the version of Eclipse I'm building (3.2). How do I check out > the pydev code and build it from scratch? > > I downloaded org.python.pydev.feature-src-1_2_2.zip but don't know > what to do after that. I presume if I have > org.python.pydev.feature-src-1_2_2.zip I don't need to check out the > 1.2.2 version from CVS? > > I cannot find documentation on the web site on how to build from > scratch. > > -- > albert chin (ch...@th...) > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, > security? > Get stuff done quickly with pre-integrated technology to make your > job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache > Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > pydev-code mailing list > pyd...@li... > https://lists.sourceforge.net/lists/listinfo/pydev-code > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |