Пример #1
0
    def change_screen_settings(self, *args):
        global current_page

        if self.current != 'settings':
            self.transition = CardTransition(duration=0.2,
                                             direction='right',
                                             mode='push')
            current_page = self.current
            self.current = "settings"
        else:
            self.transition = CardTransition(duration=0.2,
                                             direction='left',
                                             mode='pop')
            self.current = current_page
Пример #2
0
    def _to_login(self, *args):
        # clear all field for privacy
        for widget in self.all_input:
            widget.reset()

        # change to login screen
        self.manager.transition = CardTransition(direction="down", mode="pop")
        self.manager.current = "login"
Пример #3
0
 def open_list(self, btn_obj):
     EntriesScreen.current_list_id = btn_obj.id
     EntriesScreen.current_list_name = db.get_list_name(btn_obj.id)
     self.manager.transition = CardTransition(
         direction='left',
         duration=float(
             config.get_option_value('screen_transition_duration')))
     self.manager.current = "entries_screen"
Пример #4
0
    def build(self):
        screen_manager = ScreenManager(transition=CardTransition())

        screen_manager.add_widget(Home(name='home'))
        screen_manager.add_widget(Downloads(name='downloads'))
        screen_manager.add_widget(EBookViewer(name='ebook_viewer'))

        return screen_manager
Пример #5
0
 def login(self, *args):
     debug = False
     if LoginScreen.IDLE:
         LoginScreen.IDLE = False
         if API.login(*args):
             debug = True
             Player.change_screen('browser',
                                  t=CardTransition(direction='down',
                                                   mode='pop',
                                                   duration=1))
         LoginScreen.IDLE = True
     return debug
Пример #6
0
 def login(self):
     usr_input = self.ids.usr_input
     psw_input = self.ids.psw_input
     msg = Guest.login(usr_input.text, psw_input.text)
     if msg:
         MessagePopup(message=msg).open()
         usr_input.focus = True
     else:
         usr_input.text = ''
         psw_input.text = ''
         root = App.get_running_app().root  # main screen manager
         root.transition = CardTransition(direction="up", mode="pop")
         root.current = "menu"
Пример #7
0
    def __init__(self):
        Player.SCREENS = {
            'empty': EmptyScreen(name='empty'),
            'main': MainScreen(name='main'),
            'login': LoginScreen(name='login'),
            'browser': BrowserScreen(name='browser')
        }
        for scr in Player.SCREENS:
            Player.MANAGER.add_widget(Player.SCREENS[scr])

        Player.change_screen('login',
                             t=CardTransition(direction='down',
                                              mode='push',
                                              duration=1))
Пример #8
0
    def switch_to_main_screen(self, *args, duration=1):
        # Switch to the main app screen
        self.root.ids.sm.transition = CardTransition(direction='down',
                                                     mode='pop',
                                                     duration=duration)
        # Quickly add an image to the current firebase screen to fix eyesore when changing screen
        screen = self.root.ids.firebase_login_screen.ids.screen_manager.current
        screen = self.root.ids.firebase_login_screen.ids[screen]
        with screen.canvas.before:
            Rectangle(size=screen.size,
                      pos=screen.pos,
                      source='FirebaseLoginScreen/wallpaper.jpg')

        self.root.ids.sm.current = 'main_screen'
Пример #9
0
    def build(self):
        self.sm = ScreenManager(
            transition=CardTransition(mode='pop', duration=.09))
        self.bo = box()
        m1 = Screen(name='mainscreen')
        m1.add_widget(self.bo)
        self.sm.add_widget(m1)
        ## play screen
        self.play_page = song_page(music_app)
        m2 = Screen(name='playpage')
        m2.add_widget(self.play_page)
        self.sm.add_widget(m2)

        return self.sm
Пример #10
0
 def on_start(self):
     try:
         with open("refresh_token.txt", "r") as f:
             refresh_token = f.read()
             id_token, local_id = self.my_firebase.exchange_refresh_token(
                 refresh_token)
         result = requests.get("https://bestbuydb-40d9e.firebaseio.com/" +
                               local_id + ".json?auth=" + id_token)
         data = json.loads(result.content.decode())
         self.root.ids['screen_manager'].transition = NoTransition()
         self.change_screen("search_screen")
         self.root.ids['screen_manager'].transition = CardTransition()
     except Exception as e:
         pass
    def change_screen(self, screen_name, transition):
        screen_manager = self.root.ids['screen_manager']

        # Transition
        if transition == "wipe":
            screen_manager.transition = WipeTransition()
        elif transition == "swap":
            screen_manager.transition = SwapTransition()
        elif transition == "slide":
            screen_manager.transition = SlideTransition()
        elif transition == "none":
            screen_manager.transition = NoTransition()
        elif transition == "card":
            screen_manager.transition = CardTransition()

        screen_manager.current = screen_name
