Add :pyeval
This commit is contained in:
parent
bd28c00cf1
commit
fd9ab82e8b
@ -77,6 +77,7 @@ class QuteBrowser(QApplication):
|
|||||||
'scrollstart': self.mainwindow.tabs.scroll_start_act,
|
'scrollstart': self.mainwindow.tabs.scroll_start_act,
|
||||||
'scrollend': self.mainwindow.tabs.scroll_end_act,
|
'scrollend': self.mainwindow.tabs.scroll_end_act,
|
||||||
'undo': self.mainwindow.tabs.undo_close,
|
'undo': self.mainwindow.tabs.undo_close,
|
||||||
|
'pyeval': self.pyeval
|
||||||
}
|
}
|
||||||
|
|
||||||
handler = handlers[cmd]
|
handler = handlers[cmd]
|
||||||
@ -86,3 +87,14 @@ class QuteBrowser(QApplication):
|
|||||||
handler(*args, count=count)
|
handler(*args, count=count)
|
||||||
else:
|
else:
|
||||||
handler(*args)
|
handler(*args)
|
||||||
|
|
||||||
|
def pyeval(self, s):
|
||||||
|
try:
|
||||||
|
r = eval(s)
|
||||||
|
out = repr(r)
|
||||||
|
except Exception as e:
|
||||||
|
out = ': '.join([e.__class__.__name__, str(e)])
|
||||||
|
|
||||||
|
tab = self.mainwindow.tabs.currentWidget()
|
||||||
|
tab.setContent(out.encode('UTF-8'), 'text/plain')
|
||||||
|
|
||||||
|
@ -75,3 +75,7 @@ class ScrollStart(Command):
|
|||||||
class ScrollEnd(Command):
|
class ScrollEnd(Command):
|
||||||
nargs = 0
|
nargs = 0
|
||||||
key = 'G'
|
key = 'G'
|
||||||
|
|
||||||
|
class PyEval(Command):
|
||||||
|
nargs = 1
|
||||||
|
split_args = False
|
||||||
|
Loading…
Reference in New Issue
Block a user