예제 #1
0
 def build(self):
     bltAll = TotalLayout()
     svMain = ScrollView()
     bltCenter = BoxLayout(orientation='vertical')
     bltBottom = BoxLayout(size_hint_y=None, height=36)
     btnExpand = Button(text='Expand', size_hint_y=None, height=30, on_release=self.expand)
     btnOptimize = Button(text='Optimize', size_hint_y=None, height=30, on_release=self.minimize)
     self.btnSelect.bind(on_release=self.dbOptions.open)
     for name in self.idp.terms.keys():
         btnTerm = Button(text=name, size_hint_y=None, height=30)
         btnTerm.bind(on_release=lambda btnTerm: self.dbOptions.select(btnTerm.text))
         self.dbOptions.add_widget(btnTerm)
     self.dbOptions.bind(on_select=lambda instance, x: setattr(self.btnSelect, 'text', x))
     btnDistri = Button(size_hint_y=None, height=30, text='ECTS Stats', on_release=self.show_distribution_popup)
     bltBottom.add_widget(btnExpand)
     bltBottom.add_widget(btnOptimize)
     bltBottom.add_widget(self.btnSelect)
     bltBottom.add_widget(btnDistri)
     svMain.add_widget(self.pnlProgramme)
     bltCenter.add_widget(svMain)
     bltCenter.add_widget(bltBottom)
     bltAll.add_widget(bltCenter)
     bltRight = BoxLayout(size_hint_x=None, width=200, orientation='vertical', spacing=2)
     bltRight.add_widget(HistoryLabel(text='History'))
     bltRight.add_widget(self.svHistory)
     bltAll.add_widget(bltRight)
     self.add_widget(bltAll)
예제 #2
0
파일: main.py 프로젝트: Baeji1/music-player
	def library(self,instance):
		print "Show library"
		k = instance.parent.parent.parent.children[0]
		k.clear_widgets()
		s = GridLayout(cols = 1, spacing = 3, size_hint_y = None)
		s.bind(minimum_height = s.setter('height'))
		os.chdir(self.music_path)
		for i in os.listdir(u'.'):
			if '.mp3' in i:
				i = i.encode('utf-8')
				print type(i), i
				s.add_widget(Button(
					text = i[:-4],
					color = (1,1,1,1),
					size_hint_y = None,
					height = 70,
					on_press = self.playSong,
					background_color = self.song_color,
					background_normal = ''
				))

		g = ScrollView(size_hint = (1,0.5), pos_hint = {'x': 0, 'y': 0})
		g.add_widget(s)
		d = StackLayout(size_hint = (1,0.3),pos_hint = {'center_x': 0.5, 'y': 0.5}, orientation = 'lr-tb')
		d.add_widget(Button(text = self.current_song,color = (0,0,0,1),size_hint = (1,0.5),pos_hint = {'x': 0,'y':0.5}, background_normal = '', background_color = (1,1,1,1)))
		d.add_widget(Button(text = "STOP",size_hint = (0.5,0.5), on_press = self.playSong, background_normal = '', background_color = (0.9,0.1,0.1,1)))
		d.add_widget(Button(text = "PAUSE",size_hint = (0.5,0.5), on_press = self.playSong, background_normal = '', background_color = (0.9,0.7,0.1,1)))
		k.add_widget(g)
		k.add_widget(d)
	def update_file_layout(self):
		auth_token='S2_xUq0_iNAAAAAAAAAACYNG1zf1GAzKpVWVfmLcZLA-FIiSlGxMvmxBkAtspuWQ'
		client = dropbox.client.DropboxClient(auth_token)
		self.clear_widgets()  
		b=BoxLayout(orientation='vertical')
		file_system = FileSystemLocal()
		root_dir= App.get_running_app().user_data_dir+'/';result_dir=root_dir+'results'
		file_list=file_system.listdir(root_dir)   # this returns a list of files in dir
		if os.path.exists(result_dir):file_list.extend(file_system.listdir(App.get_running_app().user_data_dir+'/'+'results'+'/'))
		file_list=[x for x in file_list if x[-4:]=='.csv']
		b.add_widget(Label(text='Select Files to Upload',bold=True,font_size=sp(25),size_hint_y= 0.1))      
		file_system = FileSystemLocal()
		file_list=file_system.listdir(App.get_running_app().user_data_dir+'/')   # this returns a list of files in dir
		file_list=[x for x in file_list if x[-4:]=='.csv']
		s=ScrollView(size_hint_y=0.75)
		g=GridLayout(cols=2,size_hint_y=None)
		for file_1 in file_list:
			c=CheckBox(active=False)
			l=Label(bold= True,font_size=sp(20),text=file_1,size_hint_y= None,height=70)
			self.check_boxes[c]=file_1
			g.add_widget(l);g.add_widget(c)
		g.bind(minimum_height=g.setter('height'))
		s.add_widget(g)
		b.add_widget(s)
		g_options=GridLayout(cols=2,size_hint_y= 0.1,orientation='horizontal')       
		g_options.add_widget(Button(text="Send",on_press=self.upload,font_size=sp(25)))
		g_options.add_widget(Button(text="Back",on_press=self.return_back,font_size=sp(25)))
		b.add_widget(g_options)
		self.add_widget(b)
예제 #4
0
def load_custom_ker(self):
    Box = BoxLayout(orientation="vertical", spacing=10)
    panel = SettingsPanel(title="Custom HTC Kernels", settings=self)  
    msg = GridLayout(cols=1, size_hint=(None, 0.8), width=700)
    btn_layout = GridLayout(cols=1)
    done = Button(text="Done")
    easy = Button(text='Show Stock Kernels',size_hint_y=(None), height=25)
    btn_layout.add_widget(done)
    msg.bind(minimum_height=msg.setter('height'))
    try:
        for name in kernels:
            item = SettingItem(panel = panel, title = "%s" % name, disabled=False, desc = "https://github.com/wes342/%s" % name)
            item_btn = CustomButton(text="Clone:  %s" % name ,size_hint=(None, None),width=250, height=40)
            item.add_widget(item_btn)
            msg.add_widget(item)
        item_btn.bind(on_release=get_kernel) 
            
        root = ScrollView(size_hint=(None, None), size=(675, 350), do_scroll_x=False)
        root.add_widget(msg)
        Box.add_widget(easy)
        Box.add_widget(root)
        Box.add_widget(btn_layout)
        easy.bind(on_release=load_ker)
        
        popup = Popup(background='atlas://images/eds/pop', title='Custom HTC Kernels',content=Box, auto_dismiss=True,
        size_hint=(None, None), size=(700, 500))
        done.bind(on_release=popup.dismiss)
        easy.bind(on_release=popup.dismiss)
        popup.open()
        
    except:
        EdsNotify().run("'system/app Directory Not Found", 'Cant Find:\n' + SystemApp)   
예제 #5
0
파일: ui.py 프로젝트: Davideddu/karaokivy
    def _create_popup(self, instance):
        # create the popup
        content = BoxLayout(orientation='vertical', spacing='5dp')
        box = GridLayout(cols=1, spacing="5dp")
        box.bind(minimum_height=box.setter('height'))
        self.popup = popup = Popup(content=content,
            title=self.title, size_hint=(None, 1), width='400dp')
        #popup.height = len(self.options) * dp(55) + dp(150)

        # add all the options
        content.add_widget(Widget(size_hint_y=None, height=1))
        uid = str(self.uid)
        for option in self.options:
            state = 'down' if option == self.value else 'normal'
            btn = ToggleButton(text=option, state=state, group=uid)
            btn.bind(on_release=self._set_option)
            box.add_widget(btn)
        #box.height = metrics.dp(35) * len(self.options)

        scroll = ScrollView(pos_hint={'center_x': .5, 'center_y': .5}, do_scroll_x=False, size_hint=(1, 1))
        scroll.add_widget(box)
        content.add_widget(scroll)
        # 2 buttons are created for accept or cancel the current value
        btnlayout = BoxLayout(size_hint_y=None, height='50dp', spacing='5dp')
        btn = Button(text='OK')
        btn.bind(on_release=self._validate)
        btnlayout.add_widget(btn)
        btn = Button(text='Cancel')
        btn.bind(on_release=self.popup.dismiss)
        btnlayout.add_widget(btn)
        content.add_widget(btnlayout)

        # and open the popup !
        popup.open()
예제 #6
0
    def __init__(self, **kwargs):
        super(GameRecorder, self).__init__(**kwargs)
        self.orientation = 'vertical' if self.height > self.width else 'horizontal'
        self.bind(size=self.on_size, orientation=self.on_orientation)

        self.game = Game()
        side_box = BoxLayout(orientation='vertical')
        b = BoxLayout(size_hint_y=None, height=dp(50))
        back_button = CustomButton(text='<< Games')
        undo_button = CustomButton(text='Reset')
        undo_button.bind(on_release=self.reset)
        back_button.bind(on_release=self.go_back)
        b.add_widget(back_button)
        b.add_widget(undo_button)

        save_button = CustomButton(text='Save game', size_hint_y=None, height=dp(50))
        save_button.bind(on_release=self.save_popup)
        side_box.add_widget(b)
        side_box.add_widget(save_button)


        moves_scroll = ScrollView()
        self.moves_table=MovesGrid(padding=dp(10), spacing=dp(10))
        for move in self.game.move_history:
            self.moves_table.add_widget(MoveButton(text=move))

        side = self.height if self.orientation == 'horizontal' else self.width
        self.board = ChessboardUI(game=self.game, size_hint=(None,None), height=side, width=side)
        self.board.bind(move_made=self.change_moves)

        self.add_widget(self.board)
        moves_scroll.add_widget(self.moves_table)
        side_box.add_widget(moves_scroll)
        self.add_widget(side_box)