Пример #12
0
    def change_screen(self,screen_name, direction='forward', mode = ""):

        screen_manager = self.root.ids['screen_manager']
        if direction == 'forward':
            mode = "push"
            direction = 'left'
        elif direction == 'backwards':
            direction = 'right'
            mode = 'pop'
        elif direction == "None":
            screen_manager.transition = NoTransition()
            screen_manager.current = screen_name
            return

        screen_manager.transition = CardTransition(direction=direction, mode=mode)

        screen_manager.current = screen_name
Пример #13
0
    def change_screen(self, screen_name, direction='forward', mode = ""):
        # Get the screen manager from the kv file
        screen_manager = self.root.ids['screen_manager']
        #print(direction, mode)
        # If going backward, change the transition. Else make it the default
        # Forward/backward between pages made more sense to me than left/right
        if direction == 'forward':
            mode = "push"
            direction = 'left'
        elif direction == 'backwards':
            direction = 'right'
            mode = 'pop'
        elif direction == "None":
            screen_manager.transition = NoTransition()
            screen_manager.current = screen_name
            return

        screen_manager.transition = CardTransition(direction=direction, mode=mode)

        screen_manager.current = screen_name
Пример #14
0
    def change_screen(self, screen_name, direction='forward', mode=""):
        # Get the screen manager from the kv file.
        screen_manager = self.root.ids.screen_manager

        if direction == "None":
            screen_manager.transition = NoTransition()
            screen_manager.current = screen_name
            return

        screen_manager.transition = CardTransition(direction=direction,
                                                   mode=mode)
        screen_manager.current = screen_name

        if screen_name == "home_screen":
            self.root.ids.titlename.title = "Surge"
        if screen_name == "tata_screen":
            self.root.ids.titlename.title = "facilites"
        if screen_name == "route_screen":
            self.root.ids.titlename.title = "Route"
            self.root.ids.tata_screen.ids.tatatoolbar.ids.label_title.font_size = '13sp'
Пример #15
0
    def on_start(self):
        try:
            with open("refresh_token.txt", "r") as f:
                refresh_token = f.read()
                # Use refresh_token to get a new idToken
            id_token, local_id = self.firebase.exchange_refresh_token(
                refresh_token)

            self.root.ids["manager"].transition = NoTransition()
            self.ChangeScreen("home")
            self.root.ids["manager"].transition = CardTransition()
            self.firebase_to_file()
            # self.set_message_list()
            self.get_message()
            self.render()
            # Clock.schedule_interval(self.firebase_to_file,10)
            # Clock.schedule_interval(self.get_message,10)

        except Exception as e:
            print(e)
 def login(self):
     # create an instance of a customer using customer_functions and saves it as customer in LoginScreenLayout
     LoginScreenLayout.customer = customer_functions.Customer(self.usr_name_input.text_input.text,
                                                              self.psw_input.psw_input.text_input.text)
     # use the Customer class function check() using username and password input
     msg = LoginScreenLayout.customer.check()
     # if login not successful create a popup containing the error message
     if msg:
         Popup(title='', content=Label(text=msg), size_hint=(.5, .5)).open()
     # else clear the login screen input box texts, change screen transition and screen
     else:
         self.screen_manager.transition = CardTransition(direction='up', mode='pop')
         self.usr_name_input.text_input.text = ''
         self.psw_input.psw_input.text_input.text = ''
         self.screen_manager.current = 'shop_screen'
         # check if a week has passed since last lucky draw, if so enable lucky draw
         if LoginScreenLayout.customer.details[6] != 'lucky_draw_date':
             date_now = datetime.now().date()
             drawn_date = LoginScreenLayout.customer.details[6].date()
             delta = date_now - drawn_date
             if delta.days >= 7:
                 LoginScreenLayout.customer.update_account('', '', '', '', True, '')
Пример #17
0
 def _logout(*args):
     # change to login screen and logout
     self.manager.transition = CardTransition(direction="down", mode="push")
     self.manager.current = "login"
     Guest.logout()
Пример #18
0
 def change_screen(self, screen_name):
     screen_manager = self.root.ids['screen_manager']
     screen_manager.transition = CardTransition()
     screen_manager.transition.direction = 'up'
     screen_manager.transition.duration = .3
     screen_manager.current = screen_name
Пример #19
0
class ScreenManagement(ScreenManager):
    ScreenManager.transition = CardTransition()
    pass
