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


Okay, I wrote a python code that explores every property, and doesn't
fall into an infinite cycle. It is

def printUNO(parent, listChecked):
    try:
        for propName in dir(parent):
            if str(propName)[0].islower(): #function, skip
                continue
            try:
                property = getattr(parent, propName)
            except Exception: #inspect.UnknownPropertyException: wtf,
that doesn't work
                continue
            if str(property).startswith('pyuno'):
                if not any(propName == s for s in listChecked):
                    l = list(listChecked)
                    l.append(propName)
                    printUNO(property, l)
                continue
            print(propName + ': ' + str(property) + '\n')
    except Exception:
        return

The function accepts anything, and prints every property of the thing,
ignores functions (in PyUNO all functions starts with lower letter),
and recursively goes deeper and deeper keeping track of where it was
(in other to not visit the same property since these are sometimes
recursive).

However it produces too much output, e.g. from a test document it
produced 1gb of output. I think the problem is that most elements
still appears in output many times — the check that in backtrace
wasn't the current element is ensures only that it wouldn't fall in an
infinite cycle.

2015-08-21 7:28 GMT+03:00 Hi-Angel <hiangel999@gmail.com>:
What is the purpose of comma separated machine data in a word processor document?

That is to save in file. The more newlines, the easier differ the text
with vimdiff. Because if'd left these thousands symbols lines as is,
it would be really hard to see what just changed.

Why don't you save the shit in plain text and then do whatever you want with it without 
struggling this horrible API?

Aren't that exactly what I did in the code I just posted? Saved that
to the file "/tmp/log".

2015-08-20 23:24 GMT+03:00 Andreas Säger <villeroy@t-online.de>:
WTF are you trying to do?  What is the purpose of comma separated machine
data in a word processor document? Why don't you save the shit in plain text
and then do whatever you want with it without struggling this horrible API?



--
View this message in context: 
http://nabble.documentfoundation.org/Save-UNO-state-tp4157412p4157800.html
Sent from the Users mailing list archive at Nabble.com.

--
To unsubscribe e-mail to: users+unsubscribe@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


-- 
To unsubscribe e-mail to: users+unsubscribe@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.