LibreOffice / loeclipse

LibreOffice Eclipse plugin for extension development
https://libreoffice.github.io/loeclipse/
31 stars 25 forks source link

Add Support for Python in LOEclipse Plugin (GSoC - 18) #68

Closed shobhanmandal closed 5 years ago

shobhanmandal commented 6 years ago

Project Summary

This project developed under Google Summer of Code,2018 was all about adding capabilities to the LOEclipse Plugin, which is used to develop plugins/ extensions for LibreOffice, such that developers can use Python language to develop these plugins in addition to the existing Java Language.

The following gives out the list of commits that have been made, so that we can achieve the desired result which is creating an Extension project using Python which we can run in a installed LibreOffice.

The List of Commits:

A new separate module for 'Python is created similar to the Java module such that most of the code which corresponds the creation of a Python extension project and also its export is placed under it.

In the earlier commit the .project file which is associated with Python module was missing. We need to have it for proper execution of the Plugin.

In the first commit one of the redundant file content was removed which has no role to play in the Python module followed by, in the second commit users can start exporting their project as an ".oxt" file which can be imported by LibreOffice which is installed in the system.

Both these commits had a lot of omissions made, which we found that were not required in the Python module. These codes were made specifically for Extensions Projects or other LibreOffice Projects made using Java. Putting them under a separate commit since a large number of files were affected so grouped them under the two. Also we put in two changes, such that the build.xml will help in the including the Python module when we go ahead to create the plugin from the build.xml present in the build module and also a skeleton Python file is created when we create a new project using Python.

Run As -> LibreOffice Extension : This is an important requirement of the LibreOffice Plugin which allows users to run their Project directly from the Eclipse itself without manually exporting the project as ".oxt" file and then opening a LibreOffice instance and importing the same ".oxt". This change launched a LibreOffice instance on its own and deployed the necessary ".oxt" (extension) directly into it.

Till now the project created did not show any language associated with the Project (Example: A Java project has J symbol on the Project folder and also in its properties you will see Java Properties). similarly we needed to have something since it is a Python project in addition to being a LibreOffice Extension Project, this commit made sure we had those changes in place.

One of the final and important requirements of the project was the ability to Debug, Java Extension projects had this feature and we needed to implement the same in the Python Extension projects, we took the aid of the PyDev plugin to help us in Debugging the Python extension. You can go through the below link where you will get the idea why we needed the help of the PyDev plugin : https://wiki.documentfoundation.org/Development/Extension_Development/Python_Extensions_Development#Setting_up_a_debugger and to read about how we took the help of PyDev plugin, you can go through the following link : http://www.pydev.org/manual_adv_remote_debugger.html#remote-debugger

Again an important feature of the LibreOffice Extensions are the presence of the "idl" files, in the Java Extension projects these files were included but I had commented them since initially it was not required, but later on realising its importance we made changes such that these files were created. Also we found that Space " " and Underscore "_" if given in Project names were causing Errors during the creation of the Project therefore we introduced error warning if it was given in Project Name.

This commit allows that users/ developers are now seeing the ServicePage and the Interface page in the New Extension Project Wizard if you selected the Language as Python. As earlier mentioned these were commented that time since initially they were not required for the basic of projects.

This is one of the last commits where we have removed any redundant imports, calls, etc. that were present in the module so that they do not have any warnings, secondly we found that under New URE Project we are getting Python as a Language since we have still not developed that part of the module for Python we give out a error when you select Python Language under New URE Project under LibreOffice.

In continuation of the code clean up, this commit contains the addition of the help content to the LibreOffice Plugin Help under Help-> Help Contents (In Eclipse). The Help document contains how to use Python to create the Extension Project.

I have created a video for the creation of New Extension Projects using Python, where I have also showed debugging and running them as application directly from Eclipse using two versions of LibreOffice. https://youtu.be/64XCukPZsxA

Regards, Shobhan.