Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

remove duplicate function "pasteMagic", and change code not to use it

  • Loading branch information...
commit 6d414bb1d502013fde990d91adf6188cf4cf3e73 1 parent 95617a5
@Carreau Carreau authored fperez committed
View
29 IPython/frontend/qt/console/console_widget.py
@@ -602,14 +602,12 @@ def _set_font(self, font):
font = property(_get_font, _set_font)
- def paste(self, mode=QtGui.QClipboard.Clipboard,text=None):
- """ Paste the contents of the clipboard, or given text,
- into the input region.
+ def paste(self, mode=QtGui.QClipboard.Clipboard):
+ """ Paste the contents of the clipboard into the input region.
Parameters:
-----------
mode : QClipboard::Mode, optional [default QClipboard::Clipboard]
- text : string, optional, overide mode if given.
Controls which part of the system clipboard is used. This can be
used to access the selection clipboard in X11 and the Find buffer
@@ -626,29 +624,6 @@ def paste(self, mode=QtGui.QClipboard.Clipboard,text=None):
text = QtGui.QApplication.clipboard().text(mode).rstrip()
self._insert_plain_text_into_buffer(cursor, dedent(text))
- def pasteMagic(self,text):
- self._keyboard_quit()
- self.paste(text=text)
- self.execute()
-
- def exit_magic(self):
- self.pasteMagic("%exit")
-
- def who_magic(self):
- self.pasteMagic("%who")
-
- def whos_magic(self):
- self.pasteMagic("%whos")
-
- def who_ls_magic(self):
- self.pasteMagic("%who_ls")
-
- def clear_magic(self):
- self.pasteMagic("%clear")
-
- def reset_magic(self):
- self.pasteMagic("%reset")
-
def print_(self, printer = None):
""" Print the contents of the ConsoleWidget to the specified QPrinter.
"""
View
4 IPython/frontend/qt/console/history_console_widget.py
@@ -205,7 +205,7 @@ def history_tail(self, n=10):
return self._history[-n:]
def history_magic(self):
- self.pasteMagic("%history")
+ self.execute("%history")
def _request_update_session_history_length(self):
msg_id = self.kernel_manager.shell_channel.execute('',
@@ -246,7 +246,7 @@ def save_magic(self):
text=str('1-'+str(self._max_session_history))
)
if ok:
- self.pasteMagic("%save"+" "+file_name+" "+str(hist_range))
+ self.execute("%save"+" "+file_name+" "+str(hist_range))
#---------------------------------------------------------------------------
# 'HistoryConsoleWidget' protected interface
View
16 IPython/frontend/qt/console/qtconsoleapp.py
@@ -156,7 +156,7 @@ def closeTab(self,currentTab):
tab._hidden = True
if closing_widget in slaveTabs :
try :
- self.findMasterTab(closing_widget).pasteMagic('exit')
+ self.findMasterTab(closing_widget).execute('exit')
except AttributeError:
self.log.info("Master already closed or not local, closing only current tab")
self.tabWidget.removeTab(currentTab)
@@ -196,13 +196,13 @@ def closeTab(self,currentTab):
if reply == 1: # close All
for slave in slaveTabs:
self.tabWidget.removeTab(self.tabWidget.indexOf(slave))
- closing_widget.pasteMagic("exit")
+ closing_widget.execute("exit")
self.tabWidget.removeTab(currentTab)
elif reply == 0: # close Console
if not closing_widget._existing:
# Have kernel: don't quit, just close the window
self._app.setQuitOnLastWindowClosed(False)
- closing_widget.pasteMagic("exit True")
+ closing_widget.execute("exit True")
else:
reply = QtGui.QMessageBox.question(self, title,
"Are you sure you want to close this Console?"+
@@ -491,19 +491,19 @@ def undo_active_frontend(self):
def redo_active_frontend(self):
self.activeFrontend.redo()
def reset_magic_active_frontend(self):
- self.activeFrontend.reset_magic()
+ self.activeFrontend.execute("%reset")
def history_magic_active_frontend(self):
self.activeFrontend.history_magic()
def save_magic_active_frontend(self):
self.activeFrontend.save_magic()
def clear_magic_active_frontend(self):
- self.activeFrontend.clear_magic()
+ self.activeFrontend.execute("%clear")
def who_magic_active_frontend(self):
- self.activeFrontend.who_magic()
+ self.activeFrontend.execute("%who")
def who_ls_magic_active_frontend(self):
- self.activeFrontend.who_ls_magic()
+ self.activeFrontend.execute("%who_ls")
def whos_magic_active_frontend(self):
- self.activeFrontend.whos_magic()
+ self.activeFrontend.execute("%whos")
def print_action_active_frontend(self):
self.activeFrontend.print_action.trigger()
Please sign in to comment.
Something went wrong with that request. Please try again.