[EasyHack] Wizards: Java to Python? conversion

Bug #818185 reported by Björn Michaelsen
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
LibreOffice
Fix Released
Medium

Bug Description

If you use the File, Wizards menu - it throws up a UI using Java to
create documents. This causes some nasty problems on machines with
mis-configured (or not present) Java, and of course presents a serious
performance challenge. Since we bundle our own Python run-time anyway, it would
be ideal to run a python to java converter across the code to drop this
dependency. This should be made easier by the existing Java code using UNO APIs
to create its GUI. The wizards code lives in: wizards/com/sun/star/ and it
would (most likely) be best to start off by converting something smaller - like
the 'fax' wizard first - which is sub 1000 lines. Of course, if you prefer
native C++ to python, using that instead would be an option too.

Revision history for this message
In , Björn Michaelsen (bjoern-michaelsen) wrote :

Wizards: Java to Python? conversion

Background: If you use the File, Wizards menu - it throws up a UI using Java to create documents. This causes some nasty problems on machines with mis-configured (or not present) Java, and of course presents a serious performance challenge. Since we bundle our own Python run-time anyway, it would be ideal to run a python to java converter across the code to drop this dependency. This should be made easier by the existing Java code using UNO APIs to create its GUI. The wizards code lives in: wizards/com/sun/star/ and it would (most likely) be best to start off by converting something smaller - like the 'fax' wizard first - which is sub 1000 lines. Of course, if you prefer native C++ to python, using that instead would be an option too.

Skills: python, some Java, minor C++

Taken By: Xisco Faulí

Changed in df-libreoffice:
importance: Unknown → Medium
status: Unknown → In Progress
Revision history for this message
In , Enrico-weigelt (enrico-weigelt) wrote :

Any specific reason for not compiling the java code into machine code ?

Revision history for this message
In , Dtardon (dtardon) wrote :

(In reply to comment #1)
> Any specific reason for not compiling the java code into machine code ?

1. gcj is slowly dying
2. it is not worth the pain

Revision history for this message
In , Stéphane Aulery (lkppo) wrote :

Deteted "Easyhack" from summary

no longer affects: libreoffice (Ubuntu)
Revision history for this message
In , Michael Meeks (michael-meeks) wrote :

This is the easy hack for interested people :-)

Revision history for this message
In , Lucas Betschart (lucasbetschart) wrote :

Ah I'm sorry. Just ignore the version change.
I was thinking I'm modifying my own (an other) bug report. Missed the window.

Revision history for this message
In , Michael Hasselmann (michael-hasselmann) wrote :

This bug has been assigned for over a year yet no progress is visible. Is anyone working on it?

Revision history for this message
In , Michael Meeks (michael-meeks) wrote :

> This bug has been assigned for over a year yet no progress is visible.
> Is anyone working on it?

Ah - there are no reports in the bug for sure - but Xisco has been doing great work and has ported several of the wizards across to python. I'm sure he'd appreciate help testing / working on that if you want to get involved though: there is plenty to do still. If you checkout:

http://cgit.freedesktop.org/libreoffice/core/tree/wizards/

you can see the Jar_foo.mk vs. PyUno_baa.mk presence to track progress - so far we have fax and letter migrated - but plenty of others to come :-)

Revision history for this message
In , Xisco Faulí Tarazona (x1sc0) wrote :

Yeah, Michael is right, I'm still working on it, although I haven't had much spare time recently. Anyway, I'll be glad to help you in case you want to get involved

Revision history for this message
In , Jfernandez (jfernandez) wrote :

I have plans to contribute to this bug, but so far, still trying to figure out the current status of the implementation.

Revision history for this message
In , Xisco Faulí Tarazona (x1sc0) wrote :

Hello Javier, All,

here a brief status of the wizards up-to-date ( 0%: nothing done yet, 100%: java wizard deleted and replaced by the python wizard):

Fax: 100%
Letter: 100%
Agenda: 95%. Working on this now. 2 issues left and I'll replace it, probably will be done by this week or next week.
Web: 30-40%. I worked on it for a week or two during the GSOC11.
Report: 0%
Form: 0%
Table : 0%

I'd be glad to help you in case you're interested on doing some work here. Don't hesitate to contact me in case you have any doubt.

Revision history for this message
In , Jfernandez (jfernandez) wrote :

Hello Xisco,

(In reply to comment #10)
> Hello Javier, All,
>
> here a brief status of the wizards up-to-date ( 0%: nothing done yet, 100%:
> java wizard deleted and replaced by the python wizard):
>
> Fax: 100%
> Letter: 100%
> Agenda: 95%. Working on this now. 2 issues left and I'll replace it,
> probably will be done by this week or next week.
> Web: 30-40%. I worked on it for a week or two during the GSOC11.
> Report: 0%
> Form: 0%
> Table : 0%
>

I think the best approach would be me starting to look at Report, Form and Table, so you can continue working on Web when you have time and Agenta is completed.

> I'd be glad to help you in case you're interested on doing some work here.
> Don't hesitate to contact me in case you have any doubt.

Thank you, I'll ping you for sure in the following days, but for the time being, I'm jsut analyzing your work in the different librefoffice branches.

Revision history for this message
In , Xisco Faulí Tarazona (x1sc0) wrote :

(In reply to comment #11)
> Hello Xisco,
>
> (In reply to comment #10)
> > Hello Javier, All,
> >
> > here a brief status of the wizards up-to-date ( 0%: nothing done yet, 100%:
> > java wizard deleted and replaced by the python wizard):
> >
> > Fax: 100%
> > Letter: 100%
> > Agenda: 95%. Working on this now. 2 issues left and I'll replace it,
> > probably will be done by this week or next week.
> > Web: 30-40%. I worked on it for a week or two during the GSOC11.
> > Report: 0%
> > Form: 0%
> > Table : 0%
> >
>
> I think the best approach would be me starting to look at Report, Form and
> Table, so you can continue working on Web when you have time and Agenta is
> completed.

You can use java2python to make an initial translation but then you will have to do many manual changes. Then, if you analyse the code you'll realize some thing can be improved or be done in a better way with python.
Each wizard has its own code(ie. report/ ) but they also share some parts of the code, common/ ui/ text/ or document/. Common parts have been widely translated so you can reuse them.

>
> > I'd be glad to help you in case you're interested on doing some work here.
> > Don't hesitate to contact me in case you have any doubt.
>
> Thank you, I'll ping you for sure in the following days, but for the time
> being, I'm jsut analyzing your work in the different librefoffice branches.

You can follow my commits here: http://cgit.freedesktop.org/libreoffice/core/log/?qt=author&q=xisco

Revision history for this message
In , Libreoffice-bugs (libreoffice-bugs) wrote :

Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=f4dc5247fca29f93a2d19b7e526d30d4b022b0ee

fdo#38820: bye bye java agenda wizard

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.

Revision history for this message
In , Jfernandez (jfernandez) wrote :

Juts to inform that I've started to work on the Web wizard python implementation, completing the job Xisco had done on this regard.

Revision history for this message
In , Jfernandez (jfernandez) wrote :

I've got a preliminary version of the Web wizard port. It's still full of bugs, but so far, almost free of exceptions.

The Wizard procedure completes successfully, using all the available dialogs, Backgrounds, Icons, ... but functionality is still broken. there are still many features commented out because if unimplemented methods.

I'll try to coordinate with Xisco from now on, in order to resolve the conflicts caused by the recent Agenda implementation and, after fixing the current issues I'm facing, integrate my branch into master.

Revision history for this message
In , Jfernandez (jfernandez) wrote :

I've got a version of the web wizard that implements almost all the functionalities provided by the java version.

I've created a branch in the gerrit queue, called "gerrit-pyweb-wizard" to track all the implementation. The commits I've pushed for the time being are just the initial port of missing files and properly "pythonize" the ones already present.

Also, and I think this is the first thing to discuss after reviewing the initial implementation, I had to add an "ugly hack" to deal with the Agenda implementation related to the ConfigSet and CGTopic classes. For the time being, I've defined a new class WebConfigSet with the bits required to make the Web wizard work properly, but we must decide how to integrate it with the current Agenda approach.

Revision history for this message
In , Jfernandez (jfernandez) wrote :

I've created a branch "feature/pyweb-wizard" with the preliminary implementation of the Python port.

Apparently, it looks like most of the functionality is already ported; as far as I can remember, only some FTP stuff and preview are missing, but I'm working on it.

Revision history for this message
In , Björn Michaelsen (bjoern-michaelsen) wrote :

removing easy hack whiteboard status -- its not much left of this task and what is left seems to be in good hands.

Revision history for this message
In , Jfernandez (jfernandez) wrote :

(In reply to comment #17)
> I've created a branch "feature/pyweb-wizard" with the preliminary
> implementation of the Python port.
>
> Apparently, it looks like most of the functionality is already ported; as
> far as I can remember, only some FTP stuff and preview are missing, but I'm
> working on it.

I've pushed to the branch the last fixes for the ZIP and FTP publishers. now only thr preview issue is still there.

Revision history for this message
In , Jfernandez (jfernandez) wrote :

Pushed a fix for the preview bug.

Now the branch "feature/pyweb-wizard" contains a full implementation of the Web Wizard in python, with all the java legacy functionality ported and tested.

I'll wait some time for Xisco's feedback, since there is still some integration work to be done related with the ConfigSet class. It s not mandatory, since the WebWizard provides its own WebConfigSet class, but it would be good to share the code between the Agenda and Web wizards.

Revision history for this message
In , Xisco Faulí Tarazona (x1sc0) wrote :

Nice work Javi ;-)

Please, go ahead and merge it into master. I've been quite busy recently and I'm afraid I can't take a look at it for the moment.

Revision history for this message
In , Jfernandez (jfernandez) wrote :

The WebWizard python port has been integrated into master. The java files are still in the repo while the QA tests verify that all the functionality has been ported correctly.

Revision history for this message
In , Michael Meeks (michael-meeks) wrote :

So - it'd be great to have a status on what remains here.

I rather suspect that the "Euro Converter" could be removed without obvious problems ;-) then again - perhaps it's inverse will be useful in a few years ;-> [ joke ].

Thanks guys !

Revision history for this message
In , Xisco Faulí Tarazona (x1sc0) wrote :

Nice work Javi, If I were you I'd already delete the java code. It doesn't make much sense to have a bunch of code we're not even calling to. We can always revert it in case something goes wrong.

@Michael: Euro converter is programmed in StarBasic, not in Java: http://opengrok.libreoffice.org/xref/core/wizards/source/euro/ , Anyway, I totally agree with you that we could get rid of it ( at least until we'll need the inverse version xD ), so If you allow me i'll delete it myself.
Regarding to the java wizards, all wizards in File -> Wizards have been already ported. However, there're still 4 wizards that are used in Libreoffice Base, one for Table, one for Query, one for Report and one for Forms. I guess its priority isn't that high because Base strongly depends on java. Anyway it's in my TODO list and if no one else if taking care of it I'll do it as soon as I have some spare time.

Revision history for this message
In , Michael Meeks (michael-meeks) wrote :

Lovely work - so yes lets kill the java - git will kindly leave it there forever of course but ... ;-)

It would be great to update:

https://wiki.documentfoundation.org/ReleaseNotes/4.1

To include Javier's work (and the name of Igalia too ! :-)

Revision history for this message
In , Björn Michaelsen (bjoern-michaelsen) wrote :

Any reason not to close this monster now as RESOLVED/FIXED?

Revision history for this message
In , Libreoffice-commits (libreoffice-commits) wrote :

Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=352d6ffa8e3aee793486d8e065ad044b58ca5dac

fdo#38820 - Remove java web wizard

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.

Revision history for this message
In , Libreoffice-commits (libreoffice-commits) wrote :

Xisco Fauli committed a patch related to this issue.
It has been pushed to "libreoffice-4-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=3481bbb57d33b8548994bdb06fe01b754428a8e4&h=libreoffice-4-1

fdo#38820 - Remove java web wizard

It will be available in LibreOffice 4.1.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.

Revision history for this message
In , Michael Meeks (michael-meeks) wrote :

I guess we should close it - thanks so much for the great work Xisco & Javier.

Changed in df-libreoffice:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.