def __init__(self):
        super(TabSheetIconsExample, self).__init__()

        # Tab 1 content
        l1 = VerticalLayout()
        l1.setMargin(True)
        l1.addComponent(Label('There are no previously saved actions.'))

        # Tab 2 content
        l2 = VerticalLayout()
        l2.setMargin(True)
        l2.addComponent(Label('There are no saved notes.'))

        # Tab 3 content
        l3 = VerticalLayout()
        l3.setMargin(True)
        l3.addComponent(Label('There are currently no issues.'))

        self._t = TabSheet()
        self._t.setHeight('200px')
        self._t.setWidth('400px')
        self._t.addTab(l1, 'Saved actions', self._icon1)
        self._t.addTab(l2, 'Notes', self._icon2)
        self._t.addTab(l3, 'Issues', self._icon3)
        self._t.addListener(self, ISelectedTabChangeListener)

        self.addComponent(self._t)
Beispiel #2
0
def panel(ui):
    """Creates a panel-based Muntjac user interface for a specified UI object.
       This function does not modify the UI object passed to it.  The object
       returned may be either a component or None.
    """
    # Bind the context values to the 'info' object:
    ui.info.bind_context()

    # Get the content that will be displayed in the user interface:
    content = ui._groups
    nr_groups = len(content)

    if nr_groups == 0:
        panel = None
    if nr_groups == 1:
        panel = _GroupPanel(content[0], ui).control
    elif nr_groups > 1:
        panel = TabSheet()
        _fill_panel(panel, content, ui)
        panel.ui = ui

    # If the UI is scrollable then wrap the panel in a Panel.
    if ui.scrollable and panel is not None:
        sa = Panel()
        sa.addComponent(panel)
#        sa.getParent().setResizable(True)
        panel = sa

    return panel
    def __init__(self):
        super(TabSheetClosingExample, self).__init__()

        # Tab 1 content
        l1 = VerticalLayout()
        l1.setMargin(True)
        l1.addComponent(Label('There are no previously saved actions.'))

        # Tab 2 content
        l2 = VerticalLayout()
        l2.setMargin(True)
        l2.addComponent(Label('There are no saved notes.'))

        # Tab 3 content
        l3 = VerticalLayout()
        l3.setMargin(True)
        l3.addComponent(Label('There are currently no issues.'))

        # Tab 4 content
        l4 = VerticalLayout()
        l4.setMargin(True)
        l4.addComponent(Label('There are no comments.'))

        # Tab 5 content
        l5 = VerticalLayout()
        l5.setMargin(True)
        l5.addComponent(Label('There is no new feedback.'))

        self._t = TabSheet()
        self._t.setHeight('200px')
        self._t.setWidth('400px')

        saved = self._t.addTab(l1, 'Saved actions', None)
        saved.setClosable(True)

        notes = self._t.addTab(l2, 'Notes', None)
        notes.setClosable(True)

        issues = self._t.addTab(l3, 'Issues', None)
        issues.setClosable(True)

        comments = self._t.addTab(l4, 'Comments', None)
        comments.setClosable(True)

        feedback = self._t.addTab(l5, 'Feedback', None)
        feedback.setClosable(True)

        self._t.addListener(self, tab_sheet.ISelectedTabChangeListener)
        self._t.setCloseHandler(self)

        self.addComponent(self._t)
Beispiel #4
0
    def __init__(self):
        super(TabSheetIconsExample, self).__init__()

        # Tab 1 content
        l1 = VerticalLayout()
        l1.setMargin(True)
        l1.addComponent(Label('There are no previously saved actions.'))

        # Tab 2 content
        l2 = VerticalLayout()
        l2.setMargin(True)
        l2.addComponent(Label('There are no saved notes.'))

        # Tab 3 content
        l3 = VerticalLayout()
        l3.setMargin(True)
        l3.addComponent(Label('There are currently no issues.'))

        self._t = TabSheet()
        self._t.setHeight('200px')
        self._t.setWidth('400px')
        self._t.addTab(l1, 'Saved actions', self._icon1)
        self._t.addTab(l2, 'Notes', self._icon2)
        self._t.addTab(l3, 'Issues', self._icon3)
        self._t.addListener(self, ISelectedTabChangeListener)

        self.addComponent(self._t)
