diff options
Diffstat (limited to 'creactistore/_templates/+package+/activity.py_tmpl~')
-rw-r--r-- | creactistore/_templates/+package+/activity.py_tmpl~ | 95 |
1 files changed, 0 insertions, 95 deletions
diff --git a/creactistore/_templates/+package+/activity.py_tmpl~ b/creactistore/_templates/+package+/activity.py_tmpl~ deleted file mode 100644 index 30d1f2d..0000000 --- a/creactistore/_templates/+package+/activity.py_tmpl~ +++ /dev/null @@ -1,95 +0,0 @@ -# python import -import os, sys -# gettext import -from gettext import gettext as _ - -# sugar import -from sugar.activity import activity - -# add lib path to current python path -sys.path.append(os.path.join(activity.get_bundle_path(), 'lib')) - -# peak import -from peak.util.imports import importString - -# semanticxo import -from semanticxo.datastore import TripleStore - -# triplestore runner import and start -from server.semanticxo import Runner -Runner().run() - -# {{package}} ui import -from {{package}}.ui import toolbar - - -def _toolbar_changed(toolbox, page, activity_): - """Catch toolbox activity tab focus to display settings screen. - """ - # is the activity tab? - if page == 0: - pass - else: - pass - # propagate it - return True - - -class {{package.capitalize()}}Activity(activity.Activity): - - def __init__(self, handle): - # init parents - activity.Activity.__init__(self, handle) - self.max_participants = 1 - # init toolbar - self.__init_toolbar() - # screen registry init - self.__screens = dict() - # init datastore - self.datastore = TripleStore() - # set default screen - self.change_screen('default') - - def change_screen(self, name): - # init screen if not already initialized - if name not in self.__screens: - _cls = importString('{{package}}.ui.screens.%s.%s' % ( - name, - ''.join([n.capitalize() - for n in name.split('_')]))) - self.__screens[name] = _cls(self) - # get and show the screen - _scr = self.__screens[name] - _scr._show() - - def __init_toolbar(self): - """Keep an example of how to manage toolbar in our webapp ... - """ - # get toolbox - self._toolbox = activity.ActivityToolbox(self) - # add tool bars - self.set_toolbox(self._toolbox) - # show - self._toolbox.show() - # init toolbars - for _n in ['default']: - # init toolbar - toolbar.Toolbar(self, name=_n) - # set default tab - self._toolbox.set_current_toolbar(1) - # .. - self._toolbox.connect('current-toolbar-changed', _toolbar_changed, self) - - def read_file(self, file_path): - # .. should be overriden - pass - - def write_file(self, file_path): - # .. should be overriden - pass - - def close(self, skip_save=False): - # stop the triplestore - Runner().proc.kill() - # call parent - activity.Activity.close(self, skip_save=True) |