예제 #7
0
    def _create_subpopup(self, instance):
        ''' shows the sub popup '''
        # create the popup
        content         = GridLayout(cols=1, spacing='5dp')
        scrollview      = ScrollView( do_scroll_x=False)
        scrollcontent   = GridLayout(cols=1,  spacing='5dp', size_hint=(None, None))
        scrollcontent.bind(minimum_height=scrollcontent.setter('height'))
        self.subpopup   = popup = Popup(content=content, title=self.uOption, size_hint=(0.5, 0.9),  auto_dismiss=False)

        #we need to open the popup first to get the metrics
        popup.open()
        #Add some space on top
        content.add_widget(Widget(size_hint_y=None, height=dp(2)))
        # add all the options
        uid = str(self.uid)
        for option in self.aSubOption:
            state = 'down' if option == self.value else 'normal'
            oTbtn = ToggleButton(text=option, state=state, group=uid, size=(popup.width, dp(55)), size_hint=(None, None))
            oTbtn.bind(on_release=self._set_suboption)
            scrollcontent.add_widget(oTbtn)

        # finally, add a cancel button to return on the previous panel
        scrollview.add_widget(scrollcontent)
        content.add_widget(scrollview)
        content.add_widget(SettingSpacer())
        oMbtn = cMultiLineButton(text=ReplaceVars('$lvar(5009)'), size=(popup.width, dp(50)),size_hint=(0.9, None), halign='center', valign='middle')
        oMbtn.bind(on_release=popup.dismiss)
        content.add_widget(oMbtn)
예제 #8
0
파일: quiz.py 프로젝트: timothyf1/edumath
class QuizResults(Screen):

    def __init__(self, questions, quizenteredanswers, userid):    
        super(QuizResults, self).__init__()    
        self.questions = questions
        self.quizenteredanswers = quizenteredanswers
        self.userid = userid
        self.box = BoxLayout(orientation = 'vertical')
        self.box.add_widget(Banner('Quiz', 1, self.userid))

        # Building the results table
        self.resultsgrid = GridLayout(cols = 3, size_hint_y = None, height = dp(40) + len(self.questions) * dp(40))
        self.resultsgrid.add_widget(Label(text = 'Question\nNumber', size_hint_y = None, height = dp(40)))
        self.resultsgrid.add_widget(Label(text = 'Your\nanswer', size_hint_y = None, height = dp(40)))
        self.resultsgrid.add_widget(Label(text = 'Correct\n answer', size_hint_y = None, height = dp(40)))
        for a in range(0, len(self.questions)):
            self.resultsgrid.add_widget(Button(text = str(a+1), size_hint_y = None, height = dp(40), on_press = self.questionpopup, id = str(a)))
            if self.questions[a][5] == self.quizenteredanswers[a]:
                self.resultsgrid.add_widget(Label(text = str(self.quizenteredanswers[a]), color = (0, 1, 0, 1), size_hint_y = None, height = dp(40)))
            else:
                self.resultsgrid.add_widget(Label(text = str(self.quizenteredanswers[a]), color = (1, 0, 0, 1), size_hint_y = None, height = dp(40)))
            self.resultsgrid.add_widget(Label(text = str(self.questions[a][5]), size_hint_y = None, height = dp(40)))
            
        # If there are enough questions then the results table won't fit, so scrollview is used to scroll through the results 
        self.scroller = ScrollView()
        self.scroller.add_widget(self.resultsgrid)
        self.box.add_widget(self.scroller)  # Adds the results table to the screen
        self.add_widget(self.box)

    def questionpopup(self, button):
        QuizQuestionResultPop(self.questions[int(button.id)], self.quizenteredanswers[int(button.id)], int(button.id)).open()

    def on_leave(self):
        self.parent.remove_widget(self)
예제 #9
0
파일: main.py 프로젝트: PanosFirmpas/kivy
class ViewListScreen(MyScreen):
    def __init__(self, **kwargs):
        super(ViewListScreen, self).__init__(**kwargs)
        self.sv = ScrollView()
        self.content_box.add_widget(self.sv)



        self.list_grid = GridLayout(cols = 1,
                                size_hint_y = None,
                                orientation = 'vertical')
        self.sv.add_widget(self.list_grid)

        self.bind(on_pre_enter= self.prepare_yourself)
    
    def prepare_yourself(self,*args):
        
        self.list_grid.clear_widgets()

        c_list = App.get_running_app().root.current_list
        self.list_grid.height = len(c_list)*40 #HARDCODE

        for e,spell in enumerate(c_list):
            spell['button_card'].id = str(e)
            self.list_grid.add_widget(spell['button_card'])
예제 #10
0
                def OnIceFenwickStats(obj):
                
                    # Clear widgets in order to hide previous table if user searched for other play stat categories first
                    Layout.clear_widgets()
                    Layout.add_widget(BackToPlayerSearch)
                    Layout.add_widget(PlayerSearchLabel)
                    Layout.add_widget(IndividualButton)
                    Layout.add_widget(On_Ice_Goals_Button)
                    Layout.add_widget(On_Ice_Fenwick_Button)

                    Grid = GridLayout(rows = len(On_ice_Fenwick_stats) + 1, cols = len(On_ice_Fenwick_categories), size_hint = (None, None))
                    Grid.bind(minimum_height=Grid.setter('height'), minimum_width = Grid.setter('width'))
                    for stat_category in On_ice_Fenwick_categories:
                        Grid.add_widget(TextInput(text = str(stat_category), size_hint = (None, None), font_size = 18, readonly = True))
                    for i in range(len(On_ice_Fenwick_stats)):
                        if i % 2 == 0:
                            ColorBackGround = [200./255, 204./255, 255./255, 1]
                        else:
                            ColorBackGround = [1,1,1,1]
                        season = On_ice_Fenwick_stats[i]
                        for stat in season:
                            Grid.add_widget(TextInput(text = str(stat), size_hint = (None, None), font_size = 18, background_color = ColorBackGround, readonly = True))
                    Scroll = ScrollView(size_hint = (1, .65))
                    
                    Scroll.add_widget(Grid)
                    Layout.add_widget(Scroll)
예제 #11
0
파일: IRDB.py 프로젝트: thica/ORCA-Remote
    def Start(self,uTitle,aOptions,fktCallBack):
        ''' starts selection '''
        self.fktCallBack=fktCallBack
        # create the popup
        content         = GridLayout(cols=1, spacing='5dp')
        scrollview      = ScrollView( do_scroll_x=False, bar_width='10dp',scroll_type=['bars'] )
        scrollcontent   = GridLayout(cols=1,  spacing='5dp', size_hint=(None, None))
        scrollcontent.bind(minimum_height=scrollcontent.setter('height'))
        self.oPopup   = popup = Popup(content=content, title=ReplaceVars(uTitle), size_hint=(0.5, 0.9),  auto_dismiss=False)

        #we need to open the popup first to get the metrics
        popup.open()
        #Add some space on top
        content.add_widget(Widget(size_hint_y=None, height=dp(2)))
        # add all the options
        for option in aOptions:
            if hasattr(option,"Name"):
                name=option.Name
            else:
                name=option.Type
            btn = Button(text=name, size=(popup.width, dp(30)), size_hint=(None, None))
            btn.bind(on_release=self.On_Value)
            btn.oDBRef=option
            scrollcontent.add_widget(btn)

        # finally, add a cancel button
        scrollview.add_widget(scrollcontent)
        content.add_widget(scrollview)
        content.add_widget(SettingSpacer())
        btn = Button(text=ReplaceVars('$lvar(5009)'), size=(popup.width, dp(50)),size_hint=(0.9, None))
        btn.bind(on_release=popup.dismiss)
        content.add_widget(btn)
예제 #12
0
파일: main.py 프로젝트: anumraufsatti/Hex
class HexApp(App):
    game = ObjectProperty()
    camera = ObjectProperty()

    def build(self):
        self._keyboard = Window.request_keyboard(self._keyboard_closed,
                                                 self,
                                                 'text')
        self._keyboard.bind(on_key_down=self._on_key_down)

        self.game = Grid(size_hint=(None, None))
        self.game.build_grid(settings.GRID_WIDTH,
                             settings.GRID_HEIGHT,
                             settings.GRID_SCALE)
        self.game.add_player(0,
                             settings.GRID_HEIGHT - 1,
                             settings.GRID_SCALE)

        self.camera = ScrollView(size_hint=(1, 1))
        self.camera.add_widget(self.game)

        return self.camera

    def _keyboard_closed(self):
        self._keyboard.unbind(on_key_down=self._on_key_down)
        self._keyboard = None

    def _on_key_down(self, keyboard, keycode, text, modifiers):
        if keycode[1] in keymap.WALK_DIRECTIONS:
            return self.game.player.action(keycode[1],
                                           movesteps=settings.MOVE_STEPS)
        elif keycode[1] == keymap.QUIT:
            keyboard.release()
        return True