Beispiel #5
0
    def __init__(self):
        super(TabSheetDisabledExample, self).__init__()

        self.setSpacing(True)

        # Tab 1 content
        self._l1 = VerticalLayout()
        self._l1.setMargin(True)
        self._l1.addComponent(Label('There are no previously saved actions.'))

        # Tab 2 content
        self._l2 = VerticalLayout()
        self._l2.setMargin(True)
        self._l2.addComponent(Label('There are no saved notes.'))

        # Tab 3 content
        self._l3 = VerticalLayout()
        self._l3.setMargin(True)
        self._l3.addComponent(Label('There are currently no issues.'))

        self._t = TabSheet()
        self._t.setHeight('200px')
        self._t.setWidth('400px')

        self._t1 = self._t.addTab(self._l1, 'Saved actions', self._icon1)
        self._t2 = self._t.addTab(self._l2, 'Notes', self._icon2)
        self._t3 = self._t.addTab(self._l3, 'Issues', self._icon3)

        self._t.addListener(self, tab_sheet.ISelectedTabChangeListener)

        self._toggleEnabled = Button('Disable \'Notes\' tab')
        self._toggleEnabled.addListener(self, button.IClickListener)

        self._toggleVisible = Button('Hide \'Issues\' tab')
        self._toggleVisible.addListener(self, button.IClickListener)

        hl = HorizontalLayout()
        hl.setSpacing(True)
        hl.addComponent(self._toggleEnabled)
        hl.addComponent(self._toggleVisible)

        self.addComponent(self._t)
        self.addComponent(hl)
Beispiel #6
0
    def __init__(self):
        super(PackageIconsExample, self).__init__()

        self._icons = ['arrow-down.png', 'arrow-left.png', 'arrow-right.png',
            'arrow-up.png', 'attention.png', 'calendar.png', 'cancel.png',
            'document.png', 'document-add.png', 'document-delete.png',
            'document-doc.png', 'document-image.png', 'document-pdf.png',
            'document-ppt.png', 'document-txt.png', 'document-web.png',
            'document-xsl.png', 'email.png', 'email-reply.png',
            'email-send.png', 'folder.png', 'folder-add.png',
            'folder-delete.png', 'globe.png', 'help.png', 'lock.png',
            'note.png', 'ok.png', 'reload.png', 'settings.png', 'trash.png',
            'trash-full.png', 'user.png', 'users.png']

        self._sizes = ['16', '32', '64']

        self.setSpacing(True)

        tabSheet = TabSheet()
        tabSheet.setStyleName(Reindeer.TABSHEET_MINIMAL)

        for size in self._sizes:
            iconsSideBySide = 2 if size == '64' else 3
            grid = GridLayout(iconsSideBySide * 2, 1)
            grid.setSpacing(True)
            grid.setMargin(True)
            tabSheet.addTab(grid, size + 'x' + size, None)

            tabSheet.addComponent(grid)
            for icon in self._icons:
                res = ThemeResource('../runo/icons/' + size + '/' + icon)

                e = Embedded(None, res)

                # Set size to avoid flickering when loading
                e.setWidth(size + 'px')
                e.setHeight(size + 'px')

                name = Label(icon)
                if size == '64':
                    name.setWidth('185px')
                else:
                    name.setWidth('150px')

                grid.addComponent(e)
                grid.addComponent(name)

                grid.setComponentAlignment(name, Alignment.MIDDLE_LEFT)

        self.addComponent(tabSheet)
    def __init__(self):
        super(TabSheetDisabledExample, self).__init__()

        self.setSpacing(True)

        # Tab 1 content
        self._l1 = VerticalLayout()
        self._l1.setMargin(True)
        self._l1.addComponent(Label('There are no previously saved actions.'))

        # Tab 2 content
        self._l2 = VerticalLayout()
        self._l2.setMargin(True)
        self._l2.addComponent(Label('There are no saved notes.'))

        # Tab 3 content
        self._l3 = VerticalLayout()
        self._l3.setMargin(True)
        self._l3.addComponent(Label('There are currently no issues.'))

        self._t = TabSheet()
        self._t.setHeight('200px')
        self._t.setWidth('400px')

        self._t1 = self._t.addTab(self._l1, 'Saved actions', self._icon1)
        self._t2 = self._t.addTab(self._l2, 'Notes', self._icon2)
        self._t3 = self._t.addTab(self._l3, 'Issues', self._icon3)

        self._t.addListener(self, tab_sheet.ISelectedTabChangeListener)

        self._toggleEnabled = Button('Disable \'Notes\' tab')
        self._toggleEnabled.addListener(self, button.IClickListener)

        self._toggleVisible = Button('Hide \'Issues\' tab')
        self._toggleVisible.addListener(self, button.IClickListener)

        hl = HorizontalLayout()
        hl.setSpacing(True)
        hl.addComponent(self._toggleEnabled)
        hl.addComponent(self._toggleVisible)

        self.addComponent(self._t)
        self.addComponent(hl)
