Summer of Code/2014/Cordova Container for Sugar

From Sugar Labs
Jump to navigation Jump to search

About you

What is your name?
My name is Gaurav Parida, and I am a 2nd year undergraduate student at International Institute of Information Technology (IIIT), Hyderabad.

What is your email address?

What is your Sugar Labs wiki username?
My username on sugarlabs trac is gp94. My username on is gauravp.

What is your IRC nickname on

What is your first language? (We have mentors who speak multiple languages and can match you with one of them if you'd prefer.)
My first language of communication is English and I am also comfortable with Hindi.

Where are you located, and what hours (UTC) do you tend to work? (We also try to match mentors by general time zone if possible.)
I live in India, so the time difference in UTC and IST is +0530Hrs.I can work comfortably from afternoon to midnight. I will try to be mostly active when most of the mentors come on IRC.

Have you participated in an open-source project before? If so, please send us URLs to your profile pages for those projects, or some other demonstration of the work that you have done in open-source. If not, why do you want to work on an open-source project this summer?
Nowadays, most of the softwares that I use are open source, eg- Linux kernel, Mozilla Firefox, VLC player and etc. There has been buzz about FOSS. I had known about GSoC from the seniors of our college. Now, that I am more acquainted in software development and it's practices, so thought of giving it my level best to contribute towards FOSS and get involved in it, through SugarLabs. This is my first time contribution towards Open Source Development.

About your project

What is the name of your project?
Cordova Container for Sugar Platform

Describe your project in 10-20 sentences. What are you making? Who are you making it for, and why do they need it? What technologies (programming languages, etc.) will you be using?


Presently, the web activities in sugar don’t have any extensive support to using the hardware interfaces like accelerometer and Camera and etc in the activities. With the Sugar container, it will make easy conversion of Applications to Sugar Activities. Adding sugar as a cordova/phonegap container will help us unleash the power of many generic hardware devices like the accelerometer and camera and etc to the sugar web activities. There will be activities that would interact with these hardware devices and make it more interactive and user friendly. There will be more scope of work for the activity developers, as they will get many additional features from the Cordova container.

Cordova and it's working mechanism

Cordova / Phonegap is a software which is used to make multi-platform applications. Phonegap basically takes has different native API’s for each platform. As the platform is specified by the user, the respective javascript library is invoked and it accordingly creates a browserless window in that platform( a browser window with no address ). After the creation of the browserless window, all the HTML/CSS/JS assets are injected to the window and after that is done, the cordova js compiles the window and creates the platform-specific application. The below image shows how the cordova-js is distributed.

Old to new - New Page.jpeg

As, a part of the GSoC project, I have to write code for sugar-web so that it will have an class of chromeless window, which will be created when an application is called for porting into sugar by cordova. So, as soon as the user asks for porting the application to sugar-web activity, the class of chromeless window will be created in native sugar environment and then all the assets/application code will be injected into the class and accordingly bundled to create a sugar-web activity. The bridge between the cordova and sugar-web will be written in javascript. This bridge will be integrated with cordova-js to form the complete porting mechanism. Thus, in this way the new platform support in cordova would be added. The sugar-web activity created in this way will communicate with the generic sugar environment through websockets, which has been already implemented.
The below image shows the changes that will be reflected on sugar-web and how the porting of apps will take place.

Flow - New Page.jpeg
Milestones of the Project
Task Expected Duration
Completion of the Cordova Container for Sugar. See Fig. Below (6-7 week expected)
Working Prototype of the activity that uses hardware interfaces. (2-3 week expected)
Adding documentation on how the activities can exploit the hardware interfaces using the API's written as the part of the project.1st April (1-2 week expected)

The below image shows how the porting mechanism will work for a web application being ported to sugar-web and also shows the tasks of this project

Cordova - New Page.jpeg

The utility of making the sugar container using Cordova/PhoneGap rather than any other platform is--
1. It gives us the native API’s for supporting devices like camera, accelerometer and etc in sugar-web which is presently not supported.
2. The container will easily convert web applications to sugar-web activity (increase in the number of activities in
3. Developers will get access to lot of the native API’s provided by cordova in the sugar-web activities. Thus, more variety of activity interaction will be seen, and the developer base will also increase.

The technologies that will be used in the project are Python, Javascript, HTML,CSS/Less.
The project deliverables include addition to the documentation on how to make activities in sugar, the code for the sugar container, the activity which uses various hardware interfaces like camera, file system and etc.

What is the timeline for development of your project? The Summer of Code work period is from May 19 - August 22; tell us what you will be working on each week. (As the summer goes on, you and your mentor will adjust your schedule, but it's good to have a plan at the beginning so you have an idea of where you're headed.) Note that you should probably plan to have something "working and 90% done" by the midterm evaluation (27 June); the last steps always take longer than you think, and we will consider cancelling projects which are not mostly working by then.

Week / Days Work to be Done
1st April - 20th May
(Pre-program preparation)
*Make a few sugar web-activities and learn how the sugar-web platform works and how the code needs to be ported to make a container for sugar in cordova/phonegap.
*Report the tasks that must be done to make a new container in cordova.
*Explore more on the cordova/phonegap codebase and learn how to make plugins and how the code is to be structured with reference to sugar.
*Work out plan of action for making the cordova container after discussion with the mentors.
*Make some simple web applications that will be ported to sugar-web.

-> Plan on making the container and supported activities.
-> Sample sugar-web activities and some web apps.

20th May - 3rd June
(Week 1,2)
*Start implementing the browserless window of sugar-web and also the injection of assets into sugar-web, also work on the bridge between sugar and cordova.
-> A demonstration of a function call which will make the browserless class and accordingly inject the content of the web application.
3rd June - 17th June
(Week 3,4)
*Start work on the bridge between cordova and sugar-web framework and integrate them the to cordova-js
->The container code added to cordova-js and also the bridge code in sugar-web
17th June - 24th June
(Week 5)
*Start Implementing the native API’s by cordova with the container made for sugar.
*Start preliminary work on activity which would use the hardware device in it’s interaction.
-> Plugins for the sugar container supporting the hardware devices.
-> Pseudocode of the measure/record like activity.
24th June - 1st July
(Week 6)
*Mid-Term Evaluations
*Buffer Week 1
*Will complete the work that has to be done as a part of the evaluation and complete any backlogs.
1st July - 15th July
(Week 7,8)
*Complete the plugins for the hardware devices in sugar-web
*Complete the measure/record like activity.
-> The record/measure like sugar-web activity
15th July - 22nd July
(Week 9)
*Start the documentation of the project both on cordova and sugar-web.
->docs added to the
22nd July - 29th July
(Week 10)
*Buffer Week 2
29th July - 5th August
(Week 11)
*Complete the documentation regarding the making of new web activities and their support to hardware devices.
->docs added to “making new activities” in
5th August - 12th August
(Week 12)
*Expected Pencil Down Date
12th August - 19th August
(Week 13)
*Refactor the code and conform to the coding standards and coding style.
19th August - 26th August
(Week 14)
*Firm Pencil Down & Final Evaluations

Convince us, in 5-15 sentences, that you will be able to successfully complete your project in the timeline you have described. This is usually where people describe their past experiences, credentials, prior projects, schoolwork, and that sort of thing, but be creative. Link to prior work or other resources as relevant.
I have participated in many projects as a part of the college curriculum and my own interest. As a part of life here at IIIT, one has to not only manage completion of assignments but also seek for the overall growth. Here, we get the feel of deadlines, projects/assignments /presentations. Even under so much workload, we eventually complete them successfully. The projects that I have successfully completed is given below

  • Build a clinic management web application called HealthMate, that won the Google Cloud Developer Challenge 2013 from India Region. It was built using Google App Engine framework and python.[1]
  • Build an evernote like application which is a notes taking and task scheduling web application as a part of college coursework. It was built using web2py and python.[2]
  • Built a terminal that is similar to the linux terminal with functions like opening files and piping and etc. It was built as a part of the Operating Systems coursework. It was built using C language.[3]
  • Built a reddit like web application as a part of college coursework. It was built using web2py and python.[4]
  • Build a TCP client and server peer to peer implementation as a part of the Computer Networks course. It was built using C.[5]
  • Build a 2D and a 3D game in OpenGL as a part of the Graphics coursework. It was built using C++.[6],[7]
  • Build a simple wave mixer application using Python GUI tools(tkinter) and pyaudio library in python.[8]
  • Built an Android application called BabySteps, which is focused for Child and Infant Healthcare in India.[9]
  • Built an IRC Bot using python and twisted library to take logs of the sugar IRC channel.[10]
  • Have made a few applications like painting app using processing2.0 as a part of a coursera course online.[11]

I have been using python since last two years and I am pretty comfortable using it. I have used python as the programming language for many of my projects. Since, the summer break is the time when a student has lot of free time and one can adopt to new technologies and learn new things, meet new people, share ideas and make something useful. I feel that I can grasp new things and use them to successfully complete the project.

You and the community

If your project is successfully completed, what will its impact be on the Sugar Labs community? Give 3 answers, each 1-3 paragraphs in length. The first one should be yours. The other two should be answers from members of the Sugar Labs community, at least one of whom should be a Sugar Labs GSoC mentor. Provide email contact information for non-GSoC mentors.
Gaurav Parida : With the completion of my project, the web activities will have further support for hardware devices like camera, accelerometer and etc. Thus, users will get to interact, more with the activities intuitively. The developers will get easy access to port existing applications to sugar web activities. The developers will also get easy access to the API level functions provided by cordova to use the devices with their activities. Thus, the developer base would increase a lot and also the user’s usability will increase significantly.
Walter Bender : I can just say that for young kids, interaction with the physical world is really important: hence the need to support devices
Lionel Laské : Today, Sugar activities written using the Sugar Web Framework had limited features because they can't benefit to device capabilities (camera, audio/video capture, accelerometer, network detection, ...). Integrating a PhoneGap container into Sugar will allow to provide the same level of features to Sugar Web activities than existing Sugar activities. Plus it will allow to web developers familiar with PhoneGap/Cordova framework to easily port or adapt their applications to Sugar. So we could expect to enhance the community of developers.
Suraj KS : Writing activities using HTML5/JavaScript has already given a big boost to Sugar. Once we can get wrap it in a Cordova/Phonegap container, it'll transform Sugar Web activities to a whole new level by utilizing the PhoneGap features. This could further attract many more developers towards Sugar and thereby improving both the quality and quantity of Sugar activities.

What will you do if you get stuck on your project and your mentor isn't around?
If I need help, and there is no mentor to help, then I will first see for the regular contributors like ignacio, svineet, manuq, dnarvaez, walterbender, gonzalo, tch,llaske...that may be present on IRC and seek their help, if the problem still persists then I will send a mail to the mailing list seeking for help, so that the mentor can see it whenever he comes online. Till then I will try to get involved in some other aspect/ part of the project.

How do you propose you will be keeping the community informed of your progress and any problems or questions you might have over the course of the project?
Well, before the start of the program, I have made a micro blog ,where I keep a daily log of the work that I do as a contributor towards the organisation. I hope to keep the blog updated so that people can see the updates and put in their feedback. Thus, all the progress will be recorded in the blog. If asked to maintain the record in the wiki, I will accordingly do so.


Send us a link to a screenshot of your Sugar development environment with the following modification: when you hover over the XO-person icon in the middle of Home view, the drop-down text should have your email in place of "logout".

Sugar req.png

Send us a link to a pull request or merge request you have made on a Sugar or Sugar activity bug.
I have been regular in the sugar community for a while and I have compiled all the work that I have contributed towards the project uptill now
1. sugar-docs Pull Requests


2. sugar-build Pull Requests(Added an empty activities folder in sugar-build which was not being created earlier)


3. sugar-toolkit-gtk3 pull requests (Implemeted the verbosity feature in unit tests)


4. pull requests

5. Other


6. Bug Reporting/Triaging

Describe a great learning experience you had as a child.
When I was 6 years old, I was always interested on knowing how things worked. My dad had bought me a electronics set, where I plugged in a DC motor to a battery and made a fan. Intrigued by this success, I thought that the fan will rotate faster if I plug it to the AC port. On doing so, a short circuit occurred and from that I learnt that without the guidance of the elders, working things can go awry.

Is there anything else we should have asked you or anything else that we should know that might make us like you or your project more?
I think that, it is a very noble job to make something that helps in improving the way teaching is done and makes the subject more interactive and interesting for the student to understand and grasp. The OLPC and the SugarLabs project should be adopted in more and more countries. I feel humbled to be be a part of such a good cause.