Exemplo n.º 1
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)
Exemplo n.º 2
0
	def build(self):
		lay = StackLayout()
		btn = Button(text="hello", width=40, height=40)
		btn2 = Button(text="sup", width=40, height=40)
		lay.add_widget(btn)
		lay.add_widget(btn2)
		return lay
Exemplo n.º 3
0
 def build(self):
     s = StackLayout()
     p = MyFilechooser(title = 'test')
     b = Button(size_hint = (1,0.2))
     b.bind(on_press = p.open)
     s.add_widget(b)
     return s
Exemplo n.º 4
0
class DragTab(BoxLayout):
	def __init__(self,**kwargs):
		super(DragTab,self).__init__(**kwargs)
		#Base Layer is a BoxLayout
		#right-hand column is StackLayout, lefthand is a vertical box layout
		self.Scrollhome=StackLayout(orientation='tb-rl', size_hint=(.3,1))
		#self.Scrollhome.add_widget(Button(text='hi'))
		self.lefthand=BoxLayout(orientation='vertical', size_hint=(.7,1))
		#within lefthand, stats and a series of semesters
		self.Planner=GridLayout(size_hint=(1,.9),rows=2, cols=4, spacing=5)

		self.slot1=Semester(text=str(semesters[0]), color=(0, 0, 1., .2))
		self.Planner.add_widget(self.slot1)
		self.slot2=Semester(text=str(semesters[2]), color=(0, 0, 1., .2))
		self.Planner.add_widget(self.slot2)
		self.slot3=Semester(text=str(semesters[4]), color=(0, 0, 1., .2))
		self.Planner.add_widget(self.slot3)
		self.slot4=Semester(text=str(semesters[6]), color=(0, 0, 1., .2))
		self.Planner.add_widget(self.slot4)
		self.slot5=Semester(text=str(semesters[1]), color=(0, 0, 1., .2))
		self.Planner.add_widget(self.slot5)
		self.slot6=Semester(text=str(semesters[3]), color=(0, 0, 1., .2))
		self.Planner.add_widget(self.slot6)
		self.slot7=Semester(text=str(semesters[5]), color=(0, 0, 1., .2))
		self.Planner.add_widget(self.slot7)
		self.slot8=Semester(text=str(semesters[7]), color=(0, 0, 1., .2))
		self.Planner.add_widget(self.slot8)

		self.lefthand.add_widget(self.Planner)
		self.lefthand.add_widget(Label(size_hint=(1,.1),text= 'We can display statistics here', color=(1,1,1,.3)))		

		self.add_widget(self.lefthand)
		self.add_widget(self.Scrollhome)

		for course in catalog:
			self.add_Icon(course)
		

	def add_Icon(self, display):
		Icon=DragableButton(text=display,size=(100,100),
                              droppable_zone_objects=[],
                              bound_zone_objects=[],
                              drag_opacity=.5,
                              remove_on_drag=True)
		Icon.bound_zone_objects.append(self.Planner)
		Icon.bound_zone_objects.append(self.Scrollhome)
		
		Icon.droppable_zone_objects.append(self.slot1.coursehouse)
		Icon.droppable_zone_objects.append(self.slot2.coursehouse)
		Icon.droppable_zone_objects.append(self.slot3.coursehouse)
		Icon.droppable_zone_objects.append(self.slot4.coursehouse)
		Icon.droppable_zone_objects.append(self.slot5.coursehouse)
		Icon.droppable_zone_objects.append(self.slot6.coursehouse)
		Icon.droppable_zone_objects.append(self.slot7.coursehouse)
		Icon.droppable_zone_objects.append(self.slot8.coursehouse)
		
		Icon.droppable_zone_objects.append(self.Scrollhome)
		self.Scrollhome.add_widget(Icon)
Exemplo n.º 5
0
 def build(self):
     root = StackLayout()
     custom_widget1 = MyCustomWidget(id='my_custom_widget')
     custom_widget1.status = 'ok'
     custom_widget2 = MyCustomWidget(id='my_custom_widget')
     custom_widget2.status = 'nope'
     root.add_widget(custom_widget1)
     root.add_widget(custom_widget2)
     return root
Exemplo n.º 6
0
class QueueContainer(ScrollView):
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.inner_queue = StackLayout(padding="10px", spacing="10px")
        self.add_widget(self.inner_queue)

        add_table_btn = Button(text='Queue Customers', size_hint_y=.1)
        add_table_btn.bind(on_press=lambda e: ClockInPopup().open())
        self.inner_queue.add_widget(add_table_btn)
 def __init__(self, **kwargs):
     super(ResizableWidgetDemo, self).__init__(**kwargs)
     self.stack0 = StackLayout(size_hint=(1, 1))
     self.sidebar = ResizableSideBar(size_hint=(None, 1),
                                     width=cm(4.5),
                                     orientation='vertical')
     self.stack1 = StackLayout(size_hint=(None, 1),
                               width=self.width - cm(4.5))
     self.stack2 = ResizableStackLayout(
         # [0.8, 0.33, 0.33, 1], size_hint=(1, None),
         # height=cm(5), resizable_down=True)
         from_rgb(51, 107, 135),
         size_hint=(1, None),
         height=cm(5),
         resizable_down=True)
     self.stack3 = ResizableStackLayout(from_rgb(42, 49, 50),
                                        size_hint=(1, None))
     rbutton = ResizableButton(
         text='down, left resizable button \n in resizable stacklayout',
         resizable_right=True,
         resizable_down=True,
         size_hint=(None, None),
         size=(cm(6), cm(4)),
         on_release=lambda x: print('ON_RELASE()'))
     sidelabel = ResizableLabel(
         text='Reizable button \nin resizable sidebar',
         resizable_down=True,
         size_hint=(1, None),
         height=cm(1),
     )
     r4sides = ResizableButton(
         text='4 sides resizable,\n floating button\n with size limit',
         resizable_right=True,
         resizable_left=True,
         resizable_up=True,
         resizable_down=True,
         size_hint=(None, None),
         min_resizable_width=cm(3),
         min_resizable_height=cm(3),
         max_resizable_width=cm(10),
         max_resizable_height=cm(10),
         resizable_border_offset=14,
         size=(cm(6), cm(6)),
         on_release=lambda x: print('ON_RELASE()'))
     self.add_widget(self.stack0)
     self.stack0.add_widget(self.sidebar)
     self.stack0.add_widget(self.stack1)
     self.sidebar.add_widget(sidelabel)
     self.stack1.add_widget(self.stack2)
     self.stack1.add_widget(self.stack3)
     self.stack2.add_widget(rbutton)
     self.add_widget(r4sides)
     self.sidebar.after_init()
     self.sidebar.bind(size=lambda obj, val: setattr(
         self.stack1, 'width', self.width - val[0]))
     self.stack2.bind(size=lambda obj, val: setattr(self.stack3, 'height',
                                                    self.height - val[1]))
Exemplo n.º 8
0
    def display(self):
        displist = []

        def appendLabel(text, sizeHint, color, widget=None, **kwargs):
            label = ColorLabel(text, sizeHint, color, **kwargs)
            if not widget: displist.append(label)
            else: widget.add_widget(label)

        def appendButton(text, sizeHint, color, bind, widget=None, **kwargs):
            button = ColorButton(text, sizeHint, color, **kwargs)
            button.bind(on_release=bind)
            if not widget: displist.append(button)
            else: widget.add_widget(button)

        # auton switch
        appendButton("Auton", halfHalf, fairBlue,
                     lambda x: self.switcher.switch("auton"))
        # teleop switch
        appendButton("Teleop", halfHalf, fairBlue,
                     lambda x: self.switcher.switch("teleop"))

        # change team button
        appendButton("Change team (data will be lost if not saved)", (.5, .5),
                     fairBlue, lambda x: self.switcher.switch("login"))

        # layout for save and export buttons
        databaseLayout = StackLayout(size_hint=(.5, .5))
        displist.append(databaseLayout)
        # save button
        appendButton("Save", (1, .5), fairBlue, self.switcher.robot.localSave,
                     databaseLayout)
        # ip input text
        if self.ipInputTextHint:
            text = ""
        else:
            text = getIp()
        ipInput = TextInput(text=text,
                            size_hint=(.25, .5),
                            multiline=False,
                            hint_text=self.ipInputTextHint)

        def exportBind(_):
            ipInput.hint_text = export(ipInput.text)
            ipInput.text = ""

        ipInput.bind(on_text_validate=exportBind)
        # export button
        appendButton("Export all", (.5, .5), fairBlue, exportBind,
                     databaseLayout)
        # mysql ip label
        appendLabel("mysql IP", (.25, .5), fairBlue, databaseLayout)
        databaseLayout.add_widget(ipInput)

        # actually displaying everything
        self.clear_widgets()
        for widg in displist:
            self.add_widget(widg)