Beispiel #8
0
class TabSheetDisabledExample(VerticalLayout,
                              tab_sheet.ISelectedTabChangeListener,
                              button.IClickListener):

    _icon1 = ThemeResource('../sampler/icons/action_save.gif')
    _icon2 = ThemeResource('../sampler/icons/comment_yellow.gif')
    _icon3 = ThemeResource('../sampler/icons/icon_info.gif')

    def __init__(self):
        super(TabSheetDisabledExample, self).__init__()

        self.setSpacing(True)

        # Tab 1 content
        self._l1 = VerticalLayout()
        self._l1.setMargin(True)
        self._l1.addComponent(Label('There are no previously saved actions.'))

        # Tab 2 content
        self._l2 = VerticalLayout()
        self._l2.setMargin(True)
        self._l2.addComponent(Label('There are no saved notes.'))

        # Tab 3 content
        self._l3 = VerticalLayout()
        self._l3.setMargin(True)
        self._l3.addComponent(Label('There are currently no issues.'))

        self._t = TabSheet()
        self._t.setHeight('200px')
        self._t.setWidth('400px')

        self._t1 = self._t.addTab(self._l1, 'Saved actions', self._icon1)
        self._t2 = self._t.addTab(self._l2, 'Notes', self._icon2)
        self._t3 = self._t.addTab(self._l3, 'Issues', self._icon3)

        self._t.addListener(self, tab_sheet.ISelectedTabChangeListener)

        self._toggleEnabled = Button('Disable \'Notes\' tab')
        self._toggleEnabled.addListener(self, button.IClickListener)

        self._toggleVisible = Button('Hide \'Issues\' tab')
        self._toggleVisible.addListener(self, button.IClickListener)

        hl = HorizontalLayout()
        hl.setSpacing(True)
        hl.addComponent(self._toggleEnabled)
        hl.addComponent(self._toggleVisible)

        self.addComponent(self._t)
        self.addComponent(hl)

    def selectedTabChange(self, event):
        selected = event.getTabSheet().getSelectedTab()
        c = self._t.getTab(selected).getCaption()
        self.getWindow().showNotification('Selected tab: ' + c)

    def buttonClick(self, event):
        if self._toggleEnabled == event.getButton():
            # toggleEnabled clicked
            self._t2.setEnabled(not self._t2.isEnabled())
            if self._t2.isEnabled():
                self._toggleEnabled.setCaption('Disable \'Notes\' tab')
            else:
                self._toggleEnabled.setCaption('Enable \'Notes\' tab')
        else:
            # toggleVisible clicked
            self._t3.setVisible(not self._t3.isVisible())
            if self._t3.isVisible():
                self._toggleVisible.setCaption('Hide \'Issues\' tab')
            else:
                self._toggleVisible.setCaption('Show \'Issues\' tab')
        self._t.requestRepaint()
