Helpviewer/Download/DownloadAskActionDialog.py

changeset 978
11f8adbcac97
child 992
566e87428fc8
equal deleted inserted replaced
977:7a523bd4b00d 978:11f8adbcac97
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2011 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing a dialog to ask for a download action.
8 """
9
10 from PyQt4.QtGui import QDialog
11
12 from .Ui_DownloadAskActionDialog import Ui_DownloadAskActionDialog
13
14 import Preferences
15
16 class DownloadAskActionDialog(QDialog, Ui_DownloadAskActionDialog):
17 """
18 Class implementing a dialog to ask for a download action.
19 """
20 def __init__(self, fileName, mimeType, baseUrl, parent=None):
21 """
22 Constructor
23
24 @param parent reference to the parent widget (QWidget)
25 """
26 QDialog.__init__(self, parent)
27 self.setupUi(self)
28
29 self.infoLabel.setText("<b>{0}</b>".format(fileName))
30 self.typeLabel.setText(mimeType)
31 self.siteLabel.setText(baseUrl)
32
33 if not Preferences.getHelp("VirusTotalEnabled") or \
34 Preferences.getHelp("VirusTotalServiceKey") == "":
35 self.scanButton.setHidden(True)
36
37 def getAction(self):
38 """
39 Public method to get the selected action.
40
41 @return selected action ("save", "open", "scan" or "cancel")
42 """
43 if self.openButton.isChecked():
44 return "open"
45 elif self.scanButton.isChecked():
46 return "scan"
47 elif self.saveButton.isChecked():
48 return "save"
49 else:
50 # should not happen, but keep it safe
51 return "cancel"

eric ide

mercurial