From 1c88fcd76019e0dee8202704892a38160408f346 Mon Sep 17 00:00:00 2001 From: necoro <> Date: Mon, 18 Jun 2007 10:44:30 +0000 Subject: improved Qt-Terminal --- portato/gui/qt/terminal.py | 35 +++++++++++++++++++++++++---------- portato/gui/qt/windows.py | 4 ++-- 2 files changed, 27 insertions(+), 12 deletions(-) (limited to 'portato/gui') diff --git a/portato/gui/qt/terminal.py b/portato/gui/qt/terminal.py index bae6240..111588f 100644 --- a/portato/gui/qt/terminal.py +++ b/portato/gui/qt/terminal.py @@ -29,6 +29,12 @@ class WriteEvent (Qt.QEvent): def get_string(self): return self.string +class DeleteEvent (Qt.QEvent): + TYPE = Qt.QEvent.Type(1002) + + def __init__ (self): + Qt.QEvent.__init__(self, self.TYPE) + class BoldFormat (Qt.QTextCharFormat): def __init__(self): @@ -62,15 +68,15 @@ attr = {} attr[0] = None # normal attr[1] = BoldFormat() # bold attr[4] = UnderlineFormat() # underline -attr[30] = ColorFormat("black") +attr[30] = ColorFormat("white") # should be black - but is inverted attr[31] = ColorFormat("red") -attr[32] = ColorFormat("green") +attr[32] = ColorFormat("lime") # lime looks better on black than normal green attr[33] = ColorFormat("yellow") attr[34] = ColorFormat("blue") attr[35] = ColorFormat("magenta") attr[36] = ColorFormat("cyan") attr[37] = ColorFormat("white") -attr[39] = None # default +attr[39] = None # default - use white too class QtConsole (Console, Qt.QTextEdit): """Self implemented emulation of a terminal emulation. @@ -86,17 +92,21 @@ class QtConsole (Console, Qt.QTextEdit): self.pty = None self.running = False - self.stdFormat = self.currentCharFormat() self.formatQueue = Queue() self.title = None self.writeQueue = "" - self.setReadOnly(True) + # set black bg + self.palette().setColor(Qt.QPalette.Base, Qt.QColor("black")) + self.setBackgroundRole(Qt.QPalette.Base) + self.setAutoFillBackground(True) + + + self.stdFormat = self.currentCharFormat() + self.stdFormat.merge(attr[30]) + self.setCurrentCharFormat(self.stdFormat) - # we need these two signals, as threads are not allowed to access the GUI - # solution: thread sends signal, which is handled by the main loop -# Qt.QObject.connect(self, Qt.SIGNAL("doSomeWriting"), self._write) - Qt.QObject.connect(self, Qt.SIGNAL("deletePrevChar()"), self._deletePrev) + self.setReadOnly(True) def _deletePrev (self): """Deletes the previous character.""" @@ -107,6 +117,11 @@ class QtConsole (Console, Qt.QTextEdit): self._write(event.get_string()) event.accept() return True + + elif event.type() == DeleteEvent.TYPE: + self._deletePrev() + event.accept() + return True event.ignore() return False @@ -183,7 +198,7 @@ class QtConsole (Console, Qt.QTextEdit): if s == "": break # nothing read -> finish if ord(s) == backspace: # BS - self.emit(Qt.SIGNAL("deletePrevChar()")) + Qt.QCoreApplication.postEvent(self, DeleteEvent()) continue if s == esc_seq[0]: # -> 0x27 diff --git a/portato/gui/qt/windows.py b/portato/gui/qt/windows.py index e02a3c5..9f91109 100644 --- a/portato/gui/qt/windows.py +++ b/portato/gui/qt/windows.py @@ -861,9 +861,9 @@ class MainWindow (Window): system.reload_settings() if not self.doUpdate: - self.queue.emerge(force=True, options = ["--nospinner"]) + self.queue.emerge(force=True) else: - self.queue.update_world(force=True, newuse = self.cfg.get_boolean("newuse"), deep = self.cfg.get_boolean("deep"), options = ["--nospinner"]) + self.queue.update_world(force=True, newuse = self.cfg.get_boolean("newuse"), deep = self.cfg.get_boolean("deep")) self.doUpdate = False @Qt.pyqtSignature("") -- cgit v1.2.3-54-g00ecf