Fix review issues

This commit is contained in:
Aleksey Lim 2009-07-31 10:25:01 +00:00
parent d5c5ee88ec
commit 4d6a2cc9bd
2 changed files with 29 additions and 28 deletions

View File

@ -90,7 +90,7 @@ class ShareButton(RadioMenuButton):
self.neighborhood = RadioToolButton( self.neighborhood = RadioToolButton(
icon_name='zoom-neighborhood', icon_name='zoom-neighborhood',
group=self.private) group=self.private)
self.__neighborhood_handle = self.neighborhood.connect( self._neighborhood_handle = self.neighborhood.connect(
'clicked', self.__neighborhood_clicked_cb, activity) 'clicked', self.__neighborhood_clicked_cb, activity)
palette.append(self.neighborhood, _('My Neighborhood')) palette.append(self.neighborhood, _('My Neighborhood'))
@ -104,7 +104,7 @@ class ShareButton(RadioMenuButton):
activity.share() activity.share()
def __update_share_cb(self, activity): def __update_share_cb(self, activity):
self.neighborhood.handler_block(self.__neighborhood_handle) self.neighborhood.handler_block(self._neighborhood_handle)
try: try:
if activity.get_shared(): if activity.get_shared():
self.private.props.sensitive = False self.private.props.sensitive = False
@ -115,7 +115,7 @@ class ShareButton(RadioMenuButton):
self.neighborhood.props.sensitive = True self.neighborhood.props.sensitive = True
self.private.props.active = True self.private.props.active = True
finally: finally:
self.neighborhood.handler_unblock(self.__neighborhood_handle) self.neighborhood.handler_unblock(self._neighborhood_handle)
class KeepButton(ToolButton): class KeepButton(ToolButton):
def __init__(self, activity, **kwargs): def __init__(self, activity, **kwargs):
@ -129,15 +129,15 @@ class KeepButton(ToolButton):
keep_icon.show() keep_icon.show()
self.set_icon_widget(keep_icon) self.set_icon_widget(keep_icon)
self.connect('clicked', self.__keep_button_clicked, activity) self.connect('clicked', self.__keep_button_clicked_cb, activity)
def __keep_button_clicked(self, button, activity): def __keep_button_clicked_cb(self, button, activity):
activity.copy() activity.copy()
class TitleEntry(gtk.Entry): class TitleEntry(gtk.Entry):
def __init__(self, activity, **kwargs): def __init__(self, activity, **kwargs):
gtk.Entry.__init__(self, **kwargs) gtk.Entry.__init__(self, **kwargs)
self.__update_title_sid = None self._update_title_sid = None
self.set_size_request(int(gtk.gdk.screen_width() / 3), -1) self.set_size_request(int(gtk.gdk.screen_width() / 3), -1)
self.set_text(activity.metadata['title']) self.set_text(activity.metadata['title'])
@ -149,8 +149,8 @@ class TitleEntry(gtk.Entry):
self.set_text(jobject['title']) self.set_text(jobject['title'])
def __title_changed_cb(self, entry, activity): def __title_changed_cb(self, entry, activity):
if not self.__update_title_sid: if not self._update_title_sid:
self.__update_title_sid = gobject.timeout_add_seconds( self._update_title_sid = gobject.timeout_add_seconds(
1, self.__update_title_cb, activity) 1, self.__update_title_cb, activity)
def __update_title_cb(self, activity): def __update_title_cb(self, activity):
@ -164,7 +164,7 @@ class TitleEntry(gtk.Entry):
if shared_activity is None: if shared_activity is None:
shared_activity.props.name = title shared_activity.props.name = title
self.__update_title_sid = None self._update_title_sid = None
return False return False
class ActivityToolbar(gtk.Toolbar): class ActivityToolbar(gtk.Toolbar):

View File

