From fd6f267180985265e7ad0dcb07e59c3c70082e55 Mon Sep 17 00:00:00 2001 From: Kiooeht Date: Fri, 13 May 2011 13:39:52 -0700 Subject: [PATCH] Option for turning off animations (to avoid lagging) --- convo.py | 16 +++++++++++----- logviewer.py | 5 +++-- memos.py | 4 ++++ menus.py | 10 ++++++++++ pesterchum.py | 7 +++++++ 5 files changed, 35 insertions(+), 7 deletions(-) diff --git a/convo.py b/convo.py index ead896f..c08f1c9 100644 --- a/convo.py +++ b/convo.py @@ -213,6 +213,10 @@ class PesterTabWindow(QtGui.QFrame): class PesterText(QtGui.QTextEdit): def __init__(self, theme, parent=None): QtGui.QTextEdit.__init__(self, parent) + if hasattr(self.parent(), 'mainwindow'): + self.mainwindow = self.parent().mainwindow + else: + self.mainwindow = self.parent() self.initTheme(theme) self.setReadOnly(True) self.setMouseTracking(True) @@ -231,11 +235,13 @@ class PesterText(QtGui.QTextEdit): movie.start() @QtCore.pyqtSlot() def animate(self): - movie = self.sender() - self.document().resource(QtGui.QTextDocument.ImageResource, self.urls[movie]).clear() - self.document().addResource(QtGui.QTextDocument.ImageResource, - self.urls[movie], movie.currentPixmap()) - self.setLineWrapColumnOrWidth(self.lineWrapColumnOrWidth()) + if self.mainwindow.config.animations(): + movie = self.sender() + self.document().resource(QtGui.QTextDocument.ImageResource, self.urls[movie]).clear() + self.document().addResource(QtGui.QTextDocument.ImageResource, + self.urls[movie], movie.currentPixmap()) + self.setLineWrapColumnOrWidth(self.lineWrapColumnOrWidth()) + @QtCore.pyqtSlot(bool) def textReady(self, ready): diff --git a/logviewer.py b/logviewer.py index cab7d49..4b253ea 100644 --- a/logviewer.py +++ b/logviewer.py @@ -126,6 +126,7 @@ class PesterLogViewer(QtGui.QDialog): self.config = config self.theme = theme self.parent = parent + self.mainwindow = parent global _datadir self.handle = parent.profile().handle self.chum = chum @@ -207,13 +208,13 @@ class PesterLogViewer(QtGui.QDialog): font.setPointSize(8) self.find.setFont(font) self.find.setDefault(True) - self.find.setFixedSize(40, 16) + self.find.setFixedSize(40, 20) layout_search = QtGui.QHBoxLayout() layout_search.addWidget(self.search) layout_search.addWidget(self.find) self.qdb = QtGui.QPushButton("Pesterchum QDB", self) - self.qdb.setFixedWidth(200) + self.qdb.setFixedWidth(260) self.connect(self.qdb, QtCore.SIGNAL('clicked()'), self, QtCore.SLOT('openQDB()')) self.ok = QtGui.QPushButton("CLOSE", self) diff --git a/memos.py b/memos.py index c9499d1..5c01c48 100644 --- a/memos.py +++ b/memos.py @@ -237,6 +237,10 @@ _ctag_begin = re.compile(r'') class MemoText(PesterText): def __init__(self, theme, parent=None): QtGui.QTextEdit.__init__(self, parent) + if hasattr(self.parent(), 'mainwindow'): + self.mainwindow = self.parent().mainwindow + else: + self.mainwindow = self.parent() self.initTheme(theme) self.setReadOnly(True) self.setMouseTracking(True) diff --git a/menus.py b/menus.py index 8df50b0..723a8e4 100644 --- a/menus.py +++ b/menus.py @@ -670,6 +670,14 @@ class PesterOptions(QtGui.QDialog): if self.config.opvoiceMessages(): self.memomessagecheck.setChecked(True) + self.animationscheck = QtGui.QCheckBox("Use animated smilies", self) + if self.config.animations(): + self.animationscheck.setChecked(True) + animateLabel = QtGui.QLabel("(Disable if you leave chats open for LOOOONG periods of time)") + font = animateLabel.font() + font.setPointSize(8) + animateLabel.setFont(font) + self.userlinkscheck = QtGui.QCheckBox("Disable #Memo and @User Links", self) self.userlinkscheck.setChecked(self.config.disableUserLinks()) self.userlinkscheck.setVisible(False) @@ -773,6 +781,8 @@ class PesterOptions(QtGui.QDialog): layout_chat.addWidget(self.timestampBox) layout_chat.addWidget(self.secondscheck) layout_chat.addWidget(self.memomessagecheck) + layout_chat.addWidget(self.animationscheck) + layout_chat.addWidget(animateLabel) # Re-enable these when it's possible to disable User and Memo links #layout_chat.addWidget(hr) #layout_chat.addWidget(QtGui.QLabel("User and Memo Links")) diff --git a/pesterchum.py b/pesterchum.py index 089fa2c..67d8d2c 100644 --- a/pesterchum.py +++ b/pesterchum.py @@ -372,6 +372,8 @@ class userConfig(object): return self.config.get('closeAction', 1) def opvoiceMessages(self): return self.config.get('opvMessages', True) + def animations(self): + return self.config.get('animations', True) def addChum(self, chum): if chum.handle not in self.chums(): fp = open(self.filename) # what if we have two clients open?? @@ -2473,6 +2475,11 @@ class PesterWindow(MovingWindow): curopvmess = self.config.opvoiceMessages() if opvmesssetting != curopvmess: self.config.set('opvMessages', opvmesssetting) + # animated smiles + animatesetting = self.optionmenu.animationscheck.isChecked() + curanimate = self.config.animations() + if animatesetting != curanimate: + self.config.set('animations', animatesetting) # advanced ## user mode if self.advanced: