[sugar] QUERY REGARDING INTERFACING OF TOOLBAR
Tomeu Vizoso
tomeu at tomeuvizoso.net
Thu Jul 24 03:47:41 EDT 2008
Hi,
where is the xocom source repository?
I know nothing about xocom, but I recommend you to code a simple
python-only activity first to familiarize with that part of the
problem, and only then coming back to the SocialCalc Activity. Take a
look to this activity:
http://dev.laptop.org/~marco/Edit-1.xo
http://dev.laptop.org/git?p=users/marco/edit-activity;a=blob;f=editactivity.py;h=bb2e98e27f236e716fb47faad952ac35fb827ab9;hb=HEAD
Good luck,
Tomeu
2008/7/24 Preeti KS <kspreeti.13 at gmail.com>:
> 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
>
>
>
>
> _______________________________________________
> Devel mailing list
> Devel at lists.laptop.org
> http://lists.laptop.org/listinfo/devel
>
>
More information about the Sugar
mailing list