Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

pyuno in Libreoffice 5.1.4.2

31 views
Skip to first unread message

Jim

unread,
Jan 22, 2017, 7:10:52 PM1/22/17
to
Does anyone know if the changes outlined here [1] have been implemented?

Supposedly changes have been made to pyuno to make it more pythonic.

Item 2 Cellranges says that:
cell = sheet.getCellByPosition(cellCol + col, cellRow + row)
Can be written as:
cell = sheet.cellrange[cellRow + row, cellCol + col]

But when I try that I get:

Traceback (most recent call last):
File
"/home/jfb/.config/libreoffice/4/user/Scripts/python/enter_INV/enter_INV.py",
line 68, in keyPressed
move_selected_cell(1, 0)
File
"/home/jfb/.config/libreoffice/4/user/Scripts/python/enter_INV/enter_INV.py",
line 112, in move_selected_cell
cell = sheet.cellrange[cellRow + row, cellCol + col]
AttributeError: cellrange

Or maybe I am misunderstanding how to use it.

Regards, Jim

[1]
https://cgit.freedesktop.org/libreoffice/core/commit/?id=af8143bc40cf2cfbc12e77c9bb7de01b655f7b30


MRAB

unread,
Jan 22, 2017, 8:02:27 PM1/22/17
to
On 2017-01-23 00:10, Jim wrote:
> Does anyone know if the changes outlined here [1] have been implemented?
>
> Supposedly changes have been made to pyuno to make it more pythonic.
>
> Item 2 Cellranges says that:
> cell = sheet.getCellByPosition(cellCol + col, cellRow + row)
> Can be written as:
> cell = sheet.cellrange[cellRow + row, cellCol + col]
>
> But when I try that I get:
>
> Traceback (most recent call last):
> File
> "/home/jfb/.config/libreoffice/4/user/Scripts/python/enter_INV/enter_INV.py",
> line 68, in keyPressed
> move_selected_cell(1, 0)
> File
> "/home/jfb/.config/libreoffice/4/user/Scripts/python/enter_INV/enter_INV.py",
> line 112, in move_selected_cell
> cell = sheet.cellrange[cellRow + row, cellCol + col]
> AttributeError: cellrange
>
> Or maybe I am misunderstanding how to use it.
>
I think it might be direct indexing of the sheet:

cell = sheet[cellRow + row, cellCol + col]

Jim

unread,
Jan 22, 2017, 8:30:53 PM1/22/17
to
You are correct, that worked. Thank you very much.

Regards, Jim


0 new messages