Beispiel #1
0
        def btn_ok():
            # Here should be inserted the code to be executed when the pin is typed in
            config = ConfigParser.ConfigParser()
            config.readfp(open('config.ini'))
            pin = str(config.getint('Login','password'))

            if ( pin == self.pin ):

               self.sett = Ui_settings()
               self.sett.show()
               #To launch the application in full screen mode, Comment the previous line and Uncomment the next one.
               #self.sett.showFullScreen()


               self.close()
            else:

               self.wrongPin.setVisible(True)

               t = Timer(1,hide_message)
               t.start()


               self.pinEdit.setText("")



               self.pin = ""

            return None
Beispiel #2
0
    def __init__(self):
        super(ClbrSettings, self).__init__()
        self.sl = Ui_settings()
        self.sl.setupUi(self)

        self.load_sett()
        self.sl.save_settings.clicked.connect(self.save_sett)

        self.validat_param()
        def btn_ok():
            # Here should be inserted the code to be executed when the pin is typed in
            config = ConfigParser.ConfigParser()
            config.readfp(open('config.ini'))
            pin = str(config.getint('Login','password'))

            if ( pin == self.pin ):

               self.sett = Ui_settings()
               #self.sett.show()
               #To launch the application in full screen mode, Comment the previous line and Uncomment the next one.
               self.sett.showFullScreen()


               self.close()
            else:

               self.wrongPin.setVisible(True)

               t = Timer(1,hide_message)
               t.start()


               self.pinEdit.setText("")



               self.pin = ""

            return None
 def settings(self):
     from settings import Ui_settings
     self.Window = QtWidgets.QMainWindow()
     self.ui = Ui_settings()
     self.ui.setupUi(self.Window)
     self.Window.show()
