ducpy 0.0.1__tar.gz

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.
Files changed (50) hide show
  1. ducpy-0.0.1/PKG-INFO +12 -0
  2. ducpy-0.0.1/README.md +119 -0
  3. ducpy-0.0.1/pyproject.toml +3 -0
  4. ducpy-0.0.1/setup.cfg +4 -0
  5. ducpy-0.0.1/setup.py +16 -0
  6. ducpy-0.0.1/src/Duc/AdvancedPoint.py +136 -0
  7. ducpy-0.0.1/src/Duc/AppState.py +569 -0
  8. ducpy-0.0.1/src/Duc/BezierPoint.py +63 -0
  9. ducpy-0.0.1/src/Duc/BinaryFileData.py +128 -0
  10. ducpy-0.0.1/src/Duc/BinaryFiles.py +74 -0
  11. ducpy-0.0.1/src/Duc/BinaryFilesEntry.py +67 -0
  12. ducpy-0.0.1/src/Duc/BindingPoint.py +63 -0
  13. ducpy-0.0.1/src/Duc/BoundElement.py +63 -0
  14. ducpy-0.0.1/src/Duc/DucElement.py +939 -0
  15. ducpy-0.0.1/src/Duc/DucGroup.py +102 -0
  16. ducpy-0.0.1/src/Duc/ElementBackground.py +54 -0
  17. ducpy-0.0.1/src/Duc/ElementContentBase.py +106 -0
  18. ducpy-0.0.1/src/Duc/ElementStroke.py +114 -0
  19. ducpy-0.0.1/src/Duc/ExportedDataState.py +147 -0
  20. ducpy-0.0.1/src/Duc/ImageCrop.py +115 -0
  21. ducpy-0.0.1/src/Duc/Point.py +162 -0
  22. ducpy-0.0.1/src/Duc/PointBinding.py +123 -0
  23. ducpy-0.0.1/src/Duc/SimplePoint.py +63 -0
  24. ducpy-0.0.1/src/Duc/StrokeSides.py +89 -0
  25. ducpy-0.0.1/src/Duc/StrokeStyle.py +141 -0
  26. ducpy-0.0.1/src/Duc/TilingProperties.py +102 -0
  27. ducpy-0.0.1/src/Duc/__init__.py +0 -0
  28. ducpy-0.0.1/src/classes/AppStateClass.py +88 -0
  29. ducpy-0.0.1/src/classes/BinaryFilesClass.py +19 -0
  30. ducpy-0.0.1/src/classes/DucElementClass.py +123 -0
  31. ducpy-0.0.1/src/classes/__init__.py +4 -0
  32. ducpy-0.0.1/src/ducpy.egg-info/PKG-INFO +12 -0
  33. ducpy-0.0.1/src/ducpy.egg-info/SOURCES.txt +48 -0
  34. ducpy-0.0.1/src/ducpy.egg-info/dependency_links.txt +1 -0
  35. ducpy-0.0.1/src/ducpy.egg-info/requires.txt +2 -0
  36. ducpy-0.0.1/src/ducpy.egg-info/top_level.txt +5 -0
  37. ducpy-0.0.1/src/parse/__init__.py +5 -0
  38. ducpy-0.0.1/src/parse/parse_app_state.py +87 -0
  39. ducpy-0.0.1/src/parse/parse_binary_files.py +44 -0
  40. ducpy-0.0.1/src/parse/parse_duc.py +33 -0
  41. ducpy-0.0.1/src/parse/parse_duc_element.py +317 -0
  42. ducpy-0.0.1/src/serialize/__init__.py +5 -0
  43. ducpy-0.0.1/src/serialize/serialize_app_state.py +165 -0
  44. ducpy-0.0.1/src/serialize/serialize_binary_files.py +75 -0
  45. ducpy-0.0.1/src/serialize/serialize_duc.py +87 -0
  46. ducpy-0.0.1/src/serialize/serialize_duc_element.py +645 -0
  47. ducpy-0.0.1/src/utils/ElementTypes.py +93 -0
  48. ducpy-0.0.1/src/utils/__init__.py +10 -0
  49. ducpy-0.0.1/src/utils/constants.py +205 -0
  50. ducpy-0.0.1/src/utils/enums.py +189 -0
