コード例 #1
0
 def __init__(self):
     """
     The constructor of payment view class which set up: buttonsFactory, fontFactory, widgetFactory, labelFactory and setups UI
     """
     super(PaymentView, self).__init__()
     self.buttonsFactory = ButtonsFactory()
     self.fontFactory = FontFactory()
     self.widgetFactory = WidgetFactory()
     self.labelFactory = LabelFactory()
     self.setupUi()
     self.setupPaymentView()
コード例 #2
0
 def __init__(self):
     """
     The constructor initializes the fields: app, ticket_machine, view_helper, order, ticketFactory, moneyFactory, labelFactory
     """
     app = QtWidgets.QApplication(sys.argv)
     self.ticket_machine = TicketMachine()
     self.view_helper = ViewHelper()
     self.order = Order()
     self.ticketFactory = TicketFactory()
     self.moneyFactory = MoneyFactory()
     self.labelFactory = LabelFactory()
     self.assing_ticket_actions()
     sys.exit(app.exec_())
コード例 #3
0
 def __init__(self):
     """
     The constructor of confirmation view class which set up: buttonsFactory, fontFactory, widgetFactory, gridFactory, labelFactory and setups UI
     :param parent: widget parent
     :param geometry: geometry object
     :param name: widget name
     """
     super(ConfirmationView, self).__init__()
     self.buttonsFactory = ButtonsFactory()
     self.fontFactory = FontFactory()
     self.widgetFactory = WidgetFactory()
     self.gridFactory = GridFactory()
     self.labelFactory = LabelFactory()
     self.setupUi()
     self.setupConfirmationView()
コード例 #4
0
 def __init__(self):
     """
     The constructor of ticket view class which set up: buttonsFactory,
     fontFactory, widgetFactory, labelFactory, gridFactory,
     vboxFactory and setups UI
     """
     super(TicketsView, self).__init__()
     self.buttonsFactory = ButtonsFactory()
     self.fontFactory = FontFactory()
     self.widgetFactory = WidgetFactory()
     self.gridFactory = GridFactory()
     self.labelFactory = LabelFactory()
     self.vboxFactory = VboxFactory()
     self.setupUi()
     self.setupTicketsView()
コード例 #5
0
class ConfirmationView(QtWidgets.QWidget):
    """
    Confirmation view class of QWidget type
    """
    def __init__(self):
        """
        The constructor of confirmation view class which set up: buttonsFactory, fontFactory, widgetFactory, gridFactory, labelFactory and setups UI
        :param parent: widget parent
        :param geometry: geometry object
        :param name: widget name
        """
        super(ConfirmationView, self).__init__()
        self.buttonsFactory = ButtonsFactory()
        self.fontFactory = FontFactory()
        self.widgetFactory = WidgetFactory()
        self.gridFactory = GridFactory()
        self.labelFactory = LabelFactory()
        self.setupUi()
        self.setupConfirmationView()

    def setupUi(self):
        """
        Set up main information about view
        """
        self.setObjectName("ConfirmationWidget")
        self.ConfirmationWidget = QtWidgets.QWidget(self)
        self.ConfirmationWidget.setObjectName("ConfirmationWidget")
        self.setAutoFillBackground(False)

    def setupConfirmationView(self):
        """
        Calls view generating methods
        """
        font = self.fontFactory.createFont('Consolas', 9, True, False, 75)
        self.setFont(font)
        self.generateMainLabels(font)
        self.generateLayouts()
        self.generateButtons()
        QtCore.QMetaObject.connectSlotsByName(self)

    def generateMainLabels(self, font):
        """
        Generates labels objects
        :param font: font object
        """
        font.setPointSize(18)
        self.label_title = self.labelFactory.createLabel(
            self.ConfirmationWidget, 'label_title', font)
        font.setPointSize(12)
        self.label_printing = self.labelFactory.createLabel(
            self.ConfirmationWidget, 'label_printing', font)
        self.label_your_tickets = self.labelFactory.createLabel(
            self.ConfirmationWidget, 'label_your_tickets', font)
        self.label_your_change = self.labelFactory.createLabel(
            self.ConfirmationWidget, 'label_your_change', font)
        self.label_thanks = self.labelFactory.createLabel(
            self.ConfirmationWidget, 'label_thanks', font)
        self.label_thanks.hide()

    def generateLayouts(self):
        """
        Generates layouts objects
        """
        self.gridLayoutWidget_2 = QtWidgets.QWidget(self.ConfirmationWidget)
        self.gridLayoutWidget_2.setGeometry(QtCore.QRect(490, 230, 431, 351))
        self.gridLayoutWidget_2.setObjectName("gridLayoutWidget_2")
        self.grid_your_change = QtWidgets.QGridLayout(self.gridLayoutWidget_2)
        self.grid_your_change.setContentsMargins(0, 0, 0, 0)
        self.grid_your_change.setObjectName("grid_your_change")
        self.vertical_confirmation = self.widgetFactory.createWidget(
            self.ConfirmationWidget, 'vertical_confirmation')

        self.layout_your_tickets = QtWidgets.QVBoxLayout(
            self.vertical_confirmation)
        self.layout_your_tickets.setSizeConstraint(
            QtWidgets.QLayout.SetDefaultConstraint)
        self.layout_your_tickets.setContentsMargins(0, 0, 0, 0)
        self.layout_your_tickets.setObjectName("layout_your_tickets")
        self.scroll = QtWidgets.QScrollArea()
        self.scroll.setWidgetResizable(True)
        self.layout_your_tickets.addWidget(self.scroll)
        self.scroll.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
        self.scroll.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
        self.scroll_widget = QtWidgets.QWidget()
        self.scroll.setWidget(self.scroll_widget)
        self.scroll_widget.setObjectName("scroll_your_tickets")

    def generateButtons(self):
        """
        Generates buttons objects
        """
        self.button_again = QtWidgets.QPushButton(self.ConfirmationWidget)
        self.button_again.setGeometry(QtCore.QRect(370, 652, 181, 61))
        font = QtGui.QFont()
        font.setPointSize(-1)
        self.button_again.setFont(font)
        self.button_again.setStyleSheet(
            "border: 3px solid black; color: #f6f6f6; background: #3b3a30; font-size: 15px; "
        )
        self.button_again.setObjectName("button_again")
        self.button_again.setText("Ponowne zakupy")
        self.button_again.setDisabled(True)