class Ui_pinmenu(QtGui.QMainWindow):


    def __init__(self):

        QtGui.QMainWindow.__init__(self)
        self.setupUi(self)

    def setupUi(self, pinmenu):
        pinmenu.setObjectName(_fromUtf8("pinmenu"))
        pinmenu.resize(1024, 600)
        self.centralwidget = QtGui.QWidget(pinmenu)
        self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
        self.return_btn = QtGui.QPushButton(self.centralwidget)
        self.return_btn.setGeometry(QtCore.QRect(10, 10, 131, 51))
        self.return_btn.setObjectName(_fromUtf8("return_btn"))
        self.pinWidget = QtGui.QWidget(self.centralwidget)
        self.pinWidget.setGeometry(QtCore.QRect(290, 80, 391, 481))
        self.pinWidget.setObjectName(_fromUtf8("pinWidget"))
        self.seven_btn = QtGui.QPushButton(self.pinWidget)
        self.seven_btn.setGeometry(QtCore.QRect(10, 120, 111, 71))
        self.seven_btn.setObjectName(_fromUtf8("seven_btn"))
        self.eight_btn = QtGui.QPushButton(self.pinWidget)
        self.eight_btn.setGeometry(QtCore.QRect(140, 120, 111, 71))
        self.eight_btn.setObjectName(_fromUtf8("eight_btn"))
        self.nine_btn = QtGui.QPushButton(self.pinWidget)
        self.nine_btn.setGeometry(QtCore.QRect(270, 120, 111, 71))
        self.nine_btn.setObjectName(_fromUtf8("nine_btn"))
        self.four_btn = QtGui.QPushButton(self.pinWidget)
        self.four_btn.setGeometry(QtCore.QRect(10, 210, 111, 71))
        self.four_btn.setObjectName(_fromUtf8("four_btn"))
        self.five_btn = QtGui.QPushButton(self.pinWidget)
        self.five_btn.setGeometry(QtCore.QRect(140, 210, 111, 71))
        self.five_btn.setObjectName(_fromUtf8("five_btn"))
        self.six_btn = QtGui.QPushButton(self.pinWidget)
        self.six_btn.setGeometry(QtCore.QRect(270, 210, 111, 71))
        self.six_btn.setObjectName(_fromUtf8("six_btn"))
        self.one_btn = QtGui.QPushButton(self.pinWidget)
        self.one_btn.setGeometry(QtCore.QRect(10, 300, 111, 71))
        self.one_btn.setObjectName(_fromUtf8("one_btn"))
        self.zero_btn = QtGui.QPushButton(self.pinWidget)
        self.zero_btn.setGeometry(QtCore.QRect(10, 390, 111, 71))
        self.zero_btn.setObjectName(_fromUtf8("zero_btn"))
        self.three_btn = QtGui.QPushButton(self.pinWidget)
        self.three_btn.setGeometry(QtCore.QRect(270, 300, 111, 71))
        self.three_btn.setObjectName(_fromUtf8("three_btn"))
        self.two_btn = QtGui.QPushButton(self.pinWidget)
        self.two_btn.setGeometry(QtCore.QRect(140, 300, 111, 71))
        self.two_btn.setObjectName(_fromUtf8("two_btn"))
        self.ok_btn = QtGui.QPushButton(self.pinWidget)
        self.ok_btn.setGeometry(QtCore.QRect(270, 390, 111, 71))
        self.ok_btn.setObjectName(_fromUtf8("ok_btn"))
        self.pinEdit = QtGui.QLineEdit(self.pinWidget)
        self.pinEdit.setGeometry(QtCore.QRect(70, 50, 251, 51))
        font = QtGui.QFont()
        font.setPointSize(35)
        self.pinEdit.setMaxLength(4)
        self.pinEdit.setFont(font)
        self.pinEdit.setAlignment(QtCore.Qt.AlignCenter)
        self.pinEdit.setObjectName(_fromUtf8("pinEdit"))
        self.back_btn = QtGui.QPushButton(self.pinWidget)
        self.back_btn.setGeometry(QtCore.QRect(140, 390, 111, 71))
        self.back_btn.setObjectName(_fromUtf8("back_btn"))
        self.wrongPin = QtGui.QLabel(self.pinWidget)
        self.wrongPin.setGeometry(QtCore.QRect(70, 50, 251, 51))
        font = QtGui.QFont()
        font.setPointSize(20)
        self.wrongPin.setFont(font)
        self.wrongPin.setAlignment(QtCore.Qt.AlignCenter)

        self.wrongPin.setObjectName(_fromUtf8("wrongPin"))

        self.wrongPin.setVisible(False)
        palette = QtGui.QPalette()


        palette.setColor(QtGui.QPalette.Foreground,QtCore.Qt.red)
        self.wrongPin.setPalette(palette)




        pinmenu.setCentralWidget(self.centralwidget)

        self.retranslateUi(pinmenu)
        QtCore.QMetaObject.connectSlotsByName(pinmenu)

    def retranslateUi(self, pinmenu):

        pinmenu.setWindowTitle(_translate("pinmenu", "MainWindow", None))
        self.return_btn.setText(_translate("pinmenu", "Return", None))
        self.seven_btn.setText(_translate("pinmenu", "7", None))
        self.eight_btn.setText(_translate("pinmenu", "8", None))
        self.nine_btn.setText(_translate("pinmenu", "9", None))
        self.four_btn.setText(_translate("pinmenu", "4", None))
        self.five_btn.setText(_translate("pinmenu", "5", None))
        self.six_btn.setText(_translate("pinmenu", "6", None))
        self.one_btn.setText(_translate("pinmenu", "1", None))
        self.zero_btn.setText(_translate("pinmenu", "0", None))
        self.three_btn.setText(_translate("pinmenu", "3", None))
        self.two_btn.setText(_translate("pinmenu", "2", None))
        self.ok_btn.setText(_translate("pinmenu", "OK", None))
        self.pinEdit.setText(_translate("pinmenu", "", None))
        self.wrongPin.setText(_translate("pinmenu", "Wrong PIN", None))
        self.back_btn.setText(_translate("pinmenu", "back", None))
        self.centralwidget.setStyleSheet(CSS_BACKGROUND)
        self.pinWidget.setStyleSheet(CSS_BUTTON)



        self.btn_ok_f='btn_ok'
        self.btn_back_f='btn_back'
        self.btn_one_f='btn_one'
        self.btn_two_f='btn_two'
        self.btn_three_f='btn_three'
        self.btn_four_f='btn_four'
        self.btn_five_f='btn_five'
        self.btn_six_f='btn_six'
        self.btn_seven_f='btn_seven'
        self.btn_eight_f='btn_eight'
        self.btn_nine_f='btn_nine'
        self.btn_zero_f='btn_zero'

        self.funcs = [
        self.btn_ok_f,
        self.btn_back_f,
        self.btn_one_f,
        self.btn_two_f,
        self.btn_three_f,
        self.btn_four_f,
        self.btn_five_f,
        self.btn_six_f,
        self.btn_seven_f,
        self.btn_eight_f,
        self.btn_nine_f,
        self.btn_zero_f
                         ]

        self.buttons = [
            self.ok_btn,
            self.back_btn,
            self.one_btn,
            self.two_btn,
            self.three_btn,
            self.four_btn,
            self.five_btn,
            self.six_btn,
            self.seven_btn,
            self.eight_btn,
            self.nine_btn,
            self.zero_btn


        ]

        self.pin = ""
        def pineEdit_clear():
            line_temp = QtGui.QApplication.focusWidget()
            if ( type(line_temp) == QtGui.QLineEdit):
                 line_temp.setText('')


        def btn_one():
            line_temp = QtGui.QApplication.focusWidget()
            if ( type(line_temp) == QtGui.QLineEdit and len(line_temp.text()) < 4):
                 line_temp.setText(line_temp.text()+'*')
                 self.pin = self.pin + '1'

        def btn_two():
            line_temp = QtGui.QApplication.focusWidget()
            if ( type(line_temp) == QtGui.QLineEdit and len(line_temp.text()) < 4):
                 line_temp.setText(line_temp.text()+'*')
                 self.pin = self.pin + '2'

        def btn_three():
            line_temp = QtGui.QApplication.focusWidget()
            if ( type(line_temp) == QtGui.QLineEdit and len(line_temp.text()) < 4):
                 line_temp.setText(line_temp.text()+'*')
                 self.pin = self.pin + '3'

        def btn_four():
            line_temp = QtGui.QApplication.focusWidget()
            if ( type(line_temp) == QtGui.QLineEdit and len(line_temp.text()) < 4):
                 line_temp.setText(line_temp.text()+'*')
                 self.pin = self.pin + '4'

        def btn_five():
            line_temp = QtGui.QApplication.focusWidget()
            if ( type(line_temp) == QtGui.QLineEdit and len(line_temp.text()) < 4):
                 line_temp.setText(line_temp.text()+'*')
                 self.pin = self.pin + '5'

        def btn_six():
            line_temp = QtGui.QApplication.focusWidget()
            if ( type(line_temp) == QtGui.QLineEdit and len(line_temp.text()) < 4):
                 line_temp.setText(line_temp.text()+'*')
                 self.pin = self.pin + '6'

        def btn_seven():
            line_temp = QtGui.QApplication.focusWidget()
            if ( type(line_temp) == QtGui.QLineEdit and len(line_temp.text()) < 4):
                 line_temp.setText(line_temp.text()+'*')
                 self.pin = self.pin + '7'

        def btn_eight():
            line_temp = QtGui.QApplication.focusWidget()
            if ( type(line_temp) == QtGui.QLineEdit and len(line_temp.text()) < 4):
                 line_temp.setText(line_temp.text()+'*')
                 self.pin = self.pin + '8'

        def btn_nine():
            line_temp = QtGui.QApplication.focusWidget()
            if ( type(line_temp) == QtGui.QLineEdit and len(line_temp.text()) < 4):
                 line_temp.setText(line_temp.text()+'*')
                 self.pin = self.pin + '9'

        def btn_zero():
            line_temp = QtGui.QApplication.focusWidget()
            if ( type(line_temp) == QtGui.QLineEdit and len(line_temp.text()) < 4):
                 line_temp.setText(line_temp.text()+'*')
                 self.pin = self.pin + '0'

        def btn_ok():
            # Here should be inserted the code to be executed when the pin is typed in
            config = ConfigParser.ConfigParser()
            config.readfp(open('config.ini'))
            pin = str(config.getint('Login','password'))

            if ( pin == self.pin ):

               self.sett = Ui_settings()
               #self.sett.show()
               #To launch the application in full screen mode, Comment the previous line and Uncomment the next one.
               self.sett.showFullScreen()


               self.close()
            else:

               self.wrongPin.setVisible(True)

               t = Timer(1,hide_message)
               t.start()


               self.pinEdit.setText("")



               self.pin = ""

            return None

        def hide_message():
            self.wrongPin.setVisible(False)




        def btn_back():
            line_temp = QtGui.QApplication.focusWidget()
            if ( type(line_temp) == QtGui.QLineEdit):
                 line_temp.setText(line_temp.text()[:-1])
                 self.pin = self.pin[:-1]



        def btn_return():
            Context.actif = True
            self.close()

        for button in self.buttons:
            button.setFocusPolicy(QtCore.Qt.NoFocus)

        self.pinEdit.setFocus()

        for (button,func) in zip(self.buttons,self.funcs):

            button.clicked.connect(locals()[func])
            button.setStyleSheet(CSS_BUTTON)
        self.return_btn.setStyleSheet(CSS_BUTTON)
        self.return_btn.clicked.connect(btn_return)
