def load_book(self):
     camera = LoadQrCode(
         123, (0, 0, 0), (180, 180, 180),
         "C:/Users/Vlad/PycharmProjects/Libreri/File/num1.png")
     books = camera.load_qr()
     list_book = []
     books_model = DataContext().Book.load()
     for i in books:
         list_book.append(
             books_model.where(
                 lambda x: x.number == i["Number"]).first_of_default())
     self.__model.list_book = list_book
Beispiel #2
0
 def login(self):
     users = DataContext().User.load()
     mail = users.where(
         lambda x: x.email == self.__model.mail).first_of_default()
     if mail is not False:
         password = users.where(lambda x: x.password == self.__model.
                                password).first_of_default()
         if password is not False:
             model = MainWindowModel()
             controller = MainWindowController(model)
             self.__view.close()
         else:
             self.__model.error = "Неправельный пароль"
     else:
         self.__model.error = "неправельная почта"
 def load_list_book(self):
     date = datetime.date.today()
     for i in self.__model.list_book:
         DataContext().Bilet.add(
             BiletOrig([
                 0, self.__model.select_user.id, i.id,
                 date.strftime("%Y-%m-%d")
             ]))
         i.state = "T"
         DataContext().Book.update(i)
     DataContext().Bilet.save_change()
     DataContext().Book.save_change()
     self.__model.select_user = User(
         [1, "", "", "", "", "", "", "", "", "", "", ""])
     self.__model.list_book = []
     self.__model.search_sename = ""
Beispiel #4
0
    def __init__(self):
        self.__select_user = User(
            [1, "", "", "", "", "", "", "", "", "", "", ""])
        self.users = DataContext().User.load().list_model()
        self.__list_book = []
        self.__search_sename = ""

        self.__observers = []
Beispiel #5
0
    def __init__(self):
        self.__login = ""
        self.__password = ""
        self.__name = ""
        self.__sename = ""
        self.__midname = ""
        self.__type = ""
        self.__email = ""
        self.__phone = ""
        self.__comment = ""
        self.__class = ""
        self.__class_type = ""

        self.__select_user = User([1, "", "", "", "", "", "", "", "", "", "", ""])

        self.users = DataContext().User.load().list_model()

        self.bilet_user = DataContext().Bilet.join(Book(), User(), [-4, -3, 1, 9, -1])

        self.__observers = []
Beispiel #6
0
 def select_user(self, val):
     self.__select_user = val
     self.bilet_user = DataContext().Bilet.where(lambda x: x.id_user == val.id).list_model()
     self.login = val.login
     self.password = val.password
     self.name = val.name
     self.sename = val.sename
     self.midname = val.midname
     self.type = val.type
     self.email = val.email
     self.phone = val.phone
     self.comment = val.comment
     self._class = val._class
     self.class_type = val.class_type
Beispiel #7
0
    def __init__(self):
        self.__name = ""
        self.__author = ""
        self.__data = ""
        self.__number = ""
        self.__state = ""
        self.__photo = ""
        self.__photo_qr = ""

        self.__select_book = Book([1, "", "", "", "", "", ""])

        self.books = DataContext().Book.load().list_model()

        self.__observers = []
 def item_changed(self, item):
     row = item.row()
     self.__view.ui.table_user.selectRow(row)
     self.__model.select_user = DataContext().User.list_model()[row]
 def update(self):
     self.__model.users = DataContext().User.update(
         self.__model.select_user).save_change().load().list_model()
     self.__model.select_user = User(
         ["", "", "", "", "", "", "", "", "", "", "", ""])
 def search(self):
     self.__model.users = [
         DataContext().User.load().where(lambda x: x.sename == self.__model.
                                         search_sename).first_of_default()
     ]
     self.__model.search_sename = ""
Beispiel #11
0
 def item_changed(self, item):
     row = item.row()
     self.__view.ui.table_book.selectRow(row)
     self.__model.select_book = DataContext().Book.list_model()[row]
Beispiel #12
0
 def update(self):
     self.__model.books = DataContext().Book.update(
         self.__model.select_book).save_change().load().list_model()
     self.__model.select_book = Book(["", "", "", "", "", "", ""])
Beispiel #13
0
 def insert(self):
     self.__model.books = DataContext().Book.add(
         self.__model.select_book).save_change().load().list_model()
     self.__model.select_book = Book(["", "", "", "", "", "", ""])