예제 #13
0
        def viewGames(self):
            sview = ScrollView(size_hint=(.9, .8), pos_hint={'center_x':.5, 'center_y':.5})
            layout = GridLayout(cols=1, spacing=10, size_hint_y=None)
            # Make sure the height is such that there is something to scroll.
            layout.bind(minimum_height=layout.setter('height'))
            # Run sql query to get all available games
            availableGames = retrieve("SELECT * FROM Games")
            
            if availableGames == "":
                popup = Popup(title='No Games', content=Label(text='There are currently no available games'), size_hint=(None, None), size=(400, 100))
                popup.open()
            elif availableGames == 0:
                popup = Popup(title='Connection', content=Label(text='Could not connect to the database'), size_hint=(None, None), size=(400, 100))
                popup.open()
            else:
                for tpl in availableGames:
                    uid, name, location, creator, status = tpl
                    print "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n\n"
                    print name
                    print "\n\n\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n\n"
                    btn = Button(id=name, text=name, size_hint_y=None, height=200)
                    btn.bind(on_press=self.seeInfo)
                    layout.add_widget(btn)

            sview.add_widget(layout)
            self.add_widget(sview)
예제 #14
0
class ScrollableLabel(ScrollView):
   
    '''
   use it thisly -> scrollablelabel = ScrollableLabel().build("put your big bunch of text right here")
       or
   ScrollableLabel().build() <- thusly with no argument to just get a very big bunch of text as a demo
   
   scrolls x and y default
   '''
 
    def build(self,textinput,size):
        self.summary_label = Label(text="",text_size=(size,None),
                              size_hint_y=None,size_hint_x=None)
       
        self.summary_label.bind(texture_size=self._set_summary_height)
        # remove the above bind
        self.summary_label.text = str(textinput)
       
        #and try setting height in the following line
        self.sv = ScrollView(do_scroll_x=False)
        # it does not scroll the scroll view.
       
        self.sv.add_widget(self.summary_label)
       
        return self.sv
   
    def _set_summary_height(self, instance, size):
        instance.height = size[1]
        instance.width = size[0]
예제 #15
0
파일: __main__.py 프로젝트: uxmar/indra
    def show_view_list_path(self, *args, **kwargs):
        
        self.clear_widgets()
        color = ColorLayout()
        boxl = BoxLayout(orientation= 'vertical',anchor_y= "top")
        grid = GridLayout(cols=1, size_hint_y=None)
        grid.bind(minimum_height=grid.setter('height')) 
        scroll = ScrollView(size_hint=(None, None))
        scroll.size = (Window.width, Window.height)
        scroll.center = Window.center
        #2 Space added but button go back ocuppies space and first value hidden.
        l_space = MultiLineLabel(text='',font_size="16dp", background_color=(255,255,255,255), markup=True)
        grid.add_widget(l_space)
        l_space = MultiLineLabel(text='',font_size="16dp", background_color=(255,255,255,255), markup=True)
        grid.add_widget(l_space)
        
        for i in args[0]:
            text = '[color=333333]'+'  '+i['text'] + '[/color]'+'  '
            #~ l = MultiLineLabel(text=text,font_size="16dp",markup=True)
            l = MultiLineLabel(text=text,font_size="16dp", background_color=(255,255,255,255), markup=True)
            i['stations'] and l.bind(on_press = partial(self.show_list_stations, i['stations'],args[0]))
            grid.add_widget(l)
            
        button_back = Button(text="Go Back", auto_dismiss=False, size_hint=(None, None), pos_hint= {'center_x':.5, 'center_y':.7})
        button_back.height="50dp"
        button_back.width="100dp"
        button_back.bind(on_press = lambda widget: self.show_option_view())

        scroll.add_widget(grid)
        boxl.add_widget(scroll)
        boxl.add_widget(button_back)
        color.add_widget(boxl)
        self.add_widget(color)
예제 #16
0
        def subscroll(self):
            """
            opens scroll list of substitute characters in a popup
            """
            for btn in SMApp.teamlist:
                if btn.state == 'down':
                    SMApp.nameOff = btn
                    btn.state = 'normal'

      
            curs.execute('SELECT * FROM Subs')
            layout2 = GridLayout(cols=2, spacing=10, size_hint_y=None)
            layout2.bind(minimum_height=layout2.setter('height'))
            for row in curs:
                btn = ToggleButton(text=str(row[0]), size_hint_y=None, height=40)
                if row[1] == 1:
                    btn.background_color = (0.5, 1, 0.9, 1)
                layout2.add_widget(btn)
                btn.bind(on_press=subChar)
                SMApp.sublist.append(btn)
                lbl = Label(text=str(row[2]), size_hinty=None, height=40)
                layout2.add_widget(lbl)
            root = ScrollView(size_hint=(None, None), size=(400, 400))
            root.add_widget(layout2)
            SMApp.popup2 = Popup(content=root, size=(7, 10), size_hint=(0.55, 0.8), title="list of subs")

            SMApp.popup2.open()
예제 #17
0
    def draw_buttons(self,text_buttons,buttons,objects):

        bl = BoxLayout(
            orientation = 'vertical',
            spacing = self.spacing,
            size_hint_y = None, 
            height = len(buttons+objects+text_buttons)*(self.spacing + self.button_height) + self.spacing,
            )

        # these don't really need to be separate at all
        for t in text_buttons:
            b = Button(text=str(t), id = str(t), size_hint_y = None, height = self.button_height)
            b.bind(on_release = self.button_callback)
            bl.add_widget(b)

        for t in buttons:
            b = Button(text="", id = t.material_name, background_normal = t.icon_str, background_down = t.icon_str, size_hint_y = None, height = self.button_height)
            b.bind(on_release = self.button_callback)
            bl.add_widget(b)

        for o in objects:
            b = Button(text="", id = o.name, background_down = o.icon_str, background_normal = o.icon_str, size_hint_y = None, height = self.button_height)
            b.bind(on_release = self.button_callback)
            bl.add_widget(b)

        sv = ScrollView(size_hint = (None, None), width=self.button_width, height = self.height, x = self.x + self.spacing,
            y = self.y + self.spacing)
        sv.add_widget(bl)
        self.add_widget(sv)
예제 #18
0
				def _on_test_connect( self ) :
							"""

							:return:
							"""


							layout = GridLayout( orientation = 'horizontal' ,
											  cols = 1 ,
											  background_color = [0,0,0,0])
							action_bar = Builder.load_string( self._retr_resource( 'dlg_action_bar_3' ) )
							layout.add_widget( action_bar )
							img = Image( source = './image/kafka-logo.png' , size_hint_y = .15)
							scroll = ScrollView( id = 'scrlv' )
							grid = GridLayout( cols=1 , orientation = 'horizontal' , size_hint_y = None , size=(400 , 500 ) )
							grid.add_widget( img  )
							vx =  TextInput(
											text = '',
											background_color = [0,0,0,0] ,
											foreground_color =  [1,1,1,1] ,
											multiline = True ,
											font_size =  16 ,
											readonly =  True  )
							#vx.height = max( (len(vx._lines)+1) * vx.line_height, scroll.height )
							grid.add_widget( vx )
							scroll.add_widget( grid )
							layout.add_widget( scroll )

							popup = screen.ConsolePopup( title='kafka connect' , content = layout )
							b = popup.content.children[1].children[0].children[0]
							b.text = 'test connect'
							b.bind( on_press = lambda a:self._show_info( vx ) )
							popup.open()
예제 #19
0
    def load_senders(self):

        if self.verbose:
            print 'load sender'

        self.clear_widgets() #clear previous widgets
        scroll = ScrollView()
        self.add_widget(scroll)
        grid = GridLayout1Scroll(spacing=8, padding=[5,0,5,0])
        scroll.add_widget(grid)

        db = Manager(verbose=self.verbose)
        app = App.get_running_app()
        rows = db.getSenders(app.root.userID)

        for index, row in enumerate(rows):

            text = ''
            if row[2] != '':
                text = str(row[2])
            else:
                text = str(row[1])
            if len(text) > 50:
                text = text[:50] + '...'
            text = '[b]' + text + '[/b]'

            button = MyColorDownButton()
            button.id = str(row[0])
            button.text = text

            button.bind(on_press=self.button_callback)
            grid.add_widget(button)

        return True
예제 #20
0
파일: main.py 프로젝트: jonoco/overseer
 def clickJoinFighter(self):
     """
         called by clicking on <Move Fighter>
     """
     try:
         box = GridLayout(orientation='vertical', height='130sp', cols=2, spacing=10, padding=5, size_hint=(1,None))
         scroll = ScrollView()
         scroll.add_widget(box)
         popup = Popup(title ='Select where to send division', content = scroll,
                       size_hint = (None, None), size=(600, 600))
         dList = []
         divs = db.execute('SELECT DivisionID FROM Event')
         for d in divs:
             did = d[0]
             if did not in dList and did != self.div: 
                 dList.append(did)
         
         for i in sorted(dList):
             txt = i.replace(";","\n")
             txt = txt.replace("_"," ")
             btn = OSButton(text=txt, title='select where to move fighter', height=('60sp'), size_hint=(1, None),
                             identity = i, on_press=self.joinFighter, on_release=popup.dismiss)
             box.add_widget(btn)
         
         h = 0
         n = len(box.children)
         for c in box.children: h += c.height
         box.height = (h/2 + n*5)
         
         popup.open()
     except Exception as e: print "{} exception: {}".format(self, e)
