Exemplo n.º 1
0
 def LoginClicked(self):
     self.allwidget['userent'].setStyleSheet(StyleSheets.EntryStyleSheet())
     self.allwidget['passwent'].setStyleSheet(StyleSheets.EntryStyleSheet())
     username = self.allwidget["userent"].displayText()  ## get the username enter by user 
     password = self.allwidget["passwent"].text()        ## get the password enter bu user
     if self.UserData["username"] == username:           ## check if the user name is correct or not
         if self.UserData["password"] == password:       ## check if the password is correct or not
             self.openCalc()                             ## if password and usename is correct open the calculator
         else:                                           ## if password is wronge set red background
             self.allwidget["passwent"].setStyleSheet(StyleSheets.WrongEntryStyleSheet())    
     else:                                               ## if username is wronge set red background
         self.allwidget["userent"].setStyleSheet(StyleSheets.WrongEntryStyleSheet())
Exemplo n.º 2
0
    def __init__(self,parent = None):
        super().__init__(parent)
        self._allWidgets:dict = {}
        self._unicode:dict = {
            "rootsign":"\u221a",
            "square":"X\u00b2",
            "backarrow":"\u2192"            
        }
        self.Query = Query()
        self.setGeometry(100,30,500,800)
        self.setWindowTitle("Calculator")
        self.setStyleSheet(StyleSheets.MainWindowStyleSheet())
        self.createMenu()
        self.createStatusBar()
        self._iseqlpressed = False
        self.buttonGrid = QGridLayout()
        self.mainWidget = QWidget()
        self.extrabuttonGrid = QGridLayout()
        self.mainOuterlLayout = QHBoxLayout(self.mainWidget)
        self.mainRightLayout = QVBoxLayout()
        self.mainLeftLayout = QVBoxLayout()
        self.setCentralWidget(self.mainWidget)
        self.createAllButtons()
        self.createExtraButton()
        self.BindAllMainWidget()

        self.RecEngine = None
        self.VoiceEngine = None
        self.is_listning = False
        self.audio = None
        self.notspeaking = True
        self.allThreadStart = False
Exemplo n.º 3
0
 def passwordEntry(self):
     passw = QLineEdit("")                                ## create instance of entry field
     passw.setPlaceholderText("Password")                 ## set placeholder to field
     passw.setEchoMode(QLineEdit.Password)                ## set the text should displayed in password formate
     passw.setStyleSheet(StyleSheets.EntryStyleSheet())   ## set style to field
     self.allwidget["passwent"] = passw                   ## save the entry field to dictonary
     return passw                                         ## return the instance from function
Exemplo n.º 4
0
 def createEditWindow(self):
     _query_view = QLineEdit(self.Query.getcurrentQuery())
     _query_view.setAlignment(QtCore.Qt.AlignRight)
     _query_view.setStyleSheet(StyleSheets.EditTextStyleSheet())
     _query_view.setReadOnly(True)
     _query_view.setFocus()
     self._allWidgets["queryView"] = _query_view
     return _query_view
Exemplo n.º 5
0
 def createHistorySection(self):
     history = QTextEdit("")
     history.setReadOnly(True)
     history.setAlignment(QtCore.Qt.AlignTop)
     history.setFixedWidth(400)
     history.setStyleSheet(StyleSheets.HistorySectionStyleSheet())
     self._allWidgets["history"] = history
     return history
Exemplo n.º 6
0
 def createTopLabel(self):
     toplabel = QLabel("Standard")
     toplabel.setStyleSheet(StyleSheets.TopLabelStyleSheet())
     self._allWidgets["toplabel"] = toplabel
     return toplabel
Exemplo n.º 7
0
 def createExtraButton(self):
     self.extrabuttonGrid.addWidget(self.createOneBtn('Sin',StyleSheets.GreyButtonStyleSheet()),0,0)
     self.extrabuttonGrid.addWidget(self.createOneBtn('Cos',StyleSheets.GreyButtonStyleSheet()),0,1)
     self.extrabuttonGrid.addWidget(self.createOneBtn('Tan',StyleSheets.GreyButtonStyleSheet()),1,0)
     self.extrabuttonGrid.addWidget(self.createOneBtn('Log',StyleSheets.GreyButtonStyleSheet()),1,1)