コード例 #6
0
class PaymentView(QtWidgets.QWidget):
    """
    Payment view class of QWidget type
    """
    def __init__(self):
        """
        The constructor of payment view class which set up: buttonsFactory, fontFactory, widgetFactory, labelFactory and setups UI
        """
        super(PaymentView, self).__init__()
        self.buttonsFactory = ButtonsFactory()
        self.fontFactory = FontFactory()
        self.widgetFactory = WidgetFactory()
        self.labelFactory = LabelFactory()
        self.setupUi()
        self.setupPaymentView()

    def setupPaymentView(self):
        """
        Calls view generating methods
        """
        font = self.fontFactory.createFont('Consolas', 9, True, False, 75)
        self.setFont(font)
        self.generateLabels(font)
        self.generateButtons()

    def generateLabels(self, font):
        """
        Generates labels objects
        :param font: font object
        """
        font.setPointSize(18)
        self.label_title = self.labelFactory.createLabel(
            self.PaymentWidget, 'label_title', font)
        font.setPointSize(12)
        self.label_text = self.labelFactory.createLabel(
            self.PaymentWidget, 'label_text', font)
        self.horizontalLayoutWidget_2 = self.widgetFactory.createWidget(
            self.PaymentWidget, 'horizontal_payment_2')
        self.horizontal_payment = QtWidgets.QHBoxLayout(
            self.horizontalLayoutWidget_2)
        self.horizontal_payment.setContentsMargins(0, 0, 0, 0)
        self.horizontal_payment.setSpacing(0)
        self.horizontal_payment.setObjectName("horizontal_payment")
        self.label_payment_left = self.labelFactory.createLabel(
            self.PaymentWidget, 'label_payment_left', font)
        self.horizontal_payment.addWidget(self.label_payment_left)
        self.label_payment_left_value = self.labelFactory.createLabel(
            self.PaymentWidget, 'label_payment_left_value', font)
        self.horizontal_payment.addWidget(self.label_payment_left_value)
        self.label_payment_change = self.labelFactory.createLabel(
            self.PaymentWidget, 'label_payment_change', font)
        self.horizontal_payment.addWidget(self.label_payment_change)
        self.label_payment_change_value = self.labelFactory.createLabel(
            self.PaymentWidget, 'label_payment_change_value', font)
        self.horizontal_payment.addWidget(self.label_payment_change_value)
        self.horizontalLayoutWidget = self.widgetFactory.createWidget(
            self.PaymentWidget, 'horizontal_payment')
        self.horizontal_ticket_count = QtWidgets.QHBoxLayout(
            self.horizontalLayoutWidget)
        self.horizontal_ticket_count.setContentsMargins(0, 0, 0, 0)
        self.horizontal_ticket_count.setSpacing(0)
        self.horizontal_ticket_count.setObjectName("horizontal_ticket_count")
        self.label_ticket_text = self.labelFactory.createLabel(
            self.PaymentWidget, 'label_ticket_text', font)
        self.horizontal_ticket_count.addWidget(self.label_ticket_text)
        self.label_ticket_count = self.labelFactory.createLabel(
            self.PaymentWidget, 'label_ticket_count', font)
        self.horizontal_ticket_count.addWidget(self.label_ticket_count)

    def generateButtons(self):
        """
        Generates buttons objects
        """
        self.gridLayoutWidget = QtWidgets.QWidget(self.PaymentWidget)
        self.gridLayoutWidget.setGeometry(QtCore.QRect(40, 180, 341, 341))
        self.gridLayoutWidget.setObjectName("gridLayoutWidget")
        self.grid_coins = QtWidgets.QGridLayout(self.gridLayoutWidget)
        self.grid_coins.setContentsMargins(0, 0, 0, 0)
        self.grid_coins.setObjectName("grid_coins")
        self.button_1_gr = self.buttonsFactory.createCoinButton("button_1_gr")
        self.button_2_gr = self.buttonsFactory.createCoinButton("button_2_gr")
        self.button_5_gr = self.buttonsFactory.createCoinButton("button_5_gr")
        self.button_10_gr = self.buttonsFactory.createCoinButton(
            "button_10_gr")
        self.button_20_gr = self.buttonsFactory.createCoinButton(
            "button_20_gr")
        self.button_50_gr = self.buttonsFactory.createCoinButton(
            "button_50_gr")
        self.button_1_zl = self.buttonsFactory.createCoinButton("button_1_zl")
        self.button_2_zl = self.buttonsFactory.createCoinButton("button_2_zl")
        self.button_5_zl = self.buttonsFactory.createCoinButton("button_5_zl")
        self.grid_coins.addWidget(self.button_1_gr, 0, 0, 1, 1)
        self.grid_coins.addWidget(self.button_2_gr, 0, 1, 1, 1)
        self.grid_coins.addWidget(self.button_5_gr, 0, 2, 1, 1)
        self.grid_coins.addWidget(self.button_10_gr, 1, 0, 1, 1)
        self.grid_coins.addWidget(self.button_20_gr, 1, 1, 1, 1)
        self.grid_coins.addWidget(self.button_50_gr, 1, 2, 1, 1)
        self.grid_coins.addWidget(self.button_1_zl, 2, 0, 1, 1)
        self.grid_coins.addWidget(self.button_2_zl, 2, 1, 1, 1)
        self.grid_coins.addWidget(self.button_5_zl, 2, 2, 1, 1)

        self.gridLayoutWidget_2 = QtWidgets.QWidget(self.PaymentWidget)
        self.gridLayoutWidget_2.setGeometry(QtCore.QRect(470, 180, 421, 401))
        self.gridLayoutWidget_2.setObjectName("gridLayoutWidget_2")
        self.grid_banknote = QtWidgets.QGridLayout(self.gridLayoutWidget_2)
        self.grid_banknote.setContentsMargins(0, 0, 0, 0)
        self.grid_banknote.setObjectName("grid_banknote")
        self.button_10_zl = self.buttonsFactory.createBanknoteButton(
            "button_10_zl")
        self.button_20_zl = self.buttonsFactory.createBanknoteButton(
            "button_20_zl")
        self.button_50_zl = self.buttonsFactory.createBanknoteButton(
            "button_50_zl")
        self.button_100_zl = self.buttonsFactory.createBanknoteButton(
            "button_100_zl")
        self.button_200_zl = self.buttonsFactory.createBanknoteButton(
            "button_200_zl")
        self.button_500_zl = self.buttonsFactory.createBanknoteButton(
            "button_500_zl")
        self.grid_banknote.addWidget(self.button_10_zl, 0, 0, 1, 1)
        self.grid_banknote.addWidget(self.button_20_zl, 0, 1, 1, 1)
        self.grid_banknote.addWidget(self.button_50_zl, 1, 0, 1, 1)
        self.grid_banknote.addWidget(self.button_100_zl, 1, 1, 1, 1)
        self.grid_banknote.addWidget(self.button_200_zl, 2, 0, 1, 1)
        self.grid_banknote.addWidget(self.button_500_zl, 2, 1, 1, 1)

    def setupUi(self):
        """
        Set up main information about view
        """
        self.setObjectName("PaymentWidget")
        self.PaymentWidget = QtWidgets.QWidget(self)
        self.PaymentWidget.setObjectName("PaymentWidget")
        self.setAutoFillBackground(False)
        QtCore.QMetaObject.connectSlotsByName(self)
