Fwd: QUERY REGARDING INTERFACING OF TOOLBAR

Preeti KS kspreeti.13 at gmail.com
Thu Jul 24 03:15:59 EDT 2008


Dear all,
    I have been working on the toolbar of the SocialCalc Activity. In this
activity, a Spreadsheet was being made. The main programme has been written
in Javascript. whereas the function call has been made from Python. Hence, a
package called xocom was made to felicitate communication between JS and
Python.
   I made the toolbar in Python, and used xocom to create the webview,etc. I
also managed to interface the toolbar.py file with the socialcalc.py file,
however, as I am not very adept with JS, I am facing problems interfacing
the toolbar.py file with the Javascript file. I have attached the relevent
files with this email and also at
http://wiki.laptop.org/go/Image:SocialCalc-toolbar.zip .
My toolbar.py file is as follows, these are some code snippets:

This is the main spreadsheet activity toolbar, It has used xocom to create
the webview..

class SpreadSheetActivityToolbar:

    def __init__(self, activity, toolbox, self_canvas):

        self._activity = activity
        self.set_canvas( xocom.create_webview() )
        self._activity_toolbar = toolbox.get_activity_toolbar()
        self._keep_palette = self._activity_toolbar.keep.get_palette()

.........................

Then, I have created another class, for the edit toolbar. Its definition is
as follows:

class SpreadsheetEditToolbar(EditToolbar):

    def __init__(self, toolbox, self_canvas):
        EditToolbar.__init__(self)
        self.set_canvas( xocom.create_webview() )
.........

This is followed by the general definition of edit toolbar,
copy,paste,undo,redo, etc. There is also a viewtoolbar class, for viewing it
on hulahoop.
Here are the details of the SocialCalc.py file:
To interface it with toolbar.py, I have imported the classes from this file
as:

import toolbar
from toolbar import SpreadSheetActivityToolbar, SpreadsheetEditToolbar,
ViewToolbar

Then, while creating the toolbar, I have called these functions as:

        toolbox = activity.ActivityToolbox(self)
        self.set_toolbox(toolbox)
        toolbox.show()

Separately calling edit toolbar:

      self._edit_toolbar = SpreadsheetEditToolbar(self, self._edit_toolbar,
set_canvas)
        toolbox.add_toolbar(_('Edit'),self._edit_toolbar)
        self._edit_toolbar.show()

And similarly calling the Viewtoolbar class:

        view_toolbar = ViewToolbar (self.set_canvas)
        self.set_canvas.show()

Now, my problem is that, the xocom class connects the socialcalc.py file
with the Javascript file, socialcalc.js and xocom.js. I am unable to make
out, whether I have to make changes in the JS file, and what changes to
make.
I would be obliged if someone who has been designing toolbars, can help me
out with this interfacing problem.
Thanks and regards
KS Preeti,
Team Member,
SocialCalc Team
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.laptop.org/pipermail/devel/attachments/20080724/9572c5f5/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SocialCalc-toolbar.xo
Type: application/octet-stream
Size: 213898 bytes
Desc: not available
URL: <http://lists.laptop.org/pipermail/devel/attachments/20080724/9572c5f5/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SocialCalc-toolbar.zip
Type: application/zip
Size: 245323 bytes
Desc: not available
URL: <http://lists.laptop.org/pipermail/devel/attachments/20080724/9572c5f5/attachment.zip>


More information about the Devel mailing list