Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


Hi,

Your 3rd line is supposed to be:
TABALIGN_LEFT = uno.Enum("com.sun.star.style.TabAlign", "LEFT")

With this modification I can run your code with various Python runtimes of OpenOffice.org as well as LibreOffice 3.3:
$ $OFFICE unocmp.py
A: <type 'instance'> uno.com.sun.star.style.TabStop
A: (com.sun.star.style.TabStop){ Position = (long)0x3e8, Alignment = 
(com.sun.star.style.TabAlign)LEFT, DecimalChar = (char)'.', FillChar = (char)' ' }
B: <type 'instance'> uno.com.sun.star.style.TabStop
B: (com.sun.star.style.TabStop){ Position = (long)0x3e8, Alignment = 
(com.sun.star.style.TabAlign)LEFT, DecimalChar = (char)'.', FillChar = (char)' ' }
A==B: True True
FIELDS:
   Position True
   Alignment True
   DecimalChar True
   FillChar True

Python of LibreOffice 3.5 gives:
terminate called after throwing an instance of 'com::sun::star::registry::InvalidRegistryException'

This is my Python code including the correct indentation:

import uno
from com.sun.star.style import TabStop

TABALIGN_LEFT = uno.Enum("com.sun.star.style.TabAlign", "LEFT")

if __name__ == "__main__":
    a = TabStop()
    a.Position = 1000
    a.Alignment = TABALIGN_LEFT
    a.DecimalChar = '.'
    a.FillChar = ' '

    b = TabStop()
    b.Position = 1000
    b.Alignment = TABALIGN_LEFT
    b.DecimalChar = '.'
    b.FillChar = ' '

    print 'A:', type(a), a.__class__
    print 'A:', a
    print 'B:', type(b), b.__class__
    print 'B:', b
    print 'A==B:', a == b, a.value == b.value
    print 'FIELDS:'
    for field in ('Position', 'Alignment', 'DecimalChar', 'FillChar'):
        print '  ', field, getattr(a,field) == getattr(b,field)



--
For unsubscribe instructions e-mail to: users+help@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.