From c9e63eb8eadb0b133b88e9feb1ca48b75d959a7c Mon Sep 17 00:00:00 2001 From: Sascha Silbe Date: Tue, 25 Aug 2009 19:12:40 +0000 Subject: PEP8 white space and long line fixes --- (limited to 'src/sugar/activity') diff --git a/src/sugar/activity/activity.py b/src/sugar/activity/activity.py index dee7f90..df5d8f0 100644 --- a/src/sugar/activity/activity.py +++ b/src/sugar/activity/activity.py @@ -74,7 +74,9 @@ from sugar.session import XSMPClient from sugar import wm # support deprecated imports -from sugar.activity.widgets import ActivityToolbar, EditToolbar, ActivityToolbox +from sugar.activity.widgets import ActivityToolbar, EditToolbar +from sugar.activity.widgets import ActivityToolbox + _ = lambda msg: gettext.dgettext('sugar-toolkit', msg) @@ -86,17 +88,20 @@ J_DBUS_SERVICE = 'org.laptop.Journal' J_DBUS_PATH = '/org/laptop/Journal' J_DBUS_INTERFACE = 'org.laptop.Journal' + class _ActivitySession(gobject.GObject): + __gsignals__ = { 'quit-requested': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ([])), - 'quit': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ([])) + 'quit': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ([])), } def __init__(self): gobject.GObject.__init__(self) self._xsmp_client = XSMPClient() - self._xsmp_client.connect('quit-requested', self.__sm_quit_requested_cb) + self._xsmp_client.connect('quit-requested', + self.__sm_quit_requested_cb) self._xsmp_client.connect('quit', self.__sm_quit_cb) self._xsmp_client.startup() @@ -133,6 +138,7 @@ class _ActivitySession(gobject.GObject): def __sm_quit_cb(self, client): self.emit('quit') + class Activity(Window, gtk.Container): """This is the base Activity class that all other Activities derive from. This is where your activity starts. @@ -160,12 +166,12 @@ class Activity(Window, gtk.Container): 2. Implement read_file() and write_file() Most activities revolve around creating and storing Journal entries. - For example, Write: You create a document, it is saved to the Journal - and then later you resume working on the document. + For example, Write: You create a document, it is saved to the + Journal and then later you resume working on the document. read_file() and write_file() will be called by sugar to tell your - Activity that it should load or save the document the user is working - on. + Activity that it should load or save the document the user is + working on. 3. Implement our Activity Toolbars. The Toolbars are added to your Activity in step 1 (the toolbox), but @@ -177,9 +183,9 @@ class Activity(Window, gtk.Container): okay, but you should really stop and think about why not!) You do this with the ActivityToolbox(self) call in step 1. - Usually, you will also need the standard EditToolbar. This is the one - which has the standard copy and paste buttons. You need to derive - your own EditToolbar class from sugar.EditToolbar: + Usually, you will also need the standard EditToolbar. This is the + one which has the standard copy and paste buttons. You need to + derive your own EditToolbar class from sugar.EditToolbar: class EditToolbar(activity.EditToolbar): ... @@ -200,11 +206,12 @@ class Activity(Window, gtk.Container): Hint: A good and simple Activity to learn from is the Read activity. To create your own activity, you may want to copy it and use it as a template. """ + __gtype_name__ = 'SugarActivity' __gsignals__ = { 'shared': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ([])), - 'joined': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ([])) + 'joined': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ([])), } def __init__(self, handle, create_jobject=True): @@ -368,8 +375,8 @@ class Activity(Window, gtk.Container): The activity id is sort-of-like the unix process id (PID). However, unlike PIDs it is only different for each new instance (with create_jobject = True set) and stays the same everytime a user - resumes an activity. This is also the identity of your Activity to other - XOs for use when sharing. + resumes an activity. This is also the identity of your Activity to + other XOs for use when sharing. """ return self._activity_id @@ -378,7 +385,8 @@ class Activity(Window, gtk.Container): return os.environ['SUGAR_BUNDLE_ID'] def set_canvas(self, canvas): - """Sets the 'work area' of your activity with the canvas of your choice. + """Sets the 'work area' of your activity with the canvas of your + choice. One commonly used canvas is gtk.ScrolledWindow """ @@ -425,8 +433,8 @@ class Activity(Window, gtk.Container): ~/.sugar/default/MyActivityName/ Activities should ONLY save settings, user preferences and other data - which isn't specific to a journal item here. If (meta-)data is in anyway - specific to a journal entry, it MUST be stored in the DataStore. + which isn't specific to a journal item here. If (meta-)data is in + anyway specific to a journal entry, it MUST be stored in the DataStore. """ if os.environ.has_key('SUGAR_ACTIVITY_ROOT') and \ os.environ['SUGAR_ACTIVITY_ROOT']: @@ -446,9 +454,10 @@ class Activity(Window, gtk.Container): close it. Although not required, this is also a good time to read all meta-data: - the file itself cannot be changed externally, but the title, description - and other metadata['tags'] may change. So if it is important for you to - notice changes, this is the time to record the originals. + the file itself cannot be changed externally, but the title, + description and other metadata['tags'] may change. So if it is + important for you to notice changes, this is the time to record the + originals. """ raise NotImplementedError @@ -461,12 +470,13 @@ class Activity(Window, gtk.Container): all document data to it. Additionally, you should also write any metadata needed to resume your - activity. For example, the Read activity saves the current page and zoom - level, so it can display the page. + activity. For example, the Read activity saves the current page and + zoom level, so it can display the page. Note: Currently, the file_path *WILL* be different from the one you - received in file_read(). Even if you kept the file_path from file_read() - open until now, you must still write the entire file to this file_path. + received in file_read(). Even if you kept the file_path from + file_read() open until now, you must still write the entire file to + this file_path. """ raise NotImplementedError @@ -518,6 +528,7 @@ class Activity(Window, gtk.Container): gtk.gdk.INTERP_BILINEAR) preview_data = [] + def save_func(buf, data): data.append(buf) @@ -809,8 +820,10 @@ class Activity(Window, gtk.Container): # DEPRECATED _shared_activity = property(lambda self: self.shared_activity, None) + _session = None + def _get_session(): global _session @@ -819,14 +832,17 @@ def _get_session(): return _session + def get_bundle_name(): """Return the bundle name for the current process' bundle""" return os.environ['SUGAR_BUNDLE_NAME'] + def get_bundle_path(): """Return the bundle path for the current process' bundle""" return os.environ['SUGAR_BUNDLE_PATH'] + def get_activity_root(): """Returns a path for saving Activity specific preferences, etc.""" if os.environ.has_key('SUGAR_ACTIVITY_ROOT') and \ @@ -835,6 +851,7 @@ def get_activity_root(): else: raise RuntimeError("No SUGAR_ACTIVITY_ROOT set.") + def show_object_in_journal(object_id): bus = dbus.SessionBus() obj = bus.get_object(J_DBUS_SERVICE, J_DBUS_PATH) diff --git a/src/sugar/activity/activityfactory.py b/src/sugar/activity/activityfactory.py index f2ca5ba..ee0fd92 100644 --- a/src/sugar/activity/activityfactory.py +++ b/src/sugar/activity/activityfactory.py @@ -54,6 +54,8 @@ try: MAXFD = os.sysconf("SC_OPEN_MAX") except ValueError: MAXFD = 256 + + def _close_fds(): for i in xrange(3, MAXFD): try: @@ -62,6 +64,7 @@ def _close_fds(): except Exception: pass + def create_activity_id(): """Generate a new, unique ID for this activity""" pservice = presenceservice.get_instance() @@ -84,6 +87,7 @@ def create_activity_id(): return act_id raise RuntimeError("Cannot generate unique activity id.") + def get_environment(activity): environ = os.environ.copy() @@ -106,15 +110,17 @@ def get_environment(activity): os.mkdir(tmp_dir) environ['SUGAR_BUNDLE_PATH'] = activity.get_path() - environ['SUGAR_BUNDLE_ID'] = activity.get_bundle_id() + environ['SUGAR_BUNDLE_ID'] = activity.get_bundle_id() environ['SUGAR_ACTIVITY_ROOT'] = activity_root environ['PATH'] = bin_path + ':' + environ['PATH'] if activity.get_path().startswith(env.get_user_activities_path()): - environ['SUGAR_LOCALEDIR'] = os.path.join(activity.get_path(), 'locale') + environ['SUGAR_LOCALEDIR'] = os.path.join(activity.get_path(), + 'locale') return environ + def get_command(activity, activity_id=None, object_id=None, uri=None): if not activity_id: activity_id = create_activity_id() @@ -140,6 +146,7 @@ def get_command(activity, activity_id=None, object_id=None, uri=None): return command + def open_log_file(activity): i = 1 while True: @@ -154,10 +161,11 @@ def open_log_file(activity): i += 1 elif e.errno == ENOSPC: # not the end of the world; let's try to keep going. - return ('/dev/null', open('/dev/null','w')) + return ('/dev/null', open('/dev/null', 'w')) else: raise e + class ActivityCreationHandler(gobject.GObject): """Sugar-side activity creation interface @@ -250,7 +258,7 @@ class ActivityCreationHandler(gobject.GObject): '-u', pwd.getpwuid(os.getuid()).pw_name, '-i', environ['SUGAR_BUNDLE_ID'], '-e', environment_dir, - '--' + '--', ] + command for key, value in environ.items(): @@ -310,25 +318,29 @@ class ActivityCreationHandler(gobject.GObject): logging.error('Datastore find failed %s', err) self._launch_activity() + def create(bundle, activity_handle=None): """Create a new activity from its name.""" if not activity_handle: activity_handle = ActivityHandle() return ActivityCreationHandler(bundle, activity_handle) + def create_with_uri(bundle, uri): """Create a new activity and pass the uri as handle.""" activity_handle = ActivityHandle(uri=uri) return ActivityCreationHandler(bundle, activity_handle) + def create_with_object_id(bundle, object_id): """Create a new activity and pass the object id as handle.""" activity_handle = ActivityHandle(object_id=object_id) return ActivityCreationHandler(bundle, activity_handle) -# FIXME we use standalone method here instead of ActivityCreationHandler's -# member to have workaround code, see #1123 + def _child_watch_cb(pid, condition, user_data): + # FIXME we use standalone method here instead of ActivityCreationHandler's + # member to have workaround code, see #1123 environment_dir, log_file = user_data if environment_dir is not None: subprocess.call(['/bin/rm', '-rf', environment_dir]) diff --git a/src/sugar/activity/activityhandle.py b/src/sugar/activity/activityhandle.py index 7240e3c..4ceadb0 100644 --- a/src/sugar/activity/activityhandle.py +++ b/src/sugar/activity/activityhandle.py @@ -19,11 +19,11 @@ STABLE. """ + class ActivityHandle(object): """Data structure storing simple activity metadata""" - def __init__( - self, activity_id=None, object_id=None, uri=None - ): + + def __init__(self, activity_id=None, object_id=None, uri=None): """Initialise the handle from activity_id activity_id -- unique id for the activity to be @@ -52,7 +52,7 @@ class ActivityHandle(object): def get_dict(self): """Retrieve our settings as a dictionary""" - result = { 'activity_id' : self.activity_id } + result = {'activity_id': self.activity_id} if self.object_id: result['object_id'] = self.object_id if self.uri: @@ -60,11 +60,10 @@ class ActivityHandle(object): return result + def create_from_dict(handle_dict): """Create a handle from a dictionary of parameters""" - result = ActivityHandle( - handle_dict['activity_id'], + result = ActivityHandle(handle_dict['activity_id'], object_id = handle_dict.get('object_id'), - uri = handle_dict.get('uri'), - ) + uri = handle_dict.get('uri')) return result diff --git a/src/sugar/activity/activityservice.py b/src/sugar/activity/activityservice.py index 1e5d2ea..36f485c 100644 --- a/src/sugar/activity/activityservice.py +++ b/src/sugar/activity/activityservice.py @@ -24,10 +24,12 @@ import logging import dbus import dbus.service + _ACTIVITY_SERVICE_NAME = "org.laptop.Activity" _ACTIVITY_SERVICE_PATH = "/org/laptop/Activity" _ACTIVITY_INTERFACE = "org.laptop.Activity" + class ActivityService(dbus.service.Object): """Base dbus service object that each Activity uses to export dbus methods. @@ -51,7 +53,7 @@ class ActivityService(dbus.service.Object): activity_id = activity.get_id() service_name = _ACTIVITY_SERVICE_NAME + activity_id - object_path = _ACTIVITY_SERVICE_PATH + "/" + activity_id + object_path = _ACTIVITY_SERVICE_PATH + '/' + activity_id bus = dbus.SessionBus() bus_name = dbus.service.BusName(service_name, bus=bus) @@ -79,4 +81,3 @@ class ActivityService(dbus.service.Object): self._activity.get_document_path(async_cb, async_err_cb) except Exception, e: async_err_cb(e) - diff --git a/src/sugar/activity/bundlebuilder.py b/src/sugar/activity/bundlebuilder.py index b11c7d0..868ca3d 100644 --- a/src/sugar/activity/bundlebuilder.py +++ b/src/sugar/activity/bundlebuilder.py @@ -34,9 +34,11 @@ from fnmatch import fnmatch from sugar import env from sugar.bundle.activitybundle import ActivityBundle + IGNORE_DIRS = ['dist', '.git'] IGNORE_FILES = ['.gitignore', 'MANIFEST', '*.pyc', '*~', '*.bak', 'pseudo.po'] + def list_files(base_dir, ignore_dirs=None, ignore_files=None): result = [] @@ -58,7 +60,9 @@ def list_files(base_dir, ignore_dirs=None, ignore_files=None): return result + class Config(object): + def __init__(self, source_dir=None, dist_dir = None, dist_name = None): self.source_dir = source_dir or os.getcwd() self.dist_dir = dist_dir or os.path.join(self.source_dir, 'dist') @@ -80,7 +84,7 @@ class Config(object): self.version = bundle.get_activity_version() self.activity_name = bundle.get_name() self.bundle_id = bundle.get_bundle_id() - self.bundle_name = reduce(lambda x, y:x+y, self.activity_name.split()) + self.bundle_name = reduce(lambda x, y: x+y, self.activity_name.split()) self.bundle_root_dir = self.bundle_name + '.activity' self.tar_root_dir = '%s-%d' % (self.bundle_name, self.version) @@ -90,7 +94,9 @@ class Config(object): self.xo_name = '%s-%d.xo' % (self.bundle_name, self.version) self.tar_name = '%s-%d.tar.bz2' % (self.bundle_name, self.version) + class Builder(object): + def __init__(self, config): self.config = config @@ -167,7 +173,9 @@ class Builder(object): for line in manifest: f.write(line + "\n") + class Packager(object): + def __init__(self, config): self.config = config self.package_path = None @@ -175,7 +183,9 @@ class Packager(object): if not os.path.exists(self.config.dist_dir): os.mkdir(self.config.dist_dir) + class XOPackager(Packager): + def __init__(self, builder): Packager.__init__(self, builder.config) @@ -200,7 +210,9 @@ class XOPackager(Packager): bundle_zip.close() + class SourcePackager(Packager): + def __init__(self, config): Packager.__init__(self, config) self.package_path = os.path.join(self.config.dist_dir, @@ -210,7 +222,7 @@ class SourcePackager(Packager): git_ls = subprocess.Popen(['git', 'ls-files'], stdout=subprocess.PIPE, cwd=self.config.source_dir) stdout, _ = git_ls.communicate() - if git_ls.returncode : + if git_ls.returncode: # Fall back to filtered list return list_files(self.config.source_dir, IGNORE_DIRS, IGNORE_FILES) @@ -224,8 +236,9 @@ class SourcePackager(Packager): os.path.join(self.config.tar_root_dir, f)) tar.close() + class Installer(object): - IGNORES = [ 'po/*', 'MANIFEST', 'AUTHORS' ] + IGNORES = ['po/*', 'MANIFEST', 'AUTHORS'] def __init__(self, builder): self.config = builder.config @@ -261,6 +274,7 @@ class Installer(object): shutil.copy(source, dest) + def cmd_dev(config, args): '''Setup for development''' @@ -280,6 +294,7 @@ def cmd_dev(config, args): else: print 'ERROR - A bundle with the same name is already installed.' + def cmd_dist_xo(config, args): '''Create a xo bundle package''' @@ -290,6 +305,7 @@ def cmd_dist_xo(config, args): packager = XOPackager(Builder(config)) packager.package() + def cmd_fix_manifest(config, args): '''Add missing files to the manifest''' @@ -300,6 +316,7 @@ def cmd_fix_manifest(config, args): builder = Builder(config) builder.fix_manifest() + def cmd_dist_source(config, args): '''Create a tar source package''' @@ -310,6 +327,7 @@ def cmd_dist_source(config, args): packager = SourcePackager(config) packager.package() + def cmd_install(config, args): '''Install the activity in the system''' @@ -324,6 +342,7 @@ def cmd_install(config, args): installer = Installer(Builder(config)) installer.install(suboptions.prefix) + def cmd_genpot(config, args): '''Generate the gettext pot file''' @@ -354,14 +373,15 @@ def cmd_genpot(config, args): f.write('msgstr ""\n') f.close() - args = [ 'xgettext', '--join-existing', '--language=Python', - '--keyword=_', '--add-comments=TRANS:', '--output=%s' % pot_file ] + args = ['xgettext', '--join-existing', '--language=Python', + '--keyword=_', '--add-comments=TRANS:', '--output=%s' % pot_file] args += python_files retcode = subprocess.call(args) if retcode: print 'ERROR - xgettext failed with return code %i.' % retcode + def cmd_build(config, args): '''Build generated files''' @@ -372,6 +392,7 @@ def cmd_build(config, args): builder = Builder(config) builder.build() + def print_commands(): print 'Available commands:\n' @@ -382,6 +403,7 @@ def print_commands(): print '\n(Type "./setup.py --help" for help about a ' \ 'particular command\'s options.' + def start(bundle_name=None): if bundle_name: logging.warn("bundle_name deprecated, now comes from activity.info") @@ -397,5 +419,6 @@ def start(bundle_name=None): except (KeyError, IndexError): print_commands() + if __name__ == '__main__': start() diff --git a/src/sugar/activity/main.py b/src/sugar/activity/main.py index 168b2f4..93f34e6 100644 --- a/src/sugar/activity/main.py +++ b/src/sugar/activity/main.py @@ -30,17 +30,22 @@ from sugar.activity import activityhandle from sugar.bundle.activitybundle import ActivityBundle from sugar import logger + def create_activity_instance(constructor, handle): activity = constructor(handle) activity.show() + def get_single_process_name(bundle_id): return bundle_id + def get_single_process_path(bundle_id): return '/' + bundle_id.replace('.', '/') + class SingleProcess(dbus.service.Object): + def __init__(self, name_service, constructor): self.constructor = constructor @@ -54,6 +59,7 @@ class SingleProcess(dbus.service.Object): handle = activityhandle.create_from_dict(handle_dict) create_activity_instance(self.constructor, handle) + def main(): parser = OptionParser() parser.add_option("-b", "--bundle-id", dest="bundle_id", diff --git a/src/sugar/activity/namingalert.py b/src/sugar/activity/namingalert.py index 18e84a7..72db8dc 100644 --- a/src/sugar/activity/namingalert.py +++ b/src/sugar/activity/namingalert.py @@ -35,8 +35,10 @@ from sugar.graphics.canvastextview import CanvasTextView from sugar.bundle.activitybundle import ActivityBundle + _ = lambda msg: gettext.dgettext('sugar-toolkit', msg) + def _get_icon_name(metadata): file_name = None @@ -53,16 +55,17 @@ def _get_icon_name(metadata): return file_name + class NamingToolbar(gtk.Toolbar): """ Toolbar of the naming alert """ + __gtype_name__ = 'SugarNamingToolbar' __gsignals__ = { - 'keep-clicked': (gobject.SIGNAL_RUN_FIRST, - gobject.TYPE_NONE, - ([])) + 'keep-clicked': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ([])), } + def __init__(self): gtk.Toolbar.__init__(self) @@ -110,7 +113,9 @@ class NamingToolbar(gtk.Toolbar): def __keep_button_clicked_cb(self, widget, data=None): self.emit('keep-clicked') + class FavoriteIcon(CanvasIcon): + def __init__(self, favorite): CanvasIcon.__init__(self, icon_name='emblem-favorite', box_width=style.GRID_CELL_SIZE * 3 / 5, @@ -149,7 +154,9 @@ class FavoriteIcon(CanvasIcon): elif event.detail == hippo.MOTION_DETAIL_LEAVE: icon.props.fill_color = style.COLOR_TRANSPARENT.get_svg() + class NamingAlert(gtk.Window): + __gtype_name__ = 'SugarNamingAlert' def __init__(self, activity, bundle_path): @@ -212,11 +219,12 @@ class NamingAlert(gtk.Window): spacing=style.DEFAULT_SPACING) body.append(header) - descriptions = hippo.CanvasBox(orientation=hippo.ORIENTATION_HORIZONTAL, - spacing=style.DEFAULT_SPACING * 3, - padding_left=style.GRID_CELL_SIZE, - padding_right=style.GRID_CELL_SIZE, - padding_top=style.DEFAULT_SPACING * 3) + descriptions = hippo.CanvasBox( + orientation=hippo.ORIENTATION_HORIZONTAL, + spacing=style.DEFAULT_SPACING * 3, + padding_left=style.GRID_CELL_SIZE, + padding_right=style.GRID_CELL_SIZE, + padding_top=style.DEFAULT_SPACING * 3) body.append(descriptions, hippo.PACK_EXPAND) diff --git a/src/sugar/activity/widgets.py b/src/sugar/activity/widgets.py index 2a8b1a2..6ecdda3 100644 --- a/src/sugar/activity/widgets.py +++ b/src/sugar/activity/widgets.py @@ -29,6 +29,7 @@ from sugar.graphics.xocolor import XoColor from sugar.graphics.icon import Icon from sugar.bundle.activitybundle import ActivityBundle + _ = lambda msg: gettext.dgettext('sugar-toolkit', msg) @@ -41,7 +42,9 @@ def _create_activity_icon(): icon = Icon(file=bundle.get_icon(), xo_color=color) return icon + class ActivityButton(ToolButton): + def __init__(self, activity, **kwargs): ToolButton.__init__(self, **kwargs) @@ -55,7 +58,9 @@ class ActivityButton(ToolButton): def __jobject_updated_cb(self, jobject): self.props.tooltip = jobject['title'] + class ActivityToolbarButton(ToolbarButton): + def __init__(self, activity, **kwargs): toolbar = ActivityToolbar(activity, orientation_left=True) toolbar.stop.hide() @@ -66,7 +71,9 @@ class ActivityToolbarButton(ToolbarButton): self.set_icon_widget(icon) icon.show() + class StopButton(ToolButton): + def __init__(self, activity, **kwargs): ToolButton.__init__(self, 'activity-stop', **kwargs) self.props.tooltip = _('Stop') @@ -76,28 +83,38 @@ class StopButton(ToolButton): def __stop_button_clicked_cb(self, button, activity): activity.close() + class UndoButton(ToolButton): + def __init__(self, **kwargs): ToolButton.__init__(self, 'edit-undo', **kwargs) self.props.tooltip = _('Undo') self.props.accelerator = 'Q' + class RedoButton(ToolButton): + def __init__(self, **kwargs): ToolButton.__init__(self, 'edit-redo', **kwargs) self.props.tooltip = _('Redo') + class CopyButton(ToolButton): + def __init__(self, **kwargs): ToolButton.__init__(self, 'edit-copy', **kwargs) self.props.tooltip = _('Copy') + class PasteButton(ToolButton): + def __init__(self, **kwargs): ToolButton.__init__(self, 'edit-paste', **kwargs) self.props.tooltip = _('Paste') + class ShareButton(RadioMenuButton): + def __init__(self, activity, **kwargs): palette = RadioPalette() @@ -137,7 +154,9 @@ class ShareButton(RadioMenuButton): finally: self.neighborhood.handler_unblock(self._neighborhood_handle) + class KeepButton(ToolButton): + def __init__(self, activity, **kwargs): ToolButton.__init__(self, **kwargs) self.props.tooltip = _('Keep') @@ -154,7 +173,9 @@ class KeepButton(ToolButton): def __keep_button_clicked_cb(self, button, activity): activity.copy() + class TitleEntry(gtk.ToolItem): + def __init__(self, activity, **kwargs): gtk.ToolItem.__init__(self) self.set_expand(False) @@ -195,6 +216,7 @@ class TitleEntry(gtk.ToolItem): self._update_title_sid = None return False + class ActivityToolbar(gtk.Toolbar): """The Activity toolbar with the Journal entry title, sharing, Keep and Stop buttons @@ -202,6 +224,7 @@ class ActivityToolbar(gtk.Toolbar): All activities should have this toolbar. It is easiest to add it to your Activity by using the ActivityToolbox. """ + def __init__(self, activity, orientation_left=False): gtk.Toolbar.__init__(self) @@ -232,6 +255,7 @@ class ActivityToolbar(gtk.Toolbar): self.insert(self.stop, -1) self.stop.show() + class EditToolbar(gtk.Toolbar): """Provides the standard edit toolbar for Activities. @@ -265,6 +289,7 @@ class EditToolbar(gtk.Toolbar): # And make it visible: self._edit_toolbar.show() """ + def __init__(self): gtk.Toolbar.__init__(self) @@ -289,6 +314,7 @@ class EditToolbar(gtk.Toolbar): self.insert(self.paste, -1) self.paste.show() + class ActivityToolbox(Toolbox): """Creates the Toolbox for the Activity @@ -307,6 +333,7 @@ class ActivityToolbox(Toolbox): # And make it visible: toolbox.show() """ + def __init__(self, activity): Toolbox.__init__(self) -- cgit v0.9.1