Exemplo n.º 9
0
    def BoxLayout(self):

        # top layout
        self.layout_top = BoxLayout(orientation='horizontal')
        self.next_button = Button(text='Next Client',
                                  on_press=lambda a: self.next_client())
        self.next_button.size_hint = (.2, 1)
        logo = Image(source='../../Marketing/simbolo_semfundo.png')
        logo.size_hint = (.6, 1)
        qr = Image(source='qr.png')
        qr.size_hint = (.2, 1)
        self.layout_top.add_widget(qr)
        self.layout_top.add_widget(logo)
        self.layout_top.add_widget(self.next_button)
        self.layout_top.size_hint = (1, 0.2)

        # center layout
        self.layout_center = StackLayout(orientation='lr-bt')
        self.scrlv = ScrollView(size_hint=(0.9, 0.95))
        self.s = Slider(min=0,
                        max=1,
                        value=25,
                        orientation='vertical',
                        step=0.01,
                        size_hint=(0.1, 0.95))
        self.scrlv.bind(scroll_y=partial(self.slider_change, self.s))

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

        self.layout_grid = GridLayout(cols=3, size_hint_y=None)

        self.layout_grid.bind(minimum_height=self.layout_grid.setter('height'))
        self.scrlv.add_widget(self.layout_grid)
        self.layout_center.add_widget(self.scrlv)
        self.layout_center.add_widget(self.s)

        # bottom layout
        self.layout_bottom = BoxLayout(orientation='horizontal')
        label_total = Label(text='Total:', font_size=30, color=[0, 0, 0, 1])
        label_total.size_hint = (.5, 1)

        self.value = Label(text="0€", font_size=30, color=[0, 0, 0, 1])
        self.value.size_hint = (.5, 1)

        self.layout_bottom.add_widget(label_total)
        self.layout_bottom.add_widget(self.value)
        self.layout_bottom.size_hint = (1, 0.1)

        # global layout
        layout_global = BoxLayout(orientation='vertical')
        layout_global.add_widget(self.layout_top)
        layout_global.add_widget(self.layout_center)
        layout_global.add_widget(self.layout_bottom)

        return layout_global
Exemplo n.º 10
0
    def __init__(self, **kwargs):
        super(LivikitLines, self).__init__(**kwargs)

        self.do_scroll_y = True

        self.layout = StackLayout(orientation='lr-tb', size_hint_y=None)
        self.layout.bind(minimum_height=self.layout.setter('height'))
        self.add_widget(self.layout)

        self.add_info('Time', 'Text')
Exemplo n.º 11
0
 def __init__(self, **kwargs):
     super(Container, self).__init__(**kwargs)
     self.players_dick = {}
     anchor = AnchorLayout()
     self.new_player_btn = Button(text="New players", size=(100, 100), size_hint=(None, None))
     anchor.add_widget(self.restart)
     #self.new_player_btn.bind(on_press=self.new_players)
     self.add_widget(anchor)
     self.stack1 = StackLayout()
     self.names_input(2)
Exemplo n.º 12
0
    def build(self):
        govde = StackLayout(orientation="lr-tb")

        for i in range(1, 11):
            govde.add_widget(
                Button(text="{}".format(i),
                       size_hint=(None, None),
                       size=(100, 50)))

        return govde
Exemplo n.º 13
0
    def build(self):
        oscAPI.init()
        main_layout = StackLayout()
        for i in range(4):
            xy_pad = XyPad(size_hint=(0.5, 0.5))
            xy_pad.x_msg = '/fxparam/{0}/value'.format(i*2 + 1)
            xy_pad.y_msg = '/fxparam/{0}/value'.format(i*2 + 2)
            main_layout.add_widget(xy_pad)

        return main_layout
Exemplo n.º 14
0
    def __init__(self, *args, **kwargs):
        super(FormCanvas, self).__init__(*args, **kwargs)

        self._canvas = StackLayout(orientation='lr-tb',
                                   padding=[10, 10, 10, 10],
                                   spacing=[10, 10])
        super(FormCanvas, self).add_widget(self._canvas)

        self.widgets_height = 40
        self.widgets_size_hint = (1, None)
Exemplo n.º 15
0
    def askInfo(self,requiredInfo):
        #the button size is wrong on my laptop but right on the tablet so
        close=Button(text='Add')
        cancel=Button(text='Cancel')

        buttonGrid=GridLayout(cols=2,size_hint_y=.5)
        buttonGrid.add_widget(close)
        buttonGrid.add_widget(cancel)
        content=StackLayout(spacing=5)
        valueList=[]#empty list that gets filled with the inputs' getValue functions
        for x,y in requiredInfo:
            content.add_widget(Label(text=x,size_hint=(None,None),size=(50,32)))

            if y.split()[0]=='text':    #v if it's length 1, then it isn't a list
                tmpWidget=_RetrievableText(len(y.split())-1,multiline=False,size_hint=(None,None),
                        write_tab=False,size=(100,32))
                #^ height 32 bc font size defaults to 10 and y padding defaults to 12
                valueList.append(tmpWidget.getValue)
                content.add_widget(tmpWidget)

            elif y.split()[0]=='int':
                tmpWidget=_RetrievableText(len(y.split())-1,multiline=False,input_type='number',
                        write_tab=False,size_hint=(None,None),size=(100,32))
                #^ height 32 bc font size defaults to 10 and y padding defaults to 12
                valueList.append(tmpWidget.getValue)
                content.add_widget(tmpWidget)
        #buttonGrid.height=.5*content.height #size_hint_y=.5 should do this but i guess not
        content.add_widget(buttonGrid)
        self.askPane=Popup(title='Get Info',content=content,size_hint=(.5,None),
            height=1.5*content.height,
                auto_dismiss=False,)#on_dismiss=lambda x: self._setInfo(valueList))
        close.bind(on_release=lambda x: self._setInfo(valueList,False))#askPane.dismiss)
        cancel.bind(on_release=lambda x: self._setInfo(valueList,True))
        self.askPane.open()
Exemplo n.º 16
0
    def __init__(self, width, height, foldername, mainlayout):
        
        super(FilePane, self).__init__()
    
        # Add Option bar to top of right panel -----
        #topOptionBar =  RelativeLayout(size = (width, resY *.04), size_hint_y = None)

        self.size = (width, height)
        self.size_hint = (None,None)
        self.startPath = foldername
        self.auto_bring_to_front = False
        self.mainlayout = mainlayout


        self.orientation = 'horizontal'

        self.tiles = StackLayout(size = (width*.9, height), size_hint_x = None, padding=10, spacing=10)
        #print self.tiles.size    
        #print self.tiles.minimum_height


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



        self.add_widget(self.tiles)


        r = RelativeLayout(height = self.height)
        scrollbar = Slider(orientation = 'vertical')
        

        r.add_widget(scrollbar)
        self.add_widget(r)



        print self.tiles.height

        try:
            dirs = os.listdir( foldername )

            # This would print all the files and directories
            for file in dirs:
                if(self.isImage(file)):
                    self.addFile(self.startPath+ "\\" + file, file)
        except OSError:
            print OSError
            print "FilePane: no files found"

        print self.tiles.height


        scrollbar.range = (0, self.tiles.height)
        scrollbar.bind(value = self.updatePos)
Exemplo n.º 17
0
 def build(self):
     Config.set('graphics', 'width', '450')
     Config.set('graphics', 'height', '450')
     Config.set('graphics','resizable', False)
     self.layout = StackLayout()
     for x in range(9): # range() explanation: http://pythoncentral.io/pythons-range-function-explained/
         bt = Button(text='', font_size=120, width=150, height=150, size_hint=(None, None), id=str(x))
         bt.bind(on_release=self.btn_pressed)
         self.board.append(bt)
         self.layout.add_widget(bt)
     return self.layout
Exemplo n.º 18
0
    def __init__(self, **kwargs):
        Globals.CONFIG = App.get_running_app().config
        Globals.TESTING = Globals.CONFIG.get('Development', 'test_mode')

        self.playlist_width = int(
            Globals.CONFIG.get('Playlist', 'playlist_width'))

        Globals.API = GoogleMusicApi()
        self.login_failed_popup = None
        self.google_music_api_login()

        self.formatter = Formatter()

        self.player = Player()
        self.player.set_streaming_quality(
            Globals.CONFIG.get('Google Play Music', 'quality').split(':')[0])

        self.playlist = Playlist()

        self.librarymanager = LibraryManager()
        # self.librarymanager.load_library()

        self.history = History()
        self.playlist.queue = self.history.playlist_history

        self.updating_progress = False
        self.playlist_hidden = False

        super().__init__(**kwargs)
        self.player.bind(playing=self.update_play_button_state)
        self.player.bind(progress_percent=self.update_progress_slider)

        # Add search result views
        # Songs
        self.songlist = SongViewer()

        # Stations
        # self.stationlist = StationViewer()
        self.stationscroll = ScrollView(size_hint=(1, 1))
        self.stationscroll.do_scroll_x = False
        self.stationlist = StackLayout(size_hint_y=None, spacing=10)
        self.stationlist.bind(minimum_height=self.stationlist.setter('height'))
        self.stationscroll.add_widget(self.stationlist)

        # Albums
        self.albumlist = AlbumViewer()
        # Create and init screen manager
        self.sm = ScreenManager()
        self.init_screens()

        # Listen for Keyboard events
        self._keyboard = Window.request_keyboard(None, self, 'text')
        self._keyboard.bind(on_key_down=self._pressed_key)
        self.searchbar.focus = True
