Exemple #1
0
 def __init__(self, node, expanded=True):
     self._node = node
     self._innerwidget = None
     self.is_leaf = not hasattr(node, 'get_first_child')
     self.expanded = expanded
     widget = self.get_indented_widget()
     # Se omite la inicializacion de TreeWidget
     WidgetWrap.__init__(self, widget)
 def __init__(self, transport=None):
     self.transport = transport or self.transport
     WidgetWrap.__init__(self, AttrMap(Columns([
         ('weight', 1, PlayButton(self.transport)),
         ('weight', 1, RewindButton(self.transport)),
         ('weight', 3, Text('')),
         ('weight', 1, MetronomeWidget(self.transport)),
         ('weight', 1, TempoWidget(self.transport)),
         ('weight', 1, Text('Quant 1 bar')),
     ], 1), 'footer'))
    def __init__(self, icon, label, on_press=None, user_data=None): 
        self._icon  = AttrMap(SelectableIcon(icon, 0), 'clip_dim')
        self._label = SelectableIcon(label, 0)

        cols = Columns([
            ('fixed', len(icon), self._icon),
            self._label],
            dividechars=1)
        WidgetWrap.__init__(self, cols)

        connect_signal(self, 'click', on_press, user_data)
Exemple #4
0
 def __init__(self, tabs=[]):
     """Creates tabs with the names given in `tabs`."""
     self.tabs = tabs
     if tabs:
         self.active_index = 0
         self.visible_indexes = [0]
     else:
         self.active_index = -1
         self.visible_indexes = []
     created_text = self._create_text()
     text = created_text if created_text else ''
     WidgetWrap.__init__(self, Text(text))
    def __init__(self, ui=None, track=None, number=None):
        self.ui     = ui     or self.ui
        self.track  = track  or self.track
        self.number = number or self.number
 
        self.header = TrackHeader(self.track.name, number)
        self.clips = SimpleFocusListWalker(
            [ClipButton(self.ui, c) for c in self.track.clips] +
            [AddClipButton(self.on_add_button)])

        Clip.ON_ADD.append(self.on_clip_added)

        WidgetWrap.__init__(self, Frame(ListBox(self.clips),
                                        header=self.header))
Exemple #6
0
    def __init__(self, original_widget, title="",
                 tlcorner=u'┌', tline=u'─', lline=u'│',
                 trcorner=u'┐', blcorner=u'└', rline=u'│',
                 bline=u'─', brcorner=u'┘'):
        """
        Use 'title' to set an initial title text with will be centered
        on top of the box.

        You can also override the widgets used for the lines/corners:
            tline: top line
            bline: bottom line
            lline: left line
            rline: right line
            tlcorner: top left corner
            trcorner: top right corner
            blcorner: bottom left corner
            brcorner: bottom right corner
        """

        tline, bline = Divider(tline), Divider(bline)
        lline, rline = SolidFill(lline), SolidFill(rline)
        tlcorner, trcorner = Text(tlcorner), Text(trcorner)
        blcorner, brcorner = Text(blcorner), Text(brcorner)

        title_widget = ('fixed', len(title), AttrMap(Text(title), 'header'))
        top = Columns([
            ('fixed', 1, tlcorner),
            title_widget,
            tline,
            ('fixed', 1, trcorner)
        ])

        middle = Columns([('fixed', 1, lline),
                          original_widget,
                          ('fixed', 1, rline)],
                         box_columns=[0, 2],
                         focus_column=1)

        bottom = Columns([('fixed', 1, blcorner),
                          bline,
                          ('fixed', 1, brcorner)])

        pile = Pile([('flow', top),
                    middle,
                    ('flow', bottom)],
                    focus_item=1)

        # super?
        WidgetDecoration.__init__(self, original_widget)
        WidgetWrap.__init__(self, pile)