Exemplo n.º 8
0
 def createAllButtons(self):
     self.buttonGrid.addWidget(self.createOneBtn('%',StyleSheets.GreyButtonStyleSheet()),0,0)
     self.buttonGrid.addWidget(self.createOneBtn('\u221a',StyleSheets.GreyButtonStyleSheet()),0,1)
     self.buttonGrid.addWidget(self.createOneBtn('X\u00b2',StyleSheets.GreyButtonStyleSheet()),0,2)
     self.buttonGrid.addWidget(self.createOneBtn('1/X',StyleSheets.GreyButtonStyleSheet()),0,3)
     self.buttonGrid.addWidget(self.createOneBtn('C',StyleSheets.GreyButtonStyleSheet()),1,0,1,2)
     self.buttonGrid.addWidget(self.createOneBtn('\u2192',StyleSheets.GreyButtonStyleSheet()),1,2)
     self.buttonGrid.addWidget(self.createOneBtn('/',StyleSheets.GreyButtonStyleSheet()),1,3)
     self.buttonGrid.addWidget(self.createOneBtn('7',StyleSheets.ButtonStyleSheet()),2,0)
     self.buttonGrid.addWidget(self.createOneBtn('8',StyleSheets.ButtonStyleSheet()),2,1)
     self.buttonGrid.addWidget(self.createOneBtn('9',StyleSheets.ButtonStyleSheet()),2,2)
     self.buttonGrid.addWidget(self.createOneBtn('X',StyleSheets.GreyButtonStyleSheet()),2,3)
     self.buttonGrid.addWidget(self.createOneBtn('4',StyleSheets.ButtonStyleSheet()),3,0)
     self.buttonGrid.addWidget(self.createOneBtn('5',StyleSheets.ButtonStyleSheet()),3,1)
     self.buttonGrid.addWidget(self.createOneBtn('6',StyleSheets.ButtonStyleSheet()),3,2)
     self.buttonGrid.addWidget(self.createOneBtn("-",StyleSheets.GreyButtonStyleSheet()),3,3)
     self.buttonGrid.addWidget(self.createOneBtn('1',StyleSheets.ButtonStyleSheet()),4,0)
     self.buttonGrid.addWidget(self.createOneBtn('2',StyleSheets.ButtonStyleSheet()),4,1)
     self.buttonGrid.addWidget(self.createOneBtn('3',StyleSheets.ButtonStyleSheet()),4,2)
     self.buttonGrid.addWidget(self.createOneBtn('+',StyleSheets.GreyButtonStyleSheet()),4,3)
     self.buttonGrid.addWidget(self.createOneBtn('+,-',StyleSheets.GreyButtonStyleSheet()),5,0)
     self.buttonGrid.addWidget(self.createOneBtn('0',StyleSheets.ButtonStyleSheet()),5,1)
     self.buttonGrid.addWidget(self.createOneBtn('.',StyleSheets.GreyButtonStyleSheet()),5,2)
     self.buttonGrid.addWidget(self.createOneBtn('=',StyleSheets.GreyButtonStyleSheet()),5,3)
Exemplo n.º 9
0
 def createHistoryLabel(self):
     histlabl = QLabel("History")
     histlabl.setStyleSheet(StyleSheets.TopLabelStyleSheet())
     self._allWidgets["histlabl"] = histlabl
     return histlabl
Exemplo n.º 10
0
 def userEntry(self):
     userent = QLineEdit("")                              ## create instance of entry field
     userent.setPlaceholderText("User name")              ## set placeholder to field
     userent.setStyleSheet(StyleSheets.EntryStyleSheet()) ## set style to field
     self.allwidget["userent"] = userent                  ## save the entry field to dictonary
     return userent                                       ## return the instance from function
Exemplo n.º 11
0
 def LoginButton(self):
     loginbtn = QPushButton("Login")                             ##create login button instance
     loginbtn.setStyleSheet(StyleSheets.LoginButtonStyleSheet()) ##set style to login button
     loginbtn.clicked.connect(self.LoginClicked)                 ##bind callback funcion to button when it clicked
     self.allwidget["loginbutton"] = loginbtn                    ## save the button instance to dictonary
     return loginbtn                                             ## return the instance from function