summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornecoro <>2007-04-27 18:32:07 +0000
committernecoro <>2007-04-27 18:32:07 +0000
commitce3139188ed3f4564d37a1ffb02bb20daff6adb1 (patch)
tree93aaf3259750f9d3c61712d4b6dd420258c096c3
parent9b4319e484de43ac72b407d0656e967445c36dd4 (diff)
downloadportato-ce3139188ed3f4564d37a1ffb02bb20daff6adb1.tar.gz
portato-ce3139188ed3f4564d37a1ffb02bb20daff6adb1.tar.bz2
portato-ce3139188ed3f4564d37a1ffb02bb20daff6adb1.zip
fixed bugs in gtk and qt
-rw-r--r--portato/gui/gtk/windows.py19
-rw-r--r--portato/gui/qt/terminal.py59
2 files changed, 58 insertions, 20 deletions
diff --git a/portato/gui/gtk/windows.py b/portato/gui/gtk/windows.py
index 7c6f41b..ffeb01f 100644
--- a/portato/gui/gtk/windows.py
+++ b/portato/gui/gtk/windows.py
@@ -914,15 +914,18 @@ class MainWindow (Window):
def title_update (self, title):
- if self.tray:
- self.tray.set_tooltip(title)
-
- if title == None:
- title = "Console"
- else:
- title = ("Console (%s)" % title)
+ def __update(title):
+ if self.tray:
+ self.tray.set_tooltip(title)
+
+ if title == None:
+ title = "Console"
+ else:
+ title = ("Console (%s)" % title)
+
+ self.notebook.set_tab_label_text(self.termHB, title)
- gobject.idle_add(self.notebook.set_tab_label_text, self.termHB, title)
+ gobject.idle_add(__update, title)
def cb_cat_list_selection (self, view):
"""Callback for a category-list selection. Updates the package list with the packages in the category."""
diff --git a/portato/gui/qt/terminal.py b/portato/gui/qt/terminal.py
index 85bea0e..bae6240 100644
--- a/portato/gui/qt/terminal.py
+++ b/portato/gui/qt/terminal.py
@@ -12,12 +12,23 @@
from PyQt4 import Qt
-from threading import Thread, Lock
+from Queue import Queue
+from threading import Thread
from os import read
from portato.gui.wrapper import Console
from portato.helper import debug
+class WriteEvent (Qt.QEvent):
+ TYPE = Qt.QEvent.Type(1001)
+
+ def __init__ (self, string):
+ Qt.QEvent.__init__(self, self.TYPE)
+ self.string = string
+
+ def get_string(self):
+ return self.string
+
class BoldFormat (Qt.QTextCharFormat):
def __init__(self):
@@ -76,20 +87,29 @@ class QtConsole (Console, Qt.QTextEdit):
self.pty = None
self.running = False
self.stdFormat = self.currentCharFormat()
- self.formatQueue = []
- self.formatLock = Lock()
+ self.formatQueue = Queue()
self.title = None
+ self.writeQueue = ""
self.setReadOnly(True)
# 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("doSomeWriting"), self._write)
Qt.QObject.connect(self, Qt.SIGNAL("deletePrevChar()"), self._deletePrev)
def _deletePrev (self):
"""Deletes the previous character."""
self.textCursor().deletePreviousChar()
+
+ def event (self, event):
+ if event.type() == WriteEvent.TYPE:
+ self._write(event.get_string())
+ event.accept()
+ return True
+
+ event.ignore()
+ return False
def _write (self, text):
"""Writes some text. A text of "\\x1b" signals _write() to reload
@@ -115,7 +135,23 @@ class QtConsole (Console, Qt.QTextEdit):
def write(self, text):
"""Convenience function for emitting the writing signal."""
- self.emit(Qt.SIGNAL("doSomeWriting"), text)
+
+ def send (text):
+ Qt.QCoreApplication.postEvent(self, WriteEvent(text))
+
+ if text is None:
+ send(self.writeQueue)
+ self.writeQueue = ""
+
+ if text == esc_seq[0]:
+ send(self.writeQueue)
+ send(text)
+ self.writeQueue = ""
+ elif len(self.writeQueue) == 4:
+ send(self.writeQueue+text)
+ self.writeQueue = ""
+ else:
+ self.writeQueue = self.writeQueue + text
def start_new_thread (self):
"""Starts a new thread, which will listen for some input.
@@ -174,6 +210,10 @@ class QtConsole (Console, Qt.QTextEdit):
if s == "\r": continue
self.write(s)
+ self.write(None)
+# self.emit(Qt.SIGNAL("doSomeWriting"), "".join(self.writeQueue))
+# self.writeQueue = []
+
def parse_seq (self, seq):
"""Parses a sequence of bytes.
If a new attribute has been encountered, a new format is created and added
@@ -225,9 +265,7 @@ class QtConsole (Console, Qt.QTextEdit):
@param format: the format to add
@type format: Qt.QTextCharFormat"""
- self.formatLock.acquire()
- self.formatQueue.append(format)
- self.formatLock.release()
+ self.formatQueue.put(format)
def get_format (self):
"""Returns a format from the queue.
@@ -237,10 +275,7 @@ class QtConsole (Console, Qt.QTextEdit):
@returns: the popped format
@rtype: Qt.QTextCharFormat"""
- self.formatLock.acquire()
- f = self.formatQueue.pop(0)
- self.formatLock.release()
- return f
+ return self.formatQueue.get()
def virgin_format (self):
"""The normal standard format. It is necessary to create it as a new one for some
:30:50 +0200'>2014-04-18bash-completion: filter dot files from resultsJason A. Donenfeld1-3/+8 2014-04-18reencrypt: remove option, do automaticallyJason A. Donenfeld5-39/+25 2014-04-18reencryption: add to completion filesJason A. Donenfeld3-1/+5 2014-04-18Specify variable gpg.Jason A. Donenfeld1-1/+1 2014-04-18style: don't escape new line on &&Jason A. Donenfeld1-2/+2 2014-04-18reencryption: remove temporary file on failureJason A. Donenfeld1-1/+1 2014-04-18reencryption: only reencrypt files when requiredJason A. Donenfeld2-16/+37 2014-04-17cp: typo as cvJason A. Donenfeld1-1/+1 2014-04-17bash: gpg_id is localJason A. Donenfeld1-0/+1 2014-04-17move/copy: always reencrypt passwords at destinationJason A. Donenfeld5-25/+56 2014-04-17makefile: allow platform files with gnu sedJason A. Donenfeld1-7/+8 Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> 2014-04-17mv: Add pass mv/rename supportJason A. Donenfeld5-3/+78 Based-on-work-by: Matthieu Weber <mweber@free.fr> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> 2014-04-17revelation2pass: add plain XML importJavali1-11/+15 I found that revelatio2pass.py script doesn't work. It can not decrypt my password file. I got following error message: raceback (most recent call last): File "git/password-store/contrib/importers/revelation2pass.py", line 159, in <module> main(args.FILE, verbose=args.verbose, xml=args.xml) File "git/password-store/contrib/importers/revelation2pass.py", line 140, in main cleardata_gz = decrypt_gz(password, data) File "git/password-store/contrib/importers/revelation2pass.py", line 117, in decrypt_gz ct = c.decrypt(cipher_text[28:]) File "/usr/lib/python2.7/site-packages/Crypto/Cipher/blockalgo.py", line 295, in decrypt return self._cipher.decrypt(ciphertext) I was unable to fix the problem, but I created a workaround, that add plain XML import option to the revelation2pass.py script. Revelation can export its password file as plain XML format. 2014-04-17platform: add cygwin supportJason A. Donenfeld2-1/+17 According to Brandon Jones, all we need to do is adjust /dev/clipboard from xclip. So we add a platform specific file to do so. http://www.relaytheurgency.com/2014/04/pass-in-cygwin-relatively-simple.html Suggested-by: Brandon Jones <jones.brandon.lee@gmail.com> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>