class TabSheetDisabledExample(VerticalLayout,
            tab_sheet.ISelectedTabChangeListener, button.IClickListener):

    _icon1 = ThemeResource('../sampler/icons/action_save.gif')
    _icon2 = ThemeResource('../sampler/icons/comment_yellow.gif')
    _icon3 = ThemeResource('../sampler/icons/icon_info.gif')

    def __init__(self):
        super(TabSheetDisabledExample, self).__init__()

        self.setSpacing(True)

        # Tab 1 content
        self._l1 = VerticalLayout()
        self._l1.setMargin(True)
        self._l1.addComponent(Label('There are no previously saved actions.'))

        # Tab 2 content
        self._l2 = VerticalLayout()
        self._l2.setMargin(True)
        self._l2.addComponent(Label('There are no saved notes.'))

        # Tab 3 content
        self._l3 = VerticalLayout()
        self._l3.setMargin(True)
        self._l3.addComponent(Label('There are currently no issues.'))

        self._t = TabSheet()
        self._t.setHeight('200px')
        self._t.setWidth('400px')

        self._t1 = self._t.addTab(self._l1, 'Saved actions', self._icon1)
        self._t2 = self._t.addTab(self._l2, 'Notes', self._icon2)
        self._t3 = self._t.addTab(self._l3, 'Issues', self._icon3)

        self._t.addListener(self, tab_sheet.ISelectedTabChangeListener)

        self._toggleEnabled = Button('Disable \'Notes\' tab')
        self._toggleEnabled.addListener(self, button.IClickListener)

        self._toggleVisible = Button('Hide \'Issues\' tab')
        self._toggleVisible.addListener(self, button.IClickListener)

        hl = HorizontalLayout()
        hl.setSpacing(True)
        hl.addComponent(self._toggleEnabled)
        hl.addComponent(self._toggleVisible)

        self.addComponent(self._t)
        self.addComponent(hl)


    def selectedTabChange(self, event):
        selected = event.getTabSheet().getSelectedTab()
        c = self._t.getTab(selected).getCaption()
        self.getWindow().showNotification('Selected tab: ' + c)


    def buttonClick(self, event):
        if self._toggleEnabled == event.getButton():
            # toggleEnabled clicked
            self._t2.setEnabled(not self._t2.isEnabled())
            if self._t2.isEnabled():
                self._toggleEnabled.setCaption('Disable \'Notes\' tab')
            else:
                self._toggleEnabled.setCaption('Enable \'Notes\' tab')
        else:
            # toggleVisible clicked
            self._t3.setVisible(not self._t3.isVisible())
            if self._t3.isVisible():
                self._toggleVisible.setCaption('Hide \'Issues\' tab')
            else:
                self._toggleVisible.setCaption('Show \'Issues\' tab')
        self._t.requestRepaint()
class TabSheetScrollingExample(VerticalLayout, ISelectedTabChangeListener):

    _icon1 = ThemeResource('../sampler/icons/action_save.gif')
    _icon2 = ThemeResource('../sampler/icons/comment_yellow.gif')
    _icon3 = ThemeResource('../sampler/icons/icon_info.gif')

    def __init__(self):
        super(TabSheetScrollingExample, self).__init__()

        # Tab 1 content
        l1 = VerticalLayout()
        l1.setMargin(True)
        l1.addComponent(Label('There are no previously saved actions.'))

        # Tab 2 content
        l2 = VerticalLayout()
        l2.setMargin(True)
        l2.addComponent(Label('There are no saved notes.'))

        # Tab 3 content
        l3 = VerticalLayout()
        l3.setMargin(True)
        l3.addComponent(Label('There are currently no issues.'))

        # Tab 4 content
        l4 = VerticalLayout()
        l4.setMargin(True)
        l4.addComponent(Label('There are no comments.'))

        # Tab 5 content
        l5 = VerticalLayout()
        l5.setMargin(True)
        l5.addComponent(Label('There is no new feedback.'))

        self._t = TabSheet()
        self._t.setHeight('200px')
        self._t.setWidth('400px')
        self._t.addTab(l1, 'Saved actions', self._icon1)
        self._t.addTab(l2, 'Notes', self._icon2)
        self._t.addTab(l3, 'Issues', self._icon3)
        self._t.addTab(l4, 'Comments', self._icon2)
        self._t.addTab(l5, 'Feedback', self._icon2)
        self._t.addListener(self, ISelectedTabChangeListener)

        self.addComponent(self._t)


    def selectedTabChange(self, event):
        tabsheet = event.getTabSheet()
        tab = tabsheet.getTab(tabsheet.getSelectedTab())
        if tab is not None:
            self.getWindow().showNotification('Selected tab: '
                    + tab.getCaption())
