style cleanup: prefer ' for strings

Tomeu prefers ' for strings, so let's use it wherever we don't have a good
reason to use ".

Reviewed-by: James Cameron <quozl@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
CC: Aleksey Lim <alsroot@member.fsf.org>
This commit is contained in:
Sascha Silbe
2010-10-15 19:14:59 +00:00
parent 5f13fcfc84
commit 7acfbd070f
38 changed files with 146 additions and 146 deletions
+10 -10
View File
@@ -88,9 +88,9 @@ from sugar.activity.widgets import ActivityToolbox
_ = lambda msg: gettext.dgettext('sugar-toolkit', msg)
SCOPE_PRIVATE = "private"
SCOPE_INVITE_ONLY = "invite" # shouldn't be shown in UI, it's implicit
SCOPE_NEIGHBORHOOD = "public"
SCOPE_PRIVATE = 'private'
SCOPE_INVITE_ONLY = 'invite' # shouldn't be shown in UI, it's implicit
SCOPE_NEIGHBORHOOD = 'public'
J_DBUS_SERVICE = 'org.laptop.Journal'
J_DBUS_PATH = '/org/laptop/Journal'
@@ -269,7 +269,7 @@ class Activity(Window, gtk.Container):
# but they get truncated anyway so if more characters
# are supported in the future we will get a better view
# of the processes
proc_title = "%s <%s>" % (get_bundle_name(), handle.activity_id)
proc_title = '%s <%s>' % (get_bundle_name(), handle.activity_id)
util.set_proc_title(proc_title)
self.connect('realize', self.__realize_cb)
@@ -362,16 +362,16 @@ class Activity(Window, gtk.Container):
def _set_up_sharing(self, mesh_instance, share_scope):
# 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)
if mesh_instance is not None:
# 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.shared_activity = mesh_instance
self.shared_activity.connect('notify::private',
self.__privacy_changed_cb)
self._join_id = self.shared_activity.connect("joined",
self._join_id = self.shared_activity.connect('joined',
self.__joined_cb)
if not self.shared_activity.props.joined:
self.shared_activity.join()
@@ -778,7 +778,7 @@ class Activity(Window, gtk.Container):
its 'private' property.
"""
if self.shared_activity and self.shared_activity.props.joined:
raise RuntimeError("Activity %s already shared." %
raise RuntimeError('Activity %s already shared.' %
self._activity_id)
verb = private and 'private' or 'public'
logging.debug('Requesting %s share of activity %s.', verb,
@@ -880,7 +880,7 @@ class Activity(Window, gtk.Container):
"""Returns the jobject metadata or None if there is no jobject.
Activities can set metadata in write_file() using:
self.metadata['MyKey'] = "Something"
self.metadata['MyKey'] = 'Something'
and retrieve metadata in read_file() using:
self.metadata.get('MyKey', 'aDefaultValue')
@@ -976,7 +976,7 @@ def get_activity_root():
if os.environ.get('SUGAR_ACTIVITY_ROOT'):
return os.environ['SUGAR_ACTIVITY_ROOT']
else:
raise RuntimeError("No SUGAR_ACTIVITY_ROOT set.")
raise RuntimeError('No SUGAR_ACTIVITY_ROOT set.')
def show_object_in_journal(object_id):
+7 -7
View File
@@ -40,16 +40,16 @@ import tempfile
import subprocess
import pwd
_SHELL_SERVICE = "org.laptop.Shell"
_SHELL_PATH = "/org/laptop/Shell"
_SHELL_IFACE = "org.laptop.Shell"
_SHELL_SERVICE = 'org.laptop.Shell'
_SHELL_PATH = '/org/laptop/Shell'
_SHELL_IFACE = 'org.laptop.Shell'
_ACTIVITY_FACTORY_INTERFACE = "org.laptop.ActivityFactory"
_ACTIVITY_FACTORY_INTERFACE = 'org.laptop.ActivityFactory'
# helper method to close all filedescriptors
# borrowed from subprocess.py
try:
MAXFD = os.sysconf("SC_OPEN_MAX")
MAXFD = os.sysconf('SC_OPEN_MAX')
except ValueError:
MAXFD = 256
@@ -284,7 +284,7 @@ class ActivityCreationHandler(gobject.GObject):
self._handle.activity_id, self._service_name)
def _create_error_handler(self, err):
logging.error("Couldn't create activity %s (%s): %s",
logging.error('Couldn't create activity %s (%s): %s',
self._handle.activity_id, self._service_name, err)
self._shell.NotifyLaunchFailure(
self._handle.activity_id, reply_handler=self._no_reply_handler,
@@ -293,7 +293,7 @@ class ActivityCreationHandler(gobject.GObject):
def _find_object_reply_handler(self, jobjects, count):
if count > 0:
if count > 1:
logging.debug("Multiple objects has the same activity_id.")
logging.debug('Multiple objects has the same activity_id.')
self._handle.object_id = jobjects[0]['uid']
self._launch_activity()
+3 -3
View File
@@ -25,9 +25,9 @@ import dbus
import dbus.service
_ACTIVITY_SERVICE_NAME = "org.laptop.Activity"
_ACTIVITY_SERVICE_PATH = "/org/laptop/Activity"
_ACTIVITY_INTERFACE = "org.laptop.Activity"
_ACTIVITY_SERVICE_NAME = 'org.laptop.Activity'
_ACTIVITY_SERVICE_PATH = '/org/laptop/Activity'
_ACTIVITY_INTERFACE = 'org.laptop.Activity'
class ActivityService(dbus.service.Object):
+7 -7
View File
@@ -108,7 +108,7 @@ class Builder(object):
po_dir = os.path.join(self.config.source_dir, 'po')
if not self.config.bundle.is_dir(po_dir):
logging.warn("Missing po/ dir, cannot build_locale")
logging.warn('Missing po/ dir, cannot build_locale')
return
locale_dir = os.path.join(self.config.source_dir, 'locale')
@@ -128,8 +128,8 @@ class Builder(object):
if not os.path.isdir(mo_path):
os.makedirs(mo_path)
mo_file = os.path.join(mo_path, "%s.mo" % self.config.bundle_id)
args = ["msgfmt", "--output-file=%s" % mo_file, file_name]
mo_file = os.path.join(mo_path, '%s.mo' % self.config.bundle_id)
args = ['msgfmt', '--output-file=%s' % mo_file, file_name]
retcode = subprocess.call(args)
if retcode:
print 'ERROR - msgfmt failed with return code %i.' % retcode
@@ -170,9 +170,9 @@ class Builder(object):
for path in self.check_manifest():
manifest.append(path)
f = open(os.path.join(self.config.source_dir, "MANIFEST"), "wb")
f = open(os.path.join(self.config.source_dir, 'MANIFEST'), 'wb')
for line in manifest:
f.write(line + "\n")
f.write(line + '\n')
class Packager(object):
@@ -399,7 +399,7 @@ def print_commands():
for name, func in globals().items():
if name.startswith('cmd_'):
print "%-20s %s" % (name.replace('cmd_', ''), func.__doc__)
print '%-20s %s' % (name.replace('cmd_', ''), func.__doc__)
print '\n(Type "./setup.py <command> --help" for help about a ' \
'particular command\'s options.'
@@ -407,7 +407,7 @@ def print_commands():
def start(bundle_name=None):
if bundle_name:
logging.warn("bundle_name deprecated, now comes from activity.info")
logging.warn('bundle_name deprecated, now comes from activity.info')
parser = OptionParser(usage='[action] [options]')
parser.disable_interspersed_args()
+1 -1
View File
@@ -118,7 +118,7 @@ def get_locale_path(bundle_id):
candidate_dirs[os.environ['SUGAR_LOCALEDIR']] = 2
gconf_client = gconf.client_get_default()
package_dir = gconf_client.get_string("/desktop/sugar/i18n/langpackdir")
package_dir = gconf_client.get_string('/desktop/sugar/i18n/langpackdir')
if package_dir is not None and package_dir is not '':
candidate_dirs[package_dir] = 1
+9 -9
View File
@@ -56,7 +56,7 @@ class SingleProcess(dbus.service.Object):
object_path = get_single_process_path(name_service)
dbus.service.Object.__init__(self, bus_name, object_path)
@dbus.service.method("org.laptop.SingleProcess", in_signature="a{sv}")
@dbus.service.method('org.laptop.SingleProcess', in_signature='a{sv}')
def create(self, handle_dict):
handle = activityhandle.create_from_dict(handle_dict)
create_activity_instance(self.constructor, handle)
@@ -64,14 +64,14 @@ class SingleProcess(dbus.service.Object):
def main():
parser = OptionParser()
parser.add_option("-b", "--bundle-id", dest="bundle_id",
help="identifier of the activity bundle")
parser.add_option("-a", "--activity-id", dest="activity_id",
help="identifier of the activity instance")
parser.add_option("-o", "--object-id", dest="object_id",
help="identifier of the associated datastore object")
parser.add_option("-u", "--uri", dest="uri",
help="URI to load")
parser.add_option('-b', '--bundle-id', dest='bundle_id',
help='identifier of the activity bundle')
parser.add_option('-a', '--activity-id', dest='activity_id',
help='identifier of the activity instance')
parser.add_option('-o', '--object-id', dest='object_id',
help='identifier of the associated datastore object')
parser.add_option('-u', '--uri', dest='uri',
help='URI to load')
parser.add_option('-s', '--single-process', dest='single_process',
action='store_true',
help='start all the instances in the same process')