-
Notifications
You must be signed in to change notification settings - Fork 0
Fork of PyUNO based on Apache OpenOffice for Python 3 support.
License
hanya/pyuno3
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This is Python-UNO bridge forked from Apache OpenOffice rev 1367534. This can be build without hole source tree of the office. Requirements - Apache OpenOffice 3.4? and its SDK. - Python 3.3 and its include files. Python 3.0 to 3.2 are not supported yet. Build Setup SDK environment to build. > python setup.py build If you met problem on building about strict aliasing, add -fno-strict-aliasing option to build. Only Linux platform is supported now. For other platform, setup.py script should be updated according to SDK of the office. Resulting pyuno module is standalone which do not separeted in to two libraries. And it can be used only as RPC client. You have to setup environmental variables before you to import the module into your Python script. - URE_BOOTSTRAP specifies fundamentalrc, c.g.: export URE_BOOTSTRAP=vnd.sun.star.pathname:/opt/openoffice.org3/program/fundamentalrc - LD_LIBRARY_PATH or PATH specifies basis3.X/program and ure/lib to be found required libraries. Difference between Python 2 and Python 3 on PyUNO Most of differences are caused by Python itself. - String must be unicode known as normal str. - There is not int type anymore. - uno.ByteSequence must be initialized with bytes, bytearray or ByteSequence instance. - No __members__ and __methods__ on pyuno instance. Replaced import hook PyUNO uses custom import function to import UNO values in uno.py. It has some problems when other module uses the same way. Import hook is introduced by importlib module on Python 3.1. We should be use to import UNO values. hasModule() and getModuleElementNames() methods are introduced to get required information about UNO modules in pyuno. See uno.py more detail. New import hook allows to import module defined in IDL as Python module. For example, com.sun.star.beans module can be imported as follows: import com.sun.star.beans and its sub elements can be accessed as its attribute. pv = com.sun.star.beans.PropertyValue() When enum or constants is requested, it can be imported as modules. And its value elements are accessible as module attributes. import com.sun.star.awt.PosSize as PosSize print(PosSize.POS) These module attributes are not loaded at import time of the module. But once a value is requested, it would be normal attribute of the module. No more __getattr__ hook is not called to get the value. Base class for structs and exceptions UNO structs and exceptions are defined as class wraps pyuno instance of UNO value. They did not have any parent class. UNOStruct class is introduced for parent class of all UNO structs. UNOException class is also introduced for parent class of all UNO exceptions. UNOException class inherits Exception class of Python, therefore it is also an exception of Python. These classes generated at runtime still have typeName and __pyunostruct__ class variables. But __pyunointerface__ class variable has been removed from struct and exception class, because of it is used only on interface class.
About
Fork of PyUNO based on Apache OpenOffice for Python 3 support.
Resources
License
Stars
Watchers
Forks
Packages 0
No packages published