class Ui_pinmenu(QtGui.QMainWindow):
    def __init__(self):

        QtGui.QMainWindow.__init__(self)
        self.setupUi(self)

    def setupUi(self, pinmenu):
        pinmenu.setObjectName(_fromUtf8("pinmenu"))
        pinmenu.resize(1024, 600)
        self.centralwidget = QtGui.QWidget(pinmenu)
        self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
        self.return_btn = QtGui.QPushButton(self.centralwidget)
        self.return_btn.setGeometry(QtCore.QRect(10, 10, 131, 51))
        self.return_btn.setObjectName(_fromUtf8("return_btn"))
        self.pinWidget = QtGui.QWidget(self.centralwidget)
        self.pinWidget.setGeometry(QtCore.QRect(290, 80, 391, 481))
        self.pinWidget.setObjectName(_fromUtf8("pinWidget"))
        self.seven_btn = QtGui.QPushButton(self.pinWidget)
        self.seven_btn.setGeometry(QtCore.QRect(10, 120, 111, 71))
        self.seven_btn.setObjectName(_fromUtf8("seven_btn"))
        self.eight_btn = QtGui.QPushButton(self.pinWidget)
        self.eight_btn.setGeometry(QtCore.QRect(140, 120, 111, 71))
        self.eight_btn.setObjectName(_fromUtf8("eight_btn"))
        self.nine_btn = QtGui.QPushButton(self.pinWidget)
        self.nine_btn.setGeometry(QtCore.QRect(270, 120, 111, 71))
        self.nine_btn.setObjectName(_fromUtf8("nine_btn"))
        self.four_btn = QtGui.QPushButton(self.pinWidget)
        self.four_btn.setGeometry(QtCore.QRect(10, 210, 111, 71))
        self.four_btn.setObjectName(_fromUtf8("four_btn"))
        self.five_btn = QtGui.QPushButton(self.pinWidget)
        self.five_btn.setGeometry(QtCore.QRect(140, 210, 111, 71))
        self.five_btn.setObjectName(_fromUtf8("five_btn"))
        self.six_btn = QtGui.QPushButton(self.pinWidget)
        self.six_btn.setGeometry(QtCore.QRect(270, 210, 111, 71))
        self.six_btn.setObjectName(_fromUtf8("six_btn"))
        self.one_btn = QtGui.QPushButton(self.pinWidget)
        self.one_btn.setGeometry(QtCore.QRect(10, 300, 111, 71))
        self.one_btn.setObjectName(_fromUtf8("one_btn"))
        self.zero_btn = QtGui.QPushButton(self.pinWidget)
        self.zero_btn.setGeometry(QtCore.QRect(10, 390, 111, 71))
        self.zero_btn.setObjectName(_fromUtf8("zero_btn"))
        self.three_btn = QtGui.QPushButton(self.pinWidget)
        self.three_btn.setGeometry(QtCore.QRect(270, 300, 111, 71))
        self.three_btn.setObjectName(_fromUtf8("three_btn"))
        self.two_btn = QtGui.QPushButton(self.pinWidget)
        self.two_btn.setGeometry(QtCore.QRect(140, 300, 111, 71))
        self.two_btn.setObjectName(_fromUtf8("two_btn"))
        self.ok_btn = QtGui.QPushButton(self.pinWidget)
        self.ok_btn.setGeometry(QtCore.QRect(270, 390, 111, 71))
        self.ok_btn.setObjectName(_fromUtf8("ok_btn"))
        self.pinEdit = QtGui.QLineEdit(self.pinWidget)
        self.pinEdit.setGeometry(QtCore.QRect(70, 50, 251, 51))
        font = QtGui.QFont()
        font.setPointSize(35)
        self.pinEdit.setMaxLength(4)
        self.pinEdit.setFont(font)
        self.pinEdit.setAlignment(QtCore.Qt.AlignCenter)
        self.pinEdit.setObjectName(_fromUtf8("pinEdit"))
        self.back_btn = QtGui.QPushButton(self.pinWidget)
        self.back_btn.setGeometry(QtCore.QRect(140, 390, 111, 71))
        self.back_btn.setObjectName(_fromUtf8("back_btn"))
        self.wrongPin = QtGui.QLabel(self.pinWidget)
        self.wrongPin.setGeometry(QtCore.QRect(70, 50, 251, 51))
        font = QtGui.QFont()
        font.setPointSize(20)
        self.wrongPin.setFont(font)
        self.wrongPin.setAlignment(QtCore.Qt.AlignCenter)

        self.wrongPin.setObjectName(_fromUtf8("wrongPin"))

        self.wrongPin.setVisible(False)
        palette = QtGui.QPalette()

        palette.setColor(QtGui.QPalette.Foreground, QtCore.Qt.red)
        self.wrongPin.setPalette(palette)

        pinmenu.setCentralWidget(self.centralwidget)

        self.retranslateUi(pinmenu)
        QtCore.QMetaObject.connectSlotsByName(pinmenu)

    def retranslateUi(self, pinmenu):

        pinmenu.setWindowTitle(_translate("pinmenu", "MainWindow", None))
        self.return_btn.setText(_translate("pinmenu", "Return", None))
        self.seven_btn.setText(_translate("pinmenu", "7", None))
        self.eight_btn.setText(_translate("pinmenu", "8", None))
        self.nine_btn.setText(_translate("pinmenu", "9", None))
        self.four_btn.setText(_translate("pinmenu", "4", None))
        self.five_btn.setText(_translate("pinmenu", "5", None))
        self.six_btn.setText(_translate("pinmenu", "6", None))
        self.one_btn.setText(_translate("pinmenu", "1", None))
        self.zero_btn.setText(_translate("pinmenu", "0", None))
        self.three_btn.setText(_translate("pinmenu", "3", None))
        self.two_btn.setText(_translate("pinmenu", "2", None))
        self.ok_btn.setText(_translate("pinmenu", "OK", None))
        self.pinEdit.setText(_translate("pinmenu", "", None))
        self.wrongPin.setText(_translate("pinmenu", "Wrong PIN", None))
        self.back_btn.setText(_translate("pinmenu", "back", None))
        self.centralwidget.setStyleSheet(
            """
    	.QWidget#centralwidget {
    	background-image: url(res/images/background.jpg);
    	}"""
        )
        self.pinWidget.setStyleSheet(
            """

        .QWidget#pinWidget {
            border-width: 3px;
            border-color: black;
    	    background-color: white;
	        border-radius: 10px;
    	}"""
        )

        self.btn_ok_f = "btn_ok"
        self.btn_back_f = "btn_back"
        self.btn_one_f = "btn_one"
        self.btn_two_f = "btn_two"
        self.btn_three_f = "btn_three"
        self.btn_four_f = "btn_four"
        self.btn_five_f = "btn_five"
        self.btn_six_f = "btn_six"
        self.btn_seven_f = "btn_seven"
        self.btn_eight_f = "btn_eight"
        self.btn_nine_f = "btn_nine"
        self.btn_zero_f = "btn_zero"

        self.funcs = [
            self.btn_ok_f,
            self.btn_back_f,
            self.btn_one_f,
            self.btn_two_f,
            self.btn_three_f,
            self.btn_four_f,
            self.btn_five_f,
            self.btn_six_f,
            self.btn_seven_f,
            self.btn_eight_f,
            self.btn_nine_f,
            self.btn_zero_f,
        ]

        self.buttons = [
            self.ok_btn,
            self.back_btn,
            self.one_btn,
            self.two_btn,
            self.three_btn,
            self.four_btn,
            self.five_btn,
            self.six_btn,
            self.seven_btn,
            self.eight_btn,
            self.nine_btn,
            self.zero_btn,
        ]

        self.pin = ""

        def pineEdit_clear():
            line_temp = QtGui.QApplication.focusWidget()
            if type(line_temp) == QtGui.QLineEdit:
                line_temp.setText("")

        def btn_one():
            line_temp = QtGui.QApplication.focusWidget()
            if type(line_temp) == QtGui.QLineEdit and len(line_temp.text()) < 4:
                line_temp.setText(line_temp.text() + "*")
                self.pin = self.pin + "1"

        def btn_two():
            line_temp = QtGui.QApplication.focusWidget()
            if type(line_temp) == QtGui.QLineEdit and len(line_temp.text()) < 4:
                line_temp.setText(line_temp.text() + "*")
                self.pin = self.pin + "2"

        def btn_three():
            line_temp = QtGui.QApplication.focusWidget()
            if type(line_temp) == QtGui.QLineEdit and len(line_temp.text()) < 4:
                line_temp.setText(line_temp.text() + "*")
                self.pin = self.pin + "3"

        def btn_four():
            line_temp = QtGui.QApplication.focusWidget()
            if type(line_temp) == QtGui.QLineEdit and len(line_temp.text()) < 4:
                line_temp.setText(line_temp.text() + "*")
                self.pin = self.pin + "4"

        def btn_five():
            line_temp = QtGui.QApplication.focusWidget()
            if type(line_temp) == QtGui.QLineEdit and len(line_temp.text()) < 4:
                line_temp.setText(line_temp.text() + "*")
                self.pin = self.pin + "5"

        def btn_six():
            line_temp = QtGui.QApplication.focusWidget()
            if type(line_temp) == QtGui.QLineEdit and len(line_temp.text()) < 4:
                line_temp.setText(line_temp.text() + "*")
                self.pin = self.pin + "6"

        def btn_seven():
            line_temp = QtGui.QApplication.focusWidget()
            if type(line_temp) == QtGui.QLineEdit and len(line_temp.text()) < 4:
                line_temp.setText(line_temp.text() + "*")
                self.pin = self.pin + "7"

        def btn_eight():
            line_temp = QtGui.QApplication.focusWidget()
            if type(line_temp) == QtGui.QLineEdit and len(line_temp.text()) < 4:
                line_temp.setText(line_temp.text() + "*")
                self.pin = self.pin + "8"

        def btn_nine():
            line_temp = QtGui.QApplication.focusWidget()
            if type(line_temp) == QtGui.QLineEdit and len(line_temp.text()) < 4:
                line_temp.setText(line_temp.text() + "*")
                self.pin = self.pin + "9"

        def btn_zero():
            line_temp = QtGui.QApplication.focusWidget()
            if type(line_temp) == QtGui.QLineEdit and len(line_temp.text()) < 4:
                line_temp.setText(line_temp.text() + "*")
                self.pin = self.pin + "0"

        def btn_ok():
            # Here should be inserted the code to be executed when the pin is typed in
            config = ConfigParser.ConfigParser()
            config.readfp(open("config.ini"))
            pin = str(config.getint("Login", "password"))

            if pin == self.pin:

                self.sett = Ui_settings()
                self.sett.show()
                # To launch the application in full screen mode, Comment the previous line and Uncomment the next one.
                # self.sett.showFullScreen()

                self.close()
            else:

                self.wrongPin.setVisible(True)

                t = Timer(1, hide_message)
                t.start()

                self.pinEdit.setText("")

                self.pin = ""

            return None

        def hide_message():
            self.wrongPin.setVisible(False)

        def btn_back():
            line_temp = QtGui.QApplication.focusWidget()
            if type(line_temp) == QtGui.QLineEdit:
                line_temp.setText(line_temp.text()[:-1])
                self.pin = self.pin[:-1]

        def btn_return():
            self.close()

        for button in self.buttons:
            button.setFocusPolicy(QtCore.Qt.NoFocus)

        self.pinEdit.setFocus()

        for (button, func) in zip(self.buttons, self.funcs):

            button.clicked.connect(locals()[func])
            button.setStyleSheet(
                """

        QPushButton {

        background-color: white;
        border-style: outset;
        border-width: 1px;
        border-color: black;
        font: bold 14px;
        border-radius: 10px;


        }

        QPushButton:pressed {
        background-color: grey;
        border-style: inset;
        }

        """
            )
        self.return_btn.setStyleSheet(
            """

        QPushButton {

        background-color: white;
        border-style: outset;
        border-width: 1px;
        border-color: black;
        font: bold 14px;
        border-radius: 10px;


        }

        QPushButton:pressed {
        background-color: grey;
        border-style: inset;
        }

        """
        )
        self.return_btn.clicked.connect(btn_return)