ducpy-0.0.1/PKG-INFO ADDED
@@ -0,0 +1,12 @@
1
+ Metadata-Version: 2.2
2
+ Name: ducpy
3
+ Version: 0.0.1
4
+ Classifier: Programming Language :: Python :: 3
5
+ Classifier: License :: OSI Approved :: MIT License
6
+ Classifier: Operating System :: OS Independent
7
+ Requires-Python: >=3.7
8
+ Requires-Dist: flatbuffers
9
+ Requires-Dist: nanoid
10
+ Dynamic: classifier
11
+ Dynamic: requires-dist
12
+ Dynamic: requires-python
ducpy-0.0.1/README.md ADDED
@@ -0,0 +1,119 @@
1
+ # duc_py
2
+
3
+ Python library for working with DUC (Ducflair Canvas) files.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install duc_py
9
+ ```
10
+
11
+ Or install from a local clone:
12
+
13
+ ```bash
14
+ git clone https://github.com/your-username/duc_py.git
15
+ cd duc_py
16
+ pip install -e .
17
+ ```
18
+
19
+ ## Usage Examples
20
+
21
+ ### Basic Import
22
+
23
+ ```python
24
+ # Import duc_py
25
+ import duc_py as duc
26
+
27
+ # Create a point
28
+ point = duc.Point(x=10, y=20)
29
+
30
+ # Access modules directly
31
+ something = duc.classes.SomeClass()
32
+ result = duc.parse.parse_duc_element(...)
33
+ ```
34
+
35
+ ### Import Types Directly
36
+
37
+ ```python
38
+ # Import specific types
39
+ from duc_py import Point, BezierHandle, ElementStroke
40
+
41
+ # Create and use them
42
+ point = Point(x=10, y=20)
43
+ ```
44
+
45
+ ### Access Module Functions
46
+
47
+ ```python
48
+ # Import specific modules
49
+ from duc_py import parse, serialize, classes, utils
50
+
51
+ # Use functions from those modules
52
+ element = parse.parse_duc_element(...)
53
+ serialized = serialize.serialize_duc_element(...)
54
+ ```
55
+
56
+ ## Development
57
+
58
+ To set up for development:
59
+
60
+ ```bash
61
+ # Clone the repository
62
+ git clone https://github.com/your-username/duc_py.git
63
+
64
+ # Change to the project directory
65
+ cd duc_py
66
+
67
+ # Install in development mode
68
+ pip install -e .
69
+ ```
70
+
71
+ ## VSCode Configuration
72
+
73
+ If you're using VSCode with Pylance and having issues with imports, add this to your `.vscode/settings.json`:
74
+
75
+ ```json
76
+ {
77
+ "python.analysis.extraPaths": [
78
+ "${workspaceFolder}/venv/lib/python3.x/site-packages",
79
+ "/path/to/duc_py/src"
80
+ ],
81
+ "python.analysis.typeCheckingMode": "basic",
82
+ "python.autoComplete.extraPaths": [
83
+ "${workspaceFolder}/venv/lib/python3.x/site-packages",
84
+ "/path/to/duc_py/src"
85
+ ]
86
+ }
87
+ ```
88
+
89
+ ## License
90
+
91
+ [Add your license information here]
92
+
93
+ ## Test
94
+
95
+ ```sh
96
+ # Add 100 random elements
97
+ python -m src.tests.add_100_rand_elements ./src/tests/inputs/input.duc -o ./src/tests/dist/output.duc
98
+ ```
99
+
100
+ ```sh
101
+ # Move elements randomly
102
+ python -m src.tests.move_elements_rand ./src/tests/inputs/input.duc -o ./src/tests/dist/output.duc --max-distance 1000 --max-rotation 3.14
103
+ ```
104
+
105
+ ```sh
106
+ # Print the duc file in a readable format
107
+ python -m src.tests.pretty_print_duc ./src/tests/inputs/input.duc
108
+ ```
109
+
110
+ ```sh
111
+ # Create a Duc with 100 connected elements
112
+ python -m src.tests.create_duc_with_100_connected -o ./src/tests/dist/output.duc
113
+ ```
114
+
115
+ ## Raw Inspect in JSON
116
+
117
+ ```sh
118
+ flatc --json --strict-json --raw-binary --no-warnings -o ./src/tests/dist ../duc.fbs -- ./src/tests/dist/output.duc
119
+ ```
@@ -0,0 +1,3 @@
1
+ [build-system]
2
+ requires = ["setuptools>=45", "wheel"]
3
+ build-backend = "setuptools.build_meta"
ducpy-0.0.1/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
ducpy-0.0.1/setup.py ADDED
@@ -0,0 +1,16 @@
1
+ from setuptools import find_packages, setup
2
+
3
+
4
+ setup(
5
+ name='ducpy',
6
+ version='0.0.1',
7
+ package_dir={'': 'src'},
8
+ packages=find_packages(where='src'),
9
+ install_requires=['flatbuffers', 'nanoid'],
10
+ python_requires='>=3.7',
11
+ classifiers=[
12
+ 'Programming Language :: Python :: 3',
13
+ 'License :: OSI Approved :: MIT License',
14
+ 'Operating System :: OS Independent',
15
+ ],
16
+ )
@@ -0,0 +1,136 @@
1
+ # automatically generated by the FlatBuffers compiler, do not modify
2
+
3
+ # namespace: Duc
4
+
5
+ import flatbuffers
6
+ from flatbuffers.compat import import_numpy
7
+ np = import_numpy()
8
+
9
+ class AdvancedPoint(object):
10
+ __slots__ = ['_tab']
11
+
12
+ @classmethod
13
+ def GetRootAs(cls, buf, offset=0):
14
+ n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
15
+ x = AdvancedPoint()
16
+ x.Init(buf, n + offset)
17
+ return x
18
+
19
+ @classmethod
20
+ def GetRootAsAdvancedPoint(cls, buf, offset=0):
21
+ """This method is deprecated. Please switch to GetRootAs."""
22
+ return cls.GetRootAs(buf, offset)
23
+ # AdvancedPoint
24
+ def Init(self, buf, pos):
25
+ self._tab = flatbuffers.table.Table(buf, pos)
26
+
27
+ # AdvancedPoint
28
+ def X(self):
29
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
30
+ if o != 0:
31
+ return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
32
+ return 0.0
33
+
34
+ # AdvancedPoint
35
+ def Y(self):
36
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
37
+ if o != 0:
38
+ return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
39
+ return 0.0
40
+
41
+ # AdvancedPoint
42
+ def IsCurve(self):
43
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
44
+ if o != 0:
45
+ return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
46
+ return False
47
+
48
+ # AdvancedPoint
49
+ def MirroringAll(self):
50
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
51
+ if o != 0:
52
+ return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
53
+ return False
54
+
55
+ # AdvancedPoint
56
+ def BorderRadius(self):
57
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
58
+ if o != 0:
59
+ return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
60
+ return 0.0
61
+
62
+ # AdvancedPoint
63
+ def HandleIn(self):
64
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
65
+ if o != 0:
66
+ x = self._tab.Indirect(o + self._tab.Pos)
67
+ from Duc.Point import Point
68
+ obj = Point()
69
+ obj.Init(self._tab.Bytes, x)
70
+ return obj
71
+ return None
72
+
73
+ # AdvancedPoint
74
+ def HandleOut(self):
75
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
76
+ if o != 0:
77
+ x = self._tab.Indirect(o + self._tab.Pos)
78
+ from Duc.Point import Point
79
+ obj = Point()
80
+ obj.Init(self._tab.Bytes, x)
81
+ return obj
82
+ return None
83
+
84
+ def AdvancedPointStart(builder):
85
+ builder.StartObject(7)
86
+
87
+ def Start(builder):
88
+ AdvancedPointStart(builder)
89
+
90
+ def AdvancedPointAddX(builder, x):
91
+ builder.PrependFloat32Slot(0, x, 0.0)
92
+
93
+ def AddX(builder, x):
94
+ AdvancedPointAddX(builder, x)
95
+
96
+ def AdvancedPointAddY(builder, y):
97
+ builder.PrependFloat32Slot(1, y, 0.0)
98
+
99
+ def AddY(builder, y):
100
+ AdvancedPointAddY(builder, y)
101
+
102
+ def AdvancedPointAddIsCurve(builder, isCurve):
103
+ builder.PrependBoolSlot(2, isCurve, 0)
104
+
105
+ def AddIsCurve(builder, isCurve):
106
+ AdvancedPointAddIsCurve(builder, isCurve)
107
+
108
+ def AdvancedPointAddMirroringAll(builder, mirroringAll):
109
+ builder.PrependBoolSlot(3, mirroringAll, 0)
110
+
111
+ def AddMirroringAll(builder, mirroringAll):
112
+ AdvancedPointAddMirroringAll(builder, mirroringAll)
113
+
114
+ def AdvancedPointAddBorderRadius(builder, borderRadius):
115
+ builder.PrependFloat32Slot(4, borderRadius, 0.0)
116
+
117
+ def AddBorderRadius(builder, borderRadius):
118
+ AdvancedPointAddBorderRadius(builder, borderRadius)
119
+
120
+ def AdvancedPointAddHandleIn(builder, handleIn):
121
+ builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(handleIn), 0)
122
+
123
+ def AddHandleIn(builder, handleIn):
124
+ AdvancedPointAddHandleIn(builder, handleIn)
125
+
126
+ def AdvancedPointAddHandleOut(builder, handleOut):
127
+ builder.PrependUOffsetTRelativeSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(handleOut), 0)
128
+
129
+ def AddHandleOut(builder, handleOut):
130
+ AdvancedPointAddHandleOut(builder, handleOut)
131
+
132
+ def AdvancedPointEnd(builder):
133
+ return builder.EndObject()
134
+
135
+ def End(builder):
136
+ return AdvancedPointEnd(builder)