Fix review issues
This commit is contained in:
parent
d5c5ee88ec
commit
4d6a2cc9bd
@ -90,7 +90,7 @@ class ShareButton(RadioMenuButton):
|
||||
self.neighborhood = RadioToolButton(
|
||||
icon_name='zoom-neighborhood',
|
||||
group=self.private)
|
||||
self.__neighborhood_handle = self.neighborhood.connect(
|
||||
self._neighborhood_handle = self.neighborhood.connect(
|
||||
'clicked', self.__neighborhood_clicked_cb, activity)
|
||||
palette.append(self.neighborhood, _('My Neighborhood'))
|
||||
|
||||
@ -104,7 +104,7 @@ class ShareButton(RadioMenuButton):
|
||||
activity.share()
|
||||
|
||||
def __update_share_cb(self, activity):
|
||||
self.neighborhood.handler_block(self.__neighborhood_handle)
|
||||
self.neighborhood.handler_block(self._neighborhood_handle)
|
||||
try:
|
||||
if activity.get_shared():
|
||||
self.private.props.sensitive = False
|
||||
@ -115,7 +115,7 @@ class ShareButton(RadioMenuButton):
|
||||
self.neighborhood.props.sensitive = True
|
||||
self.private.props.active = True
|
||||
finally:
|
||||
self.neighborhood.handler_unblock(self.__neighborhood_handle)
|
||||
self.neighborhood.handler_unblock(self._neighborhood_handle)
|
||||
|
||||
class KeepButton(ToolButton):
|
||||
def __init__(self, activity, **kwargs):
|
||||
@ -129,15 +129,15 @@ class KeepButton(ToolButton):
|
||||
keep_icon.show()
|
||||
|
||||
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()
|
||||
|
||||
class TitleEntry(gtk.Entry):
|
||||
def __init__(self, activity, **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_text(activity.metadata['title'])
|
||||
@ -149,8 +149,8 @@ class TitleEntry(gtk.Entry):
|
||||
self.set_text(jobject['title'])
|
||||
|
||||
def __title_changed_cb(self, entry, activity):
|
||||
if not self.__update_title_sid:
|
||||
self.__update_title_sid = gobject.timeout_add_seconds(
|
||||
if not self._update_title_sid:
|
||||
self._update_title_sid = gobject.timeout_add_seconds(
|
||||
1, self.__update_title_cb, activity)
|
||||
|
||||
def __update_title_cb(self, activity):
|
||||
@ -164,7 +164,7 @@ class TitleEntry(gtk.Entry):
|
||||
if shared_activity is None:
|
||||
shared_activity.props.name = title
|
||||
|
||||
self.__update_title_sid = None
|
||||
self._update_title_sid = None
|
||||
return False
|
||||
|
||||
class ActivityToolbar(gtk.Toolbar):
|
||||
|
@ -119,11 +119,11 @@ class ToolbarBox(gtk.VBox):
|
||||
gtk.VBox.__init__(self)
|
||||
self.expanded_button = None
|
||||
|
||||
self.__toolbar = gtk.Toolbar()
|
||||
self.__toolbar.owner = self
|
||||
self.__toolbar.connect('remove', self.__remove_cb)
|
||||
self._toolbar = gtk.Toolbar()
|
||||
self._toolbar.owner = self
|
||||
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.props.padding = padding
|
||||
@ -138,7 +138,7 @@ class ToolbarBox(gtk.VBox):
|
||||
self.remove(button.page_widget)
|
||||
self.expanded_button = None
|
||||
|
||||
toolbar = property(lambda self: self.__toolbar)
|
||||
toolbar = property(lambda self: self._toolbar)
|
||||
|
||||
def get_padding(self):
|
||||
return self.toolbar.parent.props.left_padding
|
||||
@ -162,7 +162,7 @@ class _Box(gtk.EventBox):
|
||||
self.set_app_paintable(True)
|
||||
|
||||
def do_expose_event(self, widget, event):
|
||||
a = self.toolbar_button.allocation
|
||||
alloc = self.toolbar_button.allocation
|
||||
self.get_style().paint_box(event.window,
|
||||
gtk.STATE_NORMAL, gtk.SHADOW_IN, event.area, self,
|
||||
'palette-invoker', -style._FOCUS_LINE_WIDTH, 0,
|
||||
@ -170,8 +170,9 @@ class _Box(gtk.EventBox):
|
||||
self.allocation.height + style._FOCUS_LINE_WIDTH)
|
||||
self.get_style().paint_box(event.window,
|
||||
gtk.STATE_NORMAL, gtk.SHADOW_NONE, event.area, self, None,
|
||||
a.x + style._FOCUS_LINE_WIDTH, 0,
|
||||
a.width - style._FOCUS_LINE_WIDTH*2, style._FOCUS_LINE_WIDTH)
|
||||
alloc.x + style._FOCUS_LINE_WIDTH, 0,
|
||||
alloc.width - style._FOCUS_LINE_WIDTH*2,
|
||||
style._FOCUS_LINE_WIDTH)
|
||||
|
||||
class _Palette(gtk.Window):
|
||||
def __init__(self, toolitem, **kwargs):
|
||||
@ -185,7 +186,7 @@ class _Palette(gtk.Window):
|
||||
self._invoker = None
|
||||
self._up = False
|
||||
self._invoker_hids = []
|
||||
self.__focus = 0
|
||||
self._focus = 0
|
||||
|
||||
self._popup_anim = Animator(.5, 10)
|
||||
self._popup_anim.add(_PopupAnimation(self))
|
||||
@ -297,27 +298,27 @@ class _Palette(gtk.Window):
|
||||
|
||||
self.popup(immediate=False)
|
||||
|
||||
def __handle_focus(self, delta):
|
||||
self.__focus += delta
|
||||
if self.__focus not in (0, 1):
|
||||
logging.error('_Palette.__focus=%s not in (0, 1)' % self.__focus)
|
||||
def _handle_focus(self, delta):
|
||||
self._focus += delta
|
||||
if self._focus not in (0, 1):
|
||||
logging.error('_Palette._focus=%s not in (0, 1)' % self._focus)
|
||||
|
||||
if self.__focus == 0:
|
||||
if self._focus == 0:
|
||||
group = palettegroup.get_group('default')
|
||||
if not group.is_up():
|
||||
self.popdown()
|
||||
|
||||
def __group_popdown_cb(self, group):
|
||||
if self.__focus == 0:
|
||||
if self._focus == 0:
|
||||
self.popdown(immediate=True)
|
||||
|
||||
def __invoker_mouse_enter_cb(self, invoker):
|
||||
self._mouse_detector.start()
|
||||
self.__handle_focus(+1)
|
||||
self._handle_focus(+1)
|
||||
|
||||
def __invoker_mouse_leave_cb(self, invoker):
|
||||
self._mouse_detector.stop()
|
||||
self.__handle_focus(-1)
|
||||
self._handle_focus(-1)
|
||||
|
||||
def __invoker_right_click_cb(self, invoker):
|
||||
self.popup(immediate=True)
|
||||
@ -326,12 +327,12 @@ class _Palette(gtk.Window):
|
||||
if event.detail != gtk.gdk.NOTIFY_INFERIOR and \
|
||||
event.mode == gtk.gdk.CROSSING_NORMAL:
|
||||
self._popdown_anim.stop()
|
||||
self.__handle_focus(+1)
|
||||
self._handle_focus(+1)
|
||||
|
||||
def __leave_notify_event_cb(self, widget, event):
|
||||
if event.detail != gtk.gdk.NOTIFY_INFERIOR and \
|
||||
event.mode == gtk.gdk.CROSSING_NORMAL:
|
||||
self.__handle_focus(-1)
|
||||
self._handle_focus(-1)
|
||||
|
||||
def __show_cb(self, widget):
|
||||
self._invoker.notify_popup()
|
||||
|
Loading…
Reference in New Issue
Block a user