From fd0375f14fb47dd55bfcbb59e2891f34b9be50c4 Mon Sep 17 00:00:00 2001 From: Kiooeht Date: Fri, 15 Apr 2011 02:45:10 -0700 Subject: [PATCH] Option to view pesterlog from conversation window --- convo.py | 16 ++++++++++++++++ logviewer.py | 12 ++++++++++++ 2 files changed, 28 insertions(+) diff --git a/convo.py b/convo.py index fab1ed6..24ea2f4 100644 --- a/convo.py +++ b/convo.py @@ -449,8 +449,12 @@ class PesterConvo(QtGui.QFrame): self.reportchum = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/report"], self) self.connect(self.reportchum, QtCore.SIGNAL('triggered()'), self, QtCore.SLOT('reportThisChum()')) + self.logchum = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/viewlog"], self) + self.connect(self.logchum, QtCore.SIGNAL('triggered()'), + self, QtCore.SLOT('openChumLogs()')) self.optionsMenu.addAction(self.quirksOff) + self.optionsMenu.addAction(self.logchum) self.optionsMenu.addAction(self.addChumAction) self.optionsMenu.addAction(self.blockAction) self.optionsMenu.addAction(self.reportchum) @@ -634,6 +638,15 @@ class PesterConvo(QtGui.QFrame): @QtCore.pyqtSlot(bool) def toggleQuirks(self, toggled): self.applyquirks = not toggled + @QtCore.pyqtSlot() + def openChumLogs(self): + currentChum = self.chum.handle + self.mainwindow.chumList.pesterlogviewer = PesterLogViewer(currentChum, self.mainwindow.config, self.mainwindow.theme, self.mainwindow) + self.connect(self.mainwindow.chumList.pesterlogviewer, QtCore.SIGNAL('rejected()'), + self.mainwindow.chumList, QtCore.SLOT('closeActiveLog()')) + self.mainwindow.chumList.pesterlogviewer.show() + self.mainwindow.chumList.pesterlogviewer.raise_() + self.mainwindow.chumList.pesterlogviewer.activateWindow() messageSent = QtCore.pyqtSignal(QtCore.QString, QtCore.QString) windowClosed = QtCore.pyqtSignal(QtCore.QString) @@ -644,3 +657,6 @@ class PesterConvo(QtGui.QFrame): "v": {"center": QtCore.Qt.AlignVCenter, "top": QtCore.Qt.AlignTop, "bottom": QtCore.Qt.AlignBottom } } + +# the import is way down here to avoid recursive imports +from logviewer import PesterLogViewer diff --git a/logviewer.py b/logviewer.py index 84eb105..5badf81 100644 --- a/logviewer.py +++ b/logviewer.py @@ -234,3 +234,15 @@ class PesterLogText(PesterText): self.viewport().setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) else: self.viewport().setCursor(QtGui.QCursor(QtCore.Qt.IBeamCursor)) + + def contextMenuEvent(self, event): + textMenu = self.createStandardContextMenu() + if self.textSelected: + self.submitLogAction = QtGui.QAction("Submit to Pesterchum QDB", self) + self.connect(self.submitLogAction, QtCore.SIGNAL('triggered()'), + self, QtCore.SLOT('submitLog()')) + textMenu.addAction(self.submitLogAction) + a = textMenu.actions() + a[0].setText("Copy Plain Text") + a[0].setShortcut(self.tr("Ctrl+C")) + textMenu.exec_(event.globalPos())