To comment on the following update, log in, then open the issue:
http://www.openoffice.org/issues/show_bug.cgi?id=76281
                 Issue #|76281
                 Summary|Add import functionality to python components
               Component|udk
                 Version|OOo 2.2
                Platform|All
                     URL|
              OS/Version|All
                  Status|NEW
       Status whiteboard|
                Keywords|
              Resolution|
              Issue type|ENHANCEMENT
                Priority|P3
            Subcomponent|code
             Assigned to|jbu
             Reported by|jbu





------- Additional comments from [EMAIL PROTECTED] Wed Apr 11 20:06:07 +0000 
2007 -------
Current situation:

A python uno component must be self contained in a single
python source file, meaning that it can only import
other python modules, that are in the office pythonpath.
In general, there are just the modules offered by the
python runtime (though you can extend the pythonpath
via the pythonloader.uno[.ini|rc] in the program directory).
A uno component itself is not added to sys.modules.

This is a strong limitation for the python component, because
  - you can't split your component implementation into multiple source files
when a certain complexity level is reached
  - you can't use 3rd party python libraries

  
Suggested solution:
Whenever the pythonloader tries to load a new python unocomponent, it looks
beside the uno component for a file with the
name pythonpath.zip. If it exists, it puts it into sys.path (if it is not
already in there). Afterwards, it loads
the given component. You can put everything you want to have in PYTHONPATH into
this zip-file. This is necessary,
as otherwise every file with a .py suffix would be interpreted as a python
component, packages would fail during the
registration process.

Positive effects:
  * Uno components can be implemented with an arbirtrary number of python source
files.
  * The uno package mechanism allows them to be cleanly added/removed
  * The implementation is short and simple (see below)

Negative effects:
  * Storing these files in another zip-File is a hurdle for developers, but
    can be overcome with simple packaging scripts.
  
Undesired Side effects:
  *  (cannot be changed, as python does not have a classloader concept): Two
independend uno packages from different
    developers may interfere each other, when they have name clashes in their
code (e.g. same 3rd party product, but
    different versions).
  * If such a situation occurs, in general the last used component will not work
properly
    (which one is the last used component may also depend on the path of user
interactions in the office process)
  * The python component remains beside the .zip file. 
  * Code added through this mechanism can only be changed with a restart of the
office process (as it got added
    to sys.modules). 


In order to give this proposal a try, you have to

1) apply the attached patch to the pythonloader.py file
2) Let the attached sample package run

Note: It only works, when you use office on windows or when you use an office,
that uses the system python installation. With the default OOo build on unix,
the solution currently fails due to issue
http://www.openoffice.org/issues/show_bug.cgi?id=27026 (no zip
support in OOo's python). This issue must be fixed, before this solution can be
integrated.

---------------------------------------------------------------------
Please do not reply to this automatically generated notification from
Issue Tracker. Please log onto the website and enter your comments.
http://qa.openoffice.org/issue_handling/project_issues.html#notification

---------------------------------------------------------------------
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]

Reply via email to