Ejemplo n.º 1
0
class MainWindow(BoxLayout):

    signin_widget = SigninWindow()
    default_widget = MainWid()

    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.ids.scrn_si.add_widget(self.signin_widget)
        self.ids.scrn_def.add_widget(self.default_widget)
Ejemplo n.º 2
0
class MainWindow(BoxLayout):
    admin_widget = AdminWindow()
    operator_widget = OperatorWindow()
    signin_widget = SigninWindow()

    def __init__(self, **kwargs):
        super().__init__(**kwargs)

        self.ids.scrn_si.add_widget(self.signin_widget)
        self.ids.scrn_admin.add_widget(self.admin_widget)
        self.ids.scrn_op.add_widget(self.operator_widget)
Ejemplo n.º 3
0
class MainWindow(BoxLayout):

    admin_widget = AdminWindow()
    signin_widget = SigninWindow()
    home_widget = HomeWindow()

    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        client = MongoClient()
        db = client.miscelanea
        self.signins = db.signins
        self.signed_id = ''

        self.signed_in_user = ''
        self.shop_status = False
        self.signin_widget.pass_callback(self.signed_user)
        self.product_update = self.admin_widget.pass_update_function()
        self.sale_update = self.admin_widget.pass_update_sale_function()
        self.home_widget.pass_shop_status_callback(self.global_shop_status,
                                                   self.product_update,
                                                   self.sale_update)
        self.ids.scrn_si.add_widget(self.signin_widget)
        self.ids.scrn_admin.add_widget(self.admin_widget)
        self.ids.scrn_home.add_widget(self.home_widget)

    def global_shop_status(self, status):
        self.shop_status = status
        self.admin_widget.update_status(self.shop_status)

    def signed_user(self, user):
        self.signed_in_user = user
        date = datetime.datetime.now()

        self.signed_in_user.pop('_id', None)
        self.signed_in_user.pop('password', None)
        self.signed_in_user['sign_in'] = date
        self.signed_in_user['sign_out'] = 'n/a'
        self.signed_id = self.signins.insert(self.signed_in_user)

        self.admin_widget.show_user(self.signed_in_user, self.signout_user)
        self.home_widget.show_user(self.signed_in_user, self.signout_user)

    def signout_user(self):
        date = datetime.datetime.now()
        self.signed_in_user['sign_out'] = date
        query = {"_id": self.signed_id}
        update = {'$set': self.signed_in_user}
        self.signins.update_one(query, update)

        self.signed_id = ''
        self.signed_in_user = ''
Ejemplo n.º 4
0
class MainWindow(BoxLayout):

    signin_widget = SigninWindow()
    reminders_widget = ReminderWindow()
    admin_widget = AdminWindow()

    def __init__(self, **kwargs):
        super().__init__(**kwargs)

        self.ids.scrn_si.add_widget(self.signin_widget)
        self.ids.scrn_rem.add_widget(self.reminders_widget)
        self.ids.scrn_ad.add_widget(self.admin_widget)

    # loads all the reminders before the Reminder Screen
    def update_rem(self):
        self.reminders_widget.load_info()

    # call all the functions that need to be scheduled for the sign in screen
    def signin_schedule(self):
        self.signin_widget.schedule()

    # suspends all the sign in screen functions before switching screens
    def signin_suspend(self):
        self.signin_widget.suspend()