Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class MainToolBar(Toolbar):
- dots_menu = ObjectProperty()
- tabs_layout = ObjectProperty()
- tab1 = ObjectProperty()
- tab2 = ObjectProperty()
- sm = ObjectProperty()
- def __init__(self, **kwargs):
- super(MainToolBar, self).__init__(**kwargs)
- Clock.schedule_once(self.my_init, -1)
- def my_init(self, dt):
- self.dots_menu = DotsMenu()
- self.id = 'toolbar'
- self.title = 'Futsal World'
- self.left_action_items = [['menu', lambda x: app.nav_drawer.toggle()]]
- self.right_action_items = [['more-vert', lambda x: self.dots_menu.open(self.ids.right_actions)]]
- self.size_hint_y = .2
- # self.tab1.text = 'News'
- # self.tab1.text_color = (1, 1, 1, 1) # white color
- # self.tab1.bind(on_release=self.change_screen)
- # self.tab2.text = 'Livescores'
- # self.tab2.text_color = (1, 1, 1, 1) # white color
- # self.tab2.bind(on_release=self.change_screen)
- #print self.tabs_layout.x
- #self.tabs_layout.canvas.after.get_group('rectangle')[0].size = (self.tab1.width, dp(10))
- #app.nav_drawer.bind(center_x=self.test)
- # with self.tabs_layout.canvas.after:
- # Color(1, 0, 0, 1) # set the colour to red
- # self.tabs_layout.rect = Rectangle(pos=(0, 500),
- # size=(self.tab1.width,
- # dp(4)))
- def change_screen(self, instance):
- print instance.parent
- #self.move_rect(instance)
- if instance.name == 'tab1':
- app.root.ids['sm'].change_screen('News')
- if instance.name == 'tab2':
- if not app.root.ids['sm'].has_screen('Livescores'):
- app.root.ids['sm'].add_widget(LiveScoresScreen())
- app.root.ids['sm'].change_screen('Livescores')
- else:
- app.root.ids['sm'].change_screen('Livescores')
- def move_rect(self, instance):
- animation = Animation(size=(instance.width, dp(4)), duration=.4)
- animation &= Animation(pos=(instance.x, instance.y), duration=.4)
- animation.start(self.tabs_layout.canvas.after.get_group('rectangle')[0])
Advertisement
Add Comment
Please, Sign In to add comment