Re: [udk-dev] RE:PyUNO and OpenOffice installaed with Ubuntu distro

2007-09-21 Thread Joachim Dahl
I've used it on Ubuntu 7.04 and 7.10 for a spreadsheet plugin:
http://abel.ee.ucla.edu/cvxopt/applications/openoffice-org-spreadsheet-plugin/

and it has always worked perfectly for me.

-joachim

On 9/21/07, Laurent Godard [EMAIL PROTECTED] wrote:

 Hi

  The Ubuntu 7.04 distro provides a python UNO package that appears to
  be python 2.5 compatible  (See the Provides: section below) :
 
  Original-Maintainer: Debian OpenOffice Team 
  [EMAIL PROTECTED]

 I'll ask rene

 laurent


 --
 Laurent Godard [EMAIL PROTECTED] - Ingénierie OpenOffice.org -
 http://www.indesko.com
 Nuxeo Enterprise Content Management  http://www.nuxeo.com -
 http://www.nuxeo.org
 Livre Programmation OpenOffice.org, Eyrolles 2004-2006

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: [udk-dev] RE:PyUNO and OpenOffice installaed with Ubuntu distro

2007-09-21 Thread Joachim Dahl
It uses the default python2.5 installed install in /usr/lib/python2.5

On 9/21/07, ashok _ [EMAIL PROTECTED] wrote:

 On 9/21/07, Joachim Dahl [EMAIL PROTECTED] wrote:
  I've used it on Ubuntu 7.04 and 7.10 for a spreadsheet plugin:
 
 http://abel.ee.ucla.edu/cvxopt/applications/openoffice-org-spreadsheet-plugin/
 
  and it has always worked perfectly for me.
 
  -joachim
 

 Which system python were you using 2.4 or 2.5 ? I noticed that packaged
 OOo in
 Ubuntu is stripped of the python intrepeter.and uses the system
 python...

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: [udk-dev] Re: returning multiple values (and range cells) from a Python calc add-in

2007-05-29 Thread Joachim Dahl

The problem seems to be that the add-in is executed every time I click on a
parameter in the
function-wizard,  and thus the optimization routines I am wrapping are
executed over and over again
as I cycle through the different parameters.   So it's not a bug, but
something you want to keep in mind for larger problems that take several
minutes or longer to finish.

- joachim


On 5/29/07, Juergen Schmidt [EMAIL PROTECTED] wrote:


Hi Joachim,

that of course sounds strange and we should analyze it in detail. I am
not really familiar with the Python binding but anyway we should try to
check it. Maybe you can prepare a small demo add-in and can provide it
for further investigation.

Juergen

Joachim Dahl wrote:
 I have a final question that I'd like to ask you...

 I developed and tested the add-in on Ubuntu Feisty that comes with OOo
 2.2.0.
 The add-in
 seems to work perfectly,   but the function wizard is incredibly
sluggish
 for my add-in (and not for the
 regular OOo add-in)...   For example,  when I select a parameter in the
 add-in, CPU usage goes
 to 100% and it takes 5-10s before the new parameter and the
corresponding
 cell ranges are
 highlighted - and the examples are all very small.   But if I update the
 add-in parameters
 directly without the function wizard it works fast and smoothly,  so
it's
 not just simply Python
 being slow.

 Can anyone think of a potential error in the add-in that would cause
this?
 If I can solve this problem
 also,  I will be happy to the add a small Python example to the wiki in
 return for all your help...

 thanks
 Joachim


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: [udk-dev] Re: returning multiple values (and range cells) from a Python calc add-in

2007-05-28 Thread Joachim Dahl

I have a final question that I'd like to ask you...

I developed and tested the add-in on Ubuntu Feisty that comes with OOo 2.2.0.
The add-in
seems to work perfectly,   but the function wizard is incredibly sluggish
for my add-in (and not for the
regular OOo add-in)...   For example,  when I select a parameter in the
add-in, CPU usage goes
to 100% and it takes 5-10s before the new parameter and the corresponding
cell ranges are
highlighted - and the examples are all very small.   But if I update the
add-in parameters
directly without the function wizard it works fast and smoothly,  so it's
not just simply Python
being slow.

Can anyone think of a potential error in the add-in that would cause this?
If I can solve this problem
also,  I will be happy to the add a small Python example to the wiki in
return for all your help...

thanks
Joachim


Re: [udk-dev] Re: returning multiple values (and range cells) from a Python calc add-in

2007-05-26 Thread Joachim Dahl

Hi Juergen,

I haven't seen anything about xcu files.   I just zip up the META-INF files,
the python script,  and the binary
version of my IDL file.

Do you have a pointer handy to the newest format?

thanks
joachim


On 5/25/07, Juergen Schmidt [EMAIL PROTECTED] wrote:


Hi Joachim,

glad to hear that your add-in works now. Well not everything was
possible but you are able to workaround the multiple returns.

I would suggest that you take a look on new add-in with a configuration
file to define the new add-in function 8with localization if you want).
This new approach has several advantages and it would be nice if you can
support this. I know it is not so important for you because your add-in
works but i think it is worth to support the latest features at least
for new implementations.

Or did you already have an xcu file for your add-in?

Juergen

Joachim Dahl wrote:
 Hi Andreas,

 I think the Python UNO bridge works fine;  I managed to return an array
