コード例 #1
0
class MainMenuUi(QtView):
    form, window = uic \
        .loadUiType("{}/ui/qt/forms/car_rental.ui".format(AppConfigs.root_dir()))

    def __init__(self):
        super().__init__(MainMenuUi.window())
        self.form = MainMenuUi.form()
        self.form.setupUi(self.window)
        self.tabPanel = self.qt.find_widget(self.window, QTabWidget,
                                            'tabPanel')
        self.labelStatusBar = self.qt.find_widget(self.window, QLabel,
                                                  'labelStatusBar')
        self.car_search = CarSearchView(self.window, self)
        self.car_edit = CarEditView(self.window, self)
        self.user_search = UserSearchView(self.window, self)
        self.user_edit = UserEditView(self.window, self)
        self.rental_search = RentalSearchView(self.window, self)
        self.rental_edit = RentalEditView(self.window, self)
        self.setup_ui()
        self.set_status('Ready.')

    def setup_ui(self):
        self.tabPanel.setCurrentIndex(0)
        self.tabPanel.currentChanged.connect(self.tab_changed)

    def show(self):
        self.window.show()

    def tab_changed(self, idx: int):
        self.car_search.stackedPanelCars.setCurrentIndex(0)
        self.user_search.stackedPanelUsers.setCurrentIndex(0)
        self.rental_search.stackedPanelRentals.setCurrentIndex(0)
        self.log.info('Tab: tabPanel changed to {}'.format(idx))

    def set_status(self, message, color: Color = Color.BLACK):
        text = '<font color="{}">{}</font>'.format(
            str(color.name).lower(), message)
        self.labelStatusBar.setText(text)
コード例 #2
0
 def __init__(self):
     super().__init__("{}/../data/rentals.dat".format(
         AppConfigs.root_dir()))
コード例 #3
0
 def __init__(self):
     super().__init__("{}/../data/customers.dat".format(
         AppConfigs.root_dir()))
コード例 #4
0
 def __init__(self):
     super().__init__("{}/../data/employees.dat".format(AppConfigs.root_dir()))