예제 #1
2
class ImagesMenu(BaseScreen):
    def __init__(self, name, *navigate_screens):
        super(ImagesMenu, self).__init__(name, *navigate_screens)
        self.lower_grid = BoxLayout(orientation='vertical',
                                    spacing=5,
                                    padding=5)
        self.lower_panel.add_widget(self.lower_grid)

        self.filechooser = FileChooserListView()
        if platform == 'android':
            self.filechooser.path = '/sdcard/DCIM'
        else:
            self.filechooser.path = os.getcwd()
        self.filechooser.bind(
            on_selection=lambda x: self.selected(self.filechooser.selection))

        self.open_file_button = MDRaisedButton(text='Upload Image',
                                               size_hint=(1, .1))
        self.open_file_button.bind(on_release=lambda x: self.open_f(
            self.filechooser.path, self.filechooser.selection))

        self.lower_grid.add_widget(
            TextInput(size_hint=(1, .12), text='Image name'))
        self.lower_grid.add_widget(self.open_file_button)
        self.lower_grid.add_widget(self.filechooser)

    def open_f(self, path, filename):
        if not filename:
            img_file = None
            image_pop = Popup()
            image_pop.add_widget(
                MDLabel(text='No image file selected', halign='center'))
            image_pop.open()
        else:
            img_file = os.path.join(path, filename[0])
        image_pop = Popup()
        image_pop.add_widget(Image(source=img_file))
        image_pop.open() if img_file else ''

    def open_image_screen_callback(self):
        self.upper_panel.navigate_next()
예제 #2
0
    def on_pre_enter(self, *args):

        sApp = App.get_running_app()
        sApp.root.ids.toolbar.title = 'Who pulled, and how well?'

        self.puller = 'puller_not_set'
        # print("starting pulling, off: "+str(sApp.current_point.current_sequence().offence))
        for player in sApp.current_point.current_sequence().lines[
                1 - sApp.current_point.current_sequence().offence]:
            pb = ToggleButton(text=player.display_name, group=u'players')
            pickcallback = partial(self.set_puller, pb, player)
            pb.bind(on_release=pickcallback)
            self.ids.LeftBox.add_widget(pb)

        for action in hierarch.Pull.all_pulls:
            outcome = MDRaisedButton(text=action, size_hint=(1, 0.25))
            outcomecallback = partial(self.set_pull_outcome, outcome)
            outcome.bind(on_release=outcomecallback)
            self.ids.RightBox.add_widget(outcome)
예제 #3
0
class newwid(GridLayout, Thread):
    def __init__(self, **kwargs):

        GridLayout.__init__(self, **kwargs)
        Thread.__init__(self)

        self.cols = 1
        self.tool = ntoolbar(title='KivDL')
        self.add_widget(self.tool)
        self.body = GridLayout(cols=1, padding=(0, 20))
        self.add_widget(self.body)
        self.tex = MDTextField(pos_hint={'center_y': 0.9}, size_hint_x=0.8)
        self.tex.hint_text = " Enter URL to download"

        self.fetch_button = MDRaisedButton(text='Fetch',
                                           pos_hint={
                                               'center_y': 0,
                                               'right': 0.95
                                           },
                                           size_hint_x=0.1)
        self.fetch_button.bind(on_press=self.addcard)
        self.urlget = GridLayout(cols=2, size_hint_y=0.2)
        self.urlget.add_widget(self.tex)
        self.urlget.add_widget(self.fetch_button)
        self.body.add_widget(self.urlget)

        self.cardholder = ScrollView(do_scroll_x=False, size_hint_x=0.8)
        self.cardlist = MDList(padding=(10, 20))
        self.cardlist.spacing = (10, 20)
        self.cardholder.add_widget(self.cardlist)

        self.body.add_widget(self.cardholder)
        self.spacer = MDLabel(size_hint_y=0.2)
        self.cardlist.add_widget(self.spacer)

    def addcard(self, instance):
        if self.tex.text != '':
            self.cardlist.remove_widget(self.spacer)
            self.cardlist.add_widget(infocard(self.tex.text))
            self.cardlist.add_widget(self.spacer)
            self.tex.text = ''
예제 #4
0
    def on_pre_enter(self, *args):

        self.popup = None
        self.temp_event = ['player_not_set', None, None,
                           None]  # [player, action, ts_start, ts_end]
        self.pblist = []
        sApp = App.get_running_app()

        sApp.root.ids.toolbar.title = 'Select Player, then Action'

        # sequence_display = Label(text=str(seq_content),pos_hint={'top':1})
        # not sure pos_hint works very well - possibly bc i never use it and hence am mixing
        # this is the shit to fix with the UI restructure hey
        self.update_sequence()

        for player in sApp.current_point.current_sequence().lines[
                sApp.current_point.current_sequence().offence]:
            pb = ToggleButton(
                text=player.display_name,
                group=u'players')  #, size_hint=[0.33,None]) #StackLayout stuff
            pickcallback = partial(self.set_player, player)
            pb.bind(on_release=pickcallback)
            self.pblist.append(pb)
            self.ids.LeftBox.add_widget(pb)

        #fakePlayer = hierarch.Player(player_name=sApp.game.teams[sApp.current_point.current_sequence().offence].team_name,
        #                             player_number=-1,
        #                            player_gender='G')
        #pb = ToggleButton(text=fakePlayer.display_name, group=u'players')#, size_hint=[0.33,None])
        #pickcallback = partial(self.set_player,fakePlayer)
        #pb.bind(on_release=pickcallback)
        #self.pblist.append(pb)
        #self.ids.LeftBox.add_widget(pb)

        action = 'pass'
        select = MDRaisedButton(text=action)
        selectcallback = partial(self.set_action, action)
        select.bind(on_release=selectcallback)
        self.ids.RightBox.add_widget(select)

        rightGrid = GridLayout(cols=2, spacing=10, size_hint_y=0.9)

        self.ids.RightBox.add_widget(rightGrid)

        for action in hierarch.Event.primary_actions:
            select = MDRaisedButton(text=action)
            selectcallback = partial(self.set_action, action)
            select.bind(on_release=selectcallback)
            #self.ids.RightBox.add_widget(select)
            rightGrid.add_widget(select)

        #secondaryBox = BoxLayout(orientation='horizontal',
        #                         padding=[0,10])
        for action in hierarch.Event.secondary_actions:
            select = MDRaisedButton(text=action)
            selectcallback = partial(self.set_action, action)
            select.bind(on_release=selectcallback)
            #secondaryBox.add_widget(select)
            #self.ids.RightBox.add_widget(secondaryBox)
            rightGrid.add_widget(select)

        action = 'goal'
        select = MDRaisedButton(text=action)
        selectcallback = partial(self.set_action, action)
        select.bind(on_release=selectcallback)
        rightGrid.add_widget(select)

        for action in hierarch.Event.defensive_actions:
            select = MDRaisedButton(text=action)
            selectcallback = partial(self.set_action, action)
            select.bind(on_release=selectcallback)
            #self.ids.RightBox.add_widget(select)
            rightGrid.add_widget(select)

        playBreakButton = MDRaisedButton(text='Break in play')
        playBreakButton.bind(on_release=self.playbreak_switch)
        #self.ids.RightBox.add_widget(playBreakButton)
        rightGrid.add_widget(playBreakButton)

        undoButton = MDRaisedButton(text='Undo Event')
        # undocallback = partial(self.undo_action)
        undoButton.bind(on_release=self.undo_action)
        #self.ids.RightBox.add_widget(undoButton)
        rightGrid.add_widget(undoButton)