예제 #21
0
파일: main.py 프로젝트: rev20/Time-Tracker
	def timesheet_pop(self):
		"""Popup to display the Timesheet"""

		popup = Popup(title='Timesheet')
		b=BoxLayout(orientation='vertical')
		s = ScrollView()
		global tslabel
		tslabel=Label(size_hint_y=None,line_height=1.5,valign="top",
					  text="|_ID_|______DATE______|___TIME_SPENT____|_____TASK_________|")
		tslabel.bind(texture_size=tslabel.setter('size'))
		btn1=Button(text='CLOSE',size_hint=(1,.06))
		s.add_widget(tslabel)
		b.add_widget(s)
		b.add_widget(btn1)
		popup.content=b
		popup.open()
		btn1.bind(on_press=popup.dismiss)

		con=lite.connect('TimeTracker.db')
		with con:
				cur=con.cursor()
				cur.execute("SELECT ID, TASK_DATE, TIME, TASK FROM Timesheet")
				rows = cur.fetchall()
				for row in rows:
				  tslabel.text=tslabel.text+"\n   "
				  tslabel.text+=str(row[0]).center(4)+"      "+str(row[1])
				  tslabel.text+="  "+str(row[2]).center(34)+"  "+str(row[3])
		if con:
				con.close()
예제 #22
0
파일: main.py 프로젝트: rev20/Time-Tracker
	def readme_pop(self):
		""" Readme """

		popup = Popup(title='README')
		b=BoxLayout(orientation='vertical')
		s = ScrollView()
		global tslabel
		tslabel=Label(size_hint_y=None,line_height=1.5,valign="top",
					  text= "Copyright (C) 2015 Revathy Narayanan\n" +
					  "The TimeTracker is a Python application \n that will keep"+
					  " track of time spent\n in day-to-day activities.\n\n"+
"The Application will have features \n"+
"* Start/Stop watch \n * Log Task\n * Add Comments\n"+
"* Generate & View Timesheet\n * Mail Timesheet\n\n "+
"The code is licensed under MIT License(MIT).\n "+
"Please see the file license in this distribution\n for license terms in the link below :\n"+
"https://github.com/rev20/Time-Tracker/blob/master/LICENSE \n\n"+
"Following is the link for the repository: \n"+
"https://github.com/rev20/Time-Tracker/")

		tslabel.bind(texture_size=tslabel.setter('size'))
		btn1=Button(text='CLOSE',size_hint=(1,.06))
		s.add_widget(tslabel)
		b.add_widget(s)
		b.add_widget(btn1)
		popup.content=b
		popup.open()
		btn1.bind(on_press=popup.dismiss)
예제 #23
0
    def __init__(self, **kwargs):
        super(IntroPanelView, self).__init__(**kwargs)
        self.name='introscreen' 
        
        # create a default grid layout with custom width/height
        layout = GridLayout(cols=1, padding=10, spacing=10,
                size_hint=(None, None),pos_hint={'center_x': .5, 'center_y': .5}, width=500)
        
        layout.bind(minimum_height=layout.setter('height'))

        # create a scroll view, with a size < size of the grid
        scrl = ScrollView(size_hint=(None, None), size=(500, 320),
                pos_hint={'center_x': .5, 'center_y': .5}, do_scroll_x=False)
        
        label = Label(
            text=self.introtext,
            size=(480, 900),
            text_size=(480,900),
            size_hint_y=None,
            markup=True)
        
        scrl.add_widget(label)
        layout.add_widget(scrl)
        
        btn = Button(text='Okay', size=(480, 40),
                         size_hint=(None, None), on_press=self.close)
        
        layout.add_widget(btn)
        
        self.add_widget(layout)
예제 #24
0
 def getTreeViewAsFiles(self):
     try:
         tv = TreeView(hide_root=True)
         tv.size_hint = 1, None
         tv.bind(minimum_height = tv.setter('height'))
         
         for key in self.config_files:
             newnode = tv.add_node(TreeViewLabel(text=self.config_files[key].filename, font_size=self.label_font_size, color=self.filename_label_color))
             
             for child_filename in self.config_files[key].child_files:
                 self._addFileNodeToFileTreeView(tv, newnode, self.config_files[key].child_files[child_filename])
                 
             for configkey in self.config_files[key].config:
                 if isinstance(self.config_files[key].config[configkey], dict):
                     self._addDictNodeToFileTreeView(tv, newnode, configkey, self.config_files[key].config[configkey])
                 else:
                     tv.add_node(TreeViewLabel(text=str(configkey) + ':' + str(self.config_files[key].config[configkey]), font_size=self.label_font_size, color=self.key_label_color), newnode)
                             
         scv = ScrollView(pos = (0, 0), bar_width = 10)
         scv.add_widget(tv)
         return scv
     except:
         e = sys.exc_info()[0]
         self.log.exception("Error: %s" % e )
         raise
예제 #25
0
파일: main.py 프로젝트: snaiffer/TreeNote
  def readMode(self, *args):
    self.leafLayout.clear_widgets()
    # top
    btnBack = Button(text='Back', size_hint_x=0.1)
    capture = Label(text=tree.curItem().name, size_hint_x=0.8, color = color['lblPath'])
    btnEdit = Button(text='Edit', size_hint_x=0.1)
    topLayout = BoxLayout(size_hint_y = 0.1)
    topLayout.add_widget(btnBack)
    topLayout.add_widget(capture)
    topLayout.add_widget(btnEdit)
    self.leafLayout.add_widget(topLayout) 
    btnBack.bind(on_press=self.back)

    # Content
    self.textField = TextInputForScroll(
        size_hint_y=None,
        text=tree.curItem().read(), 
        background_color = color['readLeaf'],
        readonly = True,
        focus = True)
    self.textField.on_text()
    textFieldScroll = ScrollView( bar_width = 10)
    textFieldScroll.add_widget(self.textField)

    self.leafLayout.add_widget(textFieldScroll) 

    btnEdit.bind(on_release=self.editMode)
예제 #26
0
def kernel_mods(self):
    Box = BoxLayout(orientation="vertical", spacing=10)
    msg = GridLayout(cols=1, padding=15, spacing=10, size_hint_y=None)
    btn_layout = GridLayout(cols=1)
    done = Button(text="Done")
    btn_layout.add_widget(done)
    msg.bind(minimum_height=msg.setter('height'))
    
    over = CustomButton(text='OverClocking', size=(475, 40), size_hint=(None, None))
    over.bind(on_release=overclock)
    
    gpu = CustomButton(text='Gpu Overclock', size=(475, 40), size_hint=(None, None))
    gpu.bind(on_release=gpu_overclock)
    
    gov = CustomButton(text='Governors', size=(475, 40), size_hint=(None, None))
    gov.bind(on_release=gov_select)
    
    mhl = CustomButton(text='MHL Refresh Hack', size=(475, 40), size_hint=(None, None))
    mhl.bind(on_release=msl_options)
    
    msg.add_widget(over)
    msg.add_widget(gpu)
    msg.add_widget(gov)
    msg.add_widget(mhl)
    
    root = ScrollView(size_hint=(None, None),bar_margin=-22, size=(475, 390), do_scroll_x=False)
    root.add_widget(msg)
    Box.add_widget(root)
    Box.add_widget(btn_layout)
    
    popup = Popup(background='atlas://images/eds/pop', title='Kernel Mods',content=Box, auto_dismiss=True,
    size_hint=(None, None), size=(520, 500))
    done.bind(on_release=popup.dismiss)
    popup.open()
예제 #27
0
    def __init__(self, **kwargs):
        super(MyScreen, self).__init__(**kwargs)
        scrollView = ScrollView()
        self.add_widget(scrollView)

        boxLayout = BoxLayout(orientation='vertical', height=dp(1000), padding=dp(48))
        scrollView.add_widget(boxLayout)
        textField = SingleLineTextField(id='text_filed', size_hint=(0.8, None), height=dp(48))
        textField.hint_text='This is a pretty text filed'
        boxLayout.add_widget(textField)
        buttonContainer = BoxLayout(orientation='horizontal', height=dp(48))
        flatButton = MDFlatButton(text='FlatButton')
        # size is not working somehow
        # flatButton.size = (3*dp(48), dp(48))
        buttonContainer.add_widget(flatButton)
        raiseButton = MDRaisedButton(text='RaiseButton')
        # raiseButton.size = (3*dp(48), dp(48))
        buttonContainer.add_widget(raiseButton)
        boxLayout.add_widget(buttonContainer)

        switchContainer = BoxLayout(orientation='horizontal')
        checkbox1 = MDCheckbox(group='test')
        # checkbox1.size=(dp(48), dp(48))
        switchContainer.add_widget(checkbox1)
        checkbox2 = MDCheckbox(group='test')
        # checkbox2.size=(dp(48), dp(48))
        switchContainer.add_widget(checkbox2)
        boxLayout.add_widget(switchContainer)
예제 #28
0
    def __init__(self, player_file=None, **kwargs):
        Screen.__init__(self, **kwargs)        
        self.purchased = []
        if player_file is None:
            self._purchased_file = os.path.join("player", "backgrounds.txt")
        else: self._purchased_file = player_file
        self._read_purchased()
        self.purchased_cat = BackgroundCategory('Purchased')
        
        self.categories = []
        self._available_file = os.path.join("data", "Backgrounds.txt")
        self._read_available()

        layout = BoxLayout(orientation="vertical")
        layout.add_widget(ActionBar(size_hint=(1, .125)))
        scroller = ScrollView(do_scroll_x=False)
        self.grid = GridLayout(cols=1, size_hint_y=None)
        self.grid.add_widget(CategoryIcon(screen=self,
                                          category=self.purchased_cat))
        self.bind(size=self._resize_grid)
        for cat in self.categories:
            self.grid.add_widget(CategoryIcon(screen=self,
                                              category=cat))
        scroller.add_widget(self.grid)
        layout.add_widget(scroller)
        self.add_widget(layout)
