Preferences/ConfigurationPages/HelpVirusTotalPage.py

branch
Py2 comp.
changeset 3057
10516539f238
parent 2677
3d4277929fb3
parent 3010
befeff46ec0f
child 3058
0a02c433f52d
equal deleted inserted replaced
3056:9986ec0e559a 3057:10516539f238
33 33
34 self.testResultLabel.setHidden(True) 34 self.testResultLabel.setHidden(True)
35 35
36 from Helpviewer.VirusTotalApi import VirusTotalAPI 36 from Helpviewer.VirusTotalApi import VirusTotalAPI
37 self.__vt = VirusTotalAPI(self) 37 self.__vt = VirusTotalAPI(self)
38 self.__vt.checkServiceKeyFinished.connect(self.__checkServiceKeyFinished) 38 self.__vt.checkServiceKeyFinished.connect(
39 self.__checkServiceKeyFinished)
39 40
40 # set initial values 41 # set initial values
41 self.vtEnabledCheckBox.setChecked( 42 self.vtEnabledCheckBox.setChecked(
42 Preferences.getHelp("VirusTotalEnabled")) 43 Preferences.getHelp("VirusTotalEnabled"))
43 self.vtSecureCheckBox.setChecked( 44 self.vtSecureCheckBox.setChecked(
75 self.trUtf8("Checking validity of the service key...")) 76 self.trUtf8("Checking validity of the service key..."))
76 if self.vtSecureCheckBox.isChecked(): 77 if self.vtSecureCheckBox.isChecked():
77 protocol = "https" 78 protocol = "https"
78 else: 79 else:
79 protocol = "http" 80 protocol = "http"
80 self.__vt.checkServiceKeyValidity(self.vtServiceKeyEdit.text(), protocol) 81 self.__vt.checkServiceKeyValidity(
82 self.vtServiceKeyEdit.text(), protocol)
81 83
82 @pyqtSlot(bool, str) 84 @pyqtSlot(bool, str)
83 def __checkServiceKeyFinished(self, result, msg): 85 def __checkServiceKeyFinished(self, result, msg):
84 """ 86 """
85 Private slot to receive the result of the service key check. 87 Private slot to receive the result of the service key check.
86 88
87 @param result flag indicating a successful check (boolean) 89 @param result flag indicating a successful check (boolean)
88 @param msg network error message (str) 90 @param msg network error message (str)
89 """ 91 """
90 if result: 92 if result:
91 self.testResultLabel.setText(self.trUtf8("The service key is valid.")) 93 self.testResultLabel.setText(
94 self.trUtf8("The service key is valid."))
92 else: 95 else:
93 if msg == "": 96 if msg == "":
94 self.testResultLabel.setText(self.trUtf8( 97 self.testResultLabel.setText(self.trUtf8(
95 '<font color="#FF0000">The service key is not valid.</font>')) 98 '<font color="#FF0000">The service key is'
99 ' not valid.</font>'))
96 else: 100 else:
97 self.testResultLabel.setText(self.trUtf8( 101 self.testResultLabel.setText(self.trUtf8(
98 '<font color="#FF0000"><b>Error:</b> {0}</font>').format(msg)) 102 '<font color="#FF0000"><b>Error:</b> {0}</font>')\
103 .format(msg))
99 104
100 105
101 def create(dlg): 106 def create(dlg):
102 """ 107 """
103 Module function to create the configuration page. 108 Module function to create the configuration page.
104 109
105 @param dlg reference to the configuration dialog 110 @param dlg reference to the configuration dialog
111 @return reference to the instantiated page (ConfigurationPageBase)
106 """ 112 """
107 page = HelpVirusTotalPage(dlg) 113 page = HelpVirusTotalPage(dlg)
108 return page 114 return page

eric ide

mercurial