Initial
This commit is contained in:
commit
95c854f215
9 changed files with 287 additions and 0 deletions
39
composer.py
Normal file
39
composer.py
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
import sys
|
||||
from base import BaseWindow
|
||||
from windows import CustomerWindow, CashierWindow, LoginWindow
|
||||
from PyQt6.QtWidgets import QApplication
|
||||
from PyQt6.QtCore import pyqtSignal, pyqtSlot, QObject
|
||||
|
||||
|
||||
class Composer(QObject):
|
||||
render_request = pyqtSignal(str)
|
||||
|
||||
def __init__(self,
|
||||
app: QApplication
|
||||
):
|
||||
super().__init__()
|
||||
|
||||
self._app = app
|
||||
self._entry = LoginWindow("Окно Авторизации", "", self)
|
||||
self._current = None
|
||||
|
||||
self.render_request.connect(self._render)
|
||||
|
||||
def run(self):
|
||||
self._current = self._entry
|
||||
self._current.show()
|
||||
sys.exit(self._app.exec())
|
||||
|
||||
@pyqtSlot(str)
|
||||
def _render(self, user: str):
|
||||
if self._current:
|
||||
self._current.close()
|
||||
|
||||
match user:
|
||||
case "Покупатель":
|
||||
window = CustomerWindow("Покупатель", user, self)
|
||||
case "Кассир":
|
||||
window = CashierWindow("Кассир", user, self)
|
||||
|
||||
self._current = window
|
||||
self._current.show()
|
||||
Loading…
Add table
Add a link
Reference in a new issue