예제 #29
0
    def draw_buses(self):
        """Adds the buses to the main screen."""
        # Clear the screen of any buses.
        self.ids.bx_buses.clear_widgets()

        # Get a list of just those buses who are included in the filter.
        buses = [b for b in self.buses if b["route"] in self.filters]

        # Work out the height needed to display all the buses
        # (we need this for the StackLayout)
        h = (len(buses) * 30)

        # Create a StackLayout and ScrollView
        sl = StackLayout(orientation="tb-lr", height=h, size_hint=(1, None))
        sv = ScrollView(size_hint=(1, 1))
        sv.add_widget(sl)
        self.ids.bx_buses.add_widget(sv)

        # Loop over the buses, create a FinlandArrivals object and add it to the
        # StackLayout
        for bus in buses:
            bs = FinlandArrivals(bus=bus)
            if "alert" in(bus):
                self.alert = bus["alert"]
            sl.add_widget(bs)
예제 #30
0
파일: dialog.py 프로젝트: LogicalDash/LiSE
class DialogMenu(Box):
    """Some buttons that make the game do things.

    Set ``options`` to a list of pairs of ``(text, function)`` and the
    menu will be populated with buttons that say ``text`` that call
    ``function`` when pressed.

    """
    options = ListProperty()
    """List of pairs of (button_text, callable)"""

    def _set_sv_size(self, *args):
        self._sv.width = self.width - self.padding[0] - self.padding[2]
        self._sv.height = self.height - self.padding[1] - self.padding[3]

    def _set_sv_pos(self, *args):
        self._sv.x = self.x + self.padding[0]
        self._sv.y = self.y + self.padding[3]

    def on_options(self, *args):
        self.clear_widgets()
        if not hasattr(self, '_sv'):
            self._sv = ScrollView(size=self.size, pos=self.pos)
            self.bind(size=self._set_sv_size, pos=self._set_sv_pos)
            self._sv.add_widget(BoxLayout(orientation='vertical'))
        layout = self._sv.children[0]
        for txt, part in self.options:
            if not callable(part):
                raise TypeError("Menu options must be callable")
            layout.add_widget(Button(text=txt, on_release=part, font_name=self.font_name, font_size=self.font_size))
        self.add_widget(self._sv)
예제 #31
0
 def Del_Stud_DB(self, text):
     self.te = ''
     self.chkref = {}
     self.Selected_Students = []
     db = mysql.connector.connect(host='localhost',
                                  user='******',
                                  passwd='root')
     my = db.cursor()
     my.execute('use Voice_Comparer')
     sql = 'select * from student where StudentId = %s or name = %s or Branch = %s or class = %s or sec = %s or year = %s'
     print(type(text))
     val = (
         text,
         text,
         text,
         text,
         text,
         text,
     )
     my.execute(
         sql,
         val,
     )
     res = my.fetchall()
     print(len(res))
     inner = ScrollView(size_hint=(1, 1),
                        pos_hint={
                            'center_x': 0,
                            'center_y': .5
                        })
     grid = GridLayout(cols=1, spacing=10, size_hint_y=None, padding=dp(10))
     grid.bind(minimum_height=grid.setter('height'))
     if len(res) > 0:
         for row in res:
             string = str(row[0]) + ' ' + row[1] + ' ' + row[2] + ' ' + row[
                 3] + ' ' + row[4] + ' ' + str(row[5])
             print(string)
             b = BoxLayout(orientation='horizontal', size_hint=(1, None))
             checkbox = MDCheckbox()
             checkbox.bind(active=self.Checking)
             self.chkref[checkbox] = row[0]
             label = MDLabel(text=string)
             b.add_widget(label)
             b.add_widget(checkbox)
             grid.add_widget(b)
         inner.add_widget(grid)
     else:
         inner.add_widget(MDLabel(text='There is no Students Here!!!'))
         pass
     popup = Popup(title='Select Files',
                   size_hint=(1, .8),
                   content=inner,
                   auto_dismiss=True)
     popup.open()
예제 #32
0
 def _create_accordion_item(self, group_name, groups_data):
     group_item = MDAccordionItem(id=group_name,
                                  title=group_name,
                                  icon='accounts',
                                  background_color=self.data.alpha,
                                  title_theme_color='Primary')
     scroll = ScrollView(id=group_name)
     contacts_group = self._get_contacts_group(groups_data[group_name])
     scroll.add_widget(contacts_group)
     group_item.add_widget(scroll)
     self._new_group.ids.group.add_widget(group_item)
예제 #33
0
    def build(self):
        popup = Popup(title='Draggable Scrollbar',
                      size_hint=(0.8, 1),
                      auto_dismiss=False)

        #this layout is the child widget for the main popup
        layout1 = BoxLayout(orientation="vertical")
        #this button is a child of layout1
        closebutton = Button(text='close', size_hint=(0.9, 0.05))
        closebutton.bind(on_press=popup.dismiss)

        def corelate(instance, value):
            f = 1 - scrlv.scroll_y
            b.text = str(floor(f * 60))

        #another child of layout1 and this is the scrollview which will have a custom draggable scrollbar
        scrlv = ScrollView(size_hint=(0.4, 0.4))
        b = Label(text=str(floor((1 - scrlv.scroll_y) * 60)),
                  size_hint=(0.9, 0.1))
        scrlv.bind(scroll_y=corelate)
        #the last child of layout1 and this will act as the draggable scrollbar
        s = Slider(min=0,
                   max=1,
                   value=25,
                   orientation='vertical',
                   step=0.01,
                   size_hint=(0.1, 0.95))

        scrlv.bind(scroll_y=partial(self.slider_change, s))

        #what this does is, whenever the slider is dragged, it scrolls the previously added scrollview by the same amount the slider is dragged
        s.bind(value=partial(self.scroll_change, scrlv))

        layout2 = GridLayout(cols=1, size_hint_y=None)
        layout2.bind(minimum_height=layout2.setter('height'))
        for i in range(0, 61):
            btn = Label(text=str(i),
                        size_hint_y=None,
                        size_hint_x=0.2,
                        height=60,
                        valign='middle',
                        halign='center',
                        font_size=12)
            btn.text_size = (btn.size)
            layout2.add_widget(btn)
        scrlv.add_widget(layout2)

        layout1.add_widget(scrlv)
        layout1.add_widget(b)
        layout1.add_widget(closebutton)

        layout1.add_widget(s)
        popup.content = layout1
        popup.open()
예제 #34
0
class cScrollableLabel(cTouchRectangle):

    text = StringProperty('')

    def __init__(self, **kwargs):

        self.oScrollView = self
        self.oLabel = None
        self.aKwArgs = kwargs
        self.iLineHeight = 0

        cTouchRectangle.__init__(self, **self.aKwArgs)

        self.aKwArgs['bar_width'] = 0
        self.oScrollView = ScrollView(**kwargs)
        self.add_widget(self.oScrollView)

        #if self.aKwArgs.has_key('pos'):
        #    del self.aKwArgs['pos']

        #if self.aKwArgs.has_key('size'):
        #    del self.aKwArgs['size']

        self.aKwArgs['text_size'] = (self.aKwArgs['size'][0], None)

        self.aKwArgs['size_hint_y'] = None
        self.aKwArgs['size_hint_x'] = None

        #test
        #self.aKwArgs['text_size']     = self.size
        #self.aKwArgs['valign']     = 'top'

        self.oLabel = Label(**self.aKwArgs)
        self.oLabel.oScrollView = self
        self.oLabel.bind(texture_size=self._set_height)
        self.oScrollView.add_widget(self.oLabel)

        self.oLabel.bind(texture_size=self._set_height)

    def on_pos(self, instance, pos):
        if self.oScrollView is not None:
            self.oScrollView.pos = pos

    def _set_height(self, instance, size):
        instance.height = size[1]
        instance.width = size[0]
        if self.iLineHeight == 0:
            self.iLineHeight = instance.height
            if self.iLineHeight > instance.font_size * 2:
                self.iLineHeight = instance.font_size**1.128

    def on_text(self, instance, value):
        if self.oLabel is not None:
            self.oLabel.text = value
예제 #35
0
파일: test.py 프로젝트: fxyjj/HrAPP
 def manuPage(self):
     layout=BoxLayout(orientation='vertical')
     layout.bind(minimum_height=layout.setter('height'))
     layout.add_widget(Button(text='课程-岗位',size=(20,10)))
     layout.add_widget(Button(text='test_btn2', size=(20, 10)))
     layout.add_widget(Button(text='test_btn3', size=(20, 10)))
     layout.add_widget(Button(text='test_btn4', size=(20, 10)))
     layout.add_widget(Button(text='test_btn5', size=(20, 10)))
     root = ScrollView(do_scroll_x=False,do_scroll_y=True,size_hint=(0.2,0.8),size=(80,800),pos_hint ={'center_x': .12, 'center_y': .45})
     root.add_widget(layout)
     return root