Exemple #7
0
   def __init__(self, height, directory=".", file="", attr=(None, None),
                show_hidden=False):
       """
       height -- height of the directory list and the file list
       directory, file -- default selection
       attr -- (inner selectable widgets, selected widgets)
       show_hidden -- If True, hidden files are shown by default.
       """

       self.directory = abspath(directory)
       self.file = ""
       self.attr = attr
       self.height = height
       self.show_hidden=show_hidden

       #Create dummy widgets for directory and file display:
       self.dir_widget = AttrWrap(BoxAdapter(ListBox([self._blank]),
                                                 self.height), self.attr[0])
       self.file_widget = AttrWrap(BoxAdapter(ListBox([self._blank]),
                                              self.height), self.attr[0])

       columns = Columns([self.dir_widget, self.file_widget], 1)

       #Selection widget:
       self.select_widget = AttrWrap(Edit("", ""),
                                     self.attr[0], self.attr[1])

       #Buttons and checkbox:
       button_widgets = [AttrWrap(Button(button, self._action),
                                  attr[0], attr[1])
                         for button in ["OK", "Cancel"]]
       button_grid = GridFlow(button_widgets, 12, 2, 1, 'center')

       button_cols = Columns([CheckBox(self.SHOW_HIDDEN_TEXT,
                                       self.show_hidden,
                                       False, self._toggle_hidden),
                             button_grid])

       self.outer_widget = Pile([columns,
                                self._blank,
                                Text(self.SELECTION_TEXT),
                                self.select_widget,
                                self._blank,
                                button_cols
                                ])

       self.update_widgets()

       WidgetWrap.__init__(self, self.outer_widget)
Exemple #8
0
    def __init__(self,
                 original_widget,
                 title="",
                 tlcorner=u'┌',
                 tline=u'─',
                 lline=u'│',
                 trcorner=u'┐',
                 blcorner=u'└',
                 rline=u'│',
                 bline=u'─',
                 brcorner=u'┘'):
        """
        Use 'title' to set an initial title text with will be centered
        on top of the box.

        You can also override the widgets used for the lines/corners:
            tline: top line
            bline: bottom line
            lline: left line
            rline: right line
            tlcorner: top left corner
            trcorner: top right corner
            blcorner: bottom left corner
            brcorner: bottom right corner
        """

        tline, bline = Divider(tline), Divider(bline)
        lline, rline = SolidFill(lline), SolidFill(rline)
        tlcorner, trcorner = Text(tlcorner), Text(trcorner)
        blcorner, brcorner = Text(blcorner), Text(brcorner)

        title_widget = ('fixed', len(title), AttrMap(Text(title), 'header'))
        top = Columns([('fixed', 1, tlcorner), title_widget, tline,
                       ('fixed', 1, trcorner)])

        middle = Columns([('fixed', 1, lline), original_widget,
                          ('fixed', 1, rline)],
                         box_columns=[0, 2],
                         focus_column=1)

        bottom = Columns([('fixed', 1, blcorner), bline,
                          ('fixed', 1, brcorner)])

        pile = Pile([('flow', top), middle, ('flow', bottom)], focus_item=1)

        # super?
        WidgetDecoration.__init__(self, original_widget)
        WidgetWrap.__init__(self, pile)
Exemple #9
0
    def __init__(self, done_handler, note=None):
        self.modes = ['title', 'tags', 'text']
        self.mode = self.modes[0]
        self.note = note
        if note is None:
            self.title = ''
            self.tags = ''
            self.text = ''
        else:
            self.title = note.title
            self.tags = note.formatted_tags()
            self.text = note.text

        self.editor = Edit(u'title :: ', self.title)
        connect_signal(self, 'done', done_handler)
        WidgetWrap.__init__(self, self.editor)