Beispiel #7
0
class ClbrSettings(QtWidgets.QDialog):
    def __init__(self):
        super(ClbrSettings, self).__init__()
        self.sl = Ui_settings()
        self.sl.setupUi(self)

        self.load_sett()
        self.sl.save_settings.clicked.connect(self.save_sett)

        self.validat_param()

    def validat_param(self):
        """ Валидация полей(латинские, цифры, пробел) """
        for field in self.dict_sett().values():
            field.setValidator(QRegExpValidator(QRegExp("^[a-zA-Z0-9 ]+$")))

    def dict_sett(self):
        sett_p = {
            'calibr_type': self.sl.s_calibr_type,
            'calibr_number': self.sl.s_calibr_number,
            't': self.sl.s_t,
            'f': self.sl.s_f,
            'p': self.sl.s_p,
            'parametr_type': self.sl.s_parametr_type,
            'parametr_number': self.sl.s_parametr_number,
            'parametr_year': self.sl.s_parametr_year,
            'parametr_position': self.sl.s_parametr_position,
            'in_signal': self.sl.s_in_signal,
            'in_signal_start': self.sl.s_in_signal_start,
            'in_signal_end': self.sl.s_in_signal_end,
            'out_signal': self.sl.s_out_signal,
            'out_signal_start': self.sl.s_out_signal_start,
            'out_signal_end': self.sl.s_out_signal_end,
            'pvi_scale_start': self.sl.s_pvi_scale_start,
            'pvi_scale_end': self.sl.s_pvi_scale_end,
            'pvi_scale_out': self.sl.s_pvi_scale_out,
            'out_irt_value_5': self.sl.s_out_irt_value_5,
            'out_irt_value_25': self.sl.s_out_irt_value_25,
            'out_irt_value_50': self.sl.s_out_irt_value_50,
            'out_irt_value_75': self.sl.s_out_irt_value_75,
            'out_irt_value_95': self.sl.s_out_irt_value_95,
            'out_irt_output_5': self.sl.s_out_irt_output_5,
            'out_irt_output_25': self.sl.s_out_irt_output_25,
            'out_irt_output_50': self.sl.s_out_irt_output_50,
            'out_irt_output_75': self.sl.s_out_irt_output_75,
            'out_irt_output_95': self.sl.s_out_irt_output_95,
            'out_irt_in_5': self.sl.s_out_irt_in_5,
            'out_irt_in_25': self.sl.s_out_irt_in_25,
            'out_irt_in_50': self.sl.s_out_irt_in_50,
            'out_irt_in_75': self.sl.s_out_irt_in_75,
            'out_irt_in_95': self.sl.s_out_irt_in_95,
            'acceptance_error_irt': self.sl.s_acceptance_error_irt,
            'out_24_value': self.sl.s_out_24_value,
            'out_24_value_820': self.sl.s_out_24_value_820,
            'out_24_in': self.sl.s_out_24_in,
            'out_24_in_820': self.sl.s_out_24_in_820,
            'acceptance_error_24': self.sl.s_acceptance_error_24,
            'out_pvi_value_5': self.sl.s_out_pvi_value_5,
            'out_pvi_value_25': self.sl.s_out_pvi_value_25,
            'out_pvi_value_50': self.sl.s_out_pvi_value_50,
            'out_pvi_value_75': self.sl.s_out_pvi_value_75,
            'out_pvi_value_95': self.sl.s_out_pvi_value_95,
            'out_pvi_output_5': self.sl.s_out_pvi_output_5,
            'out_pvi_output_25': self.sl.s_out_pvi_output_25,
            'out_pvi_output_50': self.sl.s_out_pvi_output_50,
            'out_pvi_output_75': self.sl.s_out_pvi_output_75,
            'out_pvi_output_95': self.sl.s_out_pvi_output_95,
            'out_pvi_in_5': self.sl.s_out_pvi_in_5,
            'out_pvi_in_25': self.sl.s_out_pvi_in_25,
            'out_pvi_in_50': self.sl.s_out_pvi_in_50,
            'out_pvi_in_75': self.sl.s_out_pvi_in_75,
            'out_pvi_in_95': self.sl.s_out_pvi_in_95,
            'acceptance_error_pvi': self.sl.s_acceptance_error_pvi,
            'passed': self.sl.s_passed,
            'adopted': self.sl.s_adopted,
            'date_calibration': self.sl.s_date_calibration,
            'result': self.sl.s_result,
        }
        return sett_p

    def load_sett(self):
        try:
            dict_sett = self.dict_sett()

            settings = configparser.ConfigParser()
            settings.read("parameters.ini", encoding="utf-8")
            section = "Выходные ячейки"

            for key in dict_sett.keys():
                dict_sett[key].setText(settings.get(section, key))

        except Exception as exeption:
            QtWidgets.QMessageBox.critical(
                self, "Ошибка",
                f"Не удалось прочитать файл <parameters.ini>.Ошибка - {type(exeption).__name__}",
                QtWidgets.QMessageBox.Ok)

    def save_sett(self):
        try:
            dict_sett = self.dict_sett()

            settings = configparser.ConfigParser()
            settings.read("parameters.ini", encoding="utf-8")

            section = "Выходные ячейки"
            if not settings.has_section(section):
                settings.add_section(section)

            for key, value in dict_sett.items():
                settings.set(section, key, value.text())

            with open("parameters.ini", "w", encoding="utf8") as config_file:
                settings.write(config_file)

                QtWidgets.QMessageBox.information(
                    self, "Сохранение настроек", "Настроки успешно сохранены!",
                    QtWidgets.QMessageBox.Ok)
        except Exception as exeption:
            QtWidgets.QMessageBox.critical(
                self, "Ошибка записи",
                f"Не удалось сохранить настройки. Ошибка - {type(exeption).__name__}",
                QtWidgets.QMessageBox.Ok)
