Skip to content

Commit 4004256

Browse files
committed
Please a same-named German for a feature request, GTK now has pasting of the current selection
1 parent 255e688 commit 4004256

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

bpython/gtk_.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,15 @@ def ask_confirmation(self, q):
583583
def do_paste(self, widget):
584584
self.pastebin()
585585

586+
def do_partial_paste(self, widget):
587+
bounds = self.text_buffer.get_selection_bounds()
588+
if bounds == ():
589+
# FIXME show a nice status bar message
590+
pass
591+
else:
592+
self.pastebin(self.text_buffer.get_text(bounds[0], bounds[1]))
593+
594+
586595
def write(self, s):
587596
"""For overriding stdout defaults"""
588597
if '\x04' in s:
@@ -741,6 +750,10 @@ def main(args=None):
741750
pastebin = gtk.MenuItem("Pastebin")
742751
pastebin.connect("activate", repl_widget.do_paste)
743752
filemenu.append(pastebin)
753+
754+
pastebin_partial = gtk.MenuItem("Pastebin selection")
755+
pastebin_partial.connect("activate", repl_widget.do_partial_paste)
756+
filemenu.append(pastebin_partial)
744757

745758
exit = gtk.MenuItem("Exit")
746759
exit.connect("activate", gtk.main_quit)

0 commit comments

Comments
 (0)