Exemplo n.º 19
0
    def test_tb_lr_stacklayout(self):
        stacklayout = StackLayout(
            orientation='tb-lr',
            size=(200, 200),
            padding=20,
            spacing=10)

        widget = Widget(width=100, size_hint=(0.2, 0.4))
        stacklayout.add_widget(widget)
        stacklayout.do_layout()

        self.assertEqual(stacklayout.top - widget.top, 20)
Exemplo n.º 20
0
    def test_stacklayout_default(self):
        # Default orientation is lr-tb.
        sl = StackLayout()
        wgts = [Widget(size_hint=(.5, .5)) for i in range(4)]
        for wgt in wgts:
            sl.add_widget(wgt)
        sl.do_layout()

        self.assertEqual(wgts[0].pos, [0, sl.height / 2.])
        self.assertEqual(wgts[1].pos, [sl.width / 2., sl.height / 2.])
        self.assertEqual(wgts[2].pos, [0, 0])
        self.assertEqual(wgts[3].pos, [sl.width / 2., 0])
Exemplo n.º 21
0
class LogBox(ScrollView):
    _current_selection = 0


    def __init__(self, root):
        super(LogBox, self).__init__()
        self.root = root
        self.size_hint = (1, None)
        self.height = 150

        self.stack = StackLayout()
        self.stack.orientation = 'lr-tb'
        self.stack.size_hint = (1, None)
        self.stack.bind(minimum_height=self.stack.setter('height'))

        self.add_widget(self.stack)



    def add(self, note):
        self.stack.add_widget(LogEntry(note))

    def get_entry(self, at):
        if at == 0:
            return None
        if at > len(self.stack.children):
            return None
        return self.stack.children[len(self.stack.children)-at]
    def get_current_entry(self):
        return self.get_entry(self.current_selection)

    @property
    def current_selection(self):
        return self._current_selection
    @current_selection.setter
    def current_selection(self, value):
        for child in self.stack.children:
            child.color = [1,1,1,1]

        if value > len(self.stack.children):
            self._current_selection = 0
            return

        self._current_selection = value
        self.stack.children[len(self.stack.children)-value].color = [1,0,0,1]

        # We send a KEY ON signal for each note
        # only if we are on play mode.
        # Reset done status for each note.
        if self.root.app.playing:
            for note in self.get_current_entry().notes:
                note['done'] = False
                arduino.send(str.format("+{0}", note['note']))
Exemplo n.º 22
0
 def set(self):
     self.name = "LodgingScreen"
     self.T = Title()
     self.T.set()
     self.add_widget(self.T, index = 0)
     self.L = LodBg()
     self.L.set()
     self.add_widget(self.L,index = 1)
     self.bl = StackLayout(orientation = 'rl-tb',size_hint = (1,None),height = 30)
     self.bl.add_widget(Button(text = 'Back',size_hint= (.1,1),on_press = self.back))
     self.add_widget(self.bl)
     self.bk = False
Exemplo n.º 23
0
    def test_stacklayout_fixed_size(self):
        sl = StackLayout()
        wgts = [Widget(size=(50, 50), size_hint=(None, None))
                for i in range(4)]
        for wgt in wgts:
            sl.add_widget(wgt)
        sl.do_layout()

        self.assertEqual(wgts[0].pos, [0, sl.height / 2.])
        self.assertEqual(wgts[1].pos, [sl.width / 2., sl.height / 2.])
        self.assertEqual(wgts[2].pos, [0, 0])
        self.assertEqual(wgts[3].pos, [sl.width / 2., 0])
Exemplo n.º 24
0
class GameScreen(Screen):
    def __init__(self, players, name="Game"):
        Screen.__init__(self, name=name)
        _layout = BoxLayout(orientation='vertical')
        self._question = Label(text='question', markup=True, font_size=36)
        _layout.add_widget(self._question)
        self._answer = Label(text='', font_size=42)
        _layout.add_widget(self._answer)
        self._vote_buttons = StackLayout(orientation='tb-lr', spacing=10)
        for player_id, player_name in players:
            btn = Button(text=f"{player_id}:{player_name}",
                         size_hint=(0.3, 0.2),
                         disabled=True)
            btn.bind(on_release=partial(self.on_vote, player_id=player_id))
            self._vote_buttons.add_widget(btn)
        _layout.add_widget(self._vote_buttons)
        self.add_widget(_layout)

    def on_pre_enter(self, *args):
        client.add_listener(self.new_turn_handler)
        client.add_listener(self.game_over_handler)

    def on_pre_leave(self, *args):
        client.remove_listener(self.new_turn_handler)
        client.remove_listener(self.game_over_handler)

    def on_leave(self, *args):
        self.manager.remove_widget(self)

    def on_vote(self, instance: Button, *, player_id):
        for button in self._vote_buttons.children:
            button.disabled = True
        client.send({'op': 'Vote', 'winner': player_id})

    def new_turn_handler(self, msg):
        if msg.get('op') == 'NewTurn':
            if msg['your-turn']:
                self._question.color = (1, 1, 1)
                for button in self._vote_buttons.children:
                    button.disabled = False
            else:
                self._question.color = (0.5, 0.5, 0.5)
            self._question.text = msg['question']
            self._answer.text = msg['answer'] or ''
            return True

    def game_over_handler(self, msg):
        if msg.get('op') == 'GameOver':
            ladderboard = msg['scores']
            next_screen = SummaryScreen(ladderboard)
            self.manager.add_widget(next_screen)
            self.manager.current = next_screen.name
            return True
Exemplo n.º 25
0
    def getTrains(self, *args):
        # Try loading the train data but handle any failure gracefully.
        try:
            trains = NR.lookup(self.frm, self.to)
        except:
            trains = None

        # If we've got trains then we need to set up the screen
        if trains:
            # Get rid of the previous widgets.
            self.clear_widgets()

            # Add a box layout
            self.bx = BoxLayout(orientation="vertical")

            # Show the name of the train route
            self.bx.add_widget(Label(text=self.desc, size_hint_y=0.2))

            # Add headers for the trains
            self.bx.add_widget(
                TrainDetail(train=self.headers, bg=[0.2, 0.2, 0.2, 1]))

            # Create a StackLayout in case we need to scroll over the trains.
            self.stck = StackLayout(orientation="tb-lr", size_hint_y=0.8)
            self.bx.add_widget(self.stck)

            # Loop over the trains
            for train in trains:

                # Create a TrainDetail widget and add it to the StackLayout
                trn = TrainDetail(train=train)
                self.stck.add_widget(trn)

            # Get rid of the Loading label (if it's there)
            try:
                self.remove_widget(self.ids.load_label)
            except ReferenceError:
                pass

            self.add_widget(self.bx)

            # Set the next update for 5 mins later
            self.nextupdate = time.time() + 300
            self.timer = Clock.schedule_once(self.getTrains, 300)

        # No trains so let the user know.
        else:
            self.clear_widgets()
            errorm = ("Error getting train data.\nPlease check that you are "
                      "connected to the internet and\nthat you have entered "
                      "valid station names.")
            lb = Label(text=errorm)
            self.add_widget(lb)
Exemplo n.º 26
0
    def __init__(self, mask_texture, handle_set_mask, **kwargs):
        super(MaskPainterScreen, self).__init__(**kwargs)

        self.orientation = 'vertical'
        self.padding = (10, 10)

        # Upper box
        self.upper_box = AnchorLayout(anchor_x='center', anchor_y='center')
        self.add_widget(self.upper_box)

        self.canvas_wrapper = CanvasWrapper(mask_texture,
                                            size=mask_texture.size,
                                            size_hint=(None, None))
        self.upper_box.add_widget(self.canvas_wrapper)

        # Tools
        self.tools_box = StackLayout(orientation='tb-lr',
                                     size_hint=(1, None),
                                     height=40,
                                     spacing=(10, 0))
        self.add_widget(self.tools_box)

        def handle_size_change(instance, value):
            self.canvas_wrapper.brush_size = value

        def handle_intensity_change(instance, value):
            self.canvas_wrapper.intensity = value

        def handle_apply_changes(instance):
            handle_set_mask(self.canvas_wrapper.export_as_image().texture)

        size_slider = Slider(min=5, max=50)
        size_tool = ToolWrapper('Size',
                                size_slider,
                                size_hint=(None, 1),
                                width=200)
        self.tools_box.add_widget(size_tool)
        size_slider.bind(value=handle_size_change)

        intensity_slider = Slider(min=0.0, max=1.0, value=1.0)
        intensity_tool = ToolWrapper('Intensity',
                                     intensity_slider,
                                     size_hint=(None, 1),
                                     width=200)
        self.tools_box.add_widget(intensity_tool)
        intensity_slider.bind(value=handle_intensity_change)

        apply_button = Button(text="Apply changes",
                              on_press=handle_apply_changes,
                              width=250,
                              size_hint=(None, 1))
        self.tools_box.add_widget(apply_button)
