<p>Dear all,</p>
<div> 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. <br>
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 <a href="http://wiki.laptop.org/go/Image:SocialCalc-toolbar.zip">http://wiki.laptop.org/go/Image:SocialCalc-toolbar.zip</a> .</div>
<div>My toolbar.py file is as follows, these are some code snippets:</div>
<div> </div>
<div>This is the main spreadsheet activity toolbar, It has used xocom to create the webview..</div>
<div><font style="BACKGROUND-COLOR: #ffff33" color="#009900"></font> </div>
<div><font style="BACKGROUND-COLOR: #ffff33" color="#009900">class SpreadSheetActivityToolbar: </font></div>
<p><font style="BACKGROUND-COLOR: #ffff33" color="#009900"> def __init__(self, activity, toolbox, self_canvas):</font></p>
<p><font style="BACKGROUND-COLOR: #ffff33" color="#009900"> self._activity = activity<br> self.set_canvas( xocom.create_webview() )<br> self._activity_toolbar = toolbox.get_activity_toolbar()<br> self._keep_palette = self._activity_toolbar.keep.get_palette()</font></p>
<p><font style="BACKGROUND-COLOR: #ffff33" color="#009900">.........................</font></p>
<p><font style="BACKGROUND-COLOR: #ffffff" color="#000000">Then, I have created another class, for the edit toolbar. Its definition is as follows:</font></p>
<p><font style="BACKGROUND-COLOR: #ffff66" color="#009900">class SpreadsheetEditToolbar(EditToolbar):</font></p>
<p><font style="BACKGROUND-COLOR: #ffff66" color="#009900"> def __init__(self, toolbox, self_canvas):</font></p>
<div><font style="BACKGROUND-COLOR: #ffff66" color="#009900"> EditToolbar.__init__(self)<br> self.set_canvas( xocom.create_webview() )</font></div>
<div><font style="BACKGROUND-COLOR: #ffff66" color="#009900">.........</font></div>
<p><font style="BACKGROUND-COLOR: #ffff66" color="#009900"><font style="BACKGROUND-COLOR: #ffffff" color="#000000">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. </font></font></p>
<div>Here are the details of the SocialCalc.py file:</div>
<div>To interface it with toolbar.py, I have imported the classes from this file as:</div>
<div> </div>
<div><font style="BACKGROUND-COLOR: #ffff66" color="#009900">import toolbar<br>from toolbar import SpreadSheetActivityToolbar, SpreadsheetEditToolbar, ViewToolbar</font></div><font color="#009900">
<p><font color="#000000">Then, while creating the toolbar, I have called these functions as:</font></p>
<p> <font style="BACKGROUND-COLOR: #ffff66"> toolbox = activity.ActivityToolbox(self)<br> self.set_toolbox(toolbox)<br> toolbox.show()</font></p>
<p><font style="BACKGROUND-COLOR: #ffffff" color="#000000">Separately calling edit toolbar:</font></p>
<p><font style="BACKGROUND-COLOR: #ffff66"> self._edit_toolbar = SpreadsheetEditToolbar(self, self._edit_toolbar, set_canvas)<br> toolbox.add_toolbar(_('Edit'),self._edit_toolbar)<br> self._edit_toolbar.show()</font></p>
<p><font style="BACKGROUND-COLOR: #ffffff" color="#000000">And similarly calling the Viewtoolbar class:</font></p>
<p><font style="BACKGROUND-COLOR: #ffff66"> view_toolbar = ViewToolbar (self.set_canvas)<br> self.set_canvas.show()<br></font> <br><font color="#000000">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.</font></p>
<div></div></font><font color="#000000">I would be obliged if someone who has been designing toolbars, can help me out with this interfacing problem. </font>
<div><font color="#000000"></font> </div>
<div><font color="#000000">Thanks and regards</font></div>
<div><font color="#000000">KS Preeti,</font></div>
<div><font color="#000000">Team Member,</font></div>
<div><font color="#000000">SocialCalc Team<br> </font></div><font color="#009900">
<p><br> </p></font>