Esempio n. 1
0
    def __init__(self, activity, **kwargs):
        palette = RadioPalette()

        self.private = RadioToolButton(
                icon_name='zoom-home')
        palette.append(self.private, _('Private'))

        self.neighborhood = RadioToolButton(
                icon_name='zoom-neighborhood',
                group=self.private)
        self._neighborhood_handle = self.neighborhood.connect(
                'clicked', self.__neighborhood_clicked_cb, activity)
        palette.append(self.neighborhood, _('My Neighborhood'))

        activity.connect('shared', self.__update_share_cb)
        activity.connect('joined', self.__update_share_cb)

        RadioMenuButton.__init__(self, **kwargs)
        self.props.palette = palette
        if activity.max_participants == 1:
            self.props.sensitive = False
palette = RadioPalette()
# Adding 3 RadioToolButtons to a palette

button1 = RadioToolButton(icon_name='document-save',
                          accelerator="<ctrl>S",
                          xo_color=XoColor("white"))
button1.connect('toggled', lambda button: echo(button, 'document-save'))
palette.append(button1, 'menu.document-save')

button2 = RadioToolButton(icon_name='document-open',
                          accelerator="<ctrl>O",
                          xo_color=XoColor("white"),
                          group=button1)
button2.connect('toggled', lambda button: echo(button, 'document-open'))
palette.append(button2, 'menu.document-open')

button3 = RadioToolButton(icon_name='document-send',
                          accelerator="<ctrl>F",
                          xo_color=XoColor("white"),
                          group=button1)
button3.connect('toggled', lambda button: echo(button, 'document-send'))
palette.append(button3, 'menu.document-send')

button = RadioMenuButton(palette=palette)
box.pack_start(button, False, False, 1)
button.show()

if __name__ == '__main__':
    Gtk.main()
Esempio n. 3
0
def echo(button, label):
    if not button.props.active:
        return
    print label


palette = RadioPalette()
# Adding 3 RadioToolButtons to a palette

button1 = RadioToolButton(icon_name='document-save', accelerator="<ctrl>S",
                          xo_color=XoColor("white"))
button1.connect('toggled', lambda button: echo(button, 'document-save'))
palette.append(button1, 'menu.document-save')

button2 = RadioToolButton(icon_name='document-open', accelerator="<ctrl>O",
                          xo_color=XoColor("white"), group=button1)
button2.connect('toggled', lambda button: echo(button, 'document-open'))
palette.append(button2, 'menu.document-open')

button3 = RadioToolButton(icon_name='document-send', accelerator="<ctrl>F",
                          xo_color=XoColor("white"), group=button1)
button3.connect('toggled', lambda button: echo(button, 'document-send'))
palette.append(button3, 'menu.document-send')

button = RadioMenuButton(palette=palette)
box.pack_start(button, False, False, 1)
button.show()

if __name__ == '__main__':
    Gtk.main()
Esempio n. 4
0
palette = RadioPalette()

group = RadioToolButton(icon_name='document-open')
group.connect('clicked', lambda button: echo(button, 'document-open'))
palette.append(group, 'menu.document-open')

button = RadioToolButton(icon_name='document-save', group=group)
button.connect('clicked', lambda button: echo(button, 'document-save'))
palette.append(button, 'menu.document-save')

button = RadioToolButton(icon_name='document-send', group=group)
button.connect('clicked', lambda button: echo(button, 'document-send'))
palette.append(button, 'menu.document-send')

button = RadioMenuButton(palette=palette)
toolbar.insert(button, -1)

# RadioToolsButton

palette = RadioPalette()

group = RadioToolButton(icon_name='document-open')
group.connect('clicked', lambda button: echo(button, 'document-open'))
palette.append(group, 'menu.document-open')

button = RadioToolButton(icon_name='document-save', group=group)
button.connect('clicked', lambda button: echo(button, 'document-save'))
palette.append(button, 'menu.document-save')

button = RadioToolButton(icon_name='document-send', group=group)