Exemple #10
0
    def __init__(self, user, last_statuses):
        """
        Receive a ``user`` and its ``last_statuses`` to render the widget.
        """
        whitespace = Divider(' ')
        widgets = []

        # name
        name = Text('%s' % user.name)
        widgets.extend([name, whitespace])

        # bio
        if user.description:
            description = Text(parse_attributes(user.description))
            widgets.extend([description, whitespace])

        # URL
        if user.url:
            url_text_with_attr = ('url', user.url)
            url = Text(url_text_with_attr)

            widgets.extend([url, whitespace])

        # statistics: following, followers and favorites
        # TODO: tweet count
        following = Text(_('following:\n%s' % user.friends_count))
        followers = Text(_('followers:\n%s' % user.followers_count))
        favorites = Text(_('favorites:\n%s' % user.favorites_count))
        stats = Columns([following, followers, favorites])

        widgets.extend([stats, whitespace])

        # Last n statuses
        # TODO: make it configurable
        statuses_to_show = configuration.styles['statuses_in_user_info']
        status_widgets = [
            StatusWidget(status) for status in last_statuses[:statuses_to_show]
        ]
        widgets.extend(status_widgets)

        pile = Pile(widgets)

        WidgetWrap.__init__(
            self, LineBox(title='@%s' % user.screen_name,
                          original_widget=pile))
Exemple #11
0
    def __init__(self, original_widget, title=None, title_attr=None, attr=None):#{{{

        self.title = title
        self.title_attr = title_attr
        self.attr = attr
        self._attr = attr

        def _get_attr(w):
            if attr is not None:
                return AttrMap(w, attr)
            return w

        self.tline = _get_attr(Divider(utf8decode("─")))
        self.bline = _get_attr(Divider(utf8decode("─")))
        self.lline = _get_attr(SolidFill(utf8decode("│")))
        self.rline = _get_attr(SolidFill(utf8decode("│")))

        self.tlcorner = _get_attr(Text(utf8decode("┌")))
        self.trcorner = _get_attr(Text(utf8decode("┐")))
        self.blcorner = _get_attr(Text(utf8decode("└")))
        self.brcorner = _get_attr(Text(utf8decode("┘")))

        self._title_text = Text(" %s " % self.title, 'center')
        self._title = AttrMap(self._title_text, self.title_attr)

        top = Columns([('fixed', 1, self.tlcorner),
                       self.tline,
                       ('fixed', len(self.title)+2, self._title),
                       self.tline,
                       ('fixed', 1, self.trcorner)])

        middle = Columns([('fixed', 1, self.lline),
                         original_widget,
                         ('fixed', 1, self.rline)],
                         box_columns=[0,2],
                         focus_column=1)

        bottom = Columns([('fixed', 1, self.blcorner),
                          self.bline,
                          ('fixed', 1, self.brcorner)])

        pile = Pile([('flow', top), middle, ('flow', bottom)], focus_item=1)

        WidgetDecoration.__init__(self, original_widget)
        WidgetWrap.__init__(self, pile)
Exemple #12
0
    def __init__(self):
        self._editor = None

        # header
        header = TabsWidget()

        # body
        body = Banner()

        # footer
        self._status_bar = configuration.styles.get('status_bar', False)
        if self._status_bar:
            footer = StatusBar('')
        else:
            footer = None

        self.frame = Frame(body, header=header, footer=footer)

        WidgetWrap.__init__(self, self.frame)
Exemple #13
0
    def __init__(self, user, last_statuses):
        """
        Receive a ``user`` and its ``last_statuses`` to render the widget.
        """
        whitespace = Divider(' ')
        widgets = []

        # name
        name = Text('%s' % user.name)
        widgets.extend([name, whitespace])

        # bio
        if user.description:
            description = Text(parse_attributes(user.description))
            widgets.extend([description, whitespace])

        # URL
        if user.url:
            url_text_with_attr = ('url', user.url)
            url = Text(url_text_with_attr)

            widgets.extend([url, whitespace])

        # statistics: following, followers and favorites
        # TODO: tweet count
        following = Text(_('following:\n%s' % user.friends_count))
        followers = Text(_('followers:\n%s' % user.followers_count))
        favorites = Text(_('favorites:\n%s' % user.favorites_count))
        stats = Columns([following, followers, favorites])

        widgets.extend([stats, whitespace])

        # Last n statuses
        # TODO: make it configurable
        statuses_to_show = configuration.styles['statuses_in_user_info']
        status_widgets = [StatusWidget(status) for status in last_statuses[:statuses_to_show]]
        widgets.extend(status_widgets)

        pile = Pile(widgets)

        WidgetWrap.__init__(self, LineBox(title='@%s' % user.screen_name,
                                          original_widget=pile))
