Suppress sub-palettes in radiopalette
This commit is contained in:
parent
e5a701a1e6
commit
2655a8ccad
@ -30,21 +30,21 @@ group = RadioToolButton(
|
||||
icon_name='document-open',
|
||||
tooltip='menu.document-open')
|
||||
group.connect('clicked', lambda button: echo(button))
|
||||
palette.append(group)
|
||||
palette.append(group, 'menu.document-open')
|
||||
|
||||
button = RadioToolButton(
|
||||
icon_name='document-save',
|
||||
group=group,
|
||||
tooltip='menu.document-save')
|
||||
button.connect('clicked', lambda button: echo(button))
|
||||
palette.append(button)
|
||||
palette.append(button, 'menu.document-save')
|
||||
|
||||
button = RadioToolButton(
|
||||
icon_name='document-send',
|
||||
group=group,
|
||||
tooltip='menu.document-send')
|
||||
button.connect('clicked', lambda button: echo(button))
|
||||
palette.append(button)
|
||||
palette.append(button, 'menu.document-send')
|
||||
|
||||
button = RadioMenuButton(palette=palette)
|
||||
toolbar.insert(button, -1)
|
||||
@ -57,21 +57,21 @@ group = RadioToolButton(
|
||||
icon_name='document-open',
|
||||
tooltip='menu.document-open')
|
||||
group.connect('clicked', lambda button: echo(button))
|
||||
palette.append(group)
|
||||
palette.append(group, 'menu.document-open')
|
||||
|
||||
button = RadioToolButton(
|
||||
icon_name='document-save',
|
||||
group=group,
|
||||
tooltip='menu.document-save')
|
||||
button.connect('clicked', lambda button: echo(button))
|
||||
palette.append(button)
|
||||
palette.append(button, 'menu.document-save')
|
||||
|
||||
button = RadioToolButton(
|
||||
icon_name='document-send',
|
||||
group=group,
|
||||
tooltip='menu.document-send')
|
||||
button.connect('clicked', lambda button: echo(button))
|
||||
palette.append(button)
|
||||
palette.append(button, 'menu.document-send')
|
||||
|
||||
button = RadioToolsButton(palette=palette)
|
||||
toolbar.insert(button, -1)
|
||||
|
@ -1061,16 +1061,14 @@ def share_button(activity, **kwargs):
|
||||
palette = RadioPalette()
|
||||
|
||||
private = RadioToolButton(
|
||||
icon_name='zoom-home',
|
||||
tooltip=_('Private'))
|
||||
palette.append(private)
|
||||
icon_name='zoom-home')
|
||||
palette.append(private, _('Private'))
|
||||
|
||||
neighborhood = RadioToolButton(
|
||||
icon_name='zoom-neighborhood',
|
||||
group=private,
|
||||
tooltip=_('My Neighborhood'))
|
||||
group=private)
|
||||
neighborhood.connect('clicked', neighborhood_cb)
|
||||
palette.append(neighborhood)
|
||||
palette.append(neighborhood, _('My Neighborhood'))
|
||||
|
||||
def update_share():
|
||||
neighborhood.handler_block_by_func(neighborhood_cb)
|
||||
|
@ -88,12 +88,16 @@ class RadioPalette(Palette):
|
||||
self.top.show()
|
||||
self.set_content(self.top)
|
||||
|
||||
def append(self, button):
|
||||
def append(self, button, label):
|
||||
children = self.top.get_children()
|
||||
|
||||
# palette's button should not have sub-palettes
|
||||
button.palette = None
|
||||
|
||||
button.show()
|
||||
button.connect('clicked', self.__clicked_cb)
|
||||
self.top.pack_start(button, fill=False)
|
||||
button.__palette_label = label
|
||||
|
||||
if not children:
|
||||
self.__clicked_cb(button, True)
|
||||
@ -106,7 +110,7 @@ class RadioPalette(Palette):
|
||||
if not button.get_active():
|
||||
return
|
||||
|
||||
self.set_primary_text(button.props.tooltip)
|
||||
self.set_primary_text(button.__palette_label)
|
||||
if not quiet:
|
||||
self.popdown(immediate=True)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user