Small Modification to work with gedit

39 views
Skip to first unread message

Evgeny Pogorelov

unread,
Feb 28, 2012, 11:44:53 AM2/28/12
to DreamPie
Thanks for good new python development tool.
I very needed some feature in gedit, on F5 I want to have Dreampie
opened with
my python file executed. Unfortunately, Dreampie for now cannot do it.
I have to do some very small modification which I decided to share
here.
I am not very professional in Python (mostly use it for science
modeling), so the code is a little bit primitive,
but working well.

Additional feature:
> dreampie -r[--run] filename [jython|cython]
in initial code will executed
execfile('filename'), where filename will be processed automatically
into full file name.
If no such file is existed, then nothing will be happens (probably it
is better to make warning in future)

Modified file from last version "dreampie-1.1": .../dreampie-1.1/
dreampielib/gui/__init__.py
> diff __init__.py __init__.py(modified)
listing in down
141c141,142
< def __init__(self, pyexec):
---
> def __init__(self, pyexec,execute):
> self.execute = execute
611c612
< init_code = unicode(eval(self.config.get('init-code')))
---
> init_code = unicode(eval(self.config.get('init-code')))+self.execute
1095c1096
<
---
> parser.add_option("-r","--run",dest="filename",help="run initial python script-program")
1097d1097
<
1122c1122,1131
< _dp = DreamPie(pyexec)
---
>
> if opts.filename == None:
> execute = ""
> else:
> respath = path.expanduser(opts.filename)
> (head, tail) = path.split(respath)
> if head == '': respath = path.abspath(respath)
> if path.isfile(respath): execute="execfile('"+respath+"')\n"
> else: execute = ''
> _dp = DreamPie(pyexec, execute)

With new feature it is easy to use External tools plugin of gedit to
run my file in dreampie when I need.
Thanks again for good job, maybe later it is possible to make it as
gedit plugin which will allow step in and over interactive debugging,
break points and so on...
Reply all
Reply to author
Forward
0 new messages