Fixes for pep8 1.5
This commit is contained in:
parent
cbf325d994
commit
01ed63ee4b
@ -74,14 +74,14 @@ test.show()
|
|||||||
|
|
||||||
# This can be used to test for leaks by setting the LRU cache size
|
# This can be used to test for leaks by setting the LRU cache size
|
||||||
# in icon.py to 1.
|
# in icon.py to 1.
|
||||||
#def idle_cb():
|
# def idle_cb():
|
||||||
# import gc
|
# import gc
|
||||||
# gc.collect()
|
# gc.collect()
|
||||||
# test.queue_draw()
|
# test.queue_draw()
|
||||||
# return True
|
# return True
|
||||||
#
|
#
|
||||||
#from gi.repository import GLib
|
# from gi.repository import GLib
|
||||||
#GLib.idle_add(idle_cb)
|
# GLib.idle_add(idle_cb)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
common.main(test)
|
common.main(test)
|
||||||
|
@ -437,11 +437,11 @@ class Activity(Window, Gtk.Container):
|
|||||||
def _set_up_sharing(self, mesh_instance, share_scope):
|
def _set_up_sharing(self, mesh_instance, share_scope):
|
||||||
# handle activity share/join
|
# handle activity share/join
|
||||||
logging.debug('*** Act %s, mesh instance %r, scope %s' %
|
logging.debug('*** Act %s, mesh instance %r, scope %s' %
|
||||||
(self._activity_id, mesh_instance, share_scope))
|
(self._activity_id, mesh_instance, share_scope))
|
||||||
if mesh_instance is not None:
|
if mesh_instance is not None:
|
||||||
# There's already an instance on the mesh, join it
|
# There's already an instance on the mesh, join it
|
||||||
logging.debug('*** Act %s joining existing mesh instance %r' %
|
logging.debug('*** Act %s joining existing mesh instance %r' %
|
||||||
(self._activity_id, mesh_instance))
|
(self._activity_id, mesh_instance))
|
||||||
self.shared_activity = mesh_instance
|
self.shared_activity = mesh_instance
|
||||||
self.shared_activity.connect('notify::private',
|
self.shared_activity.connect('notify::private',
|
||||||
self.__privacy_changed_cb)
|
self.__privacy_changed_cb)
|
||||||
@ -854,7 +854,7 @@ class Activity(Window, Gtk.Container):
|
|||||||
def __share_cb(self, ps, success, activity, err):
|
def __share_cb(self, ps, success, activity, err):
|
||||||
if not success:
|
if not success:
|
||||||
logging.debug('Share of activity %s failed: %s.' %
|
logging.debug('Share of activity %s failed: %s.' %
|
||||||
(self._activity_id, err))
|
(self._activity_id, err))
|
||||||
return
|
return
|
||||||
|
|
||||||
logging.debug('Share of activity %s successful, PS activity is %r.' %
|
logging.debug('Share of activity %s successful, PS activity is %r.' %
|
||||||
|
@ -40,7 +40,7 @@ from sugar3.activity import activity
|
|||||||
|
|
||||||
class LocalRequestHandler(BaseHTTPRequestHandler):
|
class LocalRequestHandler(BaseHTTPRequestHandler):
|
||||||
|
|
||||||
#Handler for the GET requests
|
# Handler for the GET requests
|
||||||
def do_GET(self):
|
def do_GET(self):
|
||||||
new_path = self.server.path + '/' + self.path
|
new_path = self.server.path + '/' + self.path
|
||||||
if not os.path.exists(new_path):
|
if not os.path.exists(new_path):
|
||||||
|
@ -97,7 +97,7 @@ class ContentBundle(Bundle):
|
|||||||
self._icon = cp.get(section, 'icon')
|
self._icon = cp.get(section, 'icon')
|
||||||
|
|
||||||
# Compatibility with old content bundles
|
# Compatibility with old content bundles
|
||||||
if not self._global_name is None \
|
if self._global_name is not None \
|
||||||
and cp.has_option(section, 'bundle_class'):
|
and cp.has_option(section, 'bundle_class'):
|
||||||
self._global_name = cp.get(section, 'bundle_class')
|
self._global_name = cp.get(section, 'bundle_class')
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ class DSObject(object):
|
|||||||
self._metadata.update(properties)
|
self._metadata.update(properties)
|
||||||
|
|
||||||
def get_metadata(self):
|
def get_metadata(self):
|
||||||
if self._metadata is None and not self.object_id is None:
|
if self._metadata is None and self.object_id is not None:
|
||||||
properties = _get_data_store().get_properties(self.object_id)
|
properties = _get_data_store().get_properties(self.object_id)
|
||||||
metadata = DSMetadata(properties)
|
metadata = DSMetadata(properties)
|
||||||
self._metadata = metadata
|
self._metadata = metadata
|
||||||
@ -180,7 +180,7 @@ class DSObject(object):
|
|||||||
metadata = property(get_metadata, set_metadata)
|
metadata = property(get_metadata, set_metadata)
|
||||||
|
|
||||||
def get_file_path(self, fetch=True):
|
def get_file_path(self, fetch=True):
|
||||||
if fetch and self._file_path is None and not self.object_id is None:
|
if fetch and self._file_path is None and self.object_id is not None:
|
||||||
self.set_file_path(_get_data_store().get_filename(self.object_id))
|
self.set_file_path(_get_data_store().get_filename(self.object_id))
|
||||||
self._owns_file = True
|
self._owns_file = True
|
||||||
return self._file_path
|
return self._file_path
|
||||||
|
@ -267,7 +267,7 @@ class _IconBuffer(object):
|
|||||||
# document-generic. If that doesn't work out, bail.
|
# document-generic. If that doesn't work out, bail.
|
||||||
icon_width = None
|
icon_width = None
|
||||||
for (file_name, icon_name) in ((self.file_name, self.icon_name),
|
for (file_name, icon_name) in ((self.file_name, self.icon_name),
|
||||||
(None, 'document-generic')):
|
(None, 'document-generic')):
|
||||||
icon_info = self._get_icon_info(file_name, icon_name)
|
icon_info = self._get_icon_info(file_name, icon_name)
|
||||||
if icon_info.file_name is None:
|
if icon_info.file_name is None:
|
||||||
return None
|
return None
|
||||||
@ -347,7 +347,7 @@ class Icon(Gtk.Image):
|
|||||||
|
|
||||||
__gtype_name__ = 'SugarIcon'
|
__gtype_name__ = 'SugarIcon'
|
||||||
|
|
||||||
#FIXME: deprecate icon_size
|
# FIXME: deprecate icon_size
|
||||||
_MENU_SIZES = (Gtk.IconSize.MENU, Gtk.IconSize.DND,
|
_MENU_SIZES = (Gtk.IconSize.MENU, Gtk.IconSize.DND,
|
||||||
Gtk.IconSize.SMALL_TOOLBAR, Gtk.IconSize.BUTTON)
|
Gtk.IconSize.SMALL_TOOLBAR, Gtk.IconSize.BUTTON)
|
||||||
|
|
||||||
@ -360,7 +360,7 @@ class Icon(Gtk.Image):
|
|||||||
self._alpha = 1.0
|
self._alpha = 1.0
|
||||||
self._scale = 1.0
|
self._scale = 1.0
|
||||||
|
|
||||||
#FIXME: deprecate icon_size
|
# FIXME: deprecate icon_size
|
||||||
if 'icon_size' in kwargs:
|
if 'icon_size' in kwargs:
|
||||||
logging.warning("icon_size is deprecated. Use pixel_size instead.")
|
logging.warning("icon_size is deprecated. Use pixel_size instead.")
|
||||||
|
|
||||||
@ -391,7 +391,7 @@ class Icon(Gtk.Image):
|
|||||||
if self._buffer.file_name != self.props.file:
|
if self._buffer.file_name != self.props.file:
|
||||||
self._buffer.file_name = self.props.file
|
self._buffer.file_name = self.props.file
|
||||||
|
|
||||||
#FIXME: deprecate icon_size
|
# FIXME: deprecate icon_size
|
||||||
pixel_size = None
|
pixel_size = None
|
||||||
if self.props.pixel_size == -1:
|
if self.props.pixel_size == -1:
|
||||||
if self.props.icon_size in self._MENU_SIZES:
|
if self.props.icon_size in self._MENU_SIZES:
|
||||||
@ -453,9 +453,9 @@ class Icon(Gtk.Image):
|
|||||||
|
|
||||||
allocation = self.get_allocation()
|
allocation = self.get_allocation()
|
||||||
x = math.floor(xpad +
|
x = math.floor(xpad +
|
||||||
(allocation.width - requisition.width) * xalign)
|
(allocation.width - requisition.width) * xalign)
|
||||||
y = math.floor(ypad +
|
y = math.floor(ypad +
|
||||||
(allocation.height - requisition.height) * yalign)
|
(allocation.height - requisition.height) * yalign)
|
||||||
|
|
||||||
if self._scale != 1.0:
|
if self._scale != 1.0:
|
||||||
cr.scale(self._scale, self._scale)
|
cr.scale(self._scale, self._scale)
|
||||||
|
@ -75,7 +75,7 @@ class Group(GObject.GObject):
|
|||||||
self._sig_ids[palette].append(sid)
|
self._sig_ids[palette].append(sid)
|
||||||
|
|
||||||
def remove(self, palette):
|
def remove(self, palette):
|
||||||
if not palette in self._palettes:
|
if palette not in self._palettes:
|
||||||
# This happens when converting a window based palette to a menu
|
# This happens when converting a window based palette to a menu
|
||||||
# based one.
|
# based one.
|
||||||
return
|
return
|
||||||
|
@ -171,7 +171,7 @@ class ToolbarBox(Gtk.VBox):
|
|||||||
return self.toolbar.get_nth_item(self._expanded_button_index)
|
return self.toolbar.get_nth_item(self._expanded_button_index)
|
||||||
|
|
||||||
def set_expanded_button(self, button):
|
def set_expanded_button(self, button):
|
||||||
if not button in self.toolbar:
|
if button not in self.toolbar:
|
||||||
self._expanded_button_index = -1
|
self._expanded_button_index = -1
|
||||||
return
|
return
|
||||||
self._expanded_button_index = self.toolbar.get_item_index(button)
|
self._expanded_button_index = self.toolbar.get_item_index(button)
|
||||||
|
@ -114,7 +114,7 @@ class Activity(GObject.GObject):
|
|||||||
self._joined_buddies = {}
|
self._joined_buddies = {}
|
||||||
|
|
||||||
self._get_properties_call = None
|
self._get_properties_call = None
|
||||||
if not self.room_handle is None:
|
if self.room_handle is not None:
|
||||||
self._start_tracking_properties()
|
self._start_tracking_properties()
|
||||||
|
|
||||||
def _start_tracking_properties(self):
|
def _start_tracking_properties(self):
|
||||||
@ -390,7 +390,7 @@ class Activity(GObject.GObject):
|
|||||||
self._join_command.run()
|
self._join_command.run()
|
||||||
|
|
||||||
def share(self, share_activity_cb, share_activity_error_cb):
|
def share(self, share_activity_cb, share_activity_error_cb):
|
||||||
if not self.room_handle is None:
|
if self.room_handle is not None:
|
||||||
raise ValueError('Already have a room handle')
|
raise ValueError('Already have a room handle')
|
||||||
|
|
||||||
self._share_command = _ShareCommand(self.telepathy_conn, self._id)
|
self._share_command = _ShareCommand(self.telepathy_conn, self._id)
|
||||||
|
Loading…
Reference in New Issue
Block a user