From 13f5b071027e5aed0f9ae5eec88f4095f2246f98 Mon Sep 17 00:00:00 2001 From: necoro <> Date: Tue, 24 Apr 2007 14:36:36 +0000 Subject: added dialogs to warn you when the queue is running on quitting portato --- portato/gui/qt/dialogs.py | 3 +++ portato/gui/qt/windows.py | 12 ++++++++++++ 2 files changed, 15 insertions(+) (limited to 'portato/gui/qt') diff --git a/portato/gui/qt/dialogs.py b/portato/gui/qt/dialogs.py index 7b5609e..6a80164 100644 --- a/portato/gui/qt/dialogs.py +++ b/portato/gui/qt/dialogs.py @@ -12,6 +12,9 @@ from PyQt4.QtGui import QMessageBox +def queue_not_empty_dialog(parent): + return QMessageBox.question(parent, "Portato", "There are some packages in the emerge queue and/or an emerge process is running.\nDo you really want to quit?", QMessageBox.Ok | QMessageBox.Cancel) + def io_ex_dialog (parent, ex): string = ex.strerror if ex.filename: diff --git a/portato/gui/qt/windows.py b/portato/gui/qt/windows.py index 3fa93cf..edb1873 100644 --- a/portato/gui/qt/windows.py +++ b/portato/gui/qt/windows.py @@ -852,3 +852,15 @@ class MainWindow (Window): def cb_pkg_list_selected (self, index, prev): if not index is None: self.pkgDetails.update(self.selCatName+"/"+str(index.text()), self.queue) + + def closeEvent (self, event): + if not self.queue.is_empty(): + ret = queue_not_empty_dialog(self) + if ret == Qt.QMessageBox.Cancel: + event.ignore() + return + else: + self.queue.kill_emerge() + + event.accept() + -- cgit v1.2.3-70-g09d2