Exemplo n.º 27
0
    def __init__(self, name, **kwargs):
        super().__init__(**kwargs)
        self.orientation = "vertical"
        # the below is now handled
        #self.size_hint = (None, None) #it would be nice if this could be optionally passed in with kwargs
        #self.size = (width, height)
        self.source = ""
        self.show_file_names = True
        self.selected_image = SpecialImage(None)
        self.image_width_hint = 1  # big one
        self.bind(
            size=partial(self.set_image_width_hint)
        )  # will need size or just height, depending on what's being used in the function

        Window.bind(mouse_pos=self._mouse_move)
        self.hover_count = None  # set this during populate

        self.menu_bar = MenuBar(name, almost_black, light_grey, light_blue)
        self.add_widget(self.menu_bar)

        self.scroll_body = ScrollView(bar_width='12dp',
                                      scroll_wheel_distance='20dp',
                                      scroll_type=['bars', 'content'],
                                      bar_inactive_color=[.7, .7, .7, .2
                                                          ])  ### add settings
        self.add_widget(self.scroll_body)
        self.scroll_body.bind(on_scroll_stop=self.on_scroll_stop_function)

        self.body = StackLayout(
            orientation="lr-tb",
            size_hint_x=0.99,
            size_hint_y=None,
            spacing=[1, 5]
        )  # the horizontal spacing isn't like the website, but they didn't have background colours like I do
        self.scroll_body.add_widget(self.body)
        self.body.bind(minimum_height=self.body.setter('height'))
        self.body.bind(height=self.scroll_test_function)

        self.bottom_bar = BottomBar(size_hint=(1, None),
                                    height='17dp',
                                    font_size='13dp',
                                    bold=True)
        self.add_widget(self.bottom_bar)

        self.draw()
        self.bind(pos=self.update_rectangles, size=self.update_rectangles)

        self.bind(size=self.test_function)

        self.size = self.size

        self.test_function()
Exemplo n.º 28
0
 def set(self,text):
     cursor.execute('select * from {}'.format(text))
     row = cursor.fetchone()
     self.sl = StackLayout(orientation = 'lr-tb',padding=(10,10),spacing = 10)
     self.l = []
     i = 0
     while row is not None:
         self.l.append(Item())
         self.l[i] = self.l[i].set(row)
         self.sl.add_widget(self.l[i])
         i += 1
         row = cursor.fetchone()
     self.add_widget(self.sl)
Exemplo n.º 29
0
 def update_done_dialog(self, cur_build, upd_build):
     popup = Popup(title='Update done', content=ScrollView(), size_hint=(0.8,None), height=cm(5))
     grid = GridLayout(cols=1, spacing=0, size_hint_y=None)
     grid.bind(minimum_height= grid.setter('height'))
     con = StackLayout()
     grid.add_widget(con)
     popup.content.add_widget(grid)
     lbl1 = Label(text='Done updating from %s to %s' % (cur_build, upd_build), size_hint_y=None, height=cm(1))
     btn1 = Button(text='Close', size_hint=(1, None), height=cm(1))
     btn1.bind(on_release=popup.dismiss)
     for x in (lbl1, btn1):
         con.add_widget(x)
     popup.open()
Exemplo n.º 30
0
    def build(self):

        bl = BoxLayout(orientation='vertical')
        statistic_box = BoxLayout(size_hint=(1, .05))
        statistic_stack = StackLayout()
        for i in range(5):
            statistic_stack.add_widget(Button(text=str(i), size_hint=(.1, 1)))
        statistic_box.add_widget(statistic_stack)
        button_box = BoxLayout(size_hint=(1, .1))
        self.sm = ScreenManager(size_hint=(1, .85))
        creatures_screen = CustomScreen(name='main')
        biomes_screen = CustomScreen(name='biom')
        supply_screen = CustomScreen(name='supply')
        self.biomes_grid = GridLayout(cols=2)
        self.creatures_grid = GridLayout(cols=2)
        biomes_screen.add_widget(self.biomes_grid)
        creatures_screen.add_widget(self.creatures_grid)
        self.unremovable_screens = sorted(
            [creatures_screen, biomes_screen, supply_screen])

        popup = Popup(title='Test popup',
                      content=Label(text='Hello world'),
                      size_hint=(None, None))
        supply_screen.add_widget(Button(text='supply', on_press=popup.open))
        self.sm.add_widget(creatures_screen)
        self.sm.add_widget(biomes_screen)
        self.sm.add_widget(supply_screen)

        to_biom = Button(
            text='to biom',
            on_press=lambda *args: switch_page(self.sm, biomes_screen.name))

        to_creatures = Button(
            text='to_creatures',
            on_press=lambda *args: switch_page(self.sm, creatures_screen.name))

        to_supply = Button(
            text='to supply',
            on_press=lambda *args: switch_page(self.sm, supply_screen.name))
        make_turn_btn = Button(text='make_turn',
                               on_press=lambda *args: self.make_turn(*args))

        button_box.add_widget(make_turn_btn)
        button_box.add_widget(to_biom)
        button_box.add_widget(to_creatures)
        button_box.add_widget(to_supply)

        bl.add_widget(statistic_box)
        bl.add_widget(self.sm)
        bl.add_widget(button_box)
        return bl
Exemplo n.º 31
0
    def __init__(self, **kwargs):
        super(Notes, self).__init__(**kwargs)
        self.name = 'notes'
        self.stackcon = StackLayout(cols = 1,
                                    spacing=0,)

        #Actionbar
        self.actionbar = ActionBar(background_color = (0.50,0.50,0.50,1),
                                   pos_hint={'top':1},
                                   height = Window.height*.06,
                                   width = Window.width)

        self.actionview = ActionView()
        self.actionprevious = ActionPrevious(with_previous=False,
                                        app_icon = 'icon.png',
                                        previous_image = '',
                                        title = '')


        self._addnotebutton = AddNew()
        self.addnotebutton = self._addnotebutton.button
        self.stack = GridLayout(cols = 1,
                               spacing=0,
                               size_hint_y=None)

        self.scroll = ScrollView(size_hint=(1, None),
                                 size=(Window.width, Window.height-50))

        self.txt = Txt(text = '')

        self.close_button = CloseButton()
        self._search = SearchButton()
        self.search_button = self._search.button


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


        self.actionbar.add_widget(self.actionview)
        self.actionview.add_widget(self.actionprevious)
        self.actionview.add_widget(self.txt)
        self.actionview.add_widget(self._search)
        self.actionview.add_widget(self._addnotebutton)

        self.stackcon.add_widget(self.actionbar)
        self.scroll.add_widget(self.stack)
        self.stackcon.add_widget(self.scroll)
        self.add_widget(self.stackcon)

        self.search_button.bind(on_release = self.hidetextbar)
        self.close_button.bind(on_release = self.showtextbar)
Exemplo n.º 32
0
    def __init__(self, **kwargs):
        StackLayout.__init__(self, **kwargs)

        list_item_args_converter = lambda row_index, obj: {
            'artist': obj.artist,
            'name': obj.name,
            'size_hint_y': None,
            'height': 25
        }

        # self.ids.list.item_strings = ["Test 123"]
        self.ids.list.adapter = ListAdapter(data=[SampleData("Test Song", "Test Artist")],
                                            template='OverviewEntry',
                                            args_converter=list_item_args_converter)
Exemplo n.º 33
0
    def build_list(self):
        
        
        self.data_store = JsonStore('./dat.json')
        entries = json.loads(self.data_store.get('feeds')['entries'])
        entries_count = len(entries)
        card_contents = StackLayout(size_hint = [1, 0.0225])
            
        for entry in entries:
            self.size_hint[1] += 0.35           
            card_contents.add_widget(Image(source = './assets/images/talkpython-nowrds.png', size_hint = [0.15,0.4]))
            
            card_contents.add_widget(Label(text=entry['title'],
                                           valign='top',
                                           size_hint=[0.85, 0.4], 
                                           text_size= [Window.width * 0.35, None]))
            
            card_contents.add_widget(MyAudioPlayer(source="./assets/audio/043_monitoring_high_performance_python_apps_at_opbeat.mp3", 
                                                 thumbnail= './assets/images/talkpython.png',
                                                 size_hint = [1,0.4],
                                                 allow_fullscreen= False
                                                 ))
            
            #card_contents.add_widget(VideoPlayer(source="./assets/videos/hst_1.mpg", size_hint = [1,0.8]))
           

            
            self.entry_widgets.append(card_contents)
            card_contents = StackLayout(size_hint = [1, 0.0225])