コード例 #7
0
class Controller:
    """
    Class of controller, which controls Ticket Machine
    """
    def __init__(self):
        """
        The constructor initializes the fields: app, ticket_machine, view_helper, order, ticketFactory, moneyFactory, labelFactory
        """
        app = QtWidgets.QApplication(sys.argv)
        self.ticket_machine = TicketMachine()
        self.view_helper = ViewHelper()
        self.order = Order()
        self.ticketFactory = TicketFactory()
        self.moneyFactory = MoneyFactory()
        self.labelFactory = LabelFactory()
        self.assing_ticket_actions()
        sys.exit(app.exec_())

    def assing_ticket_actions(self):
        """
        Assigning actions to buttons in view method
        :return: nothing
        """
        self.view_helper.find_button_by_object_name(
            self.ticket_machine.get_gui(),
            'btn_normal_20_plus').clicked.connect(lambda: self.add_ticket(
                1, 2.00, 'normal', 'btn_normal_20_count', 'n20'))
        self.view_helper.find_button_by_object_name(
            self.ticket_machine.get_gui(),
            'btn_normal_40_plus').clicked.connect(lambda: self.add_ticket(
                1, 3.60, 'normal', 'btn_normal_40_count', 'n40'))
        self.view_helper.find_button_by_object_name(
            self.ticket_machine.get_gui(),
            'btn_normal_oneway_plus').clicked.connect(lambda: self.add_ticket(
                1, 4.00, 'normal', 'btn_normal_oneway_count', 'none'))
        self.view_helper.find_button_by_object_name(
            self.ticket_machine.get_gui(),
            'btn_normal_twoway_plus').clicked.connect(lambda: self.add_ticket(
                1, 7.00, 'normal', 'btn_normal_twoway_count', 'ntwo'))
        self.view_helper.find_button_by_object_name(
            self.ticket_machine.get_gui(),
            'btn_normal_20_minus').clicked.connect(
                lambda: self.remove_ticket('n20', 'btn_normal_20_count'))
        self.view_helper.find_button_by_object_name(
            self.ticket_machine.get_gui(),
            'btn_normal_40_minus').clicked.connect(
                lambda: self.remove_ticket('n40', 'btn_normal_40_count'))
        self.view_helper.find_button_by_object_name(
            self.ticket_machine.get_gui(),
            'btn_normal_oneway_minus').clicked.connect(
                lambda: self.remove_ticket('none', 'btn_normal_oneway_count'))
        self.view_helper.find_button_by_object_name(
            self.ticket_machine.get_gui(),
            'btn_normal_twoway_minus').clicked.connect(
                lambda: self.remove_ticket('ntwo', 'btn_normal_twoway_count'))
        self.view_helper.find_button_by_object_name(
            self.ticket_machine.get_gui(),
            'btn_normal_20_2_plus').clicked.connect(lambda: self.add_ticket(
                2, 2.50, 'normal', 'btn_normal_20_2_count', 'n20_2'))
        self.view_helper.find_button_by_object_name(
            self.ticket_machine.get_gui(),
            'btn_normal_40_2_plus').clicked.connect(lambda: self.add_ticket(
                2, 4.00, 'normal', 'btn_normal_40_2_count', 'n40_2'))
        self.view_helper.find_button_by_object_name(
            self.ticket_machine.get_gui(),
            'btn_normal_oneway_2_plus').clicked.connect(
                lambda: self.add_ticket(2, 4.80, 'normal',
                                        'btn_normal_oneway_2_count', 'none_2'))
        self.view_helper.find_button_by_object_name(
            self.ticket_machine.get_gui(),
            'btn_normal_twoway_2_plus').clicked.connect(
                lambda: self.add_ticket(2, 7.50, 'normal',
                                        'btn_normal_twoway_2_count', 'ntwo_2'))
        self.view_helper.find_button_by_object_name(
            self.ticket_machine.get_gui(),
            'btn_normal_20_2_minus').clicked.connect(
                lambda: self.remove_ticket('n20_2', 'btn_normal_20_2_count'))
        self.view_helper.find_button_by_object_name(
            self.ticket_machine.get_gui(),
            'btn_normal_40_2_minus').clicked.connect(
                lambda: self.remove_ticket('n40_2', 'btn_normal_40_2_count'))
        self.view_helper.find_button_by_object_name(
            self.ticket_machine.get_gui(), 'btn_normal_oneway_2_minus'
        ).clicked.connect(
            lambda: self.remove_ticket('none_2', 'btn_normal_oneway_2_count'))
        self.view_helper.find_button_by_object_name(
            self.ticket_machine.get_gui(), 'btn_normal_twoway_2_minus'
        ).clicked.connect(
            lambda: self.remove_ticket('ntwo_2', 'btn_normal_twoway_2_count'))
        self.view_helper.find_button_by_object_name(
            self.ticket_machine.get_gui(),
            'btn_reduced_20_plus').clicked.connect(lambda: self.add_ticket(
                1, 1.00, 'reduced', 'btn_reduced_20_count', 'r20'))
        self.view_helper.find_button_by_object_name(
            self.ticket_machine.get_gui(),
            'btn_reduced_40_plus').clicked.connect(lambda: self.add_ticket(
                1, 1.80, 'reduced', 'btn_reduced_40_count', 'r40'))
        self.view_helper.find_button_by_object_name(
            self.ticket_machine.get_gui(),
            'btn_reduced_oneway_plus').clicked.connect(lambda: self.add_ticket(
                1, 2.00, 'reduced', 'btn_reduced_oneway_count', 'rone'))
        self.view_helper.find_button_by_object_name(
            self.ticket_machine.get_gui(),
            'btn_reduced_twoway_plus').clicked.connect(lambda: self.add_ticket(
                1, 3.50, 'reduced', 'btn_reduced_twoway_count', 'rtwo'))
        self.view_helper.find_button_by_object_name(
            self.ticket_machine.get_gui(),
            'btn_reduced_20_minus').clicked.connect(
                lambda: self.remove_ticket('r20', 'btn_reduced_20_count'))
        self.view_helper.find_button_by_object_name(
            self.ticket_machine.get_gui(),
            'btn_reduced_40_minus').clicked.connect(
                lambda: self.remove_ticket('r40', 'btn_reduced_40_count'))
        self.view_helper.find_button_by_object_name(
            self.ticket_machine.get_gui(),
            'btn_reduced_oneway_minus').clicked.connect(
                lambda: self.remove_ticket('rone', 'btn_reduced_oneway_count'))
        self.view_helper.find_button_by_object_name(
            self.ticket_machine.get_gui(),
            'btn_reduced_twoway_minus').clicked.connect(
                lambda: self.remove_ticket('rtwo', 'btn_reduced_twoway_count'))
        self.view_helper.find_button_by_object_name(
            self.ticket_machine.get_gui(),
            'btn_reduced_20_2_plus').clicked.connect(lambda: self.add_ticket(
                2, 1.20, 'reduced', 'btn_reduced_20_2_count', 'r20_2'))
        self.view_helper.find_button_by_object_name(
            self.ticket_machine.get_gui(),
            'btn_reduced_40_2_plus').clicked.connect(lambda: self.add_ticket(
                2, 2.00, 'reduced', 'btn_reduced_40_2_count', 'r40_2'))
        self.view_helper.find_button_by_object_name(
            self.ticket_machine.get_gui(), 'btn_reduced_oneway_2_plus'
        ).clicked.connect(lambda: self.add_ticket(
            2, 2.50, 'reduced', 'btn_reduced_oneway_2_count', 'rone_2'))
        self.view_helper.find_button_by_object_name(
            self.ticket_machine.get_gui(), 'btn_reduced_twoway_2_plus'
        ).clicked.connect(lambda: self.add_ticket(
            2, 4.00, 'reduced', 'btn_reduced_twoway_2_count', 'rtwo_2'))
        self.view_helper.find_button_by_object_name(
            self.ticket_machine.get_gui(),
            'btn_reduced_20_2_minus').clicked.connect(
                lambda: self.remove_ticket('r20_2', 'btn_reduced_20_2_count'))
        self.view_helper.find_button_by_object_name(
            self.ticket_machine.get_gui(),
            'btn_reduced_40_2_minus').clicked.connect(
                lambda: self.remove_ticket('r40_2', 'btn_reduced_40_2_count'))
        self.view_helper.find_button_by_object_name(
            self.ticket_machine.get_gui(), 'btn_reduced_oneway_2_minus'
        ).clicked.connect(
            lambda: self.remove_ticket('rone_2', 'btn_reduced_oneway_2_count'))
        self.view_helper.find_button_by_object_name(
            self.ticket_machine.get_gui(), 'btn_reduced_twoway_2_minus'
        ).clicked.connect(
            lambda: self.remove_ticket('rtwo_2', 'btn_reduced_twoway_2_count'))

        # przejście do płatności
        self.view_helper.find_button_by_object_name(
            self.ticket_machine.get_gui(),
            'payment').clicked.connect(lambda: self.change_view("payment"))

    def assign_payment_actions(self):
        """
        Assigning actions to payment buttons in payment view method.
        Assign actions to coins and banknotes objects.
        :return: nothing
        """
        self.view_helper.find_button_by_object_name(
            self.ticket_machine.get_gui(), 'button_1_gr').clicked.connect(
                lambda: self.add_money("0.01", 'coin'))
        self.view_helper.find_button_by_object_name(
            self.ticket_machine.get_gui(), 'button_2_gr').clicked.connect(
                lambda: self.add_money("0.02", 'coin'))
        self.view_helper.find_button_by_object_name(
            self.ticket_machine.get_gui(), 'button_5_gr').clicked.connect(
                lambda: self.add_money("0.05", 'coin'))
        self.view_helper.find_button_by_object_name(
            self.ticket_machine.get_gui(), 'button_10_gr').clicked.connect(
                lambda: self.add_money("0.10", 'coin'))
        self.view_helper.find_button_by_object_name(
            self.ticket_machine.get_gui(), 'button_20_gr').clicked.connect(
                lambda: self.add_money("0.20", 'coin'))
        self.view_helper.find_button_by_object_name(
            self.ticket_machine.get_gui(), 'button_50_gr').clicked.connect(
                lambda: self.add_money("0.50", 'coin'))
        self.view_helper.find_button_by_object_name(
            self.ticket_machine.get_gui(), 'button_1_zl').clicked.connect(
                lambda: self.add_money("1.00", 'coin'))
        self.view_helper.find_button_by_object_name(
            self.ticket_machine.get_gui(), 'button_2_zl').clicked.connect(
                lambda: self.add_money("2.00", 'coin'))
        self.view_helper.find_button_by_object_name(
            self.ticket_machine.get_gui(), 'button_5_zl').clicked.connect(
                lambda: self.add_money("5.00", 'coin'))
        self.view_helper.find_button_by_object_name(
            self.ticket_machine.get_gui(), 'button_10_zl').clicked.connect(
                lambda: self.add_money("10.00", 'banknote'))
        self.view_helper.find_button_by_object_name(
            self.ticket_machine.get_gui(), 'button_20_zl').clicked.connect(
                lambda: self.add_money("20.00", 'banknote'))
        self.view_helper.find_button_by_object_name(
            self.ticket_machine.get_gui(), 'button_50_zl').clicked.connect(
                lambda: self.add_money("50.00", 'banknote'))
        self.view_helper.find_button_by_object_name(
            self.ticket_machine.get_gui(), 'button_100_zl').clicked.connect(
                lambda: self.add_money("100.00", 'banknote'))
        self.view_helper.find_button_by_object_name(
            self.ticket_machine.get_gui(), 'button_200_zl').clicked.connect(
                lambda: self.add_money("200.00", 'banknote'))
        self.view_helper.find_button_by_object_name(
            self.ticket_machine.get_gui(), 'button_500_zl').clicked.connect(
                lambda: self.add_money("500.00", 'banknote'))

    def assign_confirmation_actions(self):
        """
        Assign actions to buttons in confirmation view
        """
        self.view_helper.find_button_by_object_name(
            self.ticket_machine.get_gui(), 'button_again').clicked.connect(
                lambda: self.change_view("tickets"))

    def add_ticket(self, zone_number, price, type, label, code):
        """
        Adds ticket to chosen ticket list.
        :param zone_number: zone number of selected ticket
        :param price: price of selected ticket
        :param type: type of selected ticket
        :param label: label object name, which stores number of selected tickets
        :param code: code of ticket
        :return: nothing
        """
        counter = self.view_helper.find_label_by_object_name(
            self.ticket_machine.get_gui(), label)
        counter_int = int(counter.text())
        counter_int += 1
        counter.setText(str(counter_int))
        t = self.ticketFactory.createTicket(type, zone_number, price, code)
        self.order.add_ticket(t)
        self.update_informations()

    def remove_ticket(self, code, label):
        """
        Removes ticket from selected tickets list in order.
        :param label: label object name, which stores number of selected tickets
        :param code: code of ticket
        :return: nothing
        """
        if any(x.code == code for x in self.order.get_tickets()):
            object_to_remove = next(
                (x for x in self.order.get_tickets() if x.code == code))
            self.order.tickets.remove(object_to_remove)
            self.order.set_cost(self.order.get_cost() - object_to_remove.price)
            self.order.set_cost(float(round(Decimal(self.order.get_cost()),
                                            2)))
            self.update_informations()
            counter = self.view_helper.find_label_by_object_name(
                self.ticket_machine.get_gui(), label)
            counter_int = int(counter.text())
            if counter_int > 0:
                counter_int -= 1
            counter.setText(str(counter_int))

    def update_informations(self):
        """
        Update information about number of selected tickets and total cost.
        :return: nothing
        """
        self.view_helper.find_label_by_object_name(
            self.ticket_machine.get_gui(),
            "label_tickets_count_value").setText(
                str(len(self.order.get_tickets())))
        self.view_helper.find_label_by_object_name(
            self.ticket_machine.get_gui(), "label_total_cost_value").setText(
                str("{:.2f}".format(self.order.get_cost())) + " zł")

    def change_view(self, view_name):
        """
        Change view based on view_name.
        :param view_name: name of view to change
        :return: nothing
        """
        if view_name == "payment" and len(self.order.get_tickets()) > 0:
            self.ticket_machine.get_gui().change_view(view_name)
            self.assign_payment_actions()
            self.view_helper.find_label_by_object_name(
                self.ticket_machine.get_gui(),
                "label_payment_left_value").setText(
                    str("{:.2f}".format(self.order.get_cost())) + " zł")
            self.view_helper.find_label_by_object_name(
                self.ticket_machine.get_gui(), "label_ticket_count").setText(
                    str(len(self.order.get_tickets())))
            self.view_helper.find_label_by_object_name(
                self.ticket_machine.get_gui(),
                "label_payment_change_value").setText(
                    str("{:.2f}".format(self.order.get_cost())) + " zł")

        elif view_name == "confirmation":
            self.ticket_machine.get_gui().change_view(view_name)
            self.assign_confirmation_actions()
        elif view_name == "tickets":
            self.ticket_machine.get_gui().change_view(view_name)
            self.assing_ticket_actions()

    def add_money(self, value, money_type):
        """
        Create inserted money object and add it to inserted money list.
        If total inserted value is greater than total cost, it calls method to calculate and return change.
        :param value: value of money
        :param money_type: type of money
        :return: nothing
        """
        money = self.moneyFactory.createMoney(money_type, value)
        self.order.insert_money(money)

        inserted = self.order.get_inserted_amount()
        remained = self.order.get_cost()
        left_to_pay = round(remained - inserted, 2)

        self.view_helper.find_label_by_object_name(
            self.ticket_machine.get_gui(), "label_payment_left_value").setText(
                str("{:.2f}".format(left_to_pay)) + " zł")

        if self.order.get_inserted_amount() >= self.order.get_cost():
            self.change_view("confirmation")
            self.order.calculate_exchange()
            self.return_tickets_and_change()

    def return_tickets_and_change(self):
        """
        Generates bought tickets and generate change.
        :return: nothing
        """

        cash = self.order.get_change_list()
        tickets: list() = self.order.get_tickets()
        cash_layout = self.view_helper.find_QGridLayout_by_object_name(
            self.ticket_machine.get_gui(), "grid_your_change")
        tickets_scroll: QVBoxLayout = self.view_helper.find_QWidget_by_object_name(
            self.ticket_machine.get_gui(), "scroll_your_tickets")
        tickets_layout = QtWidgets.QVBoxLayout(tickets_scroll)
        i = 1
        for ticket in tickets:
            label = self.labelFactory.createTicketLabel(
                'ticket', ticket.get_info())
            tickets_layout.addWidget(label)
            label.setVisible(False)
            self.print_tickets(label)

        for money in cash:
            label = QLabel()
            pixmap = QPixmap('assets/' + "{:.2f}".format(money) + '.png')
            label.setPixmap(pixmap)
            if money > 5:
                label.setMaximumSize(150, 80)
            else:
                label.setMaximumSize(80, 80)
            label.setScaledContents(True)
            label.setVisible(False)
            self.give_change(cash_layout, label, i)
            i += 1
        self.order.clear_order_data()

    @delay(2.0)
    def print_tickets(self, label):
        """
        Print ticket to bought ticket list. Simulate waiting proccess with delay decorator.
        :return: nothing
        """
        label.setVisible(True)
        self.view_helper.find_label_by_object_name(
            self.ticket_machine.get_gui(), 'label_thanks').show()
        self.view_helper.find_button_by_object_name(
            self.ticket_machine.get_gui(), 'button_again').setDisabled(False)

    @delay(4.0)
    def give_change(self, cash_layout, label, i):
        if i < 5:
            cash_layout.addWidget(label, i, 0, 1, 1)
        elif i < 9:
            cash_layout.addWidget(label, i - 4, 1, 1, 1)
        else:
            cash_layout.addWidget(label, i - 8, 2, 1, 1)
        label.setVisible(True)