예제 #36
0
파일: irenic2.py 프로젝트: vilajp/irenic
    def __init__(self, **kwargs):
        super().__init__(**kwargs)

        self.orientation = "vertical"
        self.spacing = 5

        self.lab_ask = Label(text="Seleccione Proveedor:", size_hint=(1, .2))

        self.add_widget(self.lab_ask)

        self.grid_botones = BoxLayout(size_hint=(1, .2))

        with open("proveedores.csv") as prov:
            lista_proveedor = csv.reader(prov, delimiter=",")
            indice = 1
            for proveedor in lista_proveedor:
                if proveedor[0] != "NOMBRE":
                    exec(f"bot_prov{indice} = Button(text = proveedor[0],)")
                    exec(f"self.grid_botones.add_widget(bot_prov{indice})")
                    exec(
                        f"bot_prov{indice}.bind(on_press= self.articulo_proveedor)"
                    )
                    exec(f"bot_prov{indice}.ID = indice")
                    indice += 1

            exec(f"bot_prov{indice} = Button(text = 'Nuevo Proveedor',)")
            exec(f"self.grid_botones.add_widget(bot_prov{indice})")
            exec(f"bot_prov{indice}.bind(on_press= self.articulo_proveedor)")
            exec(f"bot_prov{indice}.ID = indice")

        self.add_widget(self.grid_botones)

        self.box_text_lab = BoxLayout(
            orientation="vertical",
            size_hint=(1, .2),
        )
        self.add_widget(self.box_text_lab)

        self.grid_tex_art = GridLayout(
            cols=4,
            spacing=5,
            size_hint_y=None,
        )

        self.grid_tex_art.bind(
            minimum_height=self.grid_tex_art.setter('height'))

        rotador = ScrollView(
            size_hint=(1, 1),
            size=(Window.width, Window.height),
        )
        rotador.add_widget(self.grid_tex_art)
        self.add_widget(rotador)
예제 #37
0
 def on_press(self):
     self.icon_box.clear_widgets()
     self.icon_box.add_widget(
         Image(source=config.data_center[self.text][0],
               allow_stretch=True,
               keep_ratio=False))
     self.statistic_grid.clear_widgets()
     queue_box = BoxLayout(orientation='vertical', size_hint_y=.4)
     queue_scroll = ScrollView(do_scroll_y=False,
                               do_scroll_x=True,
                               size_hint_y=.6)
     self.queue_grid = QueueGridLayout(rows=1, size_hint_x=None, spacing=5)
     self.queue_grid.bind(minimum_width=self.queue_grid.setter('width'))
     for program in range(len(config.programs.keys())):
         prgm_box = QueueSlotHack(size_hint=(None, None),
                                  width=55,
                                  height=55)
         self.queue_grid.add_widget(prgm_box)
     queue_scroll.add_widget(self.queue_grid)
     queue_top = BoxLayout(orientation='horizontal',
                           size_hint_y=.4,
                           padding=5)
     programs_layout = BoxLayout(orientation='horizontal', size_hint_x=.4)
     programs_now = 0
     for pr in config.player_programs:
         programs_now += int(config.player_programs[pr]) * int(
             config.programs[pr][3])
     self.programs_count_label = RightLabel(
         text=f'{programs_now}/{config.programs_max}')
     programs_layout.add_widget(self.programs_count_label)
     programs_layout.add_widget(
         Image(source=r'data/images/gui_elements/disketa.png',
               size_hint=(.45, .45),
               pos_hint=({
                   'center_x': .5,
                   'center_y': .5
               })))
     queue_top.add_widget(Label(text='Очередь: ', size_hint_x=.6))
     queue_top.add_widget(programs_layout)
     queue_box.add_widget(queue_top)
     queue_box.add_widget(queue_scroll)
     compile_box = GridLayout(cols=2, size_hint_y=.6, spacing=7)
     slot1 = HackSlotImage(unlocked=True)
     slot2 = HackSlotImage()
     slot3 = HackSlotImage()
     slot4 = HackSlotImage()
     self.slots = [slot1, slot2, slot3, slot4]
     compile_box.add_widget(slot1)
     compile_box.add_widget(slot2)
     compile_box.add_widget(slot3)
     compile_box.add_widget(slot4)
     self.statistic_grid.add_widget(queue_box)
     self.statistic_grid.add_widget(compile_box)
예제 #38
0
class DeviceSelectionScreen(Screen):

    class DeviceButton(Button):

        def __init__(self, outerScreen, **kwargs):
            super(Button, self).__init__(**kwargs)
            self.outerScreen = outerScreen

    def __init__(self, **kwargs):
        super(DeviceSelectionScreen, self).__init__(**kwargs)
        self.rStream = u""
        self.sStream = u""
        deviceNames = self.getDeviceList()
        print deviceNames, u"Device names."


    def setupDevButtons(self, listOfDevs):
        self.layout = GridLayout(cols=1, size_hint_y=None)
        self.view = ScrollView(size_hint=(1, None), size=(Window.width, Window.height))
        for devName in listOfDevs:
            btn = self.DeviceButton(self, text=devName, halign=u"left", valign=u"middle")
            self.layout.add_widget(btn)

        self.view.add_widget(self.layout)
        self.add_widget(self.view)

    def getDeviceList(self):
        result = []
        pairedDevs = BluetoothAdapter.getDefaultAdapter().getBondedDevices().toArray()
        for dev in pairedDevs:
            result.append(dev.getName())
        return result


    def createSocketStream(self, devName):
        pairedDevs = BluetoothAdapter.getDefaultAdapter().getBondedDevices().toArray()
        socket = u""
        for dev in pairedDevs:
            if dev.getName() == devName:
                socket = dev.createRfcommSocketToServiceRecord(UUID.fromString(u"80677070-a2f5-11e8-b568-0800200c9a66")) #Random UUID from https://www.famkruithof.net/uuid/uuidgen
                rStream = socket.getInputStream()   #Recieving data
                sStream = socket.getOutputStream()  #Sending data
                break   #Stop when device found
            socket.connect()
            return rStream, sStream

    def setupBT(self, devName):
        try:
            self.rStream, self.sStream = self.createSocketStream(devName)
        except Exception, e:
            print e, u"Can't connect."
            return u"Select"
        else:
예제 #39
0
파일: ui.py 프로젝트: dpwivagg/ea_scheduler
    def build(self):
        scroller = ScrollView(size_hint=(1, None), size=(Window.width, Window.height))
        root = Accordion(orientation='vertical',size_hint_y=None,height=50*27)
        chart = self.create_gantt()
        for title in chart:
            item = AccordionItem(title=title)
            item.add_widget(Image(source=title))
            root.add_widget(item)

        scroller.add_widget(root)

        return scroller
class ScenePanel(MDTab):
    label_size = BoundedNumericProperty(20, min=8)

    def __init__(self, name, panel):
        super().__init__(id=name, name=name, text=panel.title or name)
        #self.sv = ScrollView(size_hint=(1, None), size=(self.width, self.height))
        self.sv = ScrollView(size=(self.width, self.height))
        self.layout = TileGrid(cols=panel.cols or 5)
        if panel.rows is not None:
            self.layout.rows = panel.rows
        self.sv.add_widget(self.layout)
        self.add_widget(self.sv)
예제 #41
0
 def build_screen(self):
     history = JsonStore(history_path)
     scrollview = ScrollView(do_scroll_x=False)
     md_list = MDList()
     scrollview.add_widget(md_list)
     for i in history.keys():
         item = HistoryItem(text=str(i))
         item.add_widget(
             AvatarSampleWidget(source="./assets/kivy-icon-128.png"))
         md_list.add_widget(item)
     print("building screen for history")
     self.add_widget(scrollview)
예제 #42
0
 def __init__(self, **kwargs):
     super(ScrollableScreen, self).__init__(**kwargs)
     self.main_layout = GridLayout(cols=1,
                                   size_hint_y=None,
                                   height=Window.height)
     self.main_layout.bind(minimum_height=self.main_layout.setter('height'))
     scroll = ScrollView(size_hint=(1, 1))
     scroll.effect_cls = OverscrollRefresh
     scroll.add_widget(self.main_layout)
     self.add_widget(scroll)
     self.setup_widgets()
     self.main_layout.height = Window.height * 0.9
예제 #43
0
def scrollgrid2(Screen, components, pos, size):
    grid = GridLayout(cols=2, size_hint_y=None)
    grid.bind(minimum_height=grid.setter('height'))
    for i in components:
        grid.add_widget(i)

    scroll = ScrollView(size_hint=(1, None), pos=pos, size=size)
    scroll.do_scroll_y = True
    scroll.do_scroll_x = False
    scroll.add_widget(grid)

    return scroll
    def update_section_layout_from_course(self, course):

        self.pop_up.curr_course = course
        self.pop_up.selector_button.text = course.get_name()

        Functions.clear_layout(self.section_layout)

        grid_layout = GridLayout(cols=len(course.activity_dict.keys()),
                                 pos_hint={
                                     'center_x': .5,
                                     'center_y': .5
                                 })

        for activity_key in course.activity_dict:
            grid_layout.add_widget(
                Label(text=Section.Section.activity_dict[activity_key],
                      size_hint=(1, .1),
                      pos_hint={
                          'center_x': .5,
                          'center_y': .5
                      }))

        for activity_key in course.activity_dict:
            activity_layout = BoxLayout(orientation="vertical",
                                        padding=10,
                                        spacing=10,
                                        size_hint=(1, None),
                                        pos_hint={
                                            'center_x': .5,
                                            'center_y': .5
                                        })
            activity_layout.bind(
                minimum_height=activity_layout.setter('height'))

            activity_layout.add_widget(
                ChoiceLayout(label_text="All", check_box_status=True))
            for section in course.activity_dict[activity_key]:
                activity_layout.add_widget(
                    ChoiceLayout(label_text=section.id,
                                 check_box_status=False))

            scroll_view = ScrollView(
                size_hint=(1, 1),
                pos_hint={
                    'center_x': .5,
                    'center_y': .5
                },
                do_scroll_x=False,
            )
            scroll_view.add_widget(activity_layout)
            grid_layout.add_widget(scroll_view)

        self.section_layout.add_widget(grid_layout)
