[Socialcalc] PROGRESS ON SOCIALCALC

Luke Closs luke.closs at socialtext.com
Fri Aug 22 04:10:53 EDT 2008


Preeti,

Thank you for this informative email.  I'm glad to see you made some  
progress.

I've got several ideas about how to further extend xocom so that it is  
easy for the python toolbar to call javascript hooks by applications  
like this.  As you can see in this file:

   http://github.com/lukec/onepagewiki/tree/master/ 
OnePageWikiActivity.py

Once you have xocom set up, you can call javascript methods from  
python like this:

   self.xocom.send_to_browser( 'command' )

The OnePageWiki Activity[1] and the socialcalc activity use the 'read'  
and 'write' commands to cause the Socialcalc javascript to load or  
save a sheet.  We should be able to hook up other commands, by  
providing javascript hooks to call.

If you look at this example xocom HTML page, you can see how you'd  
provide new hooks:

   http://github.com/lukec/xocom/tree/master/web/index.html

This is how Socialcalc's index.html provides the read and write  
commands:

   http://github.com/lukec/socialcalc-xocom/tree/master/web/index.html#L110

Preeti, I would love to see you submitting code somewhere.  Are we  
using a public git repo?  Feel free to fork my socialcalc-xocom[2]  
project (you can sign up for github for free code hosting, it's  
great).  Once you fork that project, you can add your new toolbar code  
into your repo, and then we can share the code easier.  I'll be happy  
to review your commits to hook this stuff together.  You're really  
close, I think.

Cheers,
Luke

P.S. - I'm usually in #socialtext or #vhs on irc.freenode.net if you'd  
like to chat.

[1] http://github.com/lukec/onepagewiki/tree/master
[2] http://github.com/lukec/socialcalc-xocom/tree/master


On 22-Aug-08, at 12:03 AM, Preeti KS wrote:
>     Long time since there's been activity on this group. I thought I  
> will initiate something. I have been a wee bit busy with other  
> things, and was not in Delhi for a while. But, I did manage to do  
> some testing for SocialCalc.
>
> The good news is that xocom is working perfectly. Infact, I have  
> been working on making the toolbar.py file for the release of this  
> activity. While on it, I have made extensive use of xocom. 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. I have attached the relevent files with this email and also at http://wiki.laptop.org/go/Image:SocialCalc-toolbar.zip 
>  .
> I had mailed earlier with some doubts, some of which actually got  
> cleared when I studied the toolbars of other activities. I thought  
> you might be interested to know exactly how xocom is used in the  
> toolbar. In activities like "Abiword" I noticed that the web view,  
> etc are created using hulahop and webview. As xocom has defined  
> webviews, I have created a class SpredSheetActivityToolbar that uses  
> xocom to create webviews. 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.
> Then of course, I had to make changes in the SOcialCalc.py file in  
> order to call this toolbar interface. 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()
>
> I had a lot of fun doing this integration work. I am facing a few  
> problems dealing with the Javascript aspect of this whole activity,  
> but to deal with that I am studying JS in detail. So still an  
> advantage. I hope you all will be helping me out with the queries!
> Apart from that, I also tested the new build for various simulated  
> situations. I have taken snapshots of the same. But due to problems  
> in my net connection, they are not getting attached. I will  
> definitely mail them by Monday.
>
> Thanks and warm regards,
> Preeti
>



More information about the Socialcalc mailing list