class TabSheetClosingExample(VerticalLayout,
            tab_sheet.ISelectedTabChangeListener, tab_sheet.ICloseHandler):

    def __init__(self):
        super(TabSheetClosingExample, self).__init__()

        # Tab 1 content
        l1 = VerticalLayout()
        l1.setMargin(True)
        l1.addComponent(Label('There are no previously saved actions.'))

        # Tab 2 content
        l2 = VerticalLayout()
        l2.setMargin(True)
        l2.addComponent(Label('There are no saved notes.'))

        # Tab 3 content
        l3 = VerticalLayout()
        l3.setMargin(True)
        l3.addComponent(Label('There are currently no issues.'))

        # Tab 4 content
        l4 = VerticalLayout()
        l4.setMargin(True)
        l4.addComponent(Label('There are no comments.'))

        # Tab 5 content
        l5 = VerticalLayout()
        l5.setMargin(True)
        l5.addComponent(Label('There is no new feedback.'))

        self._t = TabSheet()
        self._t.setHeight('200px')
        self._t.setWidth('400px')

        saved = self._t.addTab(l1, 'Saved actions', None)
        saved.setClosable(True)

        notes = self._t.addTab(l2, 'Notes', None)
        notes.setClosable(True)

        issues = self._t.addTab(l3, 'Issues', None)
        issues.setClosable(True)

        comments = self._t.addTab(l4, 'Comments', None)
        comments.setClosable(True)

        feedback = self._t.addTab(l5, 'Feedback', None)
        feedback.setClosable(True)

        self._t.addListener(self, tab_sheet.ISelectedTabChangeListener)
        self._t.setCloseHandler(self)

        self.addComponent(self._t)


    def selectedTabChange(self, event):
        tabsheet = event.getTabSheet()
        tab = tabsheet.getTab(tabsheet.getSelectedTab())
        if tab is not None:
            self.getWindow().showNotification('Selected tab: '
                    + tab.getCaption())


    def onTabClose(self, tabsheet, tabContent):
        self.getWindow().showNotification('Closed tab: '
                + tabsheet.getTab(tabContent).getCaption())
        tabsheet.removeComponent(tabContent)
class TabSheetScrollingExample(VerticalLayout, ISelectedTabChangeListener):

    _icon1 = ThemeResource('../sampler/icons/action_save.gif')
    _icon2 = ThemeResource('../sampler/icons/comment_yellow.gif')
    _icon3 = ThemeResource('../sampler/icons/icon_info.gif')

    def __init__(self):
        super(TabSheetScrollingExample, self).__init__()

        # Tab 1 content
        l1 = VerticalLayout()
        l1.setMargin(True)
        l1.addComponent(Label('There are no previously saved actions.'))

        # Tab 2 content
        l2 = VerticalLayout()
        l2.setMargin(True)
        l2.addComponent(Label('There are no saved notes.'))

        # Tab 3 content
        l3 = VerticalLayout()
        l3.setMargin(True)
        l3.addComponent(Label('There are currently no issues.'))

        # Tab 4 content
        l4 = VerticalLayout()
        l4.setMargin(True)
        l4.addComponent(Label('There are no comments.'))

        # Tab 5 content
        l5 = VerticalLayout()
        l5.setMargin(True)
        l5.addComponent(Label('There is no new feedback.'))

        self._t = TabSheet()
        self._t.setHeight('200px')
        self._t.setWidth('400px')
        self._t.addTab(l1, 'Saved actions', self._icon1)
        self._t.addTab(l2, 'Notes', self._icon2)
        self._t.addTab(l3, 'Issues', self._icon3)
        self._t.addTab(l4, 'Comments', self._icon2)
        self._t.addTab(l5, 'Feedback', self._icon2)
        self._t.addListener(self, ISelectedTabChangeListener)

        self.addComponent(self._t)

    def selectedTabChange(self, event):
        tabsheet = event.getTabSheet()
        tab = tabsheet.getTab(tabsheet.getSelectedTab())
        if tab is not None:
            self.getWindow().showNotification('Selected tab: ' +
                                              tab.getCaption())