Notes
Notes - notes.io |
import untitled2
import psycopg2
import untitled_adm
import untitled_lab
import untitled_byx
class InterfaceByx(QtWidgets.QDialog):
def __init__(self):
super(InterfaceByx, self).__init__()
self.ui3 = untitled_byx.Ui_Dialog()
self.ui3.setupUi(self)
self.ui3.pushButton_exit_2.clicked.connect(self.exit)
def exit(self):
InterfaceByx.close(self)
ui3 = Interface()
ui3.exec_()
ui3.show()
class InterfaceLab(QtWidgets.QDialog):
def __init__(self):
super(InterfaceLab, self).__init__()
self.ui4 = untitled_lab.Ui_Dialog()
self.ui4.setupUi(self)
self.ui4.pushButton_exit_4.clicked.connect(self.exit)
def exit(self):
InterfaceLab.close(self)
ui4 = Interface()
ui4.exec_()
ui4.show()
class InterfaceAdm(QtWidgets.QDialog):
def __init__(self):
super(InterfaceAdm, self).__init__()
self.ui5 = untitled_adm.Ui_Dialog()
self.ui5.setupUi(self)
self.ui5.pushButton_registration.clicked.connect(self.registration)
self.ui5.pushButton_exit_3.clicked.connect(self.exit)
def exit(self):
InterfaceAdm.close(self)
ui5 = Interface()
ui5.exec_()
ui5.show()
def registration(self):
login1 = self.ui5.lineEdit_login_2.text()
passw1 = self.ui5.lineEdit_password_2.text()
name = self.ui5.lineEdit_name.text()
lastname_user = self.ui5.lineEdit_lastname.text()
type_user = self.ui5.lineEdit_type.text()
host = 'localhost'
user = 'postgres'
password = '270881qqw'
database = 'db'
connection = False
res = False
try:
connection = psycopg2.connect(
host=host,
user=user,
password=password,
database=database,
)
except Exception as _ex:
print(_ex)
cur = connection.cursor()
cur.execute(f" SELECT id FROM public.users ")
id_now = int(cur.fetchall()[-1][0])
cur.execute(f" INSERT INTO public.users(id, login, password, name, lastname, type) VALUES('{id_now + 1}', '{login1}', '{passw1}', '{name}', '{lastname_user}', '{type_user}'); ")
connection.commit()
cur.close()
connection.close()
self.ui5.label_massage.setText('ура')
class Interface(QtWidgets.QDialog):
def __init__(self):
super(Interface, self).__init__()
self.ui = Ui_Dialog()
self.ui.setupUi(self)
self.ui.pushButton_login.clicked.connect(self.auth)
def auth(self):
login = self.ui.lineEdit_login.text()
passw = self.ui.lineEdit_password.text()
host = 'localhost'
user = 'postgres'
password = '270881qqw'
database = 'db'
connection = False
res = False
try:
connection = psycopg2.connect(
host=host,
user=user,
password=password,
database=database,
)
except Exception as _ex:
print(_ex)
cur = connection.cursor()
cur.execute(f"SELECT id, login,password, type FROM public.users WHERE login='{login}'")
res = cur.fetchone()
adm = 3
lab = 1
byx = 2
try:
if login == res[1] and passw == res[2]:
if adm == res[3]:
ui5 = InterfaceAdm()
Interface.close(self)
ui5.exec_()
ui5.show()
elif lab == res[3]:
ui4 = InterfaceLab()
Interface.close(self)
ui4.exec_()
ui4.show()
else:
ui3 = InterfaceByx()
Interface.close(self)
ui3.exec_()
ui3.show()
except Exception as _es:
print(_es)
class Interface2(QtWidgets.QDialog):
def __init__(self):
super(Interface2, self).__init__()
self.ui2 = untitled2.Ui_Dialog()
self.ui2.setupUi(self)
self.ui2.pushButton_exit.clicked.connect(self.back)
def back(self):
Interface2.close(self)
ui = Interface()
ui.exec_()
ui.show()
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
Dialog = Interface()
Dialog.show()
sys.exit(app.exec_())
|
Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 12 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team