Exemplo n.º 34
0
 def __init__(self, **kwargs):
     super(MagicTab, self).__init__(**kwargs)
     self.text = 'Magic'
     tab_magic_ui = StackLayout(orientation='tb-lr',
                                minimum_width=3100,
                                padding=(5, 5, 0, 0),
                                spacing=1)
     spells = ["Fireball", "Healing Rain", "Taunt", "Holy Light", "Steady Shot",
               "Might", "Strike", "Dance"]
     for i in range(0, len(spells)):
         spell_string = spells[i]
         tab_magic_ui.add_widget(Button(text=spell_string,
                                        size_hint=(.2, .1)))  # Width of the buttons
     self.add_widget(tab_magic_ui)
Exemplo n.º 35
0
    def create_bullet(self, bt_img = None):
        bullet = Button(size_hint=size_hint, size=(self.win_height / 24, self.win_height / 24),
                        font_name=font_name, pos=(self.win_width / 2 - self.win_width / 80,
                        self.win_height / 24), background_color=bullet_color)
        if not bt_img:
            return bullet

        bbl = StackLayout(size=bullet.size, pos=bullet.pos)
        img = Image(source=bt_img)
        bbl.add_widget(img)
        bullet.add_widget(bbl)

        bullet.bind(on_press=self.help_press)
        return bullet
Exemplo n.º 36
0
    def __init__(self, screen, action, **kwargs):
        super(ExcluirTransacaoDialogo, self).__init__(**kwargs)
        self.title = 'Excluir Transação'

        self.content = StackLayout()
        self.content.add_widget(
            MDLabel(
                text=
                "Tem certeza que deseja excluir esta transação?\nEsta ação não tem retorno.",
                font_style='Caption',
                size_hint_y=None,
                valign='center'))
        self.add_action_button("Excluir", action=action)
        self.add_action_button("Cancelar", action=self.dismiss)
Exemplo n.º 37
0
 def confer(self, *args):
     self.ids['display'].clear_widgets()
     self.label2 = Label(text='Welcome Messages',
                         size_hint=(1, .1),
                         bold=True,
                         font_size=18,
                         color=[.3, .4, .6, 1])
     self.but = Button(text='The Vice Chancellor',
                       size_hint=(1, .2),
                       font_size=14,
                       on_press=self.vice_chancellor,
                       background_color=[1, 1, 1, 0],
                       color=[.3, .4, .6, 1])
     self.but2 = Button(text='DVC-PRI',
                        size_hint=(1, .1),
                        font_size=14,
                        on_press=self.dvc_pri,
                        background_color=[1, 1, 1, 0],
                        color=[.3, .4, .6, 1])
     self.but3 = Button(text='Director Research and innovation',
                        size_hint=(1, .1),
                        on_press=self.director,
                        font_size=14,
                        background_color=[1, 1, 1, 0],
                        color=[.3, .4, .6, 1])
     self.but4 = Button(text='Speakers',
                        font_size=18,
                        bold=True,
                        size_hint=(1, .1),
                        background_color=[1, 1, 1, 0],
                        color=[.3, .4, .6, 1])
     self.but5 = Button(text='Event Schedule',
                        font_size=18,
                        bold=True,
                        size_hint=(1, .1),
                        background_color=[1, 1, 1, 0],
                        color=[.3, .4, .6, 1])
     self.but6 = Button(text='Conference Organizers',
                        font_size=18,
                        bold=True,
                        size_hint=(1, .1),
                        background_color=[1, 1, 1, 0],
                        color=[.3, .4, .6, 1])
     self.lay = StackLayout(rows=7, orientation='tb-lr', size_hint=(1, 1))
     for i in [
             self.label2, self.but, self.but2, self.but3, self.but4,
             self.but5, self.but6
     ]:
         self.lay.add_widget(i)
     self.ids['display'].add_widget(self.lay)
Exemplo n.º 38
0
 def on_enter(self):
     popup = Popup(title='Dish Options', size_hint=(1,1))
     layout1 = StackLayout(orientation='lr-bt') #This time the options are layed out in a stack layout, so that I can have multiple options in a small space
     closebutton = Button(text='I want to make a different dish', size_hint=(0.9,0.05)) #This is a button that will make a different dish for the user
     closebutton.bind(on_press= popup.dismiss)                                           #The size_hint is the x and y co-ordinate score of how much percentage of the screen the button will have (with 1 being all the screen)
     closebutton.bind(on_release = self.change_page)
     scrlv = ScrollView(size_hint=(0.9,0.95)) #This adds a scrollable bar to the list of dishes, if there are lots of them
     slid = Slider(min=0, max=1, value=25, orientation='vertical', step=0.01, size_hint=(0.1, 0.95)) #The slid is the physical slider used, which calles the scrlv
     #step is the percentage of the screen it takes up, min and max are always 1 and 0 as they show the ful percentage of the screen covered by the bar
     scrlv.bind(scroll_y=partial(self.slider_change, slid))
     #what this does is, whenever the slider is dragged, it scrolls the previously added scrollview by the same amount the slider is dragged
     slid.bind(value=partial(self.scroll_change, scrlv))
     layout2 = GridLayout(cols=4, size_hint_y=None) #This is another grdi layout used within the popup
     layout2.bind(minimum_height=layout2.setter('height')) #Bind the height of the layout to the minimum height so that the scroll bar functions
     for txt in choices:
         btn = Button(text=txt, size_hint_y=None, height=80, valign='middle', font_size=12) # Add a button for each dish
         btn.text_size = (btn.size) #set the buttons so that their size changes depending on the screen size
         btn.bind(on_press = self.find_dish) #When the button is pressed, call the find_dish subroutine
         btn.bind(on_release = popup.dismiss) #Close the popup if they click the button
         layout2.add_widget(btn) # Add the buttons to the layout
     scrlv.add_widget(layout2)
     layout1.add_widget(closebutton) #Add the close button to the layout
     layout1.add_widget(scrlv) # Add the scroll bar to the layout
     layout1.add_widget(slid)  #Add the slider to the layout for the scroll bar
     popup.content = layout1
     popup.open()
     if len(choices) == 0:
         popup.dismiss()
         sm.current = "main" #This changes the screen back to the original "main" screen if there are no dishes, which allows the users to choose another dish
Exemplo n.º 39
0
class LobbyScreen(Screen):
    def __init__(self, **kwargs):
        Screen.__init__(self, name="Lobby", **kwargs)
        client.add_listener(self.players_list_update_handler)
        client.add_listener(self.game_started_handler)

        _layout = BoxLayout(orientation='vertical')
        self.add_widget(_layout)

        self.players_stack = StackLayout(orientation='tb-lr', spacing=10)
        _layout.add_widget(self.players_stack)

        self.ready_btn = ToggleButton(text="Ready",
                                      font_size=42,
                                      size_hint=(1, 0.3))
        self.ready_btn.bind(state=self.on_ready)
        _layout.add_widget(self.ready_btn)

    def on_pre_enter(self, *args):
        client.add_listener(self.players_list_update_handler)
        client.add_listener(self.game_started_handler)

    def on_pre_leave(self, *args):
        client.remove_listener(self.players_list_update_handler)
        client.remove_listener(self.game_started_handler)

    def on_leave(self, *args):
        self.ready_btn.state = 'normal'

    def on_ready(self, instance, value):
        client.send({"op": 'SetReady', 'ready': value == 'down'})

    def players_list_update_handler(self, msg):
        if msg.get('op') == 'LobbyUpdated':
            self.players_stack.clear_widgets()
            for player in msg['players']:
                self.players_stack.add_widget(
                    Label(text=player['name'],
                          font_size=24,
                          size_hint=(0.5, 0.2),
                          color=(0, 0.7, 0, 1) if player['ready'] else
                          (1, 1, 1, 1)))
            return True

    def game_started_handler(self, msg):
        if msg.get('op') == 'PreparationStarted':
            prep_screen = self.manager.get_screen("Preparation")
            prep_screen.init(msg['#questions'], msg['#answers'])
            self.manager.current = "Preparation"
            return True
Exemplo n.º 40
0
    def init_boxes(self):
        self.boxes = StackLayout()

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

        self.boxes.padding = dp(self.paddingSize)

        self.boxes.size_hint = (1, None)

        self.boxes.orientation = "lr-tb"
        self.boxes.spacing = dp(self.spacingSize)
        self.boxes.background_color = colors.PGREEN

        self.scroll.add_widget(self.boxes)
Exemplo n.º 41
0
def winPopup(winCondition):
	
	winLayout = StackLayout()
	
	winLabel = Label(text = winCondition, size_hint = (1.0,0.8))
	menuBtn = Button(text = 'Main Menu', size_hint = (0.5,0.2))
	menuBtn.bind(on_release = mainMenu)
	quitBtn = Button(text = 'Quit to Desktop', size_hint = (0.5,0.2))
	quitBtn.bind(on_release = ExitFunc)
	
	winLayout.add_widget(winLabel)
	winLayout.add_widget(menuBtn)
	winLayout.add_widget(quitBtn)
	
	win_popup.content = winLayout
