Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
141 commits
Select commit Hold shift + click to select a range
f22b01a
change for current_doc (#620)
Amourspirit Jun 8, 2024
0203a68
Merge branch 'main' into develop
Amourspirit Jun 8, 2024
535c35c
0.46.0 (#622)
Amourspirit Jun 15, 2024
5d9a310
Merge branch 'main' into develop
Amourspirit Jun 15, 2024
3141f5f
added doc custom properties and Json classes
Amourspirit Jun 20, 2024
991b40a
Merge pull request #624 from Amourspirit/0.47.0
Amourspirit Jun 20, 2024
f1883a0
Merge branch 'main' into develop
Amourspirit Jun 20, 2024
f66857a
added popup range selector
Amourspirit Jun 23, 2024
7e7e105
Merge pull request #626 from Amourspirit/0.47.1
Amourspirit Jun 23, 2024
48d99b3
Merge branch 'main' into develop
Amourspirit Jun 23, 2024
bea98b2
add events to popup range selection (#628)
Amourspirit Jun 23, 2024
d74454b
Merge branch 'main' into develop
Amourspirit Jun 23, 2024
6452238
added invoke_range_selection()
Amourspirit Jun 24, 2024
f9ca124
update for import error
Amourspirit Jun 24, 2024
1dbd59d
import fixes
Amourspirit Jun 24, 2024
a16fb46
Merge pull request #630 from Amourspirit/0.47.3
Amourspirit Jun 24, 2024
d17e070
Merge branch 'main' into develop
Amourspirit Jun 24, 2024
824bbcb
update for setting Lo current document and Logging
Amourspirit Jul 3, 2024
85a1557
Merge pull request #632 from Amourspirit/focus
Amourspirit Jul 3, 2024
5a4191c
update version history
Amourspirit Jul 3, 2024
e172a9a
Merge branch 'main' into develop
Amourspirit Jul 3, 2024
ee02a9a
copy for RangeObj and CellObj
Amourspirit Jul 7, 2024
b30edfd
Merge pull request #634 from Amourspirit/0.47.5
Amourspirit Jul 7, 2024
d93efd2
Merge branch 'main' into develop
Amourspirit Jul 7, 2024
fd56c53
update for form controls to remove scripts
Amourspirit Jul 10, 2024
9a9deab
Merge pull request #636 from Amourspirit/0.47.6
Amourspirit Jul 10, 2024
1f7b190
Merge branch 'main' into develop
Amourspirit Jul 10, 2024
ff75114
find used range methods
Amourspirit Jul 16, 2024
11507f7
Merge pull request #638 from Amourspirit/0.47.7
Amourspirit Jul 16, 2024
13338a1
Merge branch 'main' into develop
Amourspirit Jul 16, 2024
5f4d05c
update for issue 640
Amourspirit Aug 4, 2024
e536ea7
Merge pull request #641 from Amourspirit/0.47.8
Amourspirit Aug 4, 2024
1e8a902
update version hist
Amourspirit Aug 5, 2024
7ff7999
Merge branch 'main' into develop
Amourspirit Aug 5, 2024
69706a6
fix for python 3.12 Typevar issue
Amourspirit Aug 6, 2024
3b8c6d7
Merge pull request #646 from Amourspirit/0.47.9
Amourspirit Aug 6, 2024
41fd9eb
Merge branch 'main' into develop
Amourspirit Aug 6, 2024
c770008
update workflow to docker v2
Amourspirit Aug 7, 2024
cf573d4
Merge branch 'main' into develop
Amourspirit Aug 7, 2024
ca4dc14
update for cellobj compare
Amourspirit Aug 16, 2024
5f7e634
Merge pull request #649 from Amourspirit/0.47.10
Amourspirit Aug 16, 2024
8f038dc
Merge branch 'main' into develop
Amourspirit Aug 16, 2024
b2d91e6
bug fix for custom property
Amourspirit Aug 18, 2024
e7f5dd4
Merge pull request #651 from Amourspirit/0.47.11
Amourspirit Aug 18, 2024
a23e096
Merge branch 'main' into develop
Amourspirit Aug 18, 2024
9c6d99d
fix bug for control missing Name attribute
Amourspirit Aug 18, 2024
f614edf
Merge pull request #653 from Amourspirit/0.47.12
Amourspirit Aug 18, 2024
0979c9c
Merge branch 'main' into develop
Amourspirit Aug 18, 2024
6c39c0e
update for ooouno
Amourspirit Sep 1, 2024
79862a6
fix for DeletedUnoEnumMeta
Amourspirit Sep 1, 2024
d8a4424
Merge branch 'main' into develop
Amourspirit Sep 1, 2024
4a6dc62
update input box for MacOS
Amourspirit Sep 27, 2024
1f4a3c5
Merge branch 'main' into develop
Amourspirit Sep 27, 2024
65ff7a8
fix for Name attribute on some shapes in custome properties for a sheet
Amourspirit Oct 2, 2024
8f9bd0b
Merge pull request #658 from Amourspirit/custom-props
Amourspirit Oct 2, 2024
a90da0f
Merge branch 'main' into develop
Amourspirit Oct 2, 2024
dbb58c0
fix for custom property shapes not having supportsService attribute (…
Amourspirit Oct 2, 2024
c34cd46
Merge branch 'main' into develop
Amourspirit Oct 2, 2024
bf33609
update CellObj to support sheet name
Amourspirit Oct 2, 2024
c257452
Merge pull request #662 from Amourspirit/cell_obj
Amourspirit Oct 2, 2024
83c8179
Merge branch 'main' into develop
Amourspirit Oct 2, 2024
636f888
Issue 666 Fix
Amourspirit Oct 4, 2024
57650e3
Merge pull request #667 from Amourspirit/0.47.18
Amourspirit Oct 4, 2024
fc01c76
update conftest and ver history
Amourspirit Oct 4, 2024
de62ccb
Merge pull request #668 from Amourspirit/0.47.18
Amourspirit Oct 4, 2024
d611aa1
Merge branch 'main' into develop
Amourspirit Oct 4, 2024
57775ef
0.47.19 (#673)
Amourspirit Oct 7, 2024
d1410fc
Merge branch 'develop' of github.com:Amourspirit/python_ooo_dev_tools…
Amourspirit Oct 7, 2024
46577e4
fix Cache.profile_path
Amourspirit Oct 7, 2024
2dcff7b
Merge branch 'main' into develop
Amourspirit Oct 7, 2024
b3d179d
0.48 (#675)
Amourspirit Oct 11, 2024
4f11f1b
fix testing on windows
Amourspirit Oct 12, 2024
681d3e5
fix in fileio test
Amourspirit Oct 12, 2024
9bb58a1
Merge branch 'main' into develop
Amourspirit Oct 12, 2024
9fc7bb6
fix for attr import in props module
Amourspirit Oct 16, 2024
36402b5
Merge pull request #677 from Amourspirit/0.48.1
Amourspirit Oct 16, 2024
da7a02a
Merge branch 'main' into develop
Amourspirit Oct 16, 2024
9d31aa2
Lint (#679)
Amourspirit Oct 17, 2024
eeb032e
override in progress
Amourspirit Oct 18, 2024
3dc3fa7
add overrides to Adapter namespace
Amourspirit Oct 20, 2024
22e344a
more overrides
Amourspirit Oct 21, 2024
a0879cd
overrides complete
Amourspirit Oct 21, 2024
8dd694d
Merge pull request #680 from Amourspirit/override
Amourspirit Oct 21, 2024
f42adf0
0.49.0 release
Amourspirit Oct 21, 2024
b065dec
Merge branch 'main' into develop
Amourspirit Oct 21, 2024
278ace2
minor fix
Amourspirit Oct 22, 2024
470b7ac
Merge pull request #682 from Amourspirit/0.49.1
Amourspirit Oct 22, 2024
664276c
Merge branch 'main' into develop
Amourspirit Oct 22, 2024
bc1972a
read the docs update
Amourspirit Oct 25, 2024
996257a
update docs requirements.txt
Amourspirit Oct 25, 2024
e882cd6
add lxml to docs requirements
Amourspirit Oct 25, 2024
f0cb070
update for theme
Amourspirit Oct 27, 2024
24cfded
version 0.50.0 release
Amourspirit Oct 27, 2024
3b81fda
Merge pull request #684 from Amourspirit/0.50.0
Amourspirit Oct 27, 2024
672456b
Merge branch 'main' into develop
Amourspirit Oct 27, 2024
a067e9c
bump version to 0.51.0 and update changelog; modify get_val() to retu…
Amourspirit Jan 20, 2025
a00126b
Merge branch 'main' into develop
Amourspirit Jan 20, 2025
8752028
bump version to 0.51.1; fix get_val() for text output from formulas a…
Amourspirit Jan 21, 2025
e605b1d
refactor get_val() to return cell value directly for VALUE type
Amourspirit Jan 21, 2025
8c56f81
Merge branch 'main' into develop
Amourspirit Jan 21, 2025
6090105
Add singleton cache classes and update documentation
Amourspirit Feb 1, 2025
b6ff0e6
update docs
Amourspirit Feb 2, 2025
85e8ad5
Merge branch 'main' into develop
Amourspirit Feb 2, 2025
1d03b78
update .gitignore
Amourspirit Feb 2, 2025
86ecc23
added dispatch_cmd to popup menu
Amourspirit Feb 3, 2025
eef10d1
revet PopupMenu cache back to LRUCache
Amourspirit Feb 3, 2025
c9fabba
Merge branch 'main' into develop
Amourspirit Feb 3, 2025
98b4d76
update ver history
Amourspirit Feb 3, 2025
301d376
refactor Cache.del_working_dir to use contextlib for exception handling
Amourspirit Feb 10, 2025
dd0e7f5
update DotDict class to be generic and handle missing attributes
Amourspirit Feb 23, 2025
04ec7ac
refactor DotDict class to support generic types and improve internal …
Amourspirit Feb 23, 2025
ac4f55e
Merge pull request #691 from Amourspirit/0.52.2
Amourspirit Feb 23, 2025
20ad3c5
Merge branch 'main' into develop
Amourspirit Feb 23, 2025
72e6a68
bump version to 0.52.3 and add MemCache class with hit tracking
Amourspirit Feb 27, 2025
5324ea7
Merge branch 'main' into develop
Amourspirit Feb 27, 2025
b0e1eb2
Add unique_id property to CalcCell for consistent cell identification
Amourspirit Mar 12, 2025
19a445f
Merge pull request #694 from Amourspirit/0.52.4
Amourspirit Mar 12, 2025
db9b41d
Merge branch 'main' into develop
Amourspirit Mar 12, 2025
0b73c83
NULL_OBJ now is false in truthy check
Amourspirit Mar 12, 2025
42a5eb4
update ver history
Amourspirit Mar 12, 2025
e397ce2
Merge pull request #696 from Amourspirit/0.52.5
Amourspirit Mar 12, 2025
4ab2d6b
Merge branch 'main' into develop
Amourspirit Mar 12, 2025
46d163d
Add DotDict class with enhanced functionality and documentation
Amourspirit Mar 12, 2025
c4496c7
Merge pull request #698 from Amourspirit/0.52.6
Amourspirit Mar 12, 2025
ae2452d
Merge branch 'main' into develop
Amourspirit Mar 12, 2025
6c16872
Add ConnectCtx class and force_reload option; update version to 0.53.0
Amourspirit Mar 29, 2025
daf058c
Merge branch 'main' into develop
Amourspirit Mar 29, 2025
67ef2fd
Refactor logging statements in LoInst class for improved clarity and …
Amourspirit Mar 29, 2025
c8eba47
Update current_doc setter to handle None value and improve error logg…
Amourspirit Mar 29, 2025
63d8b83
Merge branch 'main' into develop
Amourspirit Mar 29, 2025
804c223
Enhance Lo class to return loader_current when all parameters are Non…
Amourspirit Mar 29, 2025
b093c0a
update ver history'
Amourspirit Mar 29, 2025
f668166
Merge branch 'main' into develop
Amourspirit Mar 29, 2025
8940904
Add get_doc method to Lo class and update from_current_doc to support…
Amourspirit Mar 31, 2025
747155f
Add DocumentNotFoundError exception; improve error handling in RangeO…
Amourspirit Mar 31, 2025
d3760c3
Merge pull request #703 from Amourspirit/0.53.3
Amourspirit Mar 31, 2025
a20c4a6
Increase sleep duration in test_thread to ensure cache expiration is …
Amourspirit Mar 31, 2025
d181133
Merge branch 'main' into develop
Amourspirit Mar 31, 2025
171b005
fix fix info version
Amourspirit May 23, 2025
7255946
fix for info version
Amourspirit May 23, 2025
bc50337
Merge pull request #705 from Amourspirit/0.53.4
Amourspirit May 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 78 additions & 11 deletions ooodev/utils/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,31 +243,38 @@ def get_reg_mods_path(cls) -> str:

@overload
@classmethod
def get_reg_item_prop(cls, item: str) -> str: ...
def get_reg_item_prop(cls, item: str) -> str:
...

@overload
@classmethod
def get_reg_item_prop(cls, item: str, prop: str) -> str: ...
def get_reg_item_prop(cls, item: str, prop: str) -> str:
...

@overload
@classmethod
def get_reg_item_prop(cls, item: str, prop: str, node: str) -> str: ...
def get_reg_item_prop(cls, item: str, prop: str, node: str) -> str:
...

@overload
@classmethod
def get_reg_item_prop(cls, item: str, *, kind: Info.RegPropKind) -> str: ...
def get_reg_item_prop(cls, item: str, *, kind: Info.RegPropKind) -> str:
...

@overload
@classmethod
def get_reg_item_prop(cls, item: str, *, kind: Info.RegPropKind, idx: int) -> str: ...
def get_reg_item_prop(cls, item: str, *, kind: Info.RegPropKind, idx: int) -> str:
...

@overload
@classmethod
def get_reg_item_prop(cls, item: str, prop: str, *, idx: int) -> str: ...
def get_reg_item_prop(cls, item: str, prop: str, *, idx: int) -> str:
...

@overload
@classmethod
def get_reg_item_prop(cls, item: str, prop: str, node: str, kind: Info.RegPropKind) -> str: ...
def get_reg_item_prop(cls, item: str, prop: str, node: str, kind: Info.RegPropKind) -> str:
...

@classmethod
def get_reg_item_prop(
Expand Down Expand Up @@ -2461,19 +2468,23 @@ def __delitem__(self, _item: int | str | DrawPage | XDrawPage) -> None:
# region is_type_enum_multi()
@overload
@staticmethod
def is_type_enum_multi(alt_type: str, enum_type: Type[Enum], enum_val: Enum) -> bool: ...
def is_type_enum_multi(alt_type: str, enum_type: Type[Enum], enum_val: Enum) -> bool:
...

@overload
@staticmethod
def is_type_enum_multi(alt_type: str, enum_type: Type[Enum], enum_val: str) -> bool: ...
def is_type_enum_multi(alt_type: str, enum_type: Type[Enum], enum_val: str) -> bool:
...

@overload
@staticmethod
def is_type_enum_multi(alt_type: str, enum_type: Type[Enum], enum_val: Enum, arg_name: str) -> bool: ...
def is_type_enum_multi(alt_type: str, enum_type: Type[Enum], enum_val: Enum, arg_name: str) -> bool:
...

@overload
@staticmethod
def is_type_enum_multi(alt_type: str, enum_type: Type[Enum], enum_val: str, arg_name: str) -> bool: ...
def is_type_enum_multi(alt_type: str, enum_type: Type[Enum], enum_val: str, arg_name: str) -> bool:
...

@staticmethod
def is_type_enum_multi(alt_type: str, enum_type: Type[Enum], enum_val: Enum | str, arg_name: str = "") -> bool:
Expand Down Expand Up @@ -2722,6 +2733,62 @@ def version_info(cls) -> Tuple[int, ...]:
cls._version_info = tuple(int(s) for s in cls.version.split("."))
return cls._version_info

@classproperty
def version_info(cls) -> Tuple[int, ...]:
"""
Gets the running LibreOffice version.

|lo_unsafe|

Returns:
tuple: version as tuple such as ``(7, 3, 4, 2)``

Note:
This property only works after Office is Loaded.
"""

try:
return cls._version_info
except AttributeError:
cls._version_info = Info.parse_version_string_to_int_tuple(cls.version)
return cls._version_info

@staticmethod
def parse_version_string_to_int_tuple(version_string: str) -> tuple[int, ...]:
"""
Parses a version string (e.g., "2025.0.1.alpha1") into a tuple of integers.
The string is split by '.', and any non-integer parts are ignored.

Args:
version_string: The string to parse.

Returns:
A tuple of integers representing the version parts.
Example: "2025.0.1.alpha1" -> (2025, 0, 1)
"1.2.3" -> (1, 2, 3)
"5.0beta" -> (5, 0)
"abc" -> ()

Raises:
TypeError: If the input is not a string.

.. versionadded:: 0.53.4
"""
if not isinstance(version_string, str):
raise TypeError("Input must be a string.")

parts = version_string.split(".")
int_parts = []
for part in parts:
try:
# Attempt to convert the part to an integer
int_parts.append(int(part))
except ValueError:
# If conversion fails (e.g., "alpha1", "beta"),
# stop processing further parts and break the loop.
break
return tuple(int_parts)


def _del_cache_attrs(source: object, e: EventArgs) -> None:
# clears Write Attributes that are dynamically created
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "ooo-dev-tools"
version = "0.53.3"
version = "0.53.4"

description = "LibreOffice Developer Tools"
license = "Apache Software License"
Expand Down
28 changes: 28 additions & 0 deletions tests/test_info/test_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,31 @@ def test_parese_language_code_error() -> None:
_ = Info.parse_language_code("en_GB")
with pytest.raises(ValueError):
_ = Info.parse_language_code("-GB")


def test_parse_version_string_to_int_tuple() -> None:
from ooodev.utils.info import Info

# Test valid version strings
assert Info.parse_version_string_to_int_tuple("2025.0.1.alpha1") == (2025, 0, 1)
assert Info.parse_version_string_to_int_tuple("1.2.3") == (1, 2, 3)
assert Info.parse_version_string_to_int_tuple("5.0beta") == (5,)
assert Info.parse_version_string_to_int_tuple("10.20.30.40") == (10, 20, 30, 40)

# Test invalid version strings
assert Info.parse_version_string_to_int_tuple("abc") == ()
assert Info.parse_version_string_to_int_tuple("") == ()

# Test mixed valid and invalid parts
assert Info.parse_version_string_to_int_tuple("1.2.alpha.3") == (1, 2)
assert Info.parse_version_string_to_int_tuple("1..3") == (1,)

# Test edge cases
assert Info.parse_version_string_to_int_tuple("0") == (0,)
assert Info.parse_version_string_to_int_tuple("0.0.0") == (0, 0, 0)

# Test input type validation
with pytest.raises(TypeError):
Info.parse_version_string_to_int_tuple(12345) # Not a string
with pytest.raises(TypeError):
Info.parse_version_string_to_int_tuple(None) # Not a string
Loading