Hi Jan!
thanks a lot for your feedback and you fix!
I've produced another diff against my Py_Shell.py which includes your
fix and somethings else; a small changelog:
-check for pygtk 2.0 (Jan)
-close/hide when Ctrl-D event is pressed (Jan)
enabling this only when Py_Shell is in it's own window
(I need it for my app but you can change it ...)
-scrolling back in history returns to an empty prompt
-press "Home" key into the last line, puts cursor to the start of the
"logical line" (I mean after ">>>")
-the same happens with "Left" key
- fix a bug with autocompletation (missing a = in separators)
Best regards!
Pier
Il mar, 2003-11-04 alle 12:35, Jan Weil ha scritto:
> Hi Pier,
>
> nice work! Thanks a lot!
>
> Just some comments:
>
> 1) I had to add an
> 'import pygtk
> pygtk.require('2.0')'
> to make it work.
>
> 2) If I scroll back in history using 'up' I am not able to get back to
> the empty prompt afterwards.
>
> 3) Maybe the standalone version could react on 'CTRL-d' by exiting?
>
> Attached is a little diff which solves 1) and 3).
> I didn't try to dig deeper into 2) yet.
>
> Regards,
>
> Jan
>
> Am 2003.11.04 09:55 schrieb(en) Pier Carteri:
> [...]
> >
> > I attached a new version of Py_Shell that fix a couple of problem:
> > - avoid duplicated entry into the autocompletetion list
> > - the width of the autocompletation popup is calculated with respect
> > to
> > the length of the strings
> > This version requires pygtk 2.0 due to some function (pango.PIXELS)
> > not present in previous release (at least 1.99.16)
> >
> > I'm sorry to post this into the list instead of giving you a link to a
> > page. I hope to have a web-page for my project (which includes
> > Py_Shell)
> > in a week or two (I've register it on SF, so the only things that
> > remains is write the pages.. ). I will post the link ASAP
> >
>
> ______________________________________________________________________
>
> _______________________________________________
> pygtk mailing list [EMAIL PROTECTED]
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
--
Pier Carteri <[EMAIL PROTECTED]>
9c9,10
<
---
> import pygtk
> pygtk.require('2.0')
227c228
< while start.get_char() not in " ,()[]":
---
> while start.get_char() not in " ,()[]=":
295c296
< self.history=[" "]
---
> self.history=[""]
348c349
< if self.history_pos>0:
---
> if self.history_pos>=0:
365c366
< if self.history_pos<len(self.history)-1:
---
> if self.history_pos<=len(self.history)-1:
370a372,374
> if self.history_pos==len(self.history)-1:
> gtk.gdk.beep()
> return
375,377c379
<
< else:
< gtk.gdk.beep()
---
>
385c387,406
<
---
>
> elif event.keyval ==gtk.gdk.keyval_from_name("Home"):
> last_line=self.buffer.get_end_iter().get_line()
>
> cur_line=self.buffer.get_iter_at_mark(self.buffer.get_insert()).get_line()
> if last_line == cur_line:
> iter=self.buffer.get_iter_at_line(cur_line)
> iter.forward_chars(4)
> self.buffer.place_cursor(iter)
> self.view.emit_stop_by_name("key-press-event")
> return gtk.TRUE
>
> elif event.keyval ==gtk.gdk.keyval_from_name("Left"):
> last_line=self.buffer.get_end_iter().get_line()
> cur_pos=self.buffer.get_iter_at_mark(self.buffer.get_insert())
> cur_line=cur_pos.get_line()
> if last_line == cur_line:
> if cur_pos.get_line_offset()==4:
> self.view.emit_stop_by_name("key-press-event")
> return gtk.TRUE
>
398c419,425
<
---
> elif (event.keyval ==gtk.gdk.keyval_from_name("d") and
> event.state & gtk.gdk.CONTROL_MASK and
> isinstance(self.gui, gtk.Window)) :
> #enable Ctrl-D only if Shell is in a separate window
> self.quit()
> return gtk.TRUE
>
554a582
> """Return the cursor line without the >>> or ... """
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/