def checkInfo(self): '''Checks that all the information fields are filled out and valid. Loads the required information and passes it for encrypted image creation.''' common.turnBlack(self.missingInfo) self.missingInfo = [] # Checks that a public key image has been selected and the relevant information has been filled in. if self.pkSelectGroup.checkedId() == -1: self.missingInfo.append(self.pkLabel) elif self.pkSelectGroup.checkedId() == 1 and self.pkFromHDText.text() == '': self.missingInfo.append(self.pkFromHD) elif self.pkSelectGroup.checkedId() == 2 and self.pkFromInternetText.text() == '': self.missingInfo.append(self.pkFromInternet) # Checks that a encrypted image has been selected and the relevant information has been filled in. if self.encSelectGroup.checkedId() == -1: self.missingInfo.append(self.encLabel) elif self.encSelectGroup.checkedId() == 1 and self.encFromHDText.text() == '': self.missingInfo.append(self.encFromHD) elif self.encSelectGroup.checkedId() == 2 and self.encFromInternetText.text() == '': self.missingInfo.append(self.encFromInternet) # Checks that message method has been selected and the relevant information has been filled in. if self.msgSelectGroup.checkedId() == -1: self.missingInfo.append(self.msgLabel) elif self.msgSelectGroup.checkedId() == 1 and self.msgFromHDText.text() == '': self.missingInfo.append(self.msgFromHD) elif self.msgSelectGroup.checkedId() == 2 and self.msgInputText.toPlainText() == '': self.missingInfo.append(self.msgInput) # Turns missing information labels red, or attempts to load the images if we have no missing information. if self.missingInfo != []: common.turnRed(self.missingInfo) common.popUpText(self, 'Error: Missing information. Empty fields have been highlighted.', 'Error') else: self.pkImageLoad()
def checkInfo(self): '''Checks that all the information fields are filled out. Creates the public key image once information is complete.''' common.turnBlack(self.missingInfo) self.missingInfo = [] # Check that a curve has been selected. if self.curveGroup.checkedId() == -1: self.missingInfo.append(self.curveLabel) # Check that an image location has been selected and location information is present. if self.selectGroup.checkedId() == -1: self.missingInfo.append(self.selectImageLabel) elif self.selectGroup.checkedId() == 1 and self.fromHDText.text() == '': self.missingInfo.append(self.fromHD) elif self.selectGroup.checkedId() == 2 and self.fromInternetText.text() == '': self.missingInfo.append(self.fromInternet) # Check that a password is filled in and that the two password fields match. if self.passwordText.text() == '': self.missingInfo.append(self.createPasswordLabel) elif self.passwordText.text() != self.cPasswordText.text(): self.missingInfo.append(self.passwordLabel) self.missingInfo.append(self.cPasswordLabel) # Turns missing information labels red, or attempts to load the image if we have no missing information. if self.missingInfo != []: common.turnRed(self.missingInfo) common.popUpText(self, 'Error: Missing information. Empty fields have been highlighted.', 'Error') else: if self.selectGroup.checkedId() == 1: try: self.baseImage = Image.open(self.fromHDText.text()) self.createPK() except IOError: self.missingInfo.append(self.fromHD) common.turnRed(self.missingInfo) common.popUpText(self,'Error: Cannot open image. Please try another image.', 'Error') elif self.selectGroup.checkedId() == 2: try: self.urlImage = cStringIO.StringIO(urllib.urlopen(self.fromInternetText.text()).read()) self.baseImage = Image.open(self.urlImage) self.createPK() except IOError: self.missingInfo.append(self.fromInternet) common.turnRed(self.missingInfo) common.popUpText(self,'Error: Cannot open image. Please verify that the website address is correct or try another image.', 'Error')
def checkInfo(self): '''Checks that all the information fields are filled out and valid. Loads the required information and passes it for encrypted image creation.''' common.turnBlack(self.missingInfo) self.missingInfo = [] # Checks that an encrypted image is selected and relevant information is present. if self.encSelectGroup.checkedId() == -1: self.missingInfo.append(self.encLabel) elif self.encSelectGroup.checkedId() == 1 and self.encFromHDText.text() == '': self.missingInfo.append(self.encFromHD) elif self.encSelectGroup.checkedId() == 2 and self.encFromInternetText.text() == '': self.missingInfo.append(self.encFromInternet) # Checks that a password has been entered. if self.passwordText.text() == '': self.missingInfo.append(self.inputPasswordLabel) self.missingInfo.append(self.passwordLabel) # Turns missing information labels red, or attempts to load the images if we have no missing information. if self.missingInfo != []: common.turnRed(self.missingInfo) common.popUpText(self, 'Error: Missing information. Empty fields have been highlighted.', 'Error') else: self.encImageLoad()