예제 #1
0
    def __init__(self, *args, **kwargs):
        super(QFrame, self).__init__(*args, **kwargs)

        account_api = Api("/account")
        status, res = account_api.get()

        if status == 200:
            self.credits = "{:.2f}".format(round(res['customer']['credits'], 3))

        self.head_img = None
        self.menu_button = None
        self.credits = 15
        self._init_ui()

        self.setStyleSheet(app_style)
예제 #2
0
    def __init__(self, *args, **kwargs):
        super(QFrame, self).__init__(*args, **kwargs)

        # variable
        self.overview = None  # section
        self.profit_history_frame = None  # section
        self.cost_history_frame = None  # section

        self.profit_history = None  # table widget
        self.cost_history = None  # table widget

        self.greeting = add_greeting()  # param string
        self.username = ""  # param string
        self.total_balance = 15  # param number
        self.estimated_profit = 30  # param number
        self.estimated_cost = 20  # param number
        self.running_machine = 5  # param number
        self.panic_machine = 2  # param number
        self.finished_job = 3  # param number
        self.running_job = 2  # param number
        self.panic_job = 0  # param number

        account_api = Api("/account")
        status, res = account_api.get()

        if status == 200:
            # Insert comma here so we can default to nameless greeting if api fails.
            self.username = f", {res['customer']['firstname'].capitalize()}"

        # TODO: request "Total Balance", "Estimated profit", "Estimated cost" "machine status"from api also

        # for testing
        self.username = "******"

        self._init_ui()
        self.setStyleSheet(dashboard_style)