Exemplo n.º 1
0
 def __init__(self):
     super().__init__()
     self.method = 0
     self.alphabet = ''
     self.state = 0
     self.key = '0'
     self.message = ''
     self.ui = Ui_Dialog()
     self.initUI()
Exemplo n.º 2
0
	def __init__(self, parent=None):
		QtGui.QWidget.__init__(self, parent)
		self.ui = Ui_Dialog()
		self.ui.setupUi(self)
		
		# here we connect signals with our slots
		
		#self.ui.pushButton = QtGui.QPushButton('Login', self)
		self.ui.pushButton.clicked.connect(self.Login)
Exemplo n.º 3
0
class MyDialog(QDialog):
    def __init__(self):
        super().__init__()
        self.ui = Ui_Dialog()
        self.ui.setupUi(self)

    def myWindow(self):
        self.hide()
        self.myWin = MyWindow()
        self.myWin.show()
Exemplo n.º 4
0
class UN(QtGui.QMainWindow):
	def __init__(self, parent=None):
		QtGui.QWidget.__init__(self, parent)
		self.ui = Ui_Dialog()
		self.ui.setupUi(self)
		
		# here we connect signals with our slots
		
		#self.ui.pushButton = QtGui.QPushButton('Login', self)
		self.ui.pushButton.clicked.connect(self.Login)
		
		
		
	def Login(self):
		if (self.ui.lineEdit.text() == 'Mani' and self.ui.lineEdit_2.text() == 'Maran'):
			self.ui.accept()
	
		else:
				QtGui.QMessageBox.warning(self, 'error','please type correct user or password')
Exemplo n.º 5
0
def run_gui():
    app = QApplication([])
    Dialog = QDialog()
    ui = Ui_Dialog()
    ui.setupUi(Dialog)

    ui.run_manual_search.clicked.connect(lambda: start_search(
        ui.google_manual.isChecked(),
        ui.imdb_manual.isChecked(),
        ui.manual_search_term.toPlainText(),
        ui.headless_2.isChecked(),
        ui.sample_size_manual.value(),
    ))

    ui.run_list_search.clicked.connect(lambda: start_search(
        ui.google_auto.isChecked(),
        ui.imdb_auto.isChecked(),
        args.manual,
        ui.headless.isChecked(),
        ui.sample_size_list.value(),
    ))

    Dialog.show()
    sys.exit(app.exec_())
Exemplo n.º 6
0
class Application(QWidget):
    def __init__(self):
        super().__init__()
        self.method = 0
        self.alphabet = ''
        self.state = 0
        self.key = '0'
        self.message = ''
        self.ui = Ui_Dialog()
        self.initUI()

    def initUI(self):

        self.ui.setupUi(self)
        self.show()

        # Hook logic
        self.ui.buttonGroup.buttonClicked.connect(self.alphabet_init)
        self.ui.buttonGroup_2.buttonClicked.connect(self.state_init)
        self.ui.buttonGroup_3.buttonClicked.connect(self.method_init)
        self.ui.message_field.editingFinished.connect(self.message_init)
        self.ui.key_field.editingFinished.connect(self.key_init)
        self.ui.pushButton.clicked.connect(self.cipher_init)

    def alphabet_init(self, check_box):
        if check_box.isChecked() and check_box.objectName() == 'Russia':
            self.alphabet = 'абвгдеёжзийклмнопрстуфхцчшщъыьэюя' * 2
        elif check_box.isChecked() and check_box.objectName() == 'English':
            self.alphabet = 'abcdefghijklmnopqrstuvwxyz' * 2
        elif check_box.isChecked() and check_box.objectName() == 'German':
            self.alphabet = 'aäbcdefghijklmnoöpqrsßtuüvwxyz' * 2
        else:
            self.alphabet = self.ui.alphabet_field.text().replace(' ', '')

    def state_init(self, check_box):
        if check_box.isChecked() and check_box.objectName() == 'encryption':
            self.state = 1
        elif check_box.isChecked() and check_box.objectName() == 'decryption':
            self.state = -1

    def key_init(self):
        self.key = self.ui.key_field.text().replace(' ', '')
        try:
            int(self.key)
        except:
            self.ui.error_label_3.setText(
                'Пожалуйста, используйте в поле ключа только арабские цифры в десятичной системе счисления!'
            )

    def message_init(self):
        self.message = self.ui.message_field.text().lower().replace(' ', '')
        # Checking for letters in a message that are not in the alphabet
        j = 0
        for letter in self.message:
            for i in range(0, len(self.alphabet)):
                if letter == self.alphabet[i]:
                    j += 1
                    break
        if j != len(self.message):
            self.ui.error_label_2.setText(
                'Пожалуйста, используйте символы только из алфавита!')
            # self.ui.error_label.setGeometry(QRect(200, 290, 570, 20))
            self.message = ''
            self.ui.message_field.setText('')
        elif j == len(self.message) and self.ui.error_label.text() == (
                'Пожалуйста, используйте символы только из алфавита!'):
            self.ui.error_label.setText(' ')

    def cipher_init(self):
        if self.alphabet != '' and self.state != 0 and self.key != '0' and self.message != '' and self.method != 0:
            self.ui.error_label.setText('')
            if self.method == 1:
                result = caesar_code(self.message, self.key, self.state,
                                     self.alphabet)
            elif self.method == 2:
                result = gronsfeld_code(self.message, self.key, self.state,
                                        self.alphabet)
            self.ui.textBrowser.setText(result)

        else:
            self.ui.error_label.setText('Пожалуйста, заполните все поля!')

    def method_init(self, check_box):
        if check_box.isChecked() and check_box.objectName() == 'caesar':
            self.method = 1
        elif check_box.isChecked() and check_box.objectName() == 'gronsfeld':
            self.method = 2
Exemplo n.º 7
0
 def __init__(self):
     super().__init__()
     self.ui = Ui_Dialog()
     self.ui.setupUi(self)