pydev-code Mailing List for PyDev for Eclipse (Page 37)
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: Don T. <nos...@gm...> - 2006-05-09 14:08:34
|
Fabio Zadrozny wrote: > I notice that Eclipse seems to let you have differing line terminators > in the same file, but that PySelection seems enforce one and only one > type of line terminator as per Guido's directions. (I hope this is what > you do). > > > Actually, sort of... In PySelection, when the terminator is requested it > will always return the same line terminator from the first line of the > document. I am using: offset = selection.getAbsoluteCursorOffset() lineno = selection.getLineOfOffset(offset) line = selection.getLine(lineno) to get the line containing the current cursor position. I then march up and down the text grabbing lines until I have acquired the 'paragraph' of text that contains the cursor. Eventually I replace this paragraph with a reformatted paragraph. In order to do this I need to figure out the offsets to the first character of the original paragraph and to the last character of the delimiter on the last line of the paragraph. Right now I am assuming that I can do the latter by adding len(selection.getDelimiter(document)) to the last character offset but this assumes that the delimiter on the last line is the same size as the document delimiter. It is possible that this is not true, for example by using a Windows editor to change a document that originated on Linux. However, I believe that CPython gets upset if mixed delimiters are used within the same document so maybe this does not really matter. In any case, I can use the IDocument method getLineDelimiter() to get the line delimiter for a specific line, but it looks like you intended PySelection to be the main interface for Jython extension scripts so maybe you want add something like this one day. BTW. I noticed that PySelection does not have a method getStartLineOffset(lineno) that would be a pair with getEndLineOffset(lineno). Not a big deal as it is easy to calculate. > While I have your attention, is there any significance in PySelection's > line numbering starting at 0 while the line number displayed by Eclipse > starts at 1 ? > > > Actually, where is this? I've checked: > > PySelection sel = new PySelection(new Document("foo\nbla")); > assertEquals(0, sel.getLineOfOffset(1)); > > So, it is returning 0 in the PySelection for the offset 1... Do you have > an example where this is not the case? I actually meant the line number shown at the bottom of the screen in Eclipse - this line number always starts at 1, which is apparantly internally known as line 0. So it looks like Eclipse is inconsistent about starting at 0 or 1. No matter. Thanks, Don. |
From: Fabio Z. <fa...@gm...> - 2006-05-09 12:35:54
|
Hi Don, On 5/8/06, Don Taylor <nos...@gm...> wrote: > > Fabio: > > Do you do something about making sure that only one type of line > terminator (cr|lf|cr-lf) is used in a Python file in Eclipse? Actually, I notice that Eclipse seems to let you have differing line terminators > in the same file, but that PySelection seems enforce one and only one > type of line terminator as per Guido's directions. (I hope this is what > you do). Actually, sort of... In PySelection, when the terminator is requested it will always return the same line terminator from the first line of the document. While I have your attention, is there any significance in PySelection's > line numbering starting at 0 while the line number displayed by Eclipse > starts at 1 ? Actually, where is this? I've checked: PySelection sel =3D new PySelection(new Document("foo\nbla")); assertEquals(0, sel.getLineOfOffset(1)); So, it is returning 0 in the PySelection for the offset 1... Do you have an example where this is not the case? -- Fabio |
From: Don T. <nos...@gm...> - 2006-05-09 00:51:37
|
Fabio: Do you do something about making sure that only one type of line terminator (cr|lf|cr-lf) is used in a Python file in Eclipse? I notice that Eclipse seems to let you have differing line terminators in the same file, but that PySelection seems enforce one and only one type of line terminator as per Guido's directions. (I hope this is what you do). While I have your attention, is there any significance in PySelection's line numbering starting at 0 while the line number displayed by Eclipse starts at 1 ? I can live with this behaviour, but I am curious if there is a reason. DOn. |
From: Fabio Z. <fa...@gm...> - 2006-04-28 23:00:57
|
> > Builders are enabled, build on save only not checked (this does not make > a difference, tested). > Ok, I just got the latest Pylint version myself and it works for me... Actually, when you mentioned the builders, this reminded me of something: are your files in the project pythonpath? In previous versions it would try to analyze all your files, even if your pythonpath was not correctly defined, so, there's a chance that your files are not underneath a source folder in the project. -- you have to define the source folders for that... check http://fabioz.com/pydev/manual_101_project_conf2.html (and the auto-build should also be set -- http://pydev.sourceforge.net/pylint.html discusses that). Cheers, Fabio |
From: Heikki T. <hj...@co...> - 2006-04-28 20:44:53
|
Fabio Zadrozny wrote: > Did you try to run it from the command-line? Also, did you check to see > if the lint.py location is correct in the preferences? Heh, are you reading my messages at all: I said I confirmed it worked on the command line in the first message, which was also quoted in the second message. But I did spend some more time looking at settings and trying different things... The lint.py location is correct. I have checked FATAL, ERRORS, WARNINGS in the checkboxes. Currently the options manually specified are: --persistent=n --comment=n Builders are enabled, build on save only not checked (this does not make a difference, tested). The problems view filter is set to show stuff for currently selected only, all types enabled, severity not checked (this does not seem to make a difference, tested). After more tests, it seems some kinds of errors do get reported at least part of the time, although there is still nothing in the console. Some types of errors that are reported: - bad indentation - somevar = Some types of errors that are not reported: - unused imports -- Heikki Toivonen |
From: Fabio Z. <fa...@gm...> - 2006-04-28 15:48:03
|
On 4/28/06, Heikki Toivonen <hj...@co...> wrote: > > Fabio Zadrozny wrote: > > Well, in latest versions you can have pylint show you its console > > (configure in the pydev preferences). Do you see something there? > > I did mention that I tried it in my original message. After the pylint > upgrade there is nothing in the console. Did you try to run it from the command-line? Also, did you check to see if the lint.py location is correct in the preferences? |
From: Heikki T. <hj...@co...> - 2006-04-28 15:44:47
|
Fabio Zadrozny wrote: > Well, in latest versions you can have pylint show you its console > (configure in the pydev preferences). Do you see something there? I did mention that I tried it in my original message. After the pylint upgrade there is nothing in the console. > On 4/28/06, *Heikki Toivonen* <hj...@co... > <mailto:hj...@co...>> wrote: > > I noticed I haven't had pylint report me problems lately, but I don't > know when this broke. I did notice the report in the console (when I had > enabled pylint messages in console). > > Today I upgraded to latest pylint (0.11.0), and now there isn't even > anything in the console. I know some warning codes have been removed > and > I tested my options on the command line until I found a list that I know > works. However, nothing seems to happen when running with pydev. > > Anybody else experienced this? Any ideas? -- Heikki Toivonen |
From: Fabio Z. <fa...@gm...> - 2006-04-28 14:01:34
|
Hi Don, > In truth, it is stupid to be trying to develop a Jython script this way. > It makes more sense to get everything working as an ordinary Jython > script first and then plug the working script into Pydev. Now that I > understand the environment a bit better I am going to away and turn mu > brain back on. > > Don. > I totally agree with you. So, I've already started some testing environment -- there is currently no synching between the developer and the non-developer cvs. I just saw the sf site status ( http://sourceforge.net/docs/a04) and it appears that it will be available shortly again. But the idea is that the Eclipse objects are Mocked, so that you can run your tests without actually having the whole Eclipse infrastructure. ALL th= e java tests already work that way, so that they don't need Eclipse running t= o run the tests, and I believe that the jython scripting should have the same structure. So, hopefully shortly the non-developers cvs will be up again, so, please remind me of pointing you how is it currently working (and to see if your requisites are covered by it). Cheers, Fabio |
From: Don T. <nos...@gm...> - 2006-04-28 13:47:34
|
Jeff Winkler wrote: > Hi Don, > You might be interested in a technique - more of a design pattern than > anything else- where if any python files change, unit tests are rerun. > The code is > http://jeffwinkler.blogspot.com/2006/04/keeping-your-nose-green.html - > I'm using nose which autodiscovers the tests. I doubt nose works under > jython and python 2.1, but perhaps the pure python aspects of your code > could be tested in nose under python. > Hi Jeff: Thanks for this, I will take a look at your nose for Python development. I don't think that it will solve my problem which is peculiar to using Jython scripts to extend Pydev itself. This issue is how to convince Pydev that some Jython script that it calls has changed 'underneath its feet'. In truth, it is stupid to be trying to develop a Jython script this way. It makes more sense to get everything working as an ordinary Jython script first and then plug the working script into Pydev. Now that I understand the environment a bit better I am going to away and turn mu brain back on. Don. |
From: Jeff W. <win...@gm...> - 2006-04-28 13:23:31
|
Hi Don, You might be interested in a technique - more of a design pattern than anything else- where if any python files change, unit tests are rerun. The code is http://jeffwinkler.blogspot.com/2006/04/keeping-your-nose-green.htm= l - I'm using nose which autodiscovers the tests. I doubt nose works under jython and python 2.1, but perhaps the pure python aspects of your code could be tested in nose under python. Having this constant feedback loop is great to know that everything is working OK, and you can avoid the debugger altogether, doing TDD. I've made a movie about it which will be at ShowMeDo soon. Jeff On 4/27/06, Don Taylor <nos...@gm...> wrote: > > Fabio: > > I am developing a Pydev Jython script and am having some difficulty in > getting imported modules to be recognized as having changed after editing= . > > I have a module called pyedit_test.py that imports wrapper.py which in > turn imports textwrap.py. All modules are in the same folder - the one > named in my Scripting Pydev preference page. |
From: Fabio Z. <fa...@gm...> - 2006-04-28 10:31:20
|
Well, in latest versions you can have pylint show you its console (configur= e in the pydev preferences). Do you see something there? On 4/28/06, Heikki Toivonen <hj...@co...> wrote: > > I noticed I haven't had pylint report me problems lately, but I don't > know when this broke. I did notice the report in the console (when I had > enabled pylint messages in console). > > Today I upgraded to latest pylint (0.11.0), and now there isn't even > anything in the console. I know some warning codes have been removed and > I tested my options on the command line until I found a list that I know > works. However, nothing seems to happen when running with pydev. > > Anybody else experienced this? Any ideas? > > -- > Heikki Toivonen > > > ------------------------------------------------------- > 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 Geronim= o > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat= =3D121642 > _______________________________________________ > pydev-code mailing list > pyd...@li... > https://lists.sourceforge.net/lists/listinfo/pydev-code > |
From: Heikki T. <hj...@co...> - 2006-04-28 05:19:58
|
I noticed I haven't had pylint report me problems lately, but I don't know when this broke. I did notice the report in the console (when I had enabled pylint messages in console). Today I upgraded to latest pylint (0.11.0), and now there isn't even anything in the console. I know some warning codes have been removed and I tested my options on the command line until I found a list that I know works. However, nothing seems to happen when running with pydev. Anybody else experienced this? Any ideas? -- Heikki Toivonen |
From: Fabio Z. <fa...@gm...> - 2006-04-28 01:38:07
|
Hi Don, I am developing a Pydev Jython script and am having some difficulty in > getting imported modules to be recognized as having changed after editing= . > > I have a module called pyedit_test.py that imports wrapper.py which in > turn imports textwrap.py. All modules are in the same folder - the one > named in my Scripting Pydev preference page. > > The problem is that Pydev only seems to recognize and reload changes to > pyedit_test.py. Yes, that's correct, it will only get the changes on the 'main' module. If you want to make changes on other modules, you'd have to restart the interpreter engine yourself: if True: #add some clausule to make the reload from org.python.pydev.jython import JythonPlugin #@UnresolvedImport editor.pyEditScripting.interpreter =3D JythonPlugin.newPythonInterprete= r (). Putting all in the same module would be another way of having it too...(or maybe you could script an action where you bind that -- maybe something suc= h as Ctrl+2+reload, where you call the code above). > PS. I tried setting a breakpoint in a Pydev Script but nothing happened > - I presume that is to be expected. Yes, there's no debugging on the scripting engine. Fabio |
From: Don T. <nos...@gm...> - 2006-04-28 00:58:09
|
Fabio: I am developing a Pydev Jython script and am having some difficulty in getting imported modules to be recognized as having changed after editing. I have a module called pyedit_test.py that imports wrapper.py which in turn imports textwrap.py. All modules are in the same folder - the one named in my Scripting Pydev preference page. The problem is that Pydev only seems to recognize and reload changes to pyedit_test.py. So I changed wrapper and textwrap to pyedit_wrapper.py and pyedit_textwrap.py. Now Pydev says that it reloads these modules when they are changed. But when I run the code with ctrl-2+w it still seems to pick up the new version. Then I added reload() calls into pyedit_test.py and pyedit_wrapper.py. Still no good. Finally, I ran the imported modules as stand-alone __main__ programs, I heard my disk chatter as the compiler ran and after that Pydev did run the modified version when I hit ctrl-2+w. I am still wrestling with my code so at least some of this behaviour may be due to my own bugs, but I wonder if you have any thoughts about this. I may just mung everything together into one module for the time being. Don. PS. I tried setting a breakpoint in a Pydev Script but nothing happened - I presume that is to be expected. |
From: Fabio Z. <fa...@gm...> - 2006-04-27 17:38:38
|
Hi Michael, > When I'm using a TQS in a docstring, if I pause a moment, suddenly the > whole buffer from that point on changes since I haven't closed the > string with another set of triple-quotes. Unfortunately, once I do, it > doesn't change. > > So, I end up closing the file and reopening it to fix the problem. > > Is this a known problem? Yes, check http://sourceforge.net/tracker/index.php?func=3Ddetail&aid=3D1402165&group_= id=3D85796&atid=3D577329. It points to a bug in Eclipse : https://bugs.eclipse.org/bugs/show_bug.cgi?id=3D125004 (so, you could try posting something there -- I think that they might be willing to fix it faster if more people ask for it). Cheers, Fabio > > > ------------------------------------------------------- > 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 Geronim= o > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat= =3D121642 > _______________________________________________ > pydev-code mailing list > pyd...@li... > https://lists.sourceforge.net/lists/listinfo/pydev-code > |
From: Michael P. S. <mic...@mi...> - 2006-04-27 17:33:14
|
Hello, When I'm using a TQS in a docstring, if I pause a moment, suddenly the whole buffer from that point on changes since I haven't closed the string with another set of triple-quotes. Unfortunately, once I do, it doesn't change. So, I end up closing the file and reopening it to fix the problem. Is this a known problem? Mike -- Michael P. Soulier <mic...@mi...>, 613-592-2122 x2522 "Any intelligent fool can make things bigger and more complex... It takes a touch of genius - and a lot of courage to move in the opposite direction." --Albert Einstein |
From: Fabio Z. <fa...@gm...> - 2006-04-27 15:04:58
|
Hi Joel, On 4/27/06, Joel Hedlund <yo...@if...> wrote: > > > > So, what do you (all) think about which would be the best way to make > those > > scripts available... I was thinking something as putting them (with the > > authors permission) toghether with the pydev distribution... > > The authors name would then appear on the script itself and in a brief > help > > in the homepage toghether with an explanation on how the script works. > > Is that page accessible somewhere today? (I'd like to show my mum... ;-) Well, still not, but you can show: http://pydev.sourceforge.net/ -- your 'alpha' was already included in the latest release ;-) I'm still making the change to hold the scripts in the page... I've already put an 'early' version of a developers manual: http://pydev.sourceforge.net/developers.html, but the scripts session was still not created. Cheers, Fabio /Joel > > > > > > Cheers, > > > > Fabio > > > > On 4/19/06, Joel Hedlund <yo...@if...> wrote: > > > >>Hi! > >> > >>New version of my script here. This time I feel it's good enough to cal= l > >>an > >>alpha (comments still appreciated, of course). > >> > >> > >>>I installed and played a little with your script - looking good. > >> > >>Thanks! > >> > >> > >>>Since I am congenitally unable to accept any compiler error messages > >> > >>:-) > >> > >> > >>> document =3D document #@UndefinedVariable > >> > >>If I used a global variable named 'document' in my previous version it > was > >>most > >>likely because of involuntary namespace pollution, and I hope the new > >>version > >>is free of it. > >> > >>Thanks for your time checking my script out! > >>/Joel Hedlund > >> > >> > >> > > > > > > > ------------------------------------------------------- > 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 Geronim= o > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat= =3D121642 > _______________________________________________ > pydev-code mailing list > pyd...@li... > https://lists.sourceforge.net/lists/listinfo/pydev-code > |
From: Joel H. <yo...@if...> - 2006-04-27 14:49:17
|
> So, what do you (all) think about which would be the best way to make those > scripts available... I was thinking something as putting them (with the > authors permission) toghether with the pydev distribution... > The authors name would then appear on the script itself and in a brief help > in the homepage toghether with an explanation on how the script works. Is that page accessible somewhere today? (I'd like to show my mum... ;-) /Joel > > Cheers, > > Fabio > > On 4/19/06, Joel Hedlund <yo...@if...> wrote: > >>Hi! >> >>New version of my script here. This time I feel it's good enough to call >>an >>alpha (comments still appreciated, of course). >> >> >>>I installed and played a little with your script - looking good. >> >>Thanks! >> >> >>>Since I am congenitally unable to accept any compiler error messages >> >>:-) >> >> >>> document = document #@UndefinedVariable >> >>If I used a global variable named 'document' in my previous version it was >>most >>likely because of involuntary namespace pollution, and I hope the new >>version >>is free of it. >> >>Thanks for your time checking my script out! >>/Joel Hedlund >> >> >> > > |
From: Joel H. <yo...@if...> - 2006-04-27 12:55:11
|
Hi! Now I feel my script pyedit_assign_params_to_attributes.py is mature enou= gh to=20 come out of the alpha closet, so here ya go: The official v1.0.0. In this version I've incorporated a few of the guards and tricks recently= =20 discussed on this list, and I now no longer wait for Enter to activate af= ter=20 Ctrl-2+a. Otherwise there are no changes in functionality from the alpha1. Cheers guys! /Joel Hedlund Ph.D. Student, IFM Bioinformatics Link=F6ping University, Sweden |
From: Fabio Z. <fa...@gm...> - 2006-04-26 13:09:18
|
> > > I am wondering what to do about my own utility modules. I use a couple > right now that I was thinking of incorporating into the source of my > pyedit_ file or simply including as peer files with the pyedit_ file. > Any thoughts on the right way to do this? I think that you could do a module (say: docutils.py -- or something descriptive on what it has if that's not all it contains), put your functions there and import that module from your scripts (the jysrc and the additional scripts path should be on your pythonpath). Don. > > PS. I really wish that Jython had kept up with CPython. My coding > style is 'Google and steal' and I keep tripping up on things that are in > later versions of CPython but not in Jython. Yeap, I wish that too... hopefully they'll turn a 2.2 version soon enough (= I keep track of the jython list, and it appears there is development going on= ) . Fabio |
From: Don T. <nos...@gm...> - 2006-04-26 13:04:53
|
Fabio Zadrozny wrote: > Yeap, that's what I'd do too... Maybe I can do a 'replace selected text' > method in pyselection... > > Also, I think that the scripting engine could start having some > 'utilities' module that you can use, where this kind of stuff would go > so that you could share it among scripts (and maybe provide a more > pythonic interface for many of the things Eclipse provides). What do you > think? > Yes, I think that would be good. I am wondering what to do about my own utility modules. I use a couple right now that I was thinking of incorporating into the source of my pyedit_ file or simply including as peer files with the pyedit_ file. Any thoughts on the right way to do this? Don. PS. I really wish that Jython had kept up with CPython. My coding style is 'Google and steal' and I keep tripping up on things that are in later versions of CPython but not in Jython. |
From: Fabio Z. <fa...@gm...> - 2006-04-26 11:00:47
|
Yeap, that's what I'd do too... Maybe I can do a 'replace selected text' method in pyselection... Also, I think that the scripting engine could start having some 'utilities' module that you can use, where this kind of stuff would go so that you coul= d share it among scripts (and maybe provide a more pythonic interface for man= y of the things Eclipse provides). What do you think? On 4/25/06, Don Taylor <nos...@gm...> wrote: > > Fabio Zadrozny wrote: > > Actually there is 1 method that does it (but it's the single one, so, > > you may want to use one of IDocument if it's not what you want): > > > > public void addLine(String contents, int afterLine) > > > Ah, ok. This does not do quite what I want. I want to replace the > current selection with some new text. Right now I am using something > like: > > selection =3D PySelection(editor) > selected_text =3D selection.getSelectedText() > offset =3D selection.getAbsoluteCursorOffset() > length =3D selection.getSelLength() > > document =3D editor.getDocument() > new_text =3D "Did this make it in?" + "\nNew line" > document.replace(offset, length, new_text) > > Don. > > > ------------------------------------------------------- > 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 Geronim= o > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat= =3D121642 > _______________________________________________ > pydev-code mailing list > pyd...@li... > https://lists.sourceforge.net/lists/listinfo/pydev-code > |
From: Don T. <nos...@gm...> - 2006-04-26 01:22:57
|
Fabio Zadrozny wrote: > Actually there is 1 method that does it (but it's the single one, so, > you may want to use one of IDocument if it's not what you want): > > public void addLine(String contents, int afterLine) Ah, ok. This does not do quite what I want. I want to replace the current selection with some new text. Right now I am using something like: selection = PySelection(editor) selected_text = selection.getSelectedText() offset = selection.getAbsoluteCursorOffset() length = selection.getSelLength() document = editor.getDocument() new_text = "Did this make it in?" + "\nNew line" document.replace(offset, length, new_text) Don. |
From: Fabio Z. <fa...@gm...> - 2006-04-25 23:19:41
|
Actually there is 1 method that does it (but it's the single one, so, you may want to use one of IDocument if it's not what you want): public void addLine(String contents, int afterLine) Cheers, Fabio On 4/25/06, Don Taylor <nos...@gm...> wrote: > > Fabio Zadrozny wrote: > > Hi Don, > > > > I'm forwarding it to the pydev-code list, as I think it might be useful > > to others... > > > > A general question about Jython scripting. > > > > Before 1.0.4 was released I had imagined that I might be able to > write a > > script that could receive a selection from the editor, reformat it > and > > return it to the editor to be pasted over the original selection. = I > > was > > thinking of doing some comment reformatting on demand. > > > > As far as I can tell the current scripting API does not support thi= s > > sort of thing. Is that right? > > > > > > Actually, you can do it, but you have to know a bit from the Eclipse AP= I > > too... A 'simple' way of doing it would be requesting the editor > > document (something like editor.getDocument()) and play with it. It is > > an IDocument, and you can get whatever you want from it and change it a= s > > much as you like. > > > > Also, maybe taking a look at PySelection ( > > > http://cvs.sourceforge.net/viewcvs.py/pydev/org.python.pydev.core/src/org= /python/pydev/core/docutils/PySelection.java?rev=3D1.7&view=3Dmarkup > > < > http://cvs.sourceforge.net/viewcvs.py/pydev/org.python.pydev.core/src/org= /python/pydev/core/docutils/PySelection.java?rev=3D1.7&view=3Dmarkup > >) > > might be worth it... It provides a nicer interface for getting info fro= m > > a document/selection. > > > > You can instantiate it in jython with: > > > > from org.python.pydev.core.docutils import PySelection > > sel =3D PySelection(editor) > > > Hi Fabio: > > As far as I can see there are no methods in PySelection that allow you > to put text back into the editor, is this correct? > > I know that I can do what I want with an IDocument using the replace > method, I just wondered if I am missing something in the PySelection. > > Thanks, > > Don. > > > > ------------------------------------------------------- > 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 Geronim= o > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat= =3D121642 > _______________________________________________ > pydev-code mailing list > pyd...@li... > https://lists.sourceforge.net/lists/listinfo/pydev-code > |
From: Don T. <nos...@gm...> - 2006-04-25 22:39:29
|
Fabio Zadrozny wrote: > Hi Don, > > I'm forwarding it to the pydev-code list, as I think it might be useful > to others... > > A general question about Jython scripting. > > Before 1.0.4 was released I had imagined that I might be able to write a > script that could receive a selection from the editor, reformat it and > return it to the editor to be pasted over the original selection. I > was > thinking of doing some comment reformatting on demand. > > As far as I can tell the current scripting API does not support this > sort of thing. Is that right? > > > Actually, you can do it, but you have to know a bit from the Eclipse API > too... A 'simple' way of doing it would be requesting the editor > document (something like editor.getDocument()) and play with it. It is > an IDocument, and you can get whatever you want from it and change it as > much as you like. > > Also, maybe taking a look at PySelection ( > http://cvs.sourceforge.net/viewcvs.py/pydev/org.python.pydev.core/src/org/python/pydev/core/docutils/PySelection.java?rev=1.7&view=markup > <http://cvs.sourceforge.net/viewcvs.py/pydev/org.python.pydev.core/src/org/python/pydev/core/docutils/PySelection.java?rev=1.7&view=markup>) > might be worth it... It provides a nicer interface for getting info from > a document/selection. > > You can instantiate it in jython with: > > from org.python.pydev.core.docutils import PySelection > sel = PySelection(editor) > Hi Fabio: As far as I can see there are no methods in PySelection that allow you to put text back into the editor, is this correct? I know that I can do what I want with an IDocument using the replace method, I just wondered if I am missing something in the PySelection. Thanks, Don. |