Exemplo n.º 42
0
    def __init__(self, **kwargs):
        Screen.__init__(self, name="Lobby", **kwargs)
        client.add_listener(self.players_list_update_handler)
        client.add_listener(self.game_started_handler)

        _layout = BoxLayout(orientation='vertical')
        self.add_widget(_layout)

        self.players_stack = StackLayout(orientation='tb-lr', spacing=10)
        _layout.add_widget(self.players_stack)

        self.ready_btn = ToggleButton(text="Ready",
                                      font_size=42,
                                      size_hint=(1, 0.3))
        self.ready_btn.bind(state=self.on_ready)
        _layout.add_widget(self.ready_btn)
Exemplo n.º 43
0
	def __init__(self,**kwargs):
		super(DragTab,self).__init__(**kwargs)
		#Base Layer
		self.base=BoxLayout()
		#right-hand column is X, lefthand is a vertical box layout
		self.Scrollhome=StackLayout(orientation='tb-lr', size_hint=(.3,1))
		self.Scrollhome.add_widget(Button(text='hi'))
		self.lefthand=BoxLayout(orientation='vertical', size_hint=(.7,1))
		#within lefthand, stats and a series of semesters
		self.Planner=GridLayout(size_hint=(1,.9),rows=2, cols=4)

		self.Planner.add_widget(Semester(size_hint=(1,1)))

		self.Planner.add_widget(Button(text='A Semester'))
		self.Planner.add_widget(Button(text='A Semester'))
		self.Planner.add_widget(Button(text='A Semester'))
		self.Planner.add_widget(Button(text='A Semester'))

		self.lefthand.add_widget(self.Planner)
		self.lefthand.add_widget(Button(size_hint=(1,.1),text= 'We can display statistics here'))
		

		self.base.add_widget(self.lefthand)
		self.base.add_widget(self.Scrollhome)
		


		self.add_widget(self.base)
Exemplo n.º 44
0
	def __init__(self,**kwargs):
		super(DragTab,self).__init__(**kwargs)
		#Base Layer is a BoxLayout
		#right-hand column is StackLayout, lefthand is a vertical box layout
		self.Scrollhome=StackLayout(orientation='tb-rl', size_hint=(.3,1))
		#self.Scrollhome.add_widget(Button(text='hi'))
		self.lefthand=BoxLayout(orientation='vertical', size_hint=(.7,1))
		#within lefthand, stats and a series of semesters
		self.Planner=GridLayout(size_hint=(1,.9),rows=2, cols=4, spacing=5)

		self.slot1=Semester(text=str(semesters[0]), color=(0, 0, 1., .2))
		self.Planner.add_widget(self.slot1)
		self.slot2=Semester(text=str(semesters[2]), color=(0, 0, 1., .2))
		self.Planner.add_widget(self.slot2)
		self.slot3=Semester(text=str(semesters[4]), color=(0, 0, 1., .2))
		self.Planner.add_widget(self.slot3)
		self.slot4=Semester(text=str(semesters[6]), color=(0, 0, 1., .2))
		self.Planner.add_widget(self.slot4)
		self.slot5=Semester(text=str(semesters[1]), color=(0, 0, 1., .2))
		self.Planner.add_widget(self.slot5)
		self.slot6=Semester(text=str(semesters[3]), color=(0, 0, 1., .2))
		self.Planner.add_widget(self.slot6)
		self.slot7=Semester(text=str(semesters[5]), color=(0, 0, 1., .2))
		self.Planner.add_widget(self.slot7)
		self.slot8=Semester(text=str(semesters[7]), color=(0, 0, 1., .2))
		self.Planner.add_widget(self.slot8)

		self.lefthand.add_widget(self.Planner)
		self.lefthand.add_widget(Label(size_hint=(1,.1),text= 'We can display statistics here', color=(1,1,1,.3)))		

		self.add_widget(self.lefthand)
		self.add_widget(self.Scrollhome)

		for course in catalog:
			self.add_Icon(course)
Exemplo n.º 45
0
    def ShowList(self):
        ''' Shows the discover results '''
        # create the popup
        oContent         = GridLayout(cols=1, spacing='5dp')
        oScrollview      = ScrollView( do_scroll_x=False)
        self.oScrollContent   = StackLayout(size_hint=(None, None))
        self.oPopup   = oPopup = Popup(content=oContent, title=ReplaceVars('$lvar(5028)'), size_hint=(0.9, 0.9),  auto_dismiss=False)

        #we need to open the popup first to get the metrics
        oPopup.open()
        #Add some space on top
        oContent.add_widget(Widget(size_hint_y=None, height=dp(2)))
        aDiscoverScripts=oORCA.oScripts.GetScriptListForScriptType("DEVICE_DISCOVER")
        aScrollContent=[]
        for uDiscoverScriptName in aDiscoverScripts:
            oScrollContentSingle   = GridLayout(size_hint=(None, None))
            aScrollContent.append(oScrollContentSingle)
            oScrollContentSingle.bind(minimum_height=oScrollContentSingle.setter('height'))
            oORCA.oScripts.RunScript(uDiscoverScriptName,{'createlist':1,'oGrid':oScrollContentSingle})
            self.oScrollContent.add_widget(cLabel(text=oORCA.oScripts.aScripts[uDiscoverScriptName].uSubType, background_color=[0.2, 0.2, 0.2, 1.0], color=[0.9, 0.9, 0.9, 1.0], size=(oPopup.width, dp(30)),size_hint=(None, None), halign='center'))
            self.oScrollContent.add_widget(oScrollContentSingle)
            self.oScrollContent.add_widget(SettingSpacer())

        # finally, add a cancel button to return on the previous panel
        oScrollview.add_widget(self.oScrollContent)
        oContent.add_widget(oScrollview)
        oContent.add_widget(SettingSpacer())

        oBtn = Button(text=ReplaceVars('$lvar(5000)'), size=(oPopup.width, dp(50)),size_hint=(1, None))
        oBtn.bind(on_release=self.On_Cancel)
        oContent.add_widget(oBtn)

        #resize the Scrollcontent to fit to all Childs. Needs to be done, after the popup has been shown
        Clock.schedule_once(self.SetScrollSize, 0)
Exemplo n.º 46
0
 def __init__(self, players, name="Game"):
     Screen.__init__(self, name=name)
     _layout = BoxLayout(orientation='vertical')
     self._question = Label(text='question', markup=True, font_size=36)
     _layout.add_widget(self._question)
     self._answer = Label(text='', font_size=42)
     _layout.add_widget(self._answer)
     self._vote_buttons = StackLayout(orientation='tb-lr', spacing=10)
     for player_id, player_name in players:
         btn = Button(text=f"{player_id}:{player_name}",
                      size_hint=(0.3, 0.2),
                      disabled=True)
         btn.bind(on_release=partial(self.on_vote, player_id=player_id))
         self._vote_buttons.add_widget(btn)
     _layout.add_widget(self._vote_buttons)
     self.add_widget(_layout)
Exemplo n.º 47
0
    def __init__(self, dataList):
        self.name = "editabletable"
        super(ROTable, self).__init__()
        parent_layout = StackLayout()
        scroll_layout = ScrollView(size_hint=(1, None), size=(Window.width, Window.height))
        table_layout = GridLayout(cols=6, size_hint_y=None, spacing=5)
        table_layout.bind(minimum_height=table_layout.setter('height'))
        length = len(dataList[0])

        sizes = [0] * length

        # for record in dataList:
        #
        #     for p, column in enumerate(record):
        #         if len(str(column)) > sizes[p]:
        #             sizes[p] = len(str(column)) + 3



        for row_n, row_data in enumerate(dataList):
            for i, row in enumerate(row_data.reverse()):
                if i <= len(row_data) - 2:
                    t = Label(hint_text=row, size_hint_y=None, height=40, font_size='20sp')
                    table_layout.add_widget(t, index=i)
                else:
                    btn = Button(text="Update", size_hint_y=None, height=40)
                    table_layout.add_widget(btn, index=i)

        scroll_layout.add_widget(table_layout)
        self.add_widget(parent_layout)
        self.add_widget(scroll_layout)
