[accerciser] * plugins/ipython_view.py: Made up/down history not loop (bug #578608).
- From: Eitan Isaacson <eitani src gnome org>
- To: svn-commits-list gnome org
- Subject: [accerciser] * plugins/ipython_view.py: Made up/down history not loop (bug #578608).
- Date: Sun, 3 May 2009 04:22:52 -0400 (EDT)
commit 8aec477fc63737f6f85c0d19f21b0611440fbefc
Author: Eitan Isaacson <eitan ascender com>
Date: Sun May 3 11:21:41 2009 +0300
* plugins/ipython_view.py: Made up/down history not loop (bug #578608).
---
ChangeLog | 2 ++
plugins/ipython_view.py | 14 ++++++++++++--
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index bae8b97..6ce7613 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
2009-05-02 Eitan Isaacson <eitan ascender com>
+ * plugins/ipython_view.py: Made up/down history not loop (bug #578608).
+
* README:
* accerciser.spec.in:
* debian/control:
diff --git a/plugins/ipython_view.py b/plugins/ipython_view.py
index a9c36bc..384c859 100755
--- a/plugins/ipython_view.py
+++ b/plugins/ipython_view.py
@@ -134,6 +134,8 @@ class IterableIPShell:
@rtype: string
'''
self.history_level -= 1
+ if not self._getHistory():
+ self.history_level +=1
return self._getHistory()
def historyForward(self):
@@ -143,7 +145,8 @@ class IterableIPShell:
@return: The command string.
@rtype: string
'''
- self.history_level += 1
+ if self.history_level < 0:
+ self.history_level += 1
return self._getHistory()
def _getHistory(self):
@@ -156,7 +159,6 @@ class IterableIPShell:
try:
rv = self.IP.user_ns['In'][self.history_level].strip('\n')
except IndexError:
- self.history_level = 0
rv = ''
return rv
@@ -511,3 +513,11 @@ class IPythonView(ConsoleView, IterableIPShell):
self.showReturned(rv)
self.cout.truncate(0)
+if __name__ == "__main__":
+ window = gtk.Window()
+ window.set_default_size(640, 320)
+ window.connect('delete-event', lambda x, y: gtk.main_quit())
+ window.add(IPythonView())
+ window.show_all()
+ gtk.main()
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]