How to use the remi.gui.ListItem function in remi

To help you get started, we’ve selected a few remi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dddomodossola / remi / examples / append_test_app.py View on Github external
def main(self):
        #creating a container VBox type, vertical (you can use also HBox or Widget)
        main_container = gui.Widget(width=300, style={'margin':'0px auto'}, layout_orientation=gui.Widget.LAYOUT_VERTICAL)


        m11 = gui.MenuItem('Save', [gui.MenuItem('Save'), gui.MenuItem('Save as')], width=100, height=30)
        m1 = gui.MenuItem('File', [m11, gui.MenuItem('Open')], width=100, height=30)
        menu = gui.Menu([m1, gui.MenuItem('View', width=100, height=30), gui.MenuItem('Dialog', width=100, height=30)], width='100%', height='30px')
        
        menubar = gui.MenuBar(width='100%', height='30px')
        menubar.append(menu)

        listview = gui.ListView(children={'0': gui.ListItem('zero'), 'n': 'n'})
        print( listview.append({'1': gui.ListItem('uno'), '2': gui.ListItem('due')}) )
        print( listview.append([gui.ListItem('tre'), gui.ListItem('quattro')]) )

        dropdown = gui.DropDown({'0': gui.DropDownItem('zero'), 'n': gui.DropDownItem('n')})
        print( dropdown.append({'1': gui.DropDownItem('uno'), '2': gui.DropDownItem('due')}) )
        print( dropdown.append(['tre', 'quattro']) )

        table = gui.Table({'0': gui.TableRow(['zero','zeroo','zerooo']), 'n':gui.TableRow(['n','nn','nnn'])})
        print( table.append({'1': gui.TableRow(['uno','unoo','unooo']), '2':gui.TableRow(['due','duee','dueee'])}) )
        row3 = gui.TableRow()
        row3.append(['tre','tree','treee'])
        row4 = gui.TableRow()
        row4.append(['quattro','quattroo','quattrooo'])
        print( table.append({'3':row3 , '4':row4}) )
        print( table.append({'5':gui.TableRow(['5','55','555']) , '6':gui.TableRow(['6','66','666'])}) )
        print( table.append(gui.TableRow(['sette','settee','setteee']) ) )

        main_container.append([menubar, listview, dropdown, table])
github dddomodossola / remi / examples / append_test_app.py View on Github external
def main(self):
        #creating a container VBox type, vertical (you can use also HBox or Widget)
        main_container = gui.Widget(width=300, style={'margin':'0px auto'}, layout_orientation=gui.Widget.LAYOUT_VERTICAL)


        m11 = gui.MenuItem('Save', [gui.MenuItem('Save'), gui.MenuItem('Save as')], width=100, height=30)
        m1 = gui.MenuItem('File', [m11, gui.MenuItem('Open')], width=100, height=30)
        menu = gui.Menu([m1, gui.MenuItem('View', width=100, height=30), gui.MenuItem('Dialog', width=100, height=30)], width='100%', height='30px')
        
        menubar = gui.MenuBar(width='100%', height='30px')
        menubar.append(menu)

        listview = gui.ListView(children={'0': gui.ListItem('zero'), 'n': 'n'})
        print( listview.append({'1': gui.ListItem('uno'), '2': gui.ListItem('due')}) )
        print( listview.append([gui.ListItem('tre'), gui.ListItem('quattro')]) )

        dropdown = gui.DropDown({'0': gui.DropDownItem('zero'), 'n': gui.DropDownItem('n')})
        print( dropdown.append({'1': gui.DropDownItem('uno'), '2': gui.DropDownItem('due')}) )
        print( dropdown.append(['tre', 'quattro']) )

        table = gui.Table({'0': gui.TableRow(['zero','zeroo','zerooo']), 'n':gui.TableRow(['n','nn','nnn'])})
        print( table.append({'1': gui.TableRow(['uno','unoo','unooo']), '2':gui.TableRow(['due','duee','dueee'])}) )
        row3 = gui.TableRow()
        row3.append(['tre','tree','treee'])
        row4 = gui.TableRow()
        row4.append(['quattro','quattroo','quattrooo'])
        print( table.append({'3':row3 , '4':row4}) )
        print( table.append({'5':gui.TableRow(['5','55','555']) , '6':gui.TableRow(['6','66','666'])}) )
        print( table.append(gui.TableRow(['sette','settee','setteee']) ) )