@ -119,11 +119,11 @@ class ToolbarBox(gtk.VBox):
gtk.VBox.__init__(self) gtk.VBox.__init__(self)
self.expanded_button = None self.expanded_button = None
self.__toolbar = gtk.Toolbar() self._toolbar = gtk.Toolbar()
self.__toolbar.owner = self self._toolbar.owner = self
self.__toolbar.connect('remove', self.__remove_cb) self._toolbar.connect('remove', self.__remove_cb)
top_widget = _embody_page(gtk.EventBox, self.__toolbar) top_widget = _embody_page(gtk.EventBox, self._toolbar)
self.pack_start(top_widget) self.pack_start(top_widget)
self.props.padding = padding self.props.padding = padding
@ -138,7 +138,7 @@ class ToolbarBox(gtk.VBox):
self.remove(button.page_widget) self.remove(button.page_widget)
self.expanded_button = None self.expanded_button = None
toolbar = property(lambda self: self.__toolbar) toolbar = property(lambda self: self._toolbar)
def get_padding(self): def get_padding(self):
return self.toolbar.parent.props.left_padding return self.toolbar.parent.props.left_padding
@ -162,7 +162,7 @@ class _Box(gtk.EventBox):
self.set_app_paintable(True) self.set_app_paintable(True)
def do_expose_event(self, widget, event): def do_expose_event(self, widget, event):
a = self.toolbar_button.allocation alloc = self.toolbar_button.allocation
self.get_style().paint_box(event.window, self.get_style().paint_box(event.window,
gtk.STATE_NORMAL, gtk.SHADOW_IN, event.area, self, gtk.STATE_NORMAL, gtk.SHADOW_IN, event.area, self,
'palette-invoker', -style._FOCUS_LINE_WIDTH, 0, 'palette-invoker', -style._FOCUS_LINE_WIDTH, 0,
@ -170,8 +170,9 @@ class _Box(gtk.EventBox):
self.allocation.height + style._FOCUS_LINE_WIDTH) self.allocation.height + style._FOCUS_LINE_WIDTH)
self.get_style().paint_box(event.window, self.get_style().paint_box(event.window,
gtk.STATE_NORMAL, gtk.SHADOW_NONE, event.area, self, None, gtk.STATE_NORMAL, gtk.SHADOW_NONE, event.area, self, None,
a.x + style._FOCUS_LINE_WIDTH, 0, alloc.x + style._FOCUS_LINE_WIDTH, 0,
a.width - style._FOCUS_LINE_WIDTH*2, style._FOCUS_LINE_WIDTH) alloc.width - style._FOCUS_LINE_WIDTH*2,
style._FOCUS_LINE_WIDTH)
class _Palette(gtk.Window): class _Palette(gtk.Window):
def __init__(self, toolitem, **kwargs): def __init__(self, toolitem, **kwargs):
@ -185,7 +186,7 @@ class _Palette(gtk.Window):
self._invoker = None self._invoker = None
self._up = False self._up = False
self._invoker_hids = [] self._invoker_hids = []
self.__focus = 0 self._focus = 0
self._popup_anim = Animator(.5, 10) self._popup_anim = Animator(.5, 10)
self._popup_anim.add(_PopupAnimation(self)) self._popup_anim.add(_PopupAnimation(self))
@ -297,27 +298,27 @@ class _Palette(gtk.Window):
self.popup(immediate=False) self.popup(immediate=False)
def __handle_focus(self, delta): def _handle_focus(self, delta):
self.__focus += delta self._focus += delta
if self.__focus not in (0, 1): if self._focus not in (0, 1):
logging.error('_Palette.__focus=%s not in (0, 1)' % self.__focus) logging.error('_Palette._focus=%s not in (0, 1)' % self._focus)
if self.__focus == 0: if self._focus == 0:
group = palettegroup.get_group('default') group = palettegroup.get_group('default')
if not group.is_up(): if not group.is_up():
self.popdown() self.popdown()
def __group_popdown_cb(self, group): def __group_popdown_cb(self, group):
if self.__focus == 0: if self._focus == 0:
self.popdown(immediate=True) self.popdown(immediate=True)
def __invoker_mouse_enter_cb(self, invoker): def __invoker_mouse_enter_cb(self, invoker):
self._mouse_detector.start() self._mouse_detector.start()
self.__handle_focus(+1) self._handle_focus(+1)
def __invoker_mouse_leave_cb(self, invoker): def __invoker_mouse_leave_cb(self, invoker):
self._mouse_detector.stop() self._mouse_detector.stop()
self.__handle_focus(-1) self._handle_focus(-1)
def __invoker_right_click_cb(self, invoker): def __invoker_right_click_cb(self, invoker):
self.popup(immediate=True) self.popup(immediate=True)
@ -326,12 +327,12 @@ class _Palette(gtk.Window):
if event.detail != gtk.gdk.NOTIFY_INFERIOR and \ if event.detail != gtk.gdk.NOTIFY_INFERIOR and \
event.mode == gtk.gdk.CROSSING_NORMAL: event.mode == gtk.gdk.CROSSING_NORMAL:
self._popdown_anim.stop() self._popdown_anim.stop()
self.__handle_focus(+1) self._handle_focus(+1)
def __leave_notify_event_cb(self, widget, event): def __leave_notify_event_cb(self, widget, event):
if event.detail != gtk.gdk.NOTIFY_INFERIOR and \ if event.detail != gtk.gdk.NOTIFY_INFERIOR and \
event.mode == gtk.gdk.CROSSING_NORMAL: event.mode == gtk.gdk.CROSSING_NORMAL:
self.__handle_focus(-1) self._handle_focus(-1)
def __show_cb(self, widget): def __show_cb(self, widget):
self._invoker.notify_popup() self._invoker.notify_popup()