Exemplo n.º 48
0
    def __init__(self, parent_btn, **kwargs):
        '''parent_btn is the NumberSelect associated with this select pad'''
        super(SelectPad, self).__init__(**kwargs)
        self.parent_btn = parent_btn

        self.content = StackLayout(orientation='lr-tb', size_hint=(1, 1))
        rows, remainder = divmod(len(self.parent_btn.the_range), 3)
        rows += bool(remainder)
        y_hint_ = 0.01 * (100 // rows)
        #y_hint_ = 0.01* int(100 /(1 + len(self.parent_btn.the_range)//3))
        for number in self.parent_btn.the_range:
            self.content.add_widget(Button(text=str(number),
                                           size_hint=(0.33, y_hint_),
                                           on_press=self.record_number))
        self.title = self.parent_btn.ids['title'].text
        self.title_align = 'center'
Exemplo n.º 49
0
    def __init__(self, **kwargs):
        Screen.__init__(self, **kwargs)
        self.tryout = StackLayout(orientation ='lr-bt') 
        self.floatt = FloatLayout()

        #variable for gettinginformation()
        self.counter = 0
        # Title of the screen
        self.floatt.add_widget(Label(text='[color=000000][size=40][font=yorkwhiteletter]EBOTS INFORMATION[/font][/size][/color]', size_hint=(0.5,0.2),markup=True,pos_hint={'x':0.05,'y':0.8}))
    
        #information on ebots with 'good' status 
        self.ebotgoodpic = Image(source='C:\Users\The Gt Zan\Pictures\ebotinfo.PNG')
        self.floatt.add_widget(self.ebotgoodpic)    

        #buttons at the bottom 
        self.switchtomenu = Button(text='[size=50][font=yorkwhiteletter][color=000000]MENU[/font][/size][/color]',markup=True, size_hint=(0.2,0.2),background_color=(1,1,1,0),on_press=self.changeToMenu)
        self.switchtoebot = Button(text='[size=50][font=yorkwhiteletter][color=000000]EBOTS[/font][/size][/color]', markup=True,size_hint=(0.2,0.2),background_color=(1,1,1,0),on_press=self.changeToebots)
        self.switchtopersonal = Button(text='[size=50][font=yorkwhiteletter][color=000000]INDIVIDUAL[/font][/size][/color]', markup=True,size_hint=(0.2,0.2),background_color=(1,1,1,0),on_press=self.changeToPersonal)
        self.tryout.add_widget(self.switchtoebot)
        self.tryout.add_widget(self.switchtopersonal)
        self.tryout.add_widget(self.switchtomenu)

        #getting information 
        self.refresh=Button(text='[size=50][font=yorkwhiteletter][color=000000]REFRESH[/font][/size][/color]', markup = True, size_hint=(0.2,0.2),background_color=(1,1,1,0),on_press=self.gettinginformation)
        self.tryout.add_widget(self.refresh)

        #add layouts
        self.add_widget(self.tryout)
        self.add_widget(self.floatt)
Exemplo n.º 50
0
 def __init__(self, screenGrid):
     self.screenGrid = screenGrid
     
     self.layout = StackLayout(size=(Types.SCREEN_SIZE_WIDTH, 80), orientation="lr-bt", size_hint=(None, None))
     self.btnGoBack = Button(text='Back', size_hint=(.1, .4), pos_hint={'x':.01, 'y':.01})
     
     self.lblScore = Label(text='SCORE:', size_hint=(.1, .4))
     self.lblScoreValue = Label(text='0', size_hint=(.1, .4))
     self.lblLife = Label(text='LIFE:', size_hint=(.1, .4))
     self.lblLifeValue = Label(text='100', size_hint=(.1, .4))
     self.lblResources = Label(text='RESOURCES:', size_hint=(.1, .4))
     self.lblResourcesValue = Label(text='100', size_hint=(.1, .4))
     
     self.btnCreateTower = Button(text='Tower', size_hint=(.1, .4), pos_hint={'x':.01, 'y':.01})
     
     self.layout.canvas.add(Color(.8, .7, .1, .7))
     self.layout.canvas.add(Rectangle(size=self.layout.size))
     
     self.layout.add_widget(self.btnGoBack)
     self.layout.add_widget(self.lblScore)
     self.layout.add_widget(self.lblScoreValue)
     self.layout.add_widget(self.lblLife)
     self.layout.add_widget(self.lblLifeValue)
     self.layout.add_widget(self.lblResources)
     self.layout.add_widget(self.lblResourcesValue)
     self.layout.add_widget(self.btnCreateTower)
     
     self.fill()
Exemplo n.º 51
0
    def __init__(self,**kwargs):
        super(Catalog, self).__init__(**kwargs)       

        #self.orientation = 'vertical'

        self.search_bar = BoxLayout(size_hint=(1.0,0.05))        
        self.search_bar.add_widget(Label(text='Search',size_hint=(0.25,1.0)))
        self.search_text = (TextInput(multiline=False))
        self.search_bar.add_widget(self.search_text)

        self.filter_bar = BoxLayout(size_hint=(1.0,0.05))        
        self.AHSE = ToggleButton(text='AHSE',size_hint=(0.25,1.0))
        self.ENGR = ToggleButton(text='ENGR',size_hint=(0.25,1.0))
        self.MTH = ToggleButton(text='MTH',size_hint=(0.25,1.0))
        self.SCI = ToggleButton(text='SCI',size_hint=(0.25,1.0))        
        self.filter_bar.add_widget(self.AHSE)
        self.filter_bar.add_widget(self.ENGR)
        self.filter_bar.add_widget(self.MTH)
        self.filter_bar.add_widget(self.SCI)

        self.scrollview = ScrollView(size_hint=(1.0,0.9),size=(400,400))
        self.courses = StackLayout(spacing=5,size_hint_y=None)
        self.courses.bind(minimum_height=self.courses.setter('height'))
        for course_object in catalog:
            course_item = Course_Item(course=course_object,size_hint=(0.245,None),height=200)                             
            self.courses.add_widget(course_item)
        self.scrollview.add_widget(self.courses)
                        
        self.add_widget(self.search_bar)
        self.add_widget(self.filter_bar)
        self.add_widget(self.scrollview)

        Clock.schedule_interval(self.update_favorites,0.1)
        Clock.schedule_interval(self.search_function,0.1)
Exemplo n.º 52
0
    def side_buttons(self):
        rooty = main.Root()

        def open_press(instance):
            rooty.set_sender("arena")
            rooty.show_load()

        # Layout to stack buttons
        side_btn_layout = StackLayout(size_hint_x=None, width=50)

        # Button to open map file
        btn_open = Button(text='Open', size_hint=(1, .1))
        btn_open.bind(on_press=open_press)

        side_btn_layout.add_widget(btn_open)

        return side_btn_layout
Exemplo n.º 53
0
 def __init__(self, **kwargs):
     ModalView.__init__(self, size_hint=(.15, 1), pos_hint={'right': 1},
                        **kwargs)
     app = App.get_running_app()
     scroller = ScrollView(do_scroll_x=False)
     layout = StackLayout(padding=[dp(10)], size_hint_y=None)
     layout.height = layout.width * len(app.powerups.purchased)
     for powerup in app.powerups.purchased:
         if not isinstance(powerup, Powerup):
             continue
         if powerup.type == PowerupType.PLAY_CARD:
             if not app.loaded_deck.get_cards(app.powerups.cards()):
                 continue
         layout.add_widget(UsablePowerupIcon(powerup=powerup,
                                             size_hint=(1, None)))
     scroller.add_widget(layout)
     self.add_widget(scroller)
Exemplo n.º 54
0
	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)
Exemplo n.º 55
0
	def build(self):

		self.title = 'Stockholm Sample Creator'

		self.layout = FloatLayout()

		self.buttonContainer = StackLayout(pos=(10,10), size_hint=(.9, .9))

		self.audioAnalyser = None

		headerLabel = Label(text="Stockholm Sample Creator", halign="left", font_size=24, width=800, size_hint=(None, 0.3), pos=(0,0))
		self.buttonContainer.add_widget(headerLabel)

		self.selectSourceButton = Button(text="Select Source Folder", font_size=14,  width=300, size_hint=(None, 0.1))
		self.selectSourceButton.bind(on_press=self.onSelectSourceFolderClick)

		self.selectDestinationButton = Button(text="Select Destination Folder", font_size=14, width=300, size_hint=(None, 0.1))
		self.selectDestinationButton.bind(on_press=self.onSelectDestinationFolderClick)

		self.sourceFolderLabel = Label(text="No Source Folder Set", font_size=14, width=300, size_hint=(None, 0.1))
		self.destinationFolderLabel = Label(text="No Destination Folder Set", font_size=14, width=300, size_hint=(None, 0.1))

		self.buttonContainer.add_widget(self.selectSourceButton)
		self.buttonContainer.add_widget(self.selectDestinationButton)
		self.buttonContainer.add_widget(self.sourceFolderLabel)
		self.buttonContainer.add_widget(self.destinationFolderLabel)

		sliderLabel = Label(text='Minimum pitch deviation (lower=more accurate, fewer samples)', font_size=10, width=200, size_hint=(None, 0.1))
		self.minAvgSlider = Slider(min=0, max=0.99, value=0.2, padding=50, width=400, size_hint=(None, 0.1))

		minDurationSliderLabel = Label(text='Minimum note duration', font_size=10, width=200, size_hint=(None, 0.1))
		self.minDurationSlider = Slider(min=0, max=2, value=0.2, padding=50, width=400, size_hint=(None, 0.1))

		maxDurationSliderLabel = Label(text='Maximum note duration', font_size=10, width=200, size_hint=(None, 0.1))
		self.maxDurationSlider = Slider(min=0, max=2, value=1, padding=50, width=400, size_hint=(None, 0.1))

		
		self.buttonContainer.add_widget(self.minAvgSlider)
		self.buttonContainer.add_widget(sliderLabel)

		self.buttonContainer.add_widget(self.minDurationSlider)
		self.buttonContainer.add_widget(minDurationSliderLabel)

		self.buttonContainer.add_widget(self.maxDurationSlider)
		self.buttonContainer.add_widget(maxDurationSliderLabel)

		self.layout.add_widget(self.buttonContainer)

		# DEBUG
		# self.sourceFolder = "/Users/owenhindley/Desktop/test-samples"
		# self.destFolder = "/Users/owenhindley/Desktop/test-output"

		# self.showAnalyseButton()

		# self.layout.add_widget(self.createFileBrowser())

		return self.layout