Beispiel #8
0
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
        self.pushButton.clicked.connect(self.home)
        self.pushButton_7.clicked.connect(self.logout)
        self.pushButton_2.clicked.connect(self.search)
        self.pushButton_8.clicked.connect(self.settings)
        self.pushButton_6.clicked.connect(self.cplaylist)
        self.pushButton_3.clicked.connect(self.upload)
        self.pushButton_4.clicked.connect(self.reset)
        self.pushButton_5.clicked.connect(self.uplaylist)

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
        self.pushButton_7.setText(_translate("MainWindow", "Logout"))
        self.pushButton_4.setText(_translate("MainWindow", "Reset Password"))


if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    MainWindow = QtWidgets.QMainWindow()
    ui = Ui_settings()
    ui.setupUi(MainWindow)
    MainWindow.show()
    sys.exit(app.exec_())
Beispiel #9
0
class Ui_pinmenu(QtGui.QMainWindow):


    def __init__(self):

        QtGui.QMainWindow.__init__(self)
        self.setupUi(self)

    def setupUi(self, pinmenu):
        pinmenu.setObjectName(_fromUtf8("pinmenu"))
        pinmenu.resize(1024, 600)
        self.centralwidget = QtGui.QWidget(pinmenu)
        self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
        self.return_btn = QtGui.QPushButton(self.centralwidget)
        self.return_btn.setGeometry(QtCore.QRect(10, 10, 131, 51))
        self.return_btn.setObjectName(_fromUtf8("return_btn"))
        self.pinWidget = QtGui.QWidget(self.centralwidget)
        self.pinWidget.setGeometry(QtCore.QRect(290, 80, 391, 481))
        self.pinWidget.setObjectName(_fromUtf8("pinWidget"))
        self.seven_btn = QtGui.QPushButton(self.pinWidget)
        self.seven_btn.setGeometry(QtCore.QRect(10, 120, 111, 71))
        self.seven_btn.setObjectName(_fromUtf8("seven_btn"))
        self.eight_btn = QtGui.QPushButton(self.pinWidget)
        self.eight_btn.setGeometry(QtCore.QRect(140, 120, 111, 71))
        self.eight_btn.setObjectName(_fromUtf8("eight_btn"))
        self.nine_btn = QtGui.QPushButton(self.pinWidget)
        self.nine_btn.setGeometry(QtCore.QRect(270, 120, 111, 71))
        self.nine_btn.setObjectName(_fromUtf8("nine_btn"))
        self.four_btn = QtGui.QPushButton(self.pinWidget)
        self.four_btn.setGeometry(QtCore.QRect(10, 210, 111, 71))
        self.four_btn.setObjectName(_fromUtf8("four_btn"))
        self.five_btn = QtGui.QPushButton(self.pinWidget)
        self.five_btn.setGeometry(QtCore.QRect(140, 210, 111, 71))
        self.five_btn.setObjectName(_fromUtf8("five_btn"))
        self.six_btn = QtGui.QPushButton(self.pinWidget)
        self.six_btn.setGeometry(QtCore.QRect(270, 210, 111, 71))
        self.six_btn.setObjectName(_fromUtf8("six_btn"))
        self.one_btn = QtGui.QPushButton(self.pinWidget)
        self.one_btn.setGeometry(QtCore.QRect(10, 300, 111, 71))
        self.one_btn.setObjectName(_fromUtf8("one_btn"))
        self.zero_btn = QtGui.QPushButton(self.pinWidget)
        self.zero_btn.setGeometry(QtCore.QRect(10, 390, 111, 71))
        self.zero_btn.setObjectName(_fromUtf8("zero_btn"))
        self.three_btn = QtGui.QPushButton(self.pinWidget)
        self.three_btn.setGeometry(QtCore.QRect(270, 300, 111, 71))
        self.three_btn.setObjectName(_fromUtf8("three_btn"))
        self.two_btn = QtGui.QPushButton(self.pinWidget)
        self.two_btn.setGeometry(QtCore.QRect(140, 300, 111, 71))
        self.two_btn.setObjectName(_fromUtf8("two_btn"))
        self.ok_btn = QtGui.QPushButton(self.pinWidget)
        self.ok_btn.setGeometry(QtCore.QRect(270, 390, 111, 71))
        self.ok_btn.setObjectName(_fromUtf8("ok_btn"))
        self.pinEdit = QtGui.QLineEdit(self.pinWidget)
        self.pinEdit.setGeometry(QtCore.QRect(70, 50, 251, 51))
        font = QtGui.QFont()
        font.setPointSize(35)
        self.pinEdit.setMaxLength(4)
        self.pinEdit.setFont(font)
        self.pinEdit.setAlignment(QtCore.Qt.AlignCenter)
        self.pinEdit.setObjectName(_fromUtf8("pinEdit"))
        self.back_btn = QtGui.QPushButton(self.pinWidget)
        self.back_btn.setGeometry(QtCore.QRect(140, 390, 111, 71))
        self.back_btn.setObjectName(_fromUtf8("back_btn"))
        self.wrongPin = QtGui.QLabel(self.pinWidget)
        self.wrongPin.setGeometry(QtCore.QRect(70, 50, 251, 51))
        font = QtGui.QFont()
        font.setPointSize(20)
        self.wrongPin.setFont(font)
        self.wrongPin.setAlignment(QtCore.Qt.AlignCenter)

        self.wrongPin.setObjectName(_fromUtf8("wrongPin"))

        self.wrongPin.setVisible(False)
        palette = QtGui.QPalette()


        palette.setColor(QtGui.QPalette.Foreground,QtCore.Qt.red)
        self.wrongPin.setPalette(palette)




        pinmenu.setCentralWidget(self.centralwidget)

        self.retranslateUi(pinmenu)
        QtCore.QMetaObject.connectSlotsByName(pinmenu)

    def retranslateUi(self, pinmenu):

        pinmenu.setWindowTitle(_translate("pinmenu", "MainWindow", None))
        self.return_btn.setText(_translate("pinmenu", "Return", None))
        self.seven_btn.setText(_translate("pinmenu", "7", None))
        self.eight_btn.setText(_translate("pinmenu", "8", None))
        self.nine_btn.setText(_translate("pinmenu", "9", None))
        self.four_btn.setText(_translate("pinmenu", "4", None))
        self.five_btn.setText(_translate("pinmenu", "5", None))
        self.six_btn.setText(_translate("pinmenu", "6", None))
        self.one_btn.setText(_translate("pinmenu", "1", None))
        self.zero_btn.setText(_translate("pinmenu", "0", None))
        self.three_btn.setText(_translate("pinmenu", "3", None))
        self.two_btn.setText(_translate("pinmenu", "2", None))
        self.ok_btn.setText(_translate("pinmenu", "OK", None))
        self.pinEdit.setText(_translate("pinmenu", "", None))
        self.wrongPin.setText(_translate("pinmenu", "Wrong PIN", None))
        self.back_btn.setText(_translate("pinmenu", "back", None))
        self.centralwidget.setStyleSheet("""
    	.QWidget#centralwidget {
    	background-image: url(res/images/background.jpg);
    	}""")
        self.pinWidget.setStyleSheet("""

        .QWidget#pinWidget {
            border-width: 3px;
            border-color: black;
    	    background-color: white;
	        border-radius: 10px;
    	}""")



        self.btn_ok_f='btn_ok'
        self.btn_back_f='btn_back'
        self.btn_one_f='btn_one'
        self.btn_two_f='btn_two'
        self.btn_three_f='btn_three'
        self.btn_four_f='btn_four'
        self.btn_five_f='btn_five'
        self.btn_six_f='btn_six'
        self.btn_seven_f='btn_seven'
        self.btn_eight_f='btn_eight'
        self.btn_nine_f='btn_nine'
        self.btn_zero_f='btn_zero'

        self.funcs = [
        self.btn_ok_f,
        self.btn_back_f,
        self.btn_one_f,
        self.btn_two_f,
        self.btn_three_f,
        self.btn_four_f,
        self.btn_five_f,
        self.btn_six_f,
        self.btn_seven_f,
        self.btn_eight_f,
        self.btn_nine_f,
        self.btn_zero_f
                         ]

        self.buttons = [
            self.ok_btn,
            self.back_btn,
            self.one_btn,
            self.two_btn,
            self.three_btn,
            self.four_btn,
            self.five_btn,
            self.six_btn,
            self.seven_btn,
            self.eight_btn,
            self.nine_btn,
            self.zero_btn


        ]

        self.pin = ""
        def pineEdit_clear():
            line_temp = QtGui.QApplication.focusWidget()
            if ( type(line_temp) == QtGui.QLineEdit):
                 line_temp.setText('')


        def btn_one():
            line_temp = QtGui.QApplication.focusWidget()
            if ( type(line_temp) == QtGui.QLineEdit and len(line_temp.text()) < 4):
                 line_temp.setText(line_temp.text()+'*')
                 self.pin = self.pin + '1'

        def btn_two():
            line_temp = QtGui.QApplication.focusWidget()
            if ( type(line_temp) == QtGui.QLineEdit and len(line_temp.text()) < 4):
                 line_temp.setText(line_temp.text()+'*')
                 self.pin = self.pin + '2'

        def btn_three():
            line_temp = QtGui.QApplication.focusWidget()
            if ( type(line_temp) == QtGui.QLineEdit and len(line_temp.text()) < 4):
                 line_temp.setText(line_temp.text()+'*')
                 self.pin = self.pin + '3'

        def btn_four():
            line_temp = QtGui.QApplication.focusWidget()
            if ( type(line_temp) == QtGui.QLineEdit and len(line_temp.text()) < 4):
                 line_temp.setText(line_temp.text()+'*')
                 self.pin = self.pin + '4'

        def btn_five():
            line_temp = QtGui.QApplication.focusWidget()
            if ( type(line_temp) == QtGui.QLineEdit and len(line_temp.text()) < 4):
                 line_temp.setText(line_temp.text()+'*')
                 self.pin = self.pin + '5'

        def btn_six():
            line_temp = QtGui.QApplication.focusWidget()
            if ( type(line_temp) == QtGui.QLineEdit and len(line_temp.text()) < 4):
                 line_temp.setText(line_temp.text()+'*')
                 self.pin = self.pin + '6'

        def btn_seven():
            line_temp = QtGui.QApplication.focusWidget()
            if ( type(line_temp) == QtGui.QLineEdit and len(line_temp.text()) < 4):
                 line_temp.setText(line_temp.text()+'*')
                 self.pin = self.pin + '7'

        def btn_eight():
            line_temp = QtGui.QApplication.focusWidget()
            if ( type(line_temp) == QtGui.QLineEdit and len(line_temp.text()) < 4):
                 line_temp.setText(line_temp.text()+'*')
                 self.pin = self.pin + '8'

        def btn_nine():
            line_temp = QtGui.QApplication.focusWidget()
            if ( type(line_temp) == QtGui.QLineEdit and len(line_temp.text()) < 4):
                 line_temp.setText(line_temp.text()+'*')
                 self.pin = self.pin + '9'

        def btn_zero():
            line_temp = QtGui.QApplication.focusWidget()
            if ( type(line_temp) == QtGui.QLineEdit and len(line_temp.text()) < 4):
                 line_temp.setText(line_temp.text()+'*')
                 self.pin = self.pin + '0'

        def btn_ok():
            # Here should be inserted the code to be executed when the pin is typed in
            config = ConfigParser.ConfigParser()
            config.readfp(open('config.ini'))
            pin = str(config.getint('Login','password'))

            if ( pin == self.pin ):

               self.sett = Ui_settings()
               self.sett.show()
               #To launch the application in full screen mode, Comment the previous line and Uncomment the next one.
               #self.sett.showFullScreen()


               self.close()
            else:

               self.wrongPin.setVisible(True)

               t = Timer(1,hide_message)
               t.start()


               self.pinEdit.setText("")



               self.pin = ""

            return None

        def hide_message():
            self.wrongPin.setVisible(False)




        def btn_back():
            line_temp = QtGui.QApplication.focusWidget()
            if ( type(line_temp) == QtGui.QLineEdit):
                 line_temp.setText(line_temp.text()[:-1])
                 self.pin = self.pin[:-1]



        def btn_return():
            self.close()

        for button in self.buttons:
            button.setFocusPolicy(QtCore.Qt.NoFocus)

        self.pinEdit.setFocus()

        for (button,func) in zip(self.buttons,self.funcs):

            button.clicked.connect(locals()[func])
            button.setStyleSheet("""

        QPushButton {

        background-color: white;
        border-style: outset;
        border-width: 1px;
        border-color: black;
        font: bold 14px;
        border-radius: 10px;


        }

        QPushButton:pressed {
        background-color: grey;
        border-style: inset;
        }

        """)
        self.return_btn.setStyleSheet("""

        QPushButton {

        background-color: white;
        border-style: outset;
        border-width: 1px;
        border-color: black;
        font: bold 14px;
        border-radius: 10px;


        }

        QPushButton:pressed {
        background-color: grey;
        border-style: inset;
        }

        """)
        self.return_btn.clicked.connect(btn_return)