How to use the remi.gui.Widget 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 / remi / View on Github external
self.set_text = self.editInput.set_text

    def onchange(self, emitter, new_value):
        return self.eventManager.propagate(self.EVENT_ONCHANGE, (new_value,))

    @decorate_set_on_listener("onchange", "(self,emitter,new_value)")
    def set_on_change_listener(self, callback, *userdata):
        """Register the listener for the onchange event.

        Note: the listener prototype have to be in the form on_item_changed(self, widget, value).
        self.eventManager.register_listener(self.EVENT_ONCHANGE, callback, *userdata)

class TableItem(Widget, _MixinTextualWidget):
    """item widget for the TableRow."""

    def __init__(self, text='', **kwargs):
            text (str):
            kwargs: See Widget.__init__()
        super(TableItem, self).__init__(**kwargs)
        self.type = 'td'

class TableTitle(TableItem, _MixinTextualWidget):
    """title widget for the table."""
github KenT2 / pipresents-gapless / remi / View on Github external
except (IndexError, ValueError):
                    return a > b

        log.debug("FileFolderNavigator - populate_folder_items")

        # krt sort that works in Raspbian
        l = sorted(os.listdir(directory))
        # l.sort(key=functools.cmp_to_key(_sort_files))

        # used to restore a valid path after a wrong edit in the path editor
        self._last_valid_path = directory
        # we remove the container avoiding graphic update adding items
        # this speeds up the navigation
        # creation of a new instance of a itemContainer
        self.itemContainer = Widget(width='100%', height=300)
        self.itemContainer.set_layout_orientation(Widget.LAYOUT_VERTICAL)['overflow-y'] = 'scroll'['overflow-x'] = 'hidden'['display'] = 'block'

        for i in l:
            full_path = os.path.join(directory, i)
            is_folder = not os.path.isfile(full_path)
            if (not is_folder) and (not self.allow_file_selection):
            fi = FileFolderItem(i, is_folder)
  ['display'] = 'block'
            fi.set_on_click_listener(self.on_folder_item_click)  # navigation purpose
            fi.set_on_selection_listener(self.on_folder_item_selected)  # selection purpose
github dddomodossola / remi / examples / View on Github external
def main(self):
        verticalContainer = gui.Widget(width=540)['display'] = 'block'['overflow'] = 'hidden'

        horizontalContainer = gui.Widget(width='100%', layout_orientation=gui.Widget.LAYOUT_HORIZONTAL, margin='0px')['display'] = 'block'['overflow'] = 'auto'
        subContainerLeft = gui.Widget(width=320)['display'] = 'block'['overflow'] = 'auto'['text-align'] = 'center'
        self.img = gui.Image('/res/logo.png', width=100, height=100, margin='10px')
        self.img.set_on_click_listener(self, 'on_img_clicked')

        self.table = gui.Table(width=300, height=200, margin='10px')
        self.table.from_2d_matrix([['ID', 'First Name', 'Last Name'],
github dddomodossola / remi / remi / View on Github external
    @decorate_set_on_listener("(self, emitter, fileList)")
    def confirm_value(self, widget):
        """event called pressing on OK button.
           propagates the string content of the input field
        params = (self.fileFolderNavigator.get_selection_list(),)
        return params

    def set_on_confirm_value_listener(self, callback, *userdata):
        self.confirm_value.connect(callback, *userdata)

class MenuBar(Widget):

    def __init__(self, *args, **kwargs):
            kwargs: See Widget.__init__()
        super(MenuBar, self).__init__(*args, **kwargs)
        self.type = 'nav'

class Menu(Widget):
    """Menu widget can contain MenuItem."""

github KenT2 / pipresents-beep / remi / View on Github external
            callback (function): Callback function pointer.
        self.attributes[self.EVENT_ONKEYDOWN] = """
            if (event.keyCode == 13) {
                var params={};
                document.getElementById('%(id)s').value = '';
                document.getElementById('%(id)s').onchange = '';
                return false;
            }""" % {'id': self.identifier, 'evt': self.EVENT_ONENTER}
        self.eventManager.register_listener(self.EVENT_ONENTER, callback, *userdata)

