numbers-parser 4.12.0__py3-none-any.whl → 4.12.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- numbers_parser/model.py +37 -36
- {numbers_parser-4.12.0.dist-info → numbers_parser-4.12.2.dist-info}/METADATA +8 -3
- {numbers_parser-4.12.0.dist-info → numbers_parser-4.12.2.dist-info}/RECORD +6 -6
- {numbers_parser-4.12.0.dist-info → numbers_parser-4.12.2.dist-info}/LICENSE.rst +0 -0
- {numbers_parser-4.12.0.dist-info → numbers_parser-4.12.2.dist-info}/WHEEL +0 -0
- {numbers_parser-4.12.0.dist-info → numbers_parser-4.12.2.dist-info}/entry_points.txt +0 -0
numbers_parser/model.py
CHANGED
|
@@ -329,12 +329,16 @@ class _NumbersModel(Cacheable):
|
|
|
329
329
|
if enabled is not None:
|
|
330
330
|
table_info.super.caption_hidden = not enabled
|
|
331
331
|
else:
|
|
332
|
+
caption_info_id = table_info.super.caption.identifier
|
|
333
|
+
caption_archive = self.objects[caption_info_id]
|
|
334
|
+
if caption_archive.DESCRIPTOR.name == "StandinCaptionArchive":
|
|
335
|
+
return False
|
|
332
336
|
return not table_info.super.caption_hidden
|
|
333
337
|
|
|
334
|
-
def
|
|
335
|
-
stylesheet = self.objects[self.
|
|
338
|
+
def find_style_id(self, style_substr: str):
|
|
339
|
+
stylesheet = self.objects[self.stylesheet_id()]
|
|
336
340
|
caption_styles = [
|
|
337
|
-
x for x in stylesheet.identifier_to_style_map if
|
|
341
|
+
x for x in stylesheet.identifier_to_style_map if style_substr in x.identifier.lower()
|
|
338
342
|
]
|
|
339
343
|
return caption_styles[0].style.identifier
|
|
340
344
|
|
|
@@ -354,6 +358,7 @@ class _NumbersModel(Cacheable):
|
|
|
354
358
|
obj.MergeFrom(TSPMessages.Reference(identifier=id))
|
|
355
359
|
|
|
356
360
|
def create_path_source_archive(self, table_id):
|
|
361
|
+
box_size = 100.0
|
|
357
362
|
return TSDArchives.PathSourceArchive(
|
|
358
363
|
horizontalFlip=False,
|
|
359
364
|
verticalFlip=False,
|
|
@@ -367,15 +372,15 @@ class _NumbersModel(Cacheable):
|
|
|
367
372
|
),
|
|
368
373
|
TSPMessages.Path.Element(
|
|
369
374
|
type=TSPMessages.Path.ElementType.lineTo,
|
|
370
|
-
points=[TSPMessages.Point(x=
|
|
375
|
+
points=[TSPMessages.Point(x=box_size, y=0.0)],
|
|
371
376
|
),
|
|
372
377
|
TSPMessages.Path.Element(
|
|
373
378
|
type=TSPMessages.Path.ElementType.lineTo,
|
|
374
|
-
points=[TSPMessages.Point(x=
|
|
379
|
+
points=[TSPMessages.Point(x=box_size, y=box_size)],
|
|
375
380
|
),
|
|
376
381
|
TSPMessages.Path.Element(
|
|
377
382
|
type=TSPMessages.Path.ElementType.lineTo,
|
|
378
|
-
points=[TSPMessages.Point(x=0.0, y=
|
|
383
|
+
points=[TSPMessages.Point(x=0.0, y=box_size)],
|
|
379
384
|
),
|
|
380
385
|
TSPMessages.Path.Element(
|
|
381
386
|
type=TSPMessages.Path.ElementType.closeSubpath,
|
|
@@ -395,8 +400,8 @@ class _NumbersModel(Cacheable):
|
|
|
395
400
|
caption_placement_id, _ = self.objects.create_object_from_dict(
|
|
396
401
|
"CalculationEngine",
|
|
397
402
|
{
|
|
398
|
-
"caption_anchor_location": 1,
|
|
399
|
-
"drawable_anchor_location": 7,
|
|
403
|
+
"caption_anchor_location": 1, # UPPER_LEFT
|
|
404
|
+
"drawable_anchor_location": 7, # LOWER_LEFT
|
|
400
405
|
},
|
|
401
406
|
TSAArchives.CaptionPlacementArchive,
|
|
402
407
|
)
|
|
@@ -419,13 +424,26 @@ class _NumbersModel(Cacheable):
|
|
|
419
424
|
}
|
|
420
425
|
]
|
|
421
426
|
},
|
|
427
|
+
"table_list_style": {
|
|
428
|
+
"entries": [
|
|
429
|
+
{
|
|
430
|
+
"character_index": 0,
|
|
431
|
+
"object": {"identifier": self.find_style_id("liststyle")},
|
|
432
|
+
}
|
|
433
|
+
]
|
|
434
|
+
},
|
|
422
435
|
"table_para_starts": {"entries": [{"character_index": 0, "first": 0, "second": 0}]},
|
|
423
436
|
"table_para_bidi": {"entries": [{"character_index": 0, "first": 0, "second": 0}]},
|
|
424
437
|
"table_drop_cap_style": {"entries": [{"character_index": 0}]},
|
|
425
438
|
},
|
|
426
439
|
TSWPArchives.StorageArchive,
|
|
427
440
|
)
|
|
428
|
-
for object_id in [
|
|
441
|
+
for object_id in [
|
|
442
|
+
storage_id,
|
|
443
|
+
self.find_style_id("caption"),
|
|
444
|
+
self.find_style_id("liststyle"),
|
|
445
|
+
self.caption_paragraph_style_id(),
|
|
446
|
+
]:
|
|
429
447
|
self.add_component_reference(
|
|
430
448
|
object_id, location="CalculationEngine", component_id=self.stylesheet_id()
|
|
431
449
|
)
|
|
@@ -435,8 +453,8 @@ class _NumbersModel(Cacheable):
|
|
|
435
453
|
owned_storage=TSPMessages.Reference(identifier=storage_id),
|
|
436
454
|
deprecated_storage=TSPMessages.Reference(identifier=storage_id),
|
|
437
455
|
super=TSDArchives.ShapeArchive(
|
|
438
|
-
super=self.create_drawable(table_info_id, 0,
|
|
439
|
-
style={"identifier": self.
|
|
456
|
+
super=self.create_drawable(table_info_id, 0, 500, flags=1),
|
|
457
|
+
style={"identifier": self.find_style_id("caption")},
|
|
440
458
|
strokePatternOffsetDistance=0.0,
|
|
441
459
|
pathsource=self.create_path_source_archive(table_id),
|
|
442
460
|
),
|
|
@@ -465,11 +483,13 @@ class _NumbersModel(Cacheable):
|
|
|
465
483
|
caption_archive = self.objects[caption_info_id]
|
|
466
484
|
|
|
467
485
|
caption_storage_id = caption_archive.super.owned_storage.identifier
|
|
468
|
-
caption_text = self.objects[caption_storage_id].text
|
|
469
486
|
if caption is not None:
|
|
470
|
-
|
|
487
|
+
clear_field_container(self.objects[caption_storage_id].text)
|
|
488
|
+
self.objects[caption_storage_id].text.append(caption)
|
|
489
|
+
elif len(self.objects[caption_storage_id].text) == 0:
|
|
490
|
+
return "Caption"
|
|
471
491
|
else:
|
|
472
|
-
return
|
|
492
|
+
return self.objects[caption_storage_id].text[0]
|
|
473
493
|
|
|
474
494
|
@cache()
|
|
475
495
|
def table_tiles(self, table_id):
|
|
@@ -1377,24 +1397,6 @@ class _NumbersModel(Cacheable):
|
|
|
1377
1397
|
"Tables/HeaderStorageBucket-{}",
|
|
1378
1398
|
)
|
|
1379
1399
|
|
|
1380
|
-
from_table_info = self.objects[self.table_info_id(from_table_id)]
|
|
1381
|
-
from_caption_info = self.objects[from_table_info.super.caption.identifier]
|
|
1382
|
-
caption_storage_id, caption_storage = self.objects.create_object_from_dict(
|
|
1383
|
-
"CalculationEngine",
|
|
1384
|
-
{"text": ["Caption"]},
|
|
1385
|
-
TSWPArchives.StorageArchive,
|
|
1386
|
-
)
|
|
1387
|
-
caption_storage.MergeFrom(self.objects[from_caption_info.super.owned_storage.identifier])
|
|
1388
|
-
caption_info_id, caption_info = self.objects.create_object_from_dict(
|
|
1389
|
-
"CalculationEngine",
|
|
1390
|
-
{},
|
|
1391
|
-
TSAArchives.CaptionInfoArchive,
|
|
1392
|
-
)
|
|
1393
|
-
caption_info.super.CopyFrom(from_caption_info.super)
|
|
1394
|
-
caption_info.super.super.CopyFrom(from_caption_info.super.super)
|
|
1395
|
-
caption_info.super.super.super.CopyFrom(from_caption_info.super.super.super)
|
|
1396
|
-
self.set_reference(caption_info.super.deprecated_storage, caption_storage_id)
|
|
1397
|
-
self.set_reference(caption_info.super.owned_storage, caption_storage_id)
|
|
1398
1400
|
sidecar_id, _ = self.objects.create_object_from_dict(
|
|
1399
1401
|
"CalculationEngine",
|
|
1400
1402
|
{"max_order": 1, "column_count": 0, "row_count": 0},
|
|
@@ -1480,13 +1482,12 @@ class _NumbersModel(Cacheable):
|
|
|
1480
1482
|
)
|
|
1481
1483
|
table_info.tableModel.MergeFrom(TSPMessages.Reference(identifier=table_model_id))
|
|
1482
1484
|
table_info.super.MergeFrom(self.create_drawable(sheet_id, x, y))
|
|
1483
|
-
|
|
1484
|
-
TSPMessages.Reference(identifier=table_info_id)
|
|
1485
|
-
)
|
|
1486
|
-
table_info.super.caption.MergeFrom(TSPMessages.Reference(identifier=caption_info_id))
|
|
1485
|
+
|
|
1487
1486
|
self.add_component_reference(
|
|
1488
1487
|
table_info_id, location="Document", component_id=self.calc_engine_id()
|
|
1489
1488
|
)
|
|
1489
|
+
self.create_caption_archive(table_model_id)
|
|
1490
|
+
self.caption_enabled(table_model_id, False)
|
|
1490
1491
|
|
|
1491
1492
|
self.add_formula_owner(
|
|
1492
1493
|
table_info_id,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: numbers-parser
|
|
3
|
-
Version: 4.12.
|
|
3
|
+
Version: 4.12.2
|
|
4
4
|
Summary: Read and write Apple Numbers spreadsheets
|
|
5
5
|
Home-page: https://github.com/masaccio/numbers-parser
|
|
6
6
|
License: MIT
|
|
@@ -384,9 +384,12 @@ Current known limitations of `numbers-parser` which may be implemented in the fu
|
|
|
384
384
|
- Creating cells of type `BulletedTextCell` is not supported
|
|
385
385
|
- New tables are inserted with a fixed offset below the last table in a
|
|
386
386
|
worksheet which does not take into account title or caption size
|
|
387
|
+
- Captions can be created and edited as of numbers-parser version 4.12, but cannot
|
|
388
|
+
be styled. New captions adopt the first caption style available in the current
|
|
389
|
+
document
|
|
387
390
|
- Formulas cannot be written to a document
|
|
388
391
|
- Pivot tables are unsupported and saving a document with a pivot table issues
|
|
389
|
-
a UnsupportedWarning.
|
|
392
|
+
a UnsupportedWarning (see [issue 73](https://github.com/masaccio/numbers-parser/issues/73) for details).
|
|
390
393
|
|
|
391
394
|
The following limitations are expected to always remain:
|
|
392
395
|
|
|
@@ -397,7 +400,9 @@ The following limitations are expected to always remain:
|
|
|
397
400
|
versions older than 3.11 do not support image filenames with UTF-8 characters
|
|
398
401
|
[Cell.add_style.bg_image()](https://masaccio.github.io/numbers-parser/api/sheet.html#numbers_parser.Style) returns
|
|
399
402
|
`None` for such files and issues a `RuntimeWarning`
|
|
400
|
-
(see [issue 69](https://github.com/masaccio/numbers-parser/
|
|
403
|
+
(see [issue 69](https://github.com/masaccio/numbers-parser/issues/69) for details).
|
|
404
|
+
- Password-encrypted documents cannot be opened. You must first re-save without
|
|
405
|
+
a password to read (see [issue 88](https://github.com/masaccio/numbers-parser/issues/88) for details).
|
|
401
406
|
|
|
402
407
|
## License
|
|
403
408
|
|
|
@@ -50,11 +50,11 @@ numbers_parser/generated/functionmap.py,sha256=VdZo0ERMYONcrnJFwABcSCHb8pjA4wY2o
|
|
|
50
50
|
numbers_parser/generated/mapping.py,sha256=xt1NaZtTse1OX3vBizENKkWl-0OgNb4SMJ0Uo-rRz0U,32342
|
|
51
51
|
numbers_parser/iwafile.py,sha256=4_MMtHdWMAfIzwODyaM7DsWKh-8yJ2blTfbues8sbdI,11915
|
|
52
52
|
numbers_parser/iwork.py,sha256=CXXM797MqcIokovrIBAx--LNG7tIVpKqeBwR4V2OrzQ,9141
|
|
53
|
-
numbers_parser/model.py,sha256=
|
|
53
|
+
numbers_parser/model.py,sha256=hrbrZ_F8s09eC0iOM1HN4Owe610wr0c3xyo9PaGJQak,106923
|
|
54
54
|
numbers_parser/numbers_cache.py,sha256=1ghEBghQAYFpPiEeOtb74i016mXc039v1pOubbqvaLs,1141
|
|
55
55
|
numbers_parser/numbers_uuid.py,sha256=q0IbHFKuBXC7MnZN3g55dgCVKOLD-4SO4MdXeN6dt0g,2699
|
|
56
|
-
numbers_parser-4.12.
|
|
57
|
-
numbers_parser-4.12.
|
|
58
|
-
numbers_parser-4.12.
|
|
59
|
-
numbers_parser-4.12.
|
|
60
|
-
numbers_parser-4.12.
|
|
56
|
+
numbers_parser-4.12.2.dist-info/LICENSE.rst,sha256=8vTa1-5KSdHrTpU9rlheO5005EWReEPMpjV7BjSaMc4,1050
|
|
57
|
+
numbers_parser-4.12.2.dist-info/METADATA,sha256=mJ_F77RApUK2vs296Mef2zCmfFNlCBiIp9mvswW99q0,16697
|
|
58
|
+
numbers_parser-4.12.2.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
|
59
|
+
numbers_parser-4.12.2.dist-info/entry_points.txt,sha256=V91uB9vBPxf3eCY1h-0syv21imYCT0MJfMxf87DmwIk,115
|
|
60
|
+
numbers_parser-4.12.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|