/usr/lib/python3/dist-packages/pyatspi/table.py is in python3-pyatspi 2.14.0+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 | #Copyright (C) 2008 Codethink Ltd
#Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
#This library is free software; you can redistribute it and/or
#modify it under the terms of the GNU Lesser General Public
#License version 2 as published by the Free Software Foundation.
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#You should have received a copy of the GNU Lesser General Public License
#along with this program; if not, write to the Free Software
#Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from gi.repository import Atspi
from pyatspi.enum import *
from pyatspi.utils import *
from pyatspi.interface import *
__all__ = [
"Table",
]
#------------------------------------------------------------------------------
class Table(interface):
"""
An interface used by containers whose contained data is arranged
in a "tabular" (i.e. row-column) fashion. Tables may resemble
a two-dimensional grid, as in a spreadsheet, or may feature objects
which span multiple rows and/or columns, but whose bounds are
aligned on a row/column matrix. Thus, the Table interface may
be used to represent "spreadsheets" as well as "frames".
Objects within tables are children of the Table instance, and
they may be referenced either via a child index or via a row/column
pair. Their role may be ROLE_TABLE_CELL, but table 'cells' may
have other roles as well. These 'cells' may implement other interfaces,
such as Text, Action, Image, and Component, and should do so
as appropriate to their onscreen representation and/or behavior.
"""
def addColumnSelection(self, column):
"""
Select the specified column, adding it to the current column
selection, if the table's selection model permits it.
@param : column
@return True if the specified column was successfully selected,
False if not.
"""
return Atspi.Table.add_column_selection(self.obj, column)
def addRowSelection(self, row):
"""
Select the specified row, adding it to the current row selection,
if the table's selection model permits it.
@param : row
@return True if the specified row was successfully selected,
False if not.
"""
return Atspi.Table.add_row_selection(self.obj, row)
def getAccessibleAt(self, row, column):
"""
Get the table cell at the specified row and column indices.
@param : row
the specified table row, zero-indexed.
@param : column
the specified table column, zero-indexed.
@return an Accessible object representing the specified table
cell.
"""
return Atspi.Table.get_accessible_at(self.obj, row, column)
def getColumnAtIndex(self, index):
"""
Get the table column index occupied by the child at a particular
1-D child index.
@param : index
the specified child index, zero-indexed.
@return a long integer indicating the first column spanned by
the child of a table, at the specified 1-D (zero-offset) index.
"""
return Atspi.Table.get_column_at_index(self.obj, index);
def getColumnDescription(self, column):
"""
Get a text description of a particular table column. This differs
from AccessibleTable_getColumnHeader, which returns an Accessible.
@param : column
the specified table column, zero-indexed.
@return a UTF-8 string describing the specified table column,
if available.
"""
return Atspi.Table.get_column_description(self.obj, column)
def getColumnExtentAt(self, row, column):
"""
Get the number of columns spanned by the table cell at the specific
row and column. (some tables can have cells which span multiple
rows and/or columns).
@param : row
the specified table row, zero-indexed.
@param : column
the specified table column, zero-indexed.
@return a long integer indicating the number of columns spanned
by the specified cell.
"""
return Atspi.Table.get_column_extent_at(self.obj, row, column)
def getColumnHeader(self, index):
"""
Get the header associated with a table column, if available,
as an instance of Accessible. This differs from getColumnDescription,
which returns a string.
@param : column
the specified table column, zero-indexed.
@return an Accessible representatin of the specified table column,
if available.
"""
return Atspi.Table.get_column_header(self.obj, index)
def getIndexAt(self, row, column):
"""
Get the 1-D child index corresponding to the specified 2-D row
and column indices.
@param : row
the specified table row, zero-indexed.
@param : column
the specified table column, zero-indexed.
@return a long integer which serves as the index of a specified
cell in the table, in a form usable by Accessible::getChildAtIndex.
"""
return Atspi.Table.get_index_at(self.obj, row, column)
def getRowAtIndex(self, index):
"""
Get the table row index occupied by the child at a particular
1-D child index.
@param : index
the specified child index, zero-indexed.
@return a long integer indicating the first row spanned by the
child of a table, at the specified 1-D (zero-offset) index.
"""
return Atspi.Table.get_row_at_index(self.obj, index)
def getRowColumnExtentsAtIndex(self, index):
"""
Given a child index, determine the row and column indices and
extents, and whether the cell is currently selected. If the child
at index is not a cell (for instance, if it is a summary, caption,
etc.), False is returned.
@param : index
the index of the Table child whose row/column extents are requested.
@param : row
back-filled with the first table row associated with the cell
with child index index.
@param : col
back-filled with the first table column associated with the cell
with child index index.
@param : row_extents
back-filled with the number of table rows across which child
i extends.
@param : col_extents
back-filled with the number of table columns across which child
i extends.
@param : is_selected
a boolean which is back-filled with True if the child at index
i corresponds to a selected table cell, False otherwise.
Example: If the Table child at index '6' extends across columns
5 and 6 of row 2 of a Table instance, and is currently selected,
then retval=table::getRowColumnExtentsAtIndex(6,row,col,
row_extents,
col_extents,
is_selected);
will return True, and after the call row, col, row_extents,
col_extents, and is_selected will contain 2, 5, 1, 2, and True,
respectively.
@return True if the index is associated with a valid table cell,
False if the index does not correspond to a cell. If False is
returned, the values of the out parameters are undefined.
"""
return Atspi.Table.get_row_column_extents_at_index(self.obj, index)
def getRowDescription(self, index):
"""
Get a text description of a particular table row. This differs
from AccessibleTable_getRowHeader, which returns an Accessible.
@param : row
the specified table row, zero-indexed.
@return a UTF-8 string describing the specified table row, if
available.
"""
return Atspi.Table.get_row_description(self.obj, index)
def getRowExtentAt(self, row, column):
"""
Get the number of rows spanned by the table cell at the specific
row and column. (some tables can have cells which span multiple
rows and/or columns).
@param : row
the specified table row, zero-indexed.
@param : column
the specified table column, zero-indexed.
@return a long integer indicating the number of rows spanned
by the specified cell.
"""
return Atspi.Table.get_row_extent_at(self.obj, row, column)
def getRowHeader(self, row):
"""
Get the header associated with a table row, if available. This
differs from getRowDescription, which returns a string.
@param : row
the specified table row, zero-indexed.
@return an Accessible representatin of the specified table row,
if available.
"""
return Atspi.Table.get_row_header(self.obj, row)
def getSelectedColumns(self):
"""
Obtain the indices of all columns which are currently selected.
@return a sequence of integers comprising the indices of columns
currently selected.
"""
return Atspi.Table.get_selected_columns(self.obj)
def getSelectedRows(self):
"""
Obtain the indices of all rows which are currently selected.
@return a sequence of integers comprising the indices of rows
currently selected.
"""
return Atspi.Table.get_selected_rows(self.obj)
def isColumnSelected(self, column):
"""
Determine whether a table column is selected.
@param : column
the column being queried.
@return True if the specified column is currently selected, False
if not.
"""
return Atspi.Table.is_column_selected(self.obj, column)
def isRowSelected(self, row):
"""
Determine whether a table row is selected.
@param : row
the row being queried.
@return True if the specified row is currently selected, False
if not.
"""
return Atspi.Table.is_row_selected(self.obj, row)
def isSelected(self, row, column):
"""
Determine whether the cell at a specific row and column is selected.
@param : row
a row occupied by the cell whose state is being queried.
@param : column
a column occupied by the cell whose state is being queried.
@return True if the specified cell is currently selected, False
if not.
"""
return Atspi.Table.is_selected(self.obj, row, column)
def removeColumnSelection(self, column):
"""
Remove the specified column from current column selection, if
the table's selection model permits it.
@param : column
@return True if the specified column was successfully de-selected,
False if not.
"""
return Atspi.Table.remove_column_selection(self.obj, column)
def removeRowSelection(self, row):
"""
Remove the specified row from current row selection, if the table's
selection model permits it.
@param : row
@return True if the specified row was successfully de-selected,
False if not.
"""
return Atspi.Table.remove_row_selection(self.obj, row)
def get_caption(self):
return Atspi.Table.get_caption(self.obj)
_captionDoc = \
"""
An Accessible which represents of a caption for a Table.
"""
caption = property(fget=get_caption, doc=_captionDoc)
def get_nColumns(self):
return Atspi.Table.get_n_columns(self.obj)
_nColumnsDoc = \
"""
The total number of columns in this table (including empty columns),
exclusive of columns which are programmatically hidden. Columns
which are scrolled out of view or clipped by the current viewport
are included.
"""
nColumns = property(fget=get_nColumns, doc=_nColumnsDoc)
def get_nRows(self):
return Atspi.Table.get_n_rows(self.obj)
_nRowsDoc = \
"""
The total number of rows in this table (including empty rows),
exclusive of any rows which are programmatically hidden. Rows
which are merely scrolled out of view are included.
"""
nRows = property(fget=get_nRows, doc=_nRowsDoc)
def get_nSelectedColumns(self):
return Atspi.Table.get_n_selected_columns(self.obj)
_nSelectedColumnsDoc = \
"""
The number of columns currently selected. A selected column is
one in which all included cells are selected.
"""
nSelectedColumns = property(fget=get_nSelectedColumns, doc=_nSelectedColumnsDoc)
def get_nSelectedRows(self):
return Atspi.Table.get_n_selected_rows(self.obj)
_nSelectedRowsDoc = \
"""
The number of rows currently selected. A selected row is one
in which all included cells are selected.
"""
nSelectedRows = property(fget=get_nSelectedRows, doc=_nSelectedRowsDoc)
def get_summary(self):
return Atspi.Table.get_summary(self.obj)
_summaryDoc = \
"""
An accessible object which summarizes the contents of a Table.
This object is frequently itself a Table instance, albeit a simplified
one.
"""
summary = property(fget=get_summary, doc=_summaryDoc)
#END----------------------------------------------------------------------------
|