예제 #45
0
파일: books.py 프로젝트: slipkova/bmi-kivy
 def __init__(self, *args, **kwargs):
     super(Books, self).__init__(orientation="horizontal")
     scrollview = ScrollView()
     list = MDList()
     with open("modules/books.json", encoding="UTF-8") as file:
         for i in json.load(file):
             list.add_widget(
                 MyItem(author=i['author'],
                        book=i['book'],
                        genre=i['genre']))
     scrollview.add_widget(list)
     self.add_widget(scrollview)
예제 #46
0
class crestChooser(Image):
    def __init__(self, position, **kwargs):
        super(crestChooser, self).__init__(**kwargs)
        self.source = './data/images/interface-choose-crest.png'
        self.size_hint = (None, None)
        self.size = (310, 90)
        self.pos = position

        self.scroller = ScrollView(do_scroll_y=False,
                                   bar_color=[.0, .0, .0, .0])
        self.scroller.size_hint = (None, None)
        self.scroller.size = (310, 90)
        self.scroller.pos = position

        self.crest_box = BoxLayout(orientation='horizontal')
        self.crest_box.size_hint = (None, None)

        self.available_crests = [
        ]  #A stub. Will be filled when the screen is called.

        self.scroller.add_widget(self.crest_box)
        self.add_widget(self.scroller)

    def get_selected(self):
        """Returns the selected crest object. It has a 'name' property."""
        selected = 'none'
        for button in self.available_crests:
            if button.state == 'down':
                selected = button
        if selected == 'none':
            return None
        else:
            return selected

    def fill_crests(self, list_of_crest_names):
        """Places the correct crests. Loaded when the screen is called."""
        #First we erase the crests that are there already
        self.crest_box.clear_widgets()
        self.available_crests = []
        ##We read the save in search of the new available crests
        #list_of_crest_names = g.save.crests
        #Then add them to the box and to a parallel list that guard the btn objects
        for name in list_of_crest_names:
            btn = ToggleButton(group='crests')
            btn.name = name
            btn.background_normal = './data/images/crest_' + name + '_no.png'
            btn.background_down = './data/images/crest_' + name + '.png'
            self.crest_box.add_widget(btn)
            self.available_crests.append(btn)
        #Then we align everything right
        self.crest_box.size = (len(list_of_crest_names) * 90, 90)
        if len(list_of_crest_names) == 3:
            self.scroller.pos = (45, self.pos[1])
예제 #47
0
def scrollgridC(Screen, components, pos, size):
    grid = GridLayout(cols=1, size_hint_y=None)
    grid.bind(minimum_height=grid.setter('height'))

    for i in components:
        grid.add_widget(BadgeC(i['teacher'], i['name'], i['year']))

    scroll = ScrollView(size_hint=(1, None), pos=pos, size=size)
    scroll.do_scroll_y = True
    scroll.do_scroll_x = False
    scroll.add_widget(grid)
    return scroll
예제 #48
0
def scrollgridU(Screen, components, pos, size):
    grid = GridLayout(cols=1, size_hint_y=None)
    grid.bind(minimum_height=grid.setter('height'))

    for i in components:
        grid.add_widget(BadgeU(i['level'], i['userid'], i['password']))

    scroll = ScrollView(size_hint=(1, None), pos=pos, size=size)
    scroll.do_scroll_y = True
    scroll.do_scroll_x = False
    scroll.add_widget(grid)
    return scroll
예제 #49
0
    def results_panel_fill(self):
        # remove previous results from results grid
        self.results_grid.clear_widgets()
        self.results_panel = TabbedPanel(do_default_tab=False)

        # loop through categories in current results
        for category in self.results.categories.keys():

            category_tab = TabbedPanelHeader(text=category)

            # add grid to a scrollview widget
            items_scrollview = ScrollView(size_hint=(1, None), size=(Window.width, Window.height * 0.55))

            # create grid that is scrollable
            items_grid = GridLayout(cols=3, size_hint=(1, None), size=(Window.width, Window.height * 0.55))
            items_grid.bind(minimum_height=items_grid.setter('height'))

            new_items_field = TextInput(hint_text="'Seperate multiple items with commas'")
            add_item_btn = Button(text='Add\nitems', size_hint=(del_col, None),
                                  on_press=partial(self.add_new_cat_item_callback, input=new_items_field,
                                                   category=category))
            add_widgets(items_grid, (new_items_field, add_item_btn))

            # disable add new item button on search box when add item btn in results box is added
            # self.add_item_btn.disabled = True

            # loop through items in category

            items = self.results.categories[category].items.items()
            for (item_name, item_obj) in items:
                # create item label, edit button, and del button
                delete_btn = ToggleButton(text="X", size_hint=(del_col, None),
                                          on_press=partial(self.delete_item_callback,
                                                           item=item_name,
                                                           category=category))

                edit_btn = Button(text=item_name, size_hint=(item_col, None),
                                  on_press=partial(self.edit_item_callback, category=category, item=item_name))

                edit_btn.text_size=edit_btn.size

                # edit_btn.text_size = edit_btn.size
                add_widgets(items_grid, (edit_btn, delete_btn))
            # create a textbox for adding new items'

            items_scrollview.add_widget(items_grid)

            category_tab.content = items_scrollview
            self.results_panel.add_widget(category_tab)

        # add panel to results grid
        self.results_grid.add_widget(self.results_panel)
예제 #50
0
class ListPicker(TextInput):
    pHint_x = NumericProperty(0.7)
    pHint_y = NumericProperty(0.7)
    pHint = ReferenceListProperty(pHint_x, pHint_y)

    def __init__(self,
                 element_list,
                 add_callback=None,
                 topic="Select item",
                 **kwargs):
        super().__init__()
        self.text = ""
        self.topic = topic
        self.element_list = element_list
        self.add_callback = add_callback

        self.scroll_view = ScrollView()
        self.grid = GridLayout(cols=1)
        self.scroll_view.add_widget(self.grid)
        for el in element_list:
            btn_act = Button(text=el)
            btn_act.bind(on_release=lambda btn: self.cb_item(btn))
            self.grid.add_widget(btn_act)

        if add_callback:
            add_button = Button(text="+ Add new")
            add_button.bind(on_release=lambda btn: self.cb_add_new())
            self.grid.add_widget(add_button)

        self.popup = Popup(title=f"Select {topic}", content=self.scroll_view)

        self.bind(focus=self.show_popup)

    def show_popup(self, isnt, val):
        """
        Open popup if textinput focused,
        and regardless update the popup size_hint
        """
        self.popup.size_hint = self.pHint
        if val:
            # Automatically dismiss the keyboard
            # that results from the textInput
            Window.release_all_keyboards()
            self.popup.open()

    def cb_item(self, btn):
        self.text = btn.text
        self.popup.dismiss()

    def cb_add_new(self):
        InputBox(title=f"Add new {self.topic}", callback=self.add_callback)
        self.popup.dismiss()
    def __init__(self, **kwargs):
        super(Main_Page, self).__init__(
            **kwargs)  # this is only for if kivy code goes in the py file

        # backend things
        sql_handler.connect_to_db()  # create db
        self.tablenames = sql_handler.get_tables()  # list of all sql tables
        self.trading_days = backend.get_trading_days(
        )  # list of last/this week's trading days, excludes weekends
        self.btn_list = []  # holds all btns but the headers
        self.ticker_list = backend.call_get_tickers(
            self.tablenames
        )  # holds all tickers used (so I don't have to call sql over and over)
        self.master_list = backend.get_all_data(self.tablenames,
                                                self.ticker_list,
                                                self.trading_days)
        self.todays_index = backend.get_todays_index()  # day of the week
        self.plot_tickers = []  # tickers to show on the plot
        self.plot_colors = [
            [1, 1, 0, 1], [1, 0, 0,
                           1],
            [1, 0, 1, 1], [0.5, .75, .9,
                           1], [0, 1, 0.3, 1]
        ]  # red, yellow, purple, light blue, green | line colors for plot
        self.plot_ratings = []  # holds ratings for the plot (2d list)
        self.plot_dates = backend.plot_make_dates(
        )  # x-axis of plot, 10 most recent trading dates
        self.twitter_blocker = False  # blocks twitter code is I've posted this session

        # ---------------------------------------------------------------------------------

        # UI things
        self.orientation = 'vertical'  # rows not cols

        # this can't a method since I want access to stock_grid later and don't want to try navigating through 2 layers of children for it
        scroll = ScrollView(
            do_scroll_x=False, do_scroll_y=True
        )  # a scroll view will contain the stock gridlayout
        self.stock_grid = GridLayout(cols=9,
                                     size_hint_y=None)  # holds my stocks
        self.stock_grid.bind(minimum_height=self.stock_grid.setter(
            "height"))  # makes the gridlayout scrollabel via the scrollview
        scroll.add_widget(self.stock_grid)

        self.add_widget(
            self.create_top_grid())  # 1st of 2 gridlayouts (the upper one)
        self.add_widget(scroll)  # 2nd of 2 grids (scrollable stock holder)

        # some things used throughout / app start methods
        self.make_header_row(["Rating", "Ticker"])  # make the ehader row
        #self.highlight_today()
        self.update_ui("start of app")