Exemple #14
0
    def __init__(self, configuration):
        self._configuration = configuration
        self._editor = None

        # header
        header = TabsWidget()

        # body
        body = Banner(configuration)

        # footer
        self._status_bar = configuration.styles.get("status_bar", False)
        if self._status_bar:
            footer = StatusBar("")
        else:
            footer = None

        self.frame = Frame(body, header=header, footer=footer)

        WidgetWrap.__init__(self, self.frame)
Exemple #15
0
    def __init__(self, user, configuration):
        """
        """
        whitespace = Divider(' ')
        widgets = []

        # name
        name = Text('%s' % user.name)
        widgets.extend([name, whitespace])

        # bio
        if user.description:
            description = Text(parse_attributes(user.description))
            widgets.extend([description, whitespace])

        # URL
        if user.url:
            url_text_with_attr = ('url', user.url)
            url = Text(url_text_with_attr)

            widgets.extend([url, whitespace])

        # statistics: following, followers and favorites
        following = Text(_('following:\n%s' % user.friends_count))
        followers = Text(_('followers:\n%s' % user.followers_count))
        favorites = Text(_('favorites:\n%s' % user.favorites_count))
        stats = Columns([following, followers, favorites])

        widgets.extend([stats, whitespace])

        # last status
        if user.status:
            status = StatusWidget(user.status, configuration)
            widgets.append(status)

        pile = Pile(widgets)

        WidgetWrap.__init__(self, LineBox(title='@%s' % user.screen_name,
                                          original_widget=pile))
Exemple #16
0
    def __init__(self, user):
        """
        """
        whitespace = Divider(' ')
        widgets = []

        # name
        name = Text('%s' % user.name)
        widgets.extend([name, whitespace])

        # bio
        if user.description:
            description = Text(parse_attributes(user.description))
            widgets.extend([description, whitespace])

        # URL
        if user.url:
            url_text_with_attr = ('url', user.url)
            url = Text(url_text_with_attr)

            widgets.extend([url, whitespace])

        # statistics: following, followers and favorites
        following = Text(_('following:\n%s' % user.friends_count))
        followers = Text(_('followers:\n%s' % user.followers_count))
        favorites = Text(_('favorites:\n%s' % user.favorites_count))
        stats = Columns([following, followers, favorites])

        widgets.extend([stats, whitespace])

        # last status
        if user.status:
            status = StatusWidget(user.status)
            widgets.append(status)

        pile = Pile(widgets)

        WidgetWrap.__init__(self, LineBox(title='@%s' % user.screen_name,
                                          original_widget=pile))
    def __init__(self, app):
        ClipLauncherUI.__init__(self, app)

        # set colors
        self.app.main_loop.screen.register_palette(self.palette)

        # create widgets
        tracks = enumerate(self.app.tracks)
        self.cols   = Columns(SimpleFocusListWalker(
            [TrackWidget(self, t, n + 1) for n, t in tracks]),
            self.track_spacing)
        self.editor = Panel()
        self.header = TransportWidget(app.transport)
        self.footer = AttrMap(Text('foo'), 'footer')

        # listen to events
        INFO.append(self.on_info)

        # init as pile of widgets
        WidgetWrap.__init__(self, Pile([
            ('pack', self.header),
            self.cols,
            (10, self.editor),
            ('pack', self.footer)]))
    def __init__(self, app):
        ClipLauncherUI.__init__(self, app)

        # set colors
        self.app.main_loop.screen.register_palette(self.palette)

        # create widgets
        tracks = enumerate(self.app.tracks)
        self.cols = Columns(
            SimpleFocusListWalker(
                [TrackWidget(self, t, n + 1) for n, t in tracks]),
            self.track_spacing)
        self.editor = Panel()
        self.header = TransportWidget(app.transport)
        self.footer = AttrMap(Text('foo'), 'footer')

        # listen to events
        INFO.append(self.on_info)

        # init as pile of widgets
        WidgetWrap.__init__(
            self,
            Pile([('pack', self.header), self.cols, (10, self.editor),
                  ('pack', self.footer)]))