Exemplo n.º 56
0
def popUP():
	popLayout = StackLayout()
	
	popup.content = popLayout
		
	popText = Label(text='What type of game would you like to play?', size_hint=(1.0,0.9))
	
	popBtn1 = Button(text='Single Player [i]COMING SOON[/i]', group='choice', size_hint=( 0.5, 0.1 ), markup = True)
	popBtn1.bind(on_press=clickSoundPlay)
	popBtn1.bind(on_release = singlePlayer)
	popBtn1.disabled = True
	popBtn2 = Button(text='Two Player', group='choice', size_hint=( 0.5, 0.1 ))
	popBtn2.bind(on_press=clickSoundPlay)
	popBtn2.bind(on_release = twoPlayer)
	
	popLayout.add_widget( popText )
	popLayout.add_widget( popBtn1 )
	popLayout.add_widget( popBtn2 )
Exemplo n.º 57
0
    def __init__(self, app):
        """Constructor"""
        # Call the base.
        super(HomePage, self).__init__(app)

        # Load the backend
        self.backend = SpecialBackend(FlatfileBackend())

        # Create a body manually, overriding the default.
        self.body = AnchorLayout(anchor_x='center', anchor_y='center')
        stack_layout = StackLayout(size_hint=(0.95, 0.6))
        self.body.add_widget(stack_layout)

        text_layout =  BoxLayout(anchor_x='left', anchor_y='center', size_hint=(0.8, None))
        text_layout.height = '35px'
        stack_layout.add_widget(text_layout)

        def on_enter(sender):
            self._on_search(sender, self.query.text)
        self.query = TextInput(text='', multiline=False, hint_text='Type here...')
        self.query.bind(on_text_validate=on_enter)
        text_layout.add_widget(self.query)


        button_layout =  BoxLayout(anchor_x='right', anchor_y='center', size_hint=(0.2, None))
        button_layout.height = '35px'
        stack_layout.add_widget(button_layout)

        def on_search_press(sender):
            self._on_search(self.query, self.query.text)
        search = Button(text='Search!')
        search.width = '50px'
        search.bind(on_press=on_search_press)
        button_layout.add_widget(search)

        self.search_results = RichPage.get_page(app, [self], self.backend, 'search')

        def on_category_press(sender):
            RichPage.get_page(app, [self], self.backend, 'categories').show(self)
            self.hide()
        category = Button(text='Categories', size_hint=(None, None), height='35px')
        category.width = '100px'
        category.bind(on_press=on_category_press)        
        self.body.add_widget(category)
Exemplo n.º 58
0
    def __init__(self, **kwargs):
        Screen.__init__(self, **kwargs)
        Window.clearcolor=(1,1,1,1) #change master bg colour, RGB in .% , last is a binary: 1 = On, 0 = Off . Currently the colour is white
        #Layouts
        self.tryout = StackLayout(orientation ='lr-bt') #buttons would be placed from left to right first then bottom to top => the buttons would be stacked at the bottom from left to right first 
        self.floatt = FloatLayout() #free size 

        #variable for def gettinginformation()
        self.counter = 0 

        #title of the screen to be seen
        self.floatt.add_widget(Label(text='[color=000000][size=40][font=yorkwhiteletter]Last Screened Individual[/size][/font][/color]',size_hint= (0.5,0.2), halign='center',markup=True,pos_hint={'x':0.05,'y':0.8}))

        #information , left column. FIXED TEXT 
        '''x is moving left right, y is moving up and down
        0.0 for y is in the middle. to move down, use -ve 
        column of the table is fixed at x=0.2, or 0.2 left relative to floatlayout'''

        self.Lname=Label(text='[color=000000][size=40][font=Impact Label Reversed]Name\nBatch[/font][/size][/color]',markup = True,pos_hint={'x':-0.2,'y':0.1})
        self.Lid=Label(text='[color=000000][size=40][font=Impact Label Reversed]Card ID[/font][/size][/color]',markup = True,pos_hint={'x':-0.2,'y':0.0})
        self.Llocation = Label(text='[color=000000][size=40][font=Impact Label Reversed]Location[/font][/size][/color]',markup = True,pos_hint={'x':-0.2,'y':-0.1})
        self.Ltime=Label(text='[color=000000][size=40][font=Impact Label Reversed]Time\nDate[/font][/size][/color]',markup = True,pos_hint={'x':-0.2,'y':-0.2})

        self.floatt.add_widget(self.Lname)
        self.floatt.add_widget(self.Lid)
        self.floatt.add_widget(self.Ltime)
        self.floatt.add_widget(self.Llocation)
       
        #widgets to get information, depending on the card ID received, RHS column of information
        #currently made RHS columns contain a '-' to show no information is being displayed    
        self.namee = Label(text='[color=000000][size=40][font=Impact Label Reversed]-[/size][/font][/color]',halign='center',markup=True,pos_hint={'x':0.2,'y':0.1})
        self.Rid=Label(text='[color=000000][size=40][font=Impact Label Reversed]-[/size][/font][/color]',markup=True,pos_hint={'x':0.2,'y':0.0})
        self.Rlocation = Label(text='[color=000000][size=40][font=Impact Label Reversed]-[/size][/font][/color]',markup=True,pos_hint={'x':0.2,'y':-0.1})
        self.Rtime = Label(text='[color=000000][size=40][font=Impact Label Reversed]%s[/size][/font][/color]' %(time.strftime("%H:%M:%S\n%d/%m/%Y")),markup=True,pos_hint={'x':0.2,'y':-0.2})
        
        self.floatt.add_widget(self.namee)
        self.floatt.add_widget(self.Rid)
        self.floatt.add_widget(self.Rtime)
        self.floatt.add_widget(self.Rlocation)

        #fixed buttons at the bottom of the screen to navigate
        self.switchtomenu = Button(text='[size=50][font=yorkwhiteletter][color=000000]MENU[/font][/size][/color]',markup=True, size_hint=(0.2,0.2),background_color=(1,1,1,0),on_press=self.changeToMenu)
        self.switchtoebot = Button(text='[size=50][font=yorkwhiteletter][color=000000]EBOTS[/font][/size][/color]', markup=True,size_hint=(0.2,0.2),background_color=(1,1,1,0),on_press=self.changeToebots)
        self.switchtopersonal = Button(text='[size=50][font=yorkwhiteletter][color=000000]INDIVIDUAL[/font][/size][/color]', markup=True,size_hint=(0.2,0.2),background_color=(1,1,1,0),on_press=self.changeToPersonal)
        
        self.tryout.add_widget(self.switchtoebot)
        self.tryout.add_widget(self.switchtopersonal)
        self.tryout.add_widget(self.switchtomenu)

        # button to trigger gettinginformation 
        self.refresh=Button(text='[size=50][font=yorkwhiteletter][color=000000]REFRESH[/font][/size][/color]', markup = True, size_hint=(0.2,0.2),background_color=(1,1,1,0),on_press=self.gettinginformation)
        self.tryout.add_widget(self.refresh)

        #add layouts
        self.add_widget(self.tryout)
        self.add_widget(self.floatt)
Exemplo n.º 59
0
 def add_results_screen(self):
     game_results = []
     for game_board_screen in self.finished_screens:
         game_result = GameResult(
                 game_board_screen,
                 orientation='horizontal',
                 size_hint=(1, None),
                 height=50
         )
         game_results.append(game_result)
     content = StackLayout(orientation='lr-tb', size_hint=(1, 1))
     label = Label(text='RESULTS', size_hint=(1, None), height=100)
     content.add_widget(label)
     for game_result in game_results:
         content.add_widget(game_result)
     scroller = ScrollView(size_hint=(1, 1))
     scroller.add_widget(content)
     results_screen = ResultsScreen(scroller, name='Results')
     self.screens.add_widget(results_screen)
Exemplo n.º 60
0
class SelectPad(Popup):
    '''a popup that is called by NumberSelect.  creates a number pad of number
    choices.'''
    def __init__(self, parent_btn, **kwargs):
        super(SelectPad, self).__init__(**kwargs)
        self.parent_btn = parent_btn

        self.content = StackLayout(orientation='lr-tb', size_hint=(1, 1))
        y_hint_ = 0.01* int(100 /(1 + len(self.parent_btn.the_range)//3))
        for number in self.parent_btn.the_range:
            self.content.add_widget(Button(text=str(number),
                                           size_hint=(0.33, y_hint_),
                                           on_press=self.record_number))
        self.title = self.parent_btn.title
        self.title_align = 'center'
    def record_number(self, btn):
        '''assigns button's number to parent'''
        self.parent_btn.number_value = int(btn.text)
        self.dismiss()