예제 #52
0
def generate_GUI(menus):
    app_gui = TabbedPanel()
    app_gui.clear_tabs()
    app_gui.orientation = "vertical"
    app_gui.do_default_tab = False
    app_gui.tab_width = 150

    for menu_key, sub_menu in menus.items():
        main_menu = TabbedPanelHeader(text=menu_key)
        scroll_pane = ScrollView()
        scroll_pane.scroll_type = ['bars', 'content']
        scroll_pane.bar_pos_y = 'left'
        scroll_pane.bar_width = 6
        scroll_pane.do_scroll_y = True
        scroll_pane.do_scroll_x = False
        scroll_pane.scroll_y = 1

        menu_grid = GridLayout(cols=1, spacing=2, size_hint_y=None)
        menu_grid.orientation = "vertical"
        menu_grid.padding = 10
        menu_grid.row_default_height = 1
        menu_height = 0

        print(">>>" + menu_key)
        for sub_menu_key, items in sub_menu.items():
            menu_grid.add_widget(
                Label(text="     " + sub_menu_key, size_hint=(None, None), font_size=14, halign="left",
                      valign="middle"))
            print("\t" + sub_menu_key)
            for option in items:

                if "Name" in option:
                    print("\t\t" + option["Name"])
                    btn = Button(text=option["Name"], size_hint=(0.1, None), background_color=(0.2, 1, 1, 0.8))
                    btn.bind(on_press=lambda x: webbrowser.open(option["URL"]))
                else:
                    print("\t\t" + "<EMPTY>")
                    btn = Button(text="<EMPTY>", size_hint=(0.1, None), background_color=(0.2, 1, 1, 0.8))
                    btn.bind(on_press=lambda x: webbrowser.open(option["URL"]))
                btn.width = 250
                btn.height = 50
                menu_grid.add_widget(btn)
                menu_height += 80
            menu_height += 51
        menu_grid.height = menu_height
        scroll_pane.add_widget(menu_grid)
        main_menu.content = scroll_pane
        main_menu.orientation = "vertical"

        # Adding headers to main layout
        app_gui.add_widget(main_menu)
    return app_gui
예제 #53
0
파일: main.py 프로젝트: Baeji1/music-player
    def library(self, instance):
        print "Show library"
        k = instance.parent.parent.parent.children[0]
        k.clear_widgets()
        s = GridLayout(cols=1, spacing=3, size_hint_y=None)
        s.bind(minimum_height=s.setter('height'))
        os.chdir(self.music_path)
        for i in os.listdir(u'.'):
            if '.mp3' in i:
                i = i.encode('utf-8')
                print type(i), i
                s.add_widget(
                    Button(text=i[:-4],
                           color=(1, 1, 1, 1),
                           size_hint_y=None,
                           height=70,
                           on_press=self.playSong,
                           background_color=self.song_color,
                           background_normal=''))

        g = ScrollView(size_hint=(1, 0.5), pos_hint={'x': 0, 'y': 0})
        g.add_widget(s)
        d = StackLayout(size_hint=(1, 0.3),
                        pos_hint={
                            'center_x': 0.5,
                            'y': 0.5
                        },
                        orientation='lr-tb')
        d.add_widget(
            Button(text=self.current_song,
                   color=(0, 0, 0, 1),
                   size_hint=(1, 0.5),
                   pos_hint={
                       'x': 0,
                       'y': 0.5
                   },
                   background_normal='',
                   background_color=(1, 1, 1, 1)))
        d.add_widget(
            Button(text="STOP",
                   size_hint=(0.5, 0.5),
                   on_press=self.playSong,
                   background_normal='',
                   background_color=(0.9, 0.1, 0.1, 1)))
        d.add_widget(
            Button(text="PAUSE",
                   size_hint=(0.5, 0.5),
                   on_press=self.playSong,
                   background_normal='',
                   background_color=(0.9, 0.7, 0.1, 1)))
        k.add_widget(g)
        k.add_widget(d)
예제 #54
0
    def _create_popup(self, instance):
        """
        Create the main Exchange popup to which new rows can be added
        :param instance:
        :return:
        """
        self.exchange = self.key
        main_layout = BoxLayout(orientation='vertical', spacing='5dp')
        scroll_view = ScrollView(do_scroll_x=False)
        header = GridLayout(cols=5,
                            spacing='5dp',
                            row_default_height='50dp',
                            row_force_default=True,
                            size_hint_y=None,
                            height='50dp')
        header.add_widget(Label(text='API', valign='top', size_hint_x=0.2))
        header.add_widget(Label(text='NBT', valign='top', size_hint_x=0.2))
        header.add_widget(Label(text='Cur', valign='top', size_hint_x=0.2))
        header.add_widget(Label(text='rates', valign='top', size_hint_x=0.2))
        header.add_widget(Label(text='Bot', valign='top', size_hint_x=0.2))
        self.content = GridLayout(cols=5,
                                  spacing='5dp',
                                  row_default_height='50dp',
                                  row_force_default=True,
                                  size_hint_x=1,
                                  size_hint_y=None)
        self.content.bind(minimum_height=self.content.setter('height'))
        main_layout.add_widget(header)
        scroll_view.add_widget(self.content)
        main_layout.add_widget(scroll_view)
        self.popup = popup = Popup(title=self.title, content=main_layout)

        # construct the content, widget are used as a spacer
        main_layout.add_widget(SettingSpacer())

        # buttons are created for accept or cancel the current value
        btnlayout = BoxLayout(size_hint_y=None, height='50dp', spacing='5dp')
        btn = Button(text='Ok')
        btn.bind(on_release=self._validate)
        btnlayout.add_widget(btn)
        btn = Button(text='Cancel')
        btn.bind(on_release=self._dismiss)
        btnlayout.add_widget(btn)
        btn = Button(text='Add Row')
        btn.bind(on_release=self.add_row)
        btnlayout.add_widget(btn)
        main_layout.add_widget(btnlayout)

        self.load_data()

        # all done, open the popup !
        popup.open()
예제 #55
0
    def __init__(self, data, **kwargs):
        super().__init__(data, **kwargs)
        kwargs['bar_inactive_color'] = [0.7, 0.7, 0.7, 1]
        kwargs['bar_margin'] = 5
        kwargs['bar_width'] = 10
        SV = ScrollView(**kwargs)

        kwargs = {'size_hint': (kwargs['size_hint'][0], None)}
        self.TV = Viewable_TreeView(data, **kwargs)
        self.TV.bind(minimum_height=self.TV.setter('height'))
        SV.add_widget(self.TV)

        self.add_widget(SV)
예제 #56
0
    def list_course(self):
        box = BoxLayout()
        sv = ScrollView()
        ml = MDList()
        self.get_courses = self.c.execute('SELECT * FROM COURSES')

        for row in sorted(self.get_courses):
            ml.add_widget(OneLineListItem(text=str(row[1])))
        sv.do_scroll_y = True
        sv.do_scroll_x = False
        sv.add_widget(ml)
        self.root.ids.courses.add_widget(sv)
        self.root.ids.screen_manager.current = str(self.root.ids.courses.name)
예제 #57
0
 def goApplications(self):
     response = requests.get("https://jobhunt-disha-tushar.herokuapp.com/api/applications/", headers=self.header)
     print(response)
     if response.ok:
         self.root.current = "Applications"
         scroll = ScrollView(size_hint=(1, 0.91))
         list_view = MDList()
         scroll.add_widget(list_view)
         for i in response.json():
             print("Companies", i)
             one = OneLineListItem(text="Company id: " + str(i["id"]) + '    Company name: ' + i["name"])
             list_view.add_widget(one)
         self.root.get_screen('Applications').add_widget(scroll)
예제 #58
0
class mainscreen(BoxLayout):
    def __init__(self,**kwargs):
        BoxLayout.__init__(self,**kwargs)
        self.orientation='vertical'
        self.add_widget(searchbar(pos_hint={'center_x':0.5,'center_y':0.5}))
        self.list=MDList()
        self.suggestions=[]
        self.scroll=ScrollView(do_scroll_x=False)
        self.scroll.add_widget(self.list)
        for x in range(10):
            self.suggestions.append(OneLineListItem())
        self.add_widget(self.scroll)
        self.add_widget(BoxLayout())
예제 #59
0
 def on_enter(self):
     layout = self.ids.listlayout
     box1 = BoxLayout(orientation='vertical')
     btn1 = Button(text='go to other', size=(200, 100), size_hint=(None,None))
     btn1.bind(on_press=self.changer)
     box1.add_widget(btn1)
     # for i in range(5):
     #     btn = Button(text=str('A button #'), size_hint = (None,None), on_press = self.changer)
     #     box1.add_widget(btn)
     root = ScrollView(size_hint=(1, None), size=(Window.width, Window.height))
     root.add_widget(box1)
     layout.add_widget(root)
     print 'Test'
예제 #60
0
 def display_out(self, uid, out='out'):
     process = self.processes[uid]
     p = Popup(size_hint=(.95, .95),
               title='std%s %s' % (out, process['label'].text))
     sc = ScrollView()
     content = Label(text=process[out], size_hint=(None, None))
     sc.bind(width=content.setter('width'))
     content.bind(
         width=lambda c, w: content.setter('text_size')(c, (w, None)))
     content.bind(texture_size=content.setter('size'))
     sc.add_widget(content)
     p.add_widget(sc)
     p.open()