Exemple #19
0
 def __init__(self, timelines=None, **kwargs):
     if timelines:
         timeline_widgets = [TimelineWidget(timeline, **kwargs) for timeline in timelines]
     else:
         timeline_widgets = []
     WidgetWrap.__init__(self, Columns(timeline_widgets))
Exemple #20
0
 def __init__(self, contents=None):
     columns = [] if contents is None else contents
     WidgetWrap.__init__(self, columns)
Exemple #21
0
 def __init__(self, text=''):
     WidgetWrap.__init__(self, Text(text))
Exemple #22
0
    def _wrap(self, widgets):
        widgets = widgets if isinstance(widgets, list) else [widgets]
        composed_widget = Columns(widgets)

        widget = AttrMap(LineBox(composed_widget), 'editor')
        WidgetWrap.__init__(self, widget)
Exemple #23
0
 def __init__(self, text=''):
     WidgetWrap.__init__(self, Text(text))
Exemple #24
0
 def __init__(self, contents=None):
     columns = [] if contents is None else contents
     WidgetWrap.__init__(self, columns)
Exemple #25
0
    def __init__(self, original_widget, title=''):
        self.color = 'header'

        def use_attr(a, t):
            if a:
                t = AttrMap(t, a)
            return t

        # top line
        tline = None
        tline_attr = Columns([('fixed', 2, 
                                        Divider(u"─")),
                                    ('fixed', len(title), 
                                        AttrMap(Text(title), self.color)),
                                    Divider(u"─"),])
        tline = use_attr(tline, tline_attr)
        # bottom line
        bline = None
        bline = use_attr(bline, Divider(u"─"))
        # left line
        lline = None
        lline = use_attr(lline, SolidFill(u"│"))
        # right line
        rline = None
        rline = use_attr(rline, SolidFill(u"│"))
        # top left corner
        tlcorner = None
        tlcorner = use_attr(tlcorner, Text(u"┌"))
        # top right corner
        trcorner = None
        trcorner = use_attr(trcorner, Text(u"┐"))
        # bottom left corner
        blcorner = None
        blcorner = use_attr(blcorner, Text(u"└"))
        # bottom right corner
        brcorner = None
        brcorner = use_attr(brcorner, Text(u"┘"))

        # top
        top = Columns([('fixed', 1, tlcorner),
                             tline, 
                             ('fixed', 1, trcorner),])
        # middle
        middle = Columns([('fixed', 1, lline),
                                original_widget, 
                                ('fixed', 1, rline)], 
                               box_columns = [0,2], 
                               focus_column = 1)
        # bottom
        bottom = Columns([('fixed', 1, blcorner),
                                bline, 
                                ('fixed', 1, brcorner)])

        # widget decoration
        pile = Pile([('flow',top),
                           middle,
                           ('flow',bottom)], 
                          focus_item = 1)

        WidgetDecoration.__init__(self, original_widget)
        WidgetWrap.__init__(self, pile)
 def __init__(self, name, number):
     WidgetWrap.__init__(self, BoxAdapter(Filler(BaseClipButton(
         str(number).rjust(3), name), top=1, bottom=1), height=3))
 def __init__(self):
     WidgetWrap.__init__(self, self.wrap(ListBox([])))
Exemple #28
0
    def _wrap(self, widgets):
        widgets = widgets if isinstance(widgets, list) else [widgets]
        composed_widget = Columns(widgets)

        widget = AttrMap(LineBox(composed_widget), 'editor')
        WidgetWrap.__init__(self, widget)
Exemple #29
0
 def __init__(self, cap):
     WidgetWrap.__init__(self, MenuButton(cap, self.item_chosen))
     self.cap = cap