summaryrefslogtreecommitdiff
path: root/portato/gui/qt/terminal.py
diff options
context:
space:
mode:
authornecoro <>2007-06-18 10:44:30 +0000
committernecoro <>2007-06-18 10:44:30 +0000
commit1c88fcd76019e0dee8202704892a38160408f346 (patch)
tree97f4ea9527b8deceff3de012fc4d752850ea1570 /portato/gui/qt/terminal.py
parent4133679ba3118a8609658637de86a8357cac98f1 (diff)
downloadportato-1c88fcd76019e0dee8202704892a38160408f346.tar.gz
portato-1c88fcd76019e0dee8202704892a38160408f346.tar.bz2
portato-1c88fcd76019e0dee8202704892a38160408f346.zip
improved Qt-Terminal
Diffstat (limited to 'portato/gui/qt/terminal.py')
-rw-r--r--portato/gui/qt/terminal.py35
1 files changed, 25 insertions, 10 deletions
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
e49348ee&follow=1'> r664@Devoty: necoro | 2008-01-18 21:40:29 +0100Necoro5-26/+181 2008-01-18 r661@Devoty: necoro | 2008-01-18 14:16:59 +0100Necoro8-211/+293 2008-01-18 r655@Devoty: necoro | 2008-01-18 03:04:53 +0100Necoro1-1/+1 2008-01-18 r651@Devoty: necoro | 2008-01-18 02:41:51 +0100Necoro3-393/+513 2008-01-18 r643@Devoty: necoro | 2008-01-16 18:55:49 +0100Necoro14-249/+525 2008-01-14 r634@Devoty: necoro | 2008-01-14 23:48:24 +0100Necoro3-1/+4 2008-01-14 r632@Devoty: necoro | 2008-01-14 23:44:52 +0100Necoro3-175/+181 2008-01-14(no commit message)Necoro10-758/+1014 2008-01-14 r621@Devoty: necoro | 2008-01-14 20:21:40 +0100Necoro2-21/+61 2008-01-14 r618@Devoty: necoro | 2008-01-14 20:19:05 +0100Necoro2-35/+57 2008-01-14 r617@Devoty: necoro | 2008-01-14 19:12:59 +0100Necoro2-10/+10 2008-01-14 r609@Devoty: necoro | 2008-01-14 17:04:38 +0100Necoro9-394/+477 2008-01-14 r605@Devoty: necoro | 2008-01-14 11:43:34 +0100Necoro2-26/+129 2008-01-14 r603@Devoty: necoro | 2008-01-14 11:30:26 +0100Necoro4-26/+38 2008-01-11 r598@Devoty: necoro | 2008-01-10 16:36:29 +0100Necoro4-10/+50 2008-01-11 r597@Devoty: necoro | 2008-01-10 14:12:35 +0100Necoro1-3/+3 2008-01-10 r595@Devoty: necoro | 2008-01-10 04:04:15 +0100Necoro1-52/+3 2008-01-09 r586@Devoty: necoro | 2008-01-09 14:54:18 +0100Necoro1-1/+1 2007-12-06 r577@Devoty: necoro | 2007-12-06 20:37:36 +0100Necoro1-1/+1 2007-12-06 r572@Devoty: necoro | 2007-11-28 08:48:15 +0100Necoro1-0/+1 2007-11-27 r570@Devoty: necoro | 2007-11-27 02:08:21 +0100Necoro3-84/+108