Пример #20
0
 def __init__(self, **kwargs):
     super(ScreenManagement, self).__init__(**kwargs)
     self.fade = FadeTransition()
     self.card = CardTransition()
     self.transition = self.fade
Пример #21
0
 def to_home(self):
     self.manager.transition = CardTransition(direction="left")
     self.manager.current = 'smsing_screen'
Пример #22
0
 def to_cost(self):  # go to cost screen with set animation
     self.manager.transition = CardTransition(direction="down", mode="push")
     self.manager.current = "cost"
     self.manager.transition = CardTransition(direction="up", mode="pop")
Пример #23
0
 def goBack(self):
     self.eScreen.manager.transition = CardTransition(duration=0.5,
                                                      direction="right",
                                                      mode="pop")
     self.eScreen.manager.current = 'cl_screen'
Пример #24
0
 def logout(self):
     # changes screen transition, changes screen and clear the item quantity dict
     shopscreen.item_quantity.clear()
     self.screen_manager.transition = CardTransition(direction='down',
                                                     mode='push')
     self.screen_manager.current = 'login_screen'
Пример #25
0
 def goSettings(self):
     self.cScreen.manager.transition = CardTransition(duration=0.6,
                                                      direction="up")
     self.cScreen.manager.current = 's_screen'
Пример #26
0
class ScreenManagement(ScreenManager):
    ScreenManager.transition = CardTransition(mode='push')
    pass
Пример #27
0
 def change_screen(self, screen_name, direction):
     self.transition = CardTransition(
         direction=direction,
         duration=float(
             config.get_option_value('screen_transition_duration')))
     self.current = screen_name
Пример #28
0
 def to_profile(self):  # go to profile screen with set animation
     self.manager.transition = CardTransition(direction="down", mode="push")
     self.manager.current = "profile"
     self.manager.transition = CardTransition(direction="up", mode="pop")
Пример #29
0
    def on_start(self):
        # Populate avatar grid
        avatar_grid = self.root.ids['change_avatar_screen'].ids['avatar_grid']
        for root_dir, folders, files in walk("icons/avatars"):
            for f in files:
                img = ImageButton(source="icons/avatars/" + f,
                                  on_release=partial(self.change_avatar, f))
                avatar_grid.add_widget(img)

        # Populate workout image grid
        workout_image_grid = self.root.ids['add_workout_screen'].ids[
            'workout_image_grid']
        for root_dir, folders, files in walk("icons/workouts"):
            for f in files:
                if '.png' in f:
                    img = ImageButton(source="icons/workouts/" + f,
                                      on_release=partial(
                                          self.update_workout_image, f))
                    workout_image_grid.add_widget(img)

        try:
            # Try to read the persisten signin credentials (refresh token)
            with open("refresh_token.txt", 'r') as f:
                refresh_token = f.read()
            # Use refresh token to get a new idToken
            id_token, local_id = self.my_firebase.exchange_refresh_token(
                refresh_token)
            self.local_id = local_id
            self.id_token = id_token

            # Get database data
            result = requests.get("https://friendly-fitness.firebaseio.com/" +
                                  local_id + ".json?auth=" + id_token)
            print("res ok?", result.ok)
            print(result.json())
            data = json.loads(result.content.decode())

            # Get and update avatar image
            avatar_image = self.root.ids['avatar_image']
            avatar_image.source = "icons/avatars/" + data['avatar']

            # Get friends list
            self.friends_list = data['friends']

            # Get and update streak label
            streak_label = self.root.ids['home_screen'].ids['streak_label']
            streak_label.text = str(data['streak']) + " Day Streak!"

            # Get and update friend id label
            friend_id_label = self.root.ids['settings_screen'].ids[
                'friend_id_label']
            friend_id_label.text = "Friend ID: " + str(self.my_friend_id)

            banner_grid = self.root.ids['home_screen'].ids['banner_grid']
            print("----")
            print(data['workouts'])
            workouts = data['workouts']
            workout_keys = workouts.keys()
            for workout_key in workout_keys:
                workout = workouts[workout_key]
                # Populate workout grid in home screen
                W = WorkoutBanner(workout_image=workout['workout_image'],
                                  description=workout['description'],
                                  type_image=workout['type_image'],
                                  number=workout['number'],
                                  units=workout['units'],
                                  likes=workout['likes'])
                banner_grid.add_widget(W)

            self.root.ids['screen_manager'].transition = NoTransition()
            self.change_screen("home_screen")
            self.root.ids['screen_manager'].transition = CardTransition()

        except Exception as e:
            print(e)
            pass
Пример #30
0
 def goViewCode(self):
     self.cScreen.manager.transition = CardTransition(duration=0.6,
                                                      direction="up")
     self.cScreen.manager.current = 'v_screen'