Fix review issues

This commit is contained in:
Aleksey Lim
2009-07-29 15:33:02 +00:00
parent 0cf445eb0f
commit 872b18a103
5 changed files with 116 additions and 110 deletions
+23 -21
View File
@@ -75,6 +75,7 @@ from sugar.graphics.icon import Icon
from sugar.graphics.xocolor import XoColor
from sugar.graphics.toolbar import Toolbar, ToolbarButton
from sugar.graphics.radiopalette import RadioPalette, RadioMenuButton
from sugar.graphics.radiotoolbutton import RadioToolButton
from sugar.datastore import datastore
from sugar.session import XSMPClient
from sugar import wm
@@ -1054,35 +1055,36 @@ def paste_button(**kwargs):
return paste
def share_button(activity, **kwargs):
quiet_trigger = []
def neighborhood_cb():
if quiet_trigger:
return
def neighborhood_cb(button):
activity.share()
palette = RadioPalette()
private = palette.append(
private = RadioToolButton(
icon_name='zoom-home',
tooltip=_('Private'))
neighborhood = palette.append(
palette.append(private)
neighborhood = RadioToolButton(
icon_name='zoom-neighborhood',
tooltip=_('My Neighborhood'),
toggled_cb=neighborhood_cb)
group=private,
tooltip=_('My Neighborhood'))
neighborhood.connect('clicked', neighborhood_cb)
palette.append(neighborhood)
def update_share():
quiet_trigger.append(True)
if activity.get_shared():
private.props.sensitive = False
neighborhood.props.sensitive = False
neighborhood.props.active = True
else:
private.props.sensitive = True
neighborhood.props.sensitive = True
private.props.active = True
quiet_trigger.pop()
neighborhood.handler_block_by_func(neighborhood_cb)
try:
if activity.get_shared():
private.props.sensitive = False
neighborhood.props.sensitive = False
neighborhood.props.active = True
else:
private.props.sensitive = True
neighborhood.props.sensitive = True
private.props.active = True
finally:
neighborhood.handler_unblock_by_func(neighborhood_cb)
activity.connect('shared', lambda activity: update_share())
activity.connect('joined', lambda activity: update_share())