Skip to content

Commit 0c4914b

Browse files
committed
Merge in main branch
2 parents 0552fd1 + 5b4c2c0 commit 0c4914b

File tree

4 files changed

+19
-7
lines changed

4 files changed

+19
-7
lines changed

bpython/cli.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1659,8 +1659,8 @@ def main_curses(scr, args, config, interactive=True, locals_=None,
16591659
clirepl._C = cols
16601660

16611661
sys.stdin = FakeStdin(repl)
1662-
sys.stdout = repl
1663-
sys.stderr = repl
1662+
sys.stdout = clirepl
1663+
sys.stderr = clirepl
16641664

16651665
if args:
16661666
bpython.args.exec_code(interpreter, args)
@@ -1689,7 +1689,7 @@ def main_curses(scr, args, config, interactive=True, locals_=None,
16891689
signal.signal(signal.SIGWINCH, old_sigwinch_handler)
16901690
signal.signal(signal.SIGCONT, old_sigcont_handler)
16911691

1692-
return repl.getstdout()
1692+
return clirepl.getstdout()
16931693

16941694

16951695
def main(args=None, locals_=None, banner=None):

bpython/gtk_.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,15 @@ def __init__(self):
143143
self.context_id = self.get_context_id('Statusbar')
144144

145145
def message(self, s, n=3):
146+
self.clear()
146147
self.push(self.context_id, s)
148+
gobject.timeout_add(n*1000, self.clear)
149+
150+
def clear(self):
151+
self.pop(self.context_id)
152+
153+
# To stop the timeout from firing again
154+
return False
147155

148156

149157
class SuggestionWindow(gtk.Window):
@@ -280,6 +288,7 @@ def file_prompt(self, s):
280288
buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_OPEN,gtk.RESPONSE_OK))
281289
chooser.set_default_response(gtk.RESPONSE_OK)
282290
chooser.set_current_name('test.py')
291+
chooser.set_current_folder(os.path.expanduser('~'))
283292

284293
pyfilter = gtk.FileFilter()
285294
pyfilter.set_name("Python files")
@@ -303,7 +312,6 @@ def file_prompt(self, s):
303312

304313
def notify(self, s, n=10):
305314
self.statusbar.message(s)
306-
307315

308316
class ReplWidget(gtk.TextView, repl.Repl):
309317
__gsignals__ = dict(button_press_event=None,
@@ -613,7 +621,10 @@ def on_suggestion_selection_changed(self, selection, word):
613621

614622

615623
def do_paste(self, widget):
616-
self.pastebin()
624+
clipboard = gtk.clipboard_get()
625+
paste_url = self.pastebin()
626+
clipboard.set_text(paste_url)
627+
clipboard.store()
617628

618629
def do_write2file(self, widget):
619630
self.write2file()

bpython/repl.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ def pastebin(self, s=None):
671671
if s == self.prev_pastebin_content:
672672
self.interact.notify('Duplicate pastebin. Previous URL: ' +
673673
self.prev_pastebin_url)
674-
return
674+
return self.prev_pastebin_url
675675

676676
self.prev_pastebin_content = s
677677

@@ -687,6 +687,7 @@ def pastebin(self, s=None):
687687
paste_url = paste_url_template.safe_substitute(paste_id=paste_id)
688688
self.prev_pastebin_url = paste_url
689689
self.interact.notify('Pastebin URL: %s' % (paste_url, ), 10)
690+
return paste_url
690691

691692
def push(self, s, insert_into_history=True):
692693
"""Push a line of code onto the buffer so it can process it all

bpython/urwid.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def decoding_input_filter(keys, raw):
169169
encoding = locale.getpreferredencoding()
170170
converted_keys = list()
171171
for key in keys:
172-
if isinstance(keys, basestring):
172+
if isinstance(key, basestring):
173173
converted_keys.append(key.decode(encoding))
174174
else:
175175
converted_keys.append(key)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy