Bug Hunting Session
Bug 38820 - Wizards: Java to Python? conversion
Summary: Wizards: Java to Python? conversion
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: UI (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: Other All
: medium normal
Assignee: Xisco Faulí
URL:
Whiteboard: target:4.1.0 target:4.2.0
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-30 07:58 UTC by Björn Michaelsen
Modified: 2013-07-26 11:40 UTC (History)
10 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Björn Michaelsen 2011-06-30 07:58:35 UTC
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í
Comment 1 enrico.weigelt 2012-03-17 08:26:24 UTC
Any specific reason for not compiling the java code into machine code ?
Comment 2 David Tardon 2012-04-04 07:29:41 UTC
(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
Comment 3 Stéphane Aulery 2012-08-11 01:22:52 UTC
Deteted "Easyhack" from summary
Comment 4 Michael Meeks 2012-10-18 01:38:45 UTC
This is the easy hack for interested people :-)
Comment 5 Lucas Betschart 2012-11-12 16:32:02 UTC
Ah I'm sorry. Just ignore the version change.
I was thinking I'm modifying my own (an other) bug report. Missed the window.
Comment 6 Michael Hasselmann 2013-01-14 16:41:15 UTC
This bug has been assigned for over a year yet no progress is visible. Is anyone working on it?
Comment 7 Michael Meeks 2013-01-14 17:25:55 UTC
> 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 :-)
Comment 8 Xisco Faulí 2013-01-14 18:05:33 UTC
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
Comment 9 Javier Fernández 2013-02-05 19:15:45 UTC
I have plans to contribute to this bug, but so far, still trying to figure out the current status of the implementation.
Comment 10 Xisco Faulí 2013-02-06 11:33:04 UTC
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.
Comment 11 Javier Fernández 2013-02-06 12:07:02 UTC
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.
Comment 12 Xisco Faulí 2013-02-06 14:04:37 UTC
(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
Comment 13 Not Assigned 2013-02-14 00:00:21 UTC
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.
Comment 14 Javier Fernández 2013-02-14 09:26:49 UTC
Juts to inform that I've started to work on the Web wizard python implementation, completing the job Xisco had done on this regard.
Comment 15 Javier Fernández 2013-03-07 11:36:19 UTC
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.
Comment 16 Javier Fernández 2013-03-25 10:55:49 UTC
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.
Comment 17 Javier Fernández 2013-04-01 10:51:42 UTC
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.
Comment 18 Björn Michaelsen 2013-04-08 18:47:00 UTC
removing easy hack whiteboard status -- its not much left of this task and what is left seems to be in good hands.
Comment 19 Javier Fernández 2013-04-18 12:19:05 UTC
(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.
Comment 20 Javier Fernández 2013-04-22 11:53:08 UTC
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.
Comment 21 Xisco Faulí 2013-04-22 12:52:49 UTC
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.
Comment 22 Javier Fernández 2013-05-08 12:53:12 UTC
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.
Comment 23 Michael Meeks 2013-05-08 13:02:47 UTC
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 !
Comment 24 Xisco Faulí 2013-05-08 13:37:39 UTC
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.
Comment 25 Michael Meeks 2013-05-08 14:22:46 UTC
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 ! :-)
Comment 26 Björn Michaelsen 2013-05-28 18:10:20 UTC
Any reason not to close this monster now as RESOLVED/FIXED?
Comment 27 Commit Notification 2013-06-09 20:11:09 UTC
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.
Comment 28 Commit Notification 2013-06-09 20:19:19 UTC
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.
Comment 29 Michael Meeks 2013-07-26 11:40:59 UTC
I guess we should close it - thanks so much for the great work Xisco & Javier.