コード例 #8
0
class TicketsView(QtWidgets.QWidget):
    """
    Tickets view class of QWidget type
    """

    def __init__(self):
        """
        The constructor of ticket view class which set up: buttonsFactory,
        fontFactory, widgetFactory, labelFactory, gridFactory,
        vboxFactory and setups UI
        """
        super(TicketsView, self).__init__()
        self.buttonsFactory = ButtonsFactory()
        self.fontFactory = FontFactory()
        self.widgetFactory = WidgetFactory()
        self.gridFactory = GridFactory()
        self.labelFactory = LabelFactory()
        self.vboxFactory = VboxFactory()
        self.setupUi()
        self.setupTicketsView()

    def setupTicketsView(self):
        """
        Calls view generating methods
        """
        font = self.fontFactory.createFont('Consolas', 9, True, False, 75)
        self.setFont(font)
        self.generateMainLabels(font)
        self.generateBottomView(font)
        self.generateButtonsAndLabelsPlusMinus(font)
        self.generateButtonsTicketsWithNames()
        self.generateCosmetics()
        QtCore.QMetaObject.connectSlotsByName(self)

    def setupUi(self):
        """
        Set up main information about view
        """
        self.setObjectName("TicketsWidget")
        self.TicketsWidget = QtWidgets.QWidget(self)
        self.TicketsWidget.setObjectName("TicketsWidget")

    def generateMainLabels(self, font):
        """
        Generates labels objects
        :param font: font object
        """
        font.setPointSize(18)
        self.label_title = self.labelFactory.createLabel(self.TicketsWidget, 'label_title', font)
        font.setPointSize(14)
        self.label_tickets_reduced = self.labelFactory.createLabel(self.TicketsWidget, 'label_tickets_reduced', font)
        self.label_tickets_normal = self.labelFactory.createLabel(self.TicketsWidget, 'label_tickets_normal', font)
        font.setPointSize(13)
        self.label_strefa_1 = self.labelFactory.createLabel(self.TicketsWidget, 'label_strefa_1', font)
        self.label_strefa_1.setLayoutDirection(QtCore.Qt.LeftToRight)
        self.label_strefa_1.setTextFormat(QtCore.Qt.PlainText)
        self.label_strefa_1.setWordWrap(True)
        self.label_strefa_2 = self.labelFactory.createLabel(self.TicketsWidget, 'label_strefa_2', font)
        self.label_strefa_2.setLayoutDirection(QtCore.Qt.LeftToRight)
        self.label_strefa_2.setTextFormat(QtCore.Qt.PlainText)
        self.label_strefa_2.setWordWrap(True)

    def generateBottomView(self, font):
        """
        Generates objects on bottom of the view
        :param font: font object
        """
        self.horizontalLayoutWidget = self.widgetFactory.createWidget(self.TicketsWidget, 'horizontalLayoutWidget')
        self.horizontalLayout = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget)
        self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.label_total_cost = self.labelFactory.createLabel(self.horizontalLayoutWidget, 'label_total_cost', 0)
        self.label_total_cost_value = self.labelFactory.createLabel(self.horizontalLayoutWidget, 'label_total_cost_value', 0)
        self.label_tickets_count = self.labelFactory.createLabel(self.horizontalLayoutWidget, 'label_tickets_count', 0)
        self.label_tickets_count_value = self.labelFactory.createLabel(self.horizontalLayoutWidget, 'label_tickets_count_value', 0)
        self.horizontalLayout.addWidget(self.label_total_cost)
        self.horizontalLayout.addWidget(self.label_total_cost_value)
        self.horizontalLayout.addWidget(self.label_tickets_count)
        self.horizontalLayout.addWidget(self.label_tickets_count_value)
        self.payment = QtWidgets.QPushButton(self.TicketsWidget)
        self.payment.setGeometry(QtCore.QRect(600, 640, 351, 81))
        font.setPointSize(15)
        self.payment.setFont(font)
        self.payment.setObjectName("payment")
        self.payment.setText('Płatność')
        self.payment.setStyleSheet("font-family: Verdana; background: #FF7C00; padding: 20px 10px 10px 10px; text-transform: uppercase; font-weight: bold; font-size: "
                                   "30px")

    def generateButtonsAndLabelsPlusMinus(self, font):
        """
        Generates increasing and decreasing ticket count buttons
        :param font: font object
        """
        self.verticalLayoutWidget = self.widgetFactory.createWidget(self.TicketsWidget, 'verticalLayoutWidget')
        self.btn_reduced_20_2_minus = self.buttonsFactory.createMinusButton('btn_reduced_20_2_minus')
        self.btn_reduced_40_2_minus = self.buttonsFactory.createMinusButton('btn_reduced_40_2_minus')
        self.btn_reduced_oneway_2_minus = self.buttonsFactory.createMinusButton('btn_reduced_oneway_2_minus')
        self.btn_reduced_twoway_2_minus = self.buttonsFactory.createMinusButton('btn_reduced_twoway_2_minus')
        self.layout_reduced_second_minus = self.vboxFactory.createVbox(self.verticalLayoutWidget, 'layout_reduced_second_minus', [
            self.btn_reduced_20_2_minus, self.btn_reduced_40_2_minus, self.btn_reduced_oneway_2_minus, self.btn_reduced_twoway_2_minus
        ])

        self.verticalLayoutWidget_2 = self.widgetFactory.createWidget(self.TicketsWidget, 'verticalLayoutWidget_2')
        self.btn_reduced_20_2_plus = self.buttonsFactory.createPlusButton('btn_reduced_20_2_plus')
        self.btn_reduced_40_2_plus = self.buttonsFactory.createPlusButton('btn_reduced_40_2_plus')
        self.btn_reduced_oneway_2_plus = self.buttonsFactory.createPlusButton('btn_reduced_oneway_2_plus')
        self.btn_reduced_twoway_2_plus = self.buttonsFactory.createPlusButton('btn_reduced_twoway_2_plus')
        self.layout_reduced_second_plus = self.vboxFactory.createVbox(self.verticalLayoutWidget_2, 'layout_reduced_second_plus', [
            self.btn_reduced_20_2_plus, self.btn_reduced_40_2_plus, self.btn_reduced_oneway_2_plus, self.btn_reduced_twoway_2_plus
        ])

        font.setPointSize(12)
        self.verticalLayoutWidget_3 = self.widgetFactory.createWidget(self.TicketsWidget, 'verticalLayoutWidget_3')
        self.btn_reduced_20_2_count = self.labelFactory.createLabel(self.verticalLayoutWidget_3, 'btn_reduced_20_2_count', font)
        self.btn_reduced_40_2_count = self.labelFactory.createLabel(self.verticalLayoutWidget_3, 'btn_reduced_40_2_count', font)
        self.btn_reduced_oneway_2_count = self.labelFactory.createLabel(self.verticalLayoutWidget_3, 'btn_reduced_oneway_2_count', font)
        self.btn_reduced_twoway_2_count = self.labelFactory.createLabel(self.verticalLayoutWidget_3, 'btn_reduced_twoway_2_count', font)
        self.layout_reduced_second_count = self.vboxFactory.createVbox(self.verticalLayoutWidget_3, 'layout_reduced_second_count', [
            self.btn_reduced_20_2_count, self.btn_reduced_40_2_count, self.btn_reduced_oneway_2_count, self.btn_reduced_twoway_2_count
        ])

        self.verticalLayoutWidget_4 = self.widgetFactory.createWidget(self.TicketsWidget, 'verticalLayoutWidget_4')
        self.btn_reduced_20_minus = self.buttonsFactory.createMinusButton('btn_reduced_20_minus')
        self.btn_reduced_40_minus = self.buttonsFactory.createMinusButton('btn_reduced_40_minus')
        self.btn_reduced_oneway_minus = self.buttonsFactory.createMinusButton('btn_reduced_oneway_minus')
        self.btn_reduced_twoway_minus = self.buttonsFactory.createMinusButton('btn_reduced_twoway_minus')
        self.verticalLayout_7 = self.vboxFactory.createVbox(self.verticalLayoutWidget_4, 'verticalLayout_7', [
            self.btn_reduced_20_minus, self.btn_reduced_40_minus, self.btn_reduced_oneway_minus, self.btn_reduced_twoway_minus
        ])

        self.verticalLayoutWidget_5 = self.widgetFactory.createWidget(self.TicketsWidget, 'verticalLayoutWidget_5')
        self.btn_normal_20_minus = self.buttonsFactory.createMinusButton('btn_normal_20_minus')
        self.btn_normal_40_minus = self.buttonsFactory.createMinusButton('btn_normal_40_minus')
        self.btn_normal_oneway_minus = self.buttonsFactory.createMinusButton('btn_normal_oneway_minus')
        self.btn_normal_twoway_minus = self.buttonsFactory.createMinusButton('btn_normal_twoway_minus')
        self.layout_normal_first_minus = self.vboxFactory.createVbox(self.verticalLayoutWidget_5, 'layout_normal_first_minus', [
            self.btn_normal_20_minus, self.btn_normal_40_minus, self.btn_normal_oneway_minus, self.btn_normal_twoway_minus
        ])

        self.verticalLayoutWidget_6 = self.widgetFactory.createWidget(self.TicketsWidget, 'verticalLayoutWidget_6')
        self.btn_normal_20_2_minus = self.buttonsFactory.createMinusButton('btn_normal_20_2_minus')
        self.btn_normal_40_2_minus = self.buttonsFactory.createMinusButton('btn_normal_40_2_minus')
        self.btn_normal_oneway_2_minus = self.buttonsFactory.createMinusButton('btn_normal_oneway_2_minus')
        self.btn_normal_twoway_2_minus = self.buttonsFactory.createMinusButton('btn_normal_twoway_2_minus')
        self.layout_normal_second_minus = self.vboxFactory.createVbox(self.verticalLayoutWidget_6, 'layout_normal_second_minus', [
            self.btn_normal_20_2_minus, self.btn_normal_40_2_minus, self.btn_normal_oneway_2_minus, self.btn_normal_twoway_2_minus
        ])

        self.verticalLayoutWidget_7 = self.widgetFactory.createWidget(self.TicketsWidget, 'verticalLayoutWidget_7')
        self.btn_normal_20_count = self.labelFactory.createLabel(self.verticalLayoutWidget_3, 'btn_normal_20_count', font)
        self.btn_normal_40_count = self.labelFactory.createLabel(self.verticalLayoutWidget_3, 'btn_normal_40_count', font)
        self.btn_normal_oneway_count = self.labelFactory.createLabel(self.verticalLayoutWidget_3, 'btn_normal_oneway_count', font)
        self.btn_normal_twoway_count = self.labelFactory.createLabel(self.verticalLayoutWidget_3, 'btn_normal_twoway_count', font)
        self.layout_normal_first_count = self.vboxFactory.createVbox(self.verticalLayoutWidget_7, 'layout_normal_first_count', [
            self.btn_normal_20_count, self.btn_normal_40_count, self.btn_normal_oneway_count, self.btn_normal_twoway_count
        ])

        self.verticalLayoutWidget_8 = self.widgetFactory.createWidget(self.TicketsWidget, 'verticalLayoutWidget_8')
        self.btn_normal_20_2_count = self.labelFactory.createLabel(self.verticalLayoutWidget_3, 'btn_normal_20_2_count', font)
        self.btn_normal_40_2_count = self.labelFactory.createLabel(self.verticalLayoutWidget_3, 'btn_normal_40_2_count', font)
        self.btn_normal_oneway_2_count = self.labelFactory.createLabel(self.verticalLayoutWidget_3, 'btn_normal_oneway_2_count', font)
        self.btn_normal_twoway_2_count = self.labelFactory.createLabel(self.verticalLayoutWidget_3, 'btn_normal_twoway_2_count', font)
        self.layout_normal_second_count = self.vboxFactory.createVbox(self.verticalLayoutWidget_8, 'layout_normal_second_count', [
            self.btn_normal_20_2_count, self.btn_normal_40_2_count, self.btn_normal_oneway_2_count, self.btn_normal_twoway_2_count
        ])

        self.verticalLayoutWidget_9 = self.widgetFactory.createWidget(self.TicketsWidget, 'verticalLayoutWidget_9')
        self.btn_normal_20_plus = self.buttonsFactory.createPlusButton('btn_normal_20_plus')
        self.btn_normal_40_plus = self.buttonsFactory.createPlusButton('btn_normal_40_plus')
        self.btn_normal_oneway_plus = self.buttonsFactory.createPlusButton('btn_normal_oneway_plus')
        self.btn_normal_twoway_plus = self.buttonsFactory.createPlusButton('btn_normal_twoway_plus')
        self.layout_normal_first_plus = self.vboxFactory.createVbox(self.verticalLayoutWidget_9, 'layout_normal_first_plus', [
            self.btn_normal_20_plus, self.btn_normal_40_plus, self.btn_normal_oneway_plus, self.btn_normal_twoway_plus
        ])

        self.verticalLayoutWidget_10 = self.widgetFactory.createWidget(self.TicketsWidget, 'verticalLayoutWidget_10')
        self.btn_normal_20_2_plus = self.buttonsFactory.createPlusButton('btn_normal_20_2_plus')
        self.btn_normal_40_2_plus = self.buttonsFactory.createPlusButton('btn_normal_40_2_plus')
        self.btn_normal_oneway_2_plus = self.buttonsFactory.createPlusButton('btn_normal_oneway_2_plus')
        self.btn_normal_twoway_2_plus = self.buttonsFactory.createPlusButton('btn_normal_twoway_2_plus')
        self.layout_normal_second_plus = self.vboxFactory.createVbox(self.verticalLayoutWidget_10, 'layout_normal_second_plus', [
            self.btn_normal_20_2_plus, self.btn_normal_40_2_plus, self.btn_normal_oneway_2_plus, self.btn_normal_twoway_2_plus
        ])

        self.verticalLayoutWidget_11 = self.widgetFactory.createWidget(self.TicketsWidget, 'verticalLayoutWidget_11')
        self.btn_reduced_20_count = self.labelFactory.createLabel(self.verticalLayoutWidget_3, 'btn_reduced_20_count', font)
        self.btn_reduced_40_count = self.labelFactory.createLabel(self.verticalLayoutWidget_3, 'btn_reduced_40_count', font)
        self.btn_reduced_oneway_count = self.labelFactory.createLabel(self.verticalLayoutWidget_3, 'btn_reduced_oneway_count', font)
        self.btn_reduced_twoway_count = self.labelFactory.createLabel(self.verticalLayoutWidget_3, 'btn_reduced_twoway_count', font)
        self.layout_reduced_first_count = self.vboxFactory.createVbox(self.verticalLayoutWidget_11, 'layout_reduced_first_count', [
            self.btn_reduced_20_count, self.btn_reduced_40_count, self.btn_reduced_oneway_count, self.btn_reduced_twoway_count
        ])

        self.verticalLayoutWidget_12 = self.widgetFactory.createWidget(self.TicketsWidget, 'verticalLayoutWidget_12')
        self.btn_reduced_20_plus = self.buttonsFactory.createPlusButton('btn_reduced_20_plus')
        self.btn_reduced_40_plus = self.buttonsFactory.createPlusButton('btn_reduced_40_plus')
        self.btn_reduced_oneway_plus = self.buttonsFactory.createPlusButton('btn_reduced_oneway_plus')
        self.btn_reduced_twoway_plus = self.buttonsFactory.createPlusButton('btn_reduced_twoway_plus')
        self.layout_reduced_first_plus = self.vboxFactory.createVbox(self.verticalLayoutWidget_12, 'layout_reduced_first_plus', [
            self.btn_reduced_20_plus, self.btn_reduced_40_plus, self.btn_reduced_oneway_plus, self.btn_reduced_twoway_plus
        ])

    def generateButtonsTicketsWithNames(self):
        """
        Generates fields with ticket names
        """
        self.btn_reduced_20 = self.buttonsFactory.createTicketFirstZone('r_20')
        self.btn_reduced_40 = self.buttonsFactory.createTicketFirstZone('r_40')
        self.btn_reduced_oneway = self.buttonsFactory.createTicketFirstZone('r_oneway')
        self.btn_reduced_twoway = self.buttonsFactory.createTicketFirstZone('r_twoway')
        self.widget_reduced_first = self.widgetFactory.createWidget(self.TicketsWidget, 'widget_reduced_first')
        self.grid_reduced_tickets_first = self.gridFactory.createGrid( self.widget_reduced_first,'zone1','r',[
            self.btn_reduced_20, self.btn_reduced_40, self.btn_reduced_oneway, self.btn_reduced_twoway
        ])
        self.btn_normal_20 = self.buttonsFactory.createTicketFirstZone('n_20')
        self.btn_normal_40 = self.buttonsFactory.createTicketFirstZone('n_40')
        self.btn_normal_oneway = self.buttonsFactory.createTicketFirstZone('n_oneway')
        self.btn_normal_twoway = self.buttonsFactory.createTicketFirstZone('n_twoway')
        self.widget_normal_first = self.widgetFactory.createWidget(self.TicketsWidget, 'widget_normal_first')
        self.grid_normal_tickets_first = self.gridFactory.createGrid( self.widget_normal_first,'zone1','n',[
            self.btn_normal_20, self.btn_normal_40, self.btn_normal_oneway, self.btn_normal_twoway
        ])
        self.btn_reduced_20_2 = self.buttonsFactory.createTicketSecondZone('r_20')
        self.btn_reduced_40_2 = self.buttonsFactory.createTicketSecondZone('r_40')
        self.btn_reduced_oneway_2 = self.buttonsFactory.createTicketSecondZone('r_oneway')
        self.btn_reduced_twoway_2 = self.buttonsFactory.createTicketSecondZone('r_twoway')
        self.widget_reduced_second = self.widgetFactory.createWidget(self.TicketsWidget, 'widget_reduced_second')
        self.grid_reduced_tickets_second = self.gridFactory.createGrid( self.widget_reduced_second,'zone2','r',[
            self.btn_reduced_20_2, self.btn_reduced_40_2, self.btn_reduced_oneway_2, self.btn_reduced_twoway_2
        ])
        self.btn_normal_20_2 = self.buttonsFactory.createTicketSecondZone('n_20')
        self.btn_normal_40_2 = self.buttonsFactory.createTicketSecondZone('n_40')
        self.btn_normal_oneway_2 = self.buttonsFactory.createTicketSecondZone('n_oneway')
        self.btn_normal_twoway_2 = self.buttonsFactory.createTicketSecondZone('n_twoway')
        self.widget_normal_second = self.widgetFactory.createWidget(self.TicketsWidget, 'widget_normal_second')
        self.grid_normal_tickets_second = self.gridFactory.createGrid( self.widget_normal_second,'zone2','n',[
            self.btn_normal_20_2, self.btn_normal_40_2, self.btn_normal_oneway_2, self.btn_normal_twoway_2
        ])

    def generateCosmetics(self):
        """
        Generates other gui objects
        """
        self.line = QtWidgets.QFrame(self.TicketsWidget)
        self.line.setGeometry(QtCore.QRect(0, 100, 951, 10))
        self.line.setFrameShape(QtWidgets.QFrame.HLine)
        self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.line.setObjectName("line")
        self.line.setStyleSheet('background: #01090F')
        self.line_2 = QtWidgets.QFrame(self.TicketsWidget)
        self.line_2.setGeometry(QtCore.QRect(0, 390, 961, 10))
        self.line_2.setFrameShape(QtWidgets.QFrame.HLine)
        self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.line_2.setObjectName("line_2")
        self.line_2.setStyleSheet('background: #01090F; padding:0; height: 5px')
        self.line_3 = QtWidgets.QFrame(self.TicketsWidget)
        self.line_3.setGeometry(QtCore.QRect(0, 640, 951, 10))
        self.line_3.setFrameShape(QtWidgets.QFrame.HLine)
        self.line_3.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.line_3.setObjectName("line_3")
        self.line_3.setStyleSheet('background: #01090F; padding:0; height: 5px')
        self.line_4 = QtWidgets.QFrame(self.TicketsWidget)
        self.line_4.setGeometry(QtCore.QRect(263, 650, 10, 101))
        self.line_4.setFrameShape(QtWidgets.QFrame.VLine)
        self.line_4.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.line_4.setObjectName("line_4")
        self.line_4.setStyleSheet('background: #01090F; padding:0; height: 5px')
        self.line_6 = QtWidgets.QFrame(self.TicketsWidget)
        self.line_6.setGeometry(QtCore.QRect(590, 650, 10, 91))
        self.line_6.setFrameShape(QtWidgets.QFrame.VLine)
        self.line_6.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.line_6.setObjectName("line_6")
        self.line_6.setStyleSheet('background: #01090F; padding:0; height: 5px')
        self.line_7 = QtWidgets.QFrame(self.TicketsWidget)
        self.line_7.setGeometry(QtCore.QRect(483, 110, 10, 540))
        self.line_7.setFrameShape(QtWidgets.QFrame.VLine)
        self.line_7.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.line_7.setObjectName("line_7")
        self.line_7.setStyleSheet('background: #01090F; padding:0; height: 5px')