class Label(Widget, _MixinTextualWidget):
    """Non editable text label widget. Set its content by means of set_text function, and retrieve its content with the
    function get_text.
    def __init__(self, text, **kwargs):
            text (str): The string content that have to be displayed in the Label.
            kwargs: See Widget.__init__()
        super(Label, self).__init__(**kwargs)
        self.type = 'p'

class GenericDialog(Widget):
github PySimpleGUI / PySimpleGUI / PySimpleGUIWeb / Demo Programs / View on Github external
subContainerLeft = gui.Widget(width=320,
                                      style={'display': 'block', 'overflow': 'auto', 'text-align': 'center'})
        self.img = gui.Image('/res:logo.png', height=100, margin='10px')

        self.table = gui.Table.new_from_list([('ID', 'First Name', 'Last Name'),
                                              ('101', 'Danny', 'Young'),
                                              ('102', 'Christine', 'Holand'),
                                              ('103', 'Lars', 'Gordon'),
                                              ('104', 'Roberto', 'Robitaille'),
                                              ('105', 'Maria', 'Papadopoulos')],
                                             width=300, height=200, margin='10px')

        # the arguments are width - height - layoutOrientationOrizontal
        subContainerRight = gui.Widget(
            style={'width': '220px', 'display': 'block',
                   'overflow': 'auto', 'text-align': 'center'})
        self.count = 0
        self.counter = gui.Label('', width=200, height=30, margin='10px')

        self.lbl = gui.Label('This is a LABEL!', width=200,
                             height=30, margin='10px') = gui.Button('Press me!', width=200, height=30, margin='10px')
        # setting the listener for the onclick event of the button

        self.txt = gui.TextInput(width=200, height=30, margin='10px')
        self.txt.set_text('This is a TEXTAREA')
github KenT2 / pipresents-gapless / remi / View on Github external
GenericObject widget - allows to show embedded object like pdf,swf..

    def __init__(self, filename, **kwargs):
            filename (str): URL
            kwargs: See Widget.__init__()
        super(GenericObject, self).__init__(**kwargs)
        self.type = 'object'
        self.attributes['data'] = filename

class FileFolderNavigator(Widget):
    """FileFolderNavigator widget."""

    @decorate_constructor_parameter_types([bool, str, bool, bool])
    def __init__(self, multiple_selection, selection_folder, allow_file_selection, allow_folder_selection, **kwargs):
        super(FileFolderNavigator, self).__init__(**kwargs)
        self.set_layout_orientation(Widget.LAYOUT_VERTICAL)['width'] = '100%'

        self.multiple_selection = multiple_selection
        self.allow_file_selection = allow_file_selection
        self.allow_folder_selection = allow_folder_selection
        self.selectionlist = []
        self.controlsContainer = Widget()
        self.controlsContainer.set_size('100%', '30px')['display'] = 'flex'
github KenT2 / pipresents-gapless / View on Github external
self.text +=text+'\n'

#  ****************************************************
# TabView - a framework for a Tabbed Editor
#  ****************************************************

The TabView constucts a container.
The container has a tab bar, tab title and a frame (self.tab_frame).
The tab_frame can contain one of many panels depending on the tab selected
add_tab adds a button to the tab bar, and creates and returns a panel 


class TabView(gui.Widget):
    def __init__(self, frame_width,frame_height,bar_height,**kwargs):
        super(TabView, self).__init__(**kwargs)

        #dictionary to  lookup panel object given key
        #tab bar
github dddomodossola / remi / remi / View on Github external
kwargs: See Widget.__init__()
        super(MenuItem, self).__init__(**kwargs)
        self.sub_container = None
        self.type = 'li'
        self.attributes[self.EVENT_ONCLICK] = ''

    def append(self, value, key=''):
        if self.sub_container is None:
            self.sub_container = Menu()
            super(MenuItem, self).append(self.sub_container, key='subcontainer')
        self.sub_container.append(value, key=key)

class TreeView(Widget):
    """TreeView widget can contain TreeItem."""

    def __init__(self, **kwargs):
            kwargs: See Widget.__init__()
        super(TreeView, self).__init__(**kwargs)
        self.type = 'ul'

class TreeItem(Widget, _MixinTextualWidget):
    """TreeItem widget can contain other TreeItem."""

github dddomodossola / remi / remi / View on Github external
text (str, unicode): The textual content of the ListItem.
            kwargs: See Widget.__init__()
        super(ListItem, self).__init__(*args, **kwargs)
        self.type = 'li'

    def get_value(self):
            str: The text content of the ListItem
        return self.get_text()

class DropDown(Widget):
    """Drop down selection widget. Implements the onchange(value) event. Register a listener for its selection change
    by means of the function DropDown.onchange.connect.

    def __init__(self, *args, **kwargs):
            kwargs: See Widget.__init__()
        super(DropDown, self).__init__(*args, **kwargs)
        self.type = 'select'
        self.attributes[self.EVENT_ONCHANGE] = \
            "var params={};params['value']=document.getElementById('%(id)s').value;" \
            "sendCallbackParam('%(id)s','%(evt)s',params);" % {'id': self.identifier,
                                                               'evt': self.EVENT_ONCHANGE}