github KenT2 / pipresents-gapless / pp_manager.py View on Github external
def display_media(self):
        self.media_list.empty()
        self.current_media_name=''
        items=sorted(os.listdir(self.current_media))
        i=0
        for item in items:
            if (self.is_profile is False and os.path.isdir(self.current_media+ os.sep+item) is False) or (self.is_profile is True and os.path.isdir(self.current_media+ os.sep+item) is True and os.path.exists(self.current_media+ os.sep + item + os.sep + 'pp_showlist.json') is True):
                obj= gui.ListItem(item,width=200, height=20)
                self.media_list.append(obj,key=i)
                i+=1
        return
github KenT2 / pipresents-gapless / pp_web_editor.py View on Github external
def refresh_tracks_display(self):
        self.tracks_display.empty()
        if self.current_medialist is not None:
            key=0
            for index in range(self.current_medialist.length()):
                if self.current_medialist.track(index)['track-ref'] != '':
                    track_ref_string="  ["+self.current_medialist.track(index)['track-ref']+"]"
                else:
                    track_ref_string=""
                obj = gui.ListItem(self.current_medialist.track(index)['title']+track_ref_string,width=300, height=20)
                self.tracks_display.append(obj,key=key)
                key+=1                
            if self.current_medialist.track_is_selected():
                self.tracks_display.select_by_key(self.current_medialist.selected_track_index())
github KenT2 / pipresents-gapless / pp_web_editor.py View on Github external
def refresh_medialists_display(self):
        # print 'refresh medialists'
        self.medialists_display.empty()
        key=0
        for index in range (len(self.medialists)):
            obj = gui.ListItem(self.medialists[index],width=300, height=20)
            self.medialists_display.append(obj,key=key)
            key+=1
                    
        if self.current_medialist is not None:
            self.medialists_display.select_by_key(self.current_medialists_index)
            # self.medialists_display.show(self)
github dddomodossola / remi / remi / gui.py View on Github external
def append(self, item, key=''):
        """Appends child items to the ListView. The items are accessible by list.children[key].

        Args:
            item (ListItem): the item to add.
            key (str): string key for the item.
        """
        if isinstance(item, type('')) or isinstance(item, type(u'')):
            item = ListItem(item)
        elif not isinstance(item, ListItem):
            raise ValueError("item must be text or a ListItem instance")
        # if an event listener is already set for the added item, it will not generate a selection event
        if item.attributes[self.EVENT_ONCLICK] == '':
            item.set_on_click_listener(self.onselection)
        item.attributes['selected'] = False
        super(ListView, self).append(item, key=key)
github KenT2 / pipresents-beep / pp_web_editor.py View on Github external
def refresh_medialists_display(self):
        # print 'refresh medialists'
        self.medialists_display.empty()
        key=0
        for index in range (len(self.medialists)):
            obj = gui.ListItem(self.medialists[index],width=300, height=20)
            self.medialists_display.append(obj,key=key)
            key+=1
                    
        if self.current_medialist is not None:
            self.medialists_display.select_by_key(self.current_medialists_index)
            # self.medialists_display.show(self)
github dddomodossola / remi / remi / gui.py View on Github external
def append(self, item, key=''):
        """Appends child items to the ListView. The items are accessible by list.children[key].

        Args:
            item (ListItem): the item to add.
            key (str): string key for the item.
        """
        if isinstance(item, type('')) or isinstance(item, type(u'')):
            item = ListItem(item)
        elif not isinstance(item, ListItem):
            raise ValueError("item must be text or a ListItem instance")
        # if an event listener is already set for the added item, it will not generate a selection event
        if item.attributes[self.EVENT_ONCLICK] == '':
            item.set_on_click_listener(self.onselection)
        item.attributes['selected'] = False
        super(ListView, self).append(item, key=key)
github KenT2 / pipresents-beep / remi / gui.py View on Github external
def new_from_list(cls, items, **kwargs):
        """Populates the ListView with a string list.

        Args:
            items (list): list of strings to fill the widget with.
        """
        obj = cls(**kwargs)
        for item in items:
            obj.append(ListItem(item))
        return obj