of
 values by using an array function.
 I needed to return multiple arrays of different lengths;  to give a
 specific
 example I made a wrapper around a
 linear programming solver with input arguments 'c' (a vector), 'G' (a
 matrix) and 'h' (a vector).  This routine
 outputs a status string,   a vector 'x' and a vector 'z',  and I used an
 IDL
 as

  string lp ([in] sequence  sequence double  c,
 [in] com::sun::star::table::XCellRange x,
 [in] sequence  sequence double  G,
 [in] sequence  sequence double  h,
 [in] com::sun::star::table::XCellRange z);

 i.e., I used the XCellRange as a way to return additional variables by
 writing back values in x and z.   This approach
 works well for me in Python.

 The only problem I have left is that I have optional arguments, some of
 which are also output argument (albeit, in
 the sense of being XCellRanges),  but that's not possible with a Calc
 add-in.  So my work-around for this problem
 is to have a different function 'lp2' with more arguments (all
mandatory).

 But in summary,  the Python UNO bridge seems fine for writing add-ins.

 Joachim



 On 5/25/07, Andreas Saeger [EMAIL PROTECTED] wrote:

 Joachim Dahl wrote:
  me.
 
  So my problem is not so much of how to write a prototype of an
 addin,  but
  rather how to
  implement something more advanced like methodFour.
 
  Joachim
 

 Hi Joachim,
 http://wiki.services.openoffice.org/wiki/CompleteAddIn has a chapter
 Transforming sequence of sequence into array. This describes the same
 problem as I tried to explain with my simple Basic function
TWICE(array)
 in http://www.oooforum.org/forum/viewtopic.phtml?t=57196. Only
 array-functions, such as the built-in LINEST, can return more than one
 value. The resulting array has to be converted to a 2-dimensional
matrix
 rather than a list of lists. So it is possible that python alone is not
 suitable for add-ins that deal with sheet functions in array context.

 Andreas

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: [udk-dev] returning multiple values (and range cells) from a Python calc add-in

2007-05-21 Thread Joachim Dahl

Joerg,

thanks for all the help;  I managed to get it working...

The output must be a sequence of sequence, otherwise I get the #NAME error
as if the addin is not properly
loaded.  My last problem was actually caused by not flagging the function as
an 'array' function.

Just reference, this is my IDL file:

   interface Xcvxopt : com::sun::star::uno::XInterface
   {
 sequence  sequence long  lp( [in] sequence  sequence  long  
c);
   };

and this is my Python method:

   def lp(self, c):
   x = ((1,),(2,))
   return x

I prefer to return the results in a column,  but a row works also:
   def lp(self, c):
   x = (1,2),
   return x

It would still be nice to be able to return multiple arguments (as you can
in, e.g., gnumeric).  For example,
I would like to return both primal and dual variables for the optimization
variables, and a status
message about the solution (feasible, infeasible, unbounded, etc.) but I can
live with the
current solution.

- Joachim

On 5/20/07, Jörg Budischewski [EMAIL PROTECTED] wrote:


what I actually wonder about is that you choose a matrix signature,
but your sample only takes vectors, maybe change your addin to vectors
or your sample to matrixes, just to see, how it behaves.

But as I said, i dont know calc good enough.

Bye,

Joerg

Joachim Dahl wrote:
 thanks,  this brought me a step further...

 Doing like Joerg suggest,  at least I don't get the #NAME error.

 I invoke my add-in as
 =LP(A1:A2)

 but only a single element of the (1,2), array is returned (the first
 element).

 Joachim



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: [udk-dev] returning multiple values (and range cells) from a Python calc add-in

2007-05-21 Thread Joachim Dahl

I just wanted to add an update...

One way to output several values seems to be via the XCellRange type;  I
guess that's what have been looking for all along...   After learning more
by trial and error,  the Python UNO bridge is very nice!

- Joachim


Re: [udk-dev] returning multiple values (and range cells) from a Python calc add-in

2007-05-19 Thread Joachim Dahl

thanks,  this brought me a step further...

Doing like Joerg suggest,  at least I don't get the #NAME error.

I invoke my add-in as
=LP(A1:A2)

but only a single element of the (1,2), array is returned (the first
element).

Joachim


Re: [udk-dev] returning multiple values (and range cells) from a Python calc add-in

2007-05-18 Thread Joachim Dahl

all of the Python add-in tutorials I've seen are fairly simple, e.g., they
take two numbers as input
and return their sum.

I cannot find any documentation or examples on how to return multiple values
in Python.
This is done in the C++ method called methodfour in the CompleteAddin
tutorial
mentioned above.   If I could figure out how to reimplement methodfour in
Python, that would
probably answer my questions...Handling input range-cells via Python is
straightforward, since
they are just mapped into tuples,  but output range-cells are still illuding
me.

So my problem is not so much of how to write a prototype of an addin,  but
rather how to
implement something more advanced like methodFour.

Joachim


[udk-dev] returning multiple values (and range cells) from a Python calc add-in

2007-05-17 Thread Joachim Dahl

I am trying to write a Python calc add-in that returns multiple values
including range-cells (or arrays of numbers).

E.g., if I want the method to take two input long arguments 'inarg1' and
'inarg2' and return a status string and two
arrays of numbers, how would I specify the IDL routine and python method?

I've searched, but I can't find much information about this topic in the
PyUNO documentation...