def on_activated(self,*args): super(VirtualScreenManagerStack, self).on_activated(*args) print 'on activated', self.activated, self.current_screen SCALE = .6 if self.activated else 1 if self.activated: self.clear_widgets() grid = Carousel(size_hint = (1,1), width=.8*Window.width, x=.1*Window.width, direction="bottom") FloatLayout.add_widget(self,grid) for wrapper in self.wrappers.values(): print 'before', wrapper.size wrapper.scale=SCALE print 'after', wrapper.size if self.activated: wrapper.size_hint= None, None print 'adding wrapper of ', wrapper.height grid.add_widget(wrapper) else: self.children[0].remove_widget(wrapper) if not self.activated: self.clear_widgets() w= self.wrappers[self.current_screen] w.pos = 0,0 w.size_hint= 1,1 FloatLayout.add_widget(self, w) else: print "grid", grid.size, grid.pos, grid.size_hint return if 0: self.clear_widgets() sv = ScrollView() with sv.canvas.before: Color(.3,.3,.3) Rectangle(size=self.size, pos=self.pos) FloatLayout.add_widget(self,sv) grid= GridLayout() sv.do_scroll_x = self.activated sv.do_scroll_y = self.activated grid.rows = 1 if self.orientation=='horizontal' else None grid.cols = 1 if self.orientation=="vertical" else None grid.bind(minimum_height = grid.setter('height')) grid.bind(minimum_width = grid.setter('width')) grid.spacing = self.spacing sv.add_widget(grid) SCALE = .6 # if self.orientation == 'vertical': # attrName = "cols" # dh_name = "row_default_height" # default_value = SCALE*self.height #300 # size_hint=(1,None) # else: # attrName = "rows" # dh_name = "col_default_width" # default_value = 400 # size_hint=(None,1) # kwargs = {attrName:2, dh_name:default_value} # kwargs = {attrName:2} # kwargs = {attrName:1} # kwargs = {attrName:1, dh_name:default_value} # if self.orientation == 'vertical': # grid.height = len(self.content)*(SCALE*self.height+self.spacing) # else: # grid.width = len(self.content)*(SCALE*self.width + self.spacing) for sindex, screen in enumerate(self.content): wrapper = self.wrappers[screen] wrapper.size_hint = None,None wrapper.size = self.size if 1 or screen != self.current_screen: wrapper.scale = SCALE else: reducer = Animation(scale=SCALE, opacity=.5, duration=.3) reducer.start(wrapper) grid.add_widget(wrapper) #Clock.schedule_once(adder,.31) #if self.orientation=='vertical': # name = wrapper.screen_name or str(screen) # grid.add_widget(MagicLabel(target= wrapper, text=name, size = wrapper.size, texture_size = (800,600), size_hint_x=None, width=60)) ##if self.orientation =="horizontal": ## for screen in self.content: ## name = wrapper.screen_name or str(screen) ## grid.add_widget(MagicLabel(target= wrapper, text=name, size = wrapper.size, texture_size = (800,600), size_hint_y=None, height=30)) #scrool sv to proper height ##if self.orientation=="vertical": ## sv.scroll_y= 1- float(self.content.index(self.current_screen))/len(self.content) ##else: ## sv.scroll_x= float(self.content.index(self.current_screen))/len(self.content) else: sv = self.children[0] grid = sv.children[0] for screen in self.content: wrapper = self.wrappers[screen] grid.remove_widget(wrapper) self.clear_widgets() w = self.wrappers[self.current_screen] w.size_hint = 1,1 FloatLayout.add_widget(self,w) wrapper = self.wrappers[self.current_screen] expander = Animation(scale = 1, opacity=1, x=0, y=0, duration=.3) expander.start(wrapper)