drawlib 0.2.3.dev6__py3-none-any.whl → 0.2.3.dev7__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.
Potentially problematic release.
This version of drawlib might be problematic. Click here for more details.
- drawlib/__init__.py +1 -1
- drawlib/v0_2/private/smartarts/gridlayout.py +36 -31
- {drawlib-0.2.3.dev6.dist-info → drawlib-0.2.3.dev7.dist-info}/METADATA +1 -1
- {drawlib-0.2.3.dev6.dist-info → drawlib-0.2.3.dev7.dist-info}/RECORD +7 -7
- {drawlib-0.2.3.dev6.dist-info → drawlib-0.2.3.dev7.dist-info}/LICENSE.txt +0 -0
- {drawlib-0.2.3.dev6.dist-info → drawlib-0.2.3.dev7.dist-info}/WHEEL +0 -0
- {drawlib-0.2.3.dev6.dist-info → drawlib-0.2.3.dev7.dist-info}/entry_points.txt +0 -0
drawlib/__init__.py
CHANGED
|
@@ -14,7 +14,7 @@ import sys
|
|
|
14
14
|
from typing import Final, List
|
|
15
15
|
|
|
16
16
|
# please update here when you release new version
|
|
17
|
-
LIB_VERSION = "0.2.3.
|
|
17
|
+
LIB_VERSION: Final[str] = "0.2.3.dev7"
|
|
18
18
|
|
|
19
19
|
# please list active main committers (1+ commits per month)
|
|
20
20
|
AUTHORS: Final[List[str]] = [
|
|
@@ -154,7 +154,7 @@ class GridLayout:
|
|
|
154
154
|
width: float,
|
|
155
155
|
height: float,
|
|
156
156
|
margin: float,
|
|
157
|
-
outer_r: int =
|
|
157
|
+
outer_r: Optional[int] = None,
|
|
158
158
|
outer_style: Union[str, ShapeStyle, None] = None,
|
|
159
159
|
) -> None:
|
|
160
160
|
"""Draw the grid layout.
|
|
@@ -169,15 +169,16 @@ class GridLayout:
|
|
|
169
169
|
The style for the outer grid border. Can be a string key for a predefined style,
|
|
170
170
|
a ShapeStyle object, or None.
|
|
171
171
|
"""
|
|
172
|
-
column_widths = [width / self._num_column] * self._num_column
|
|
173
|
-
row_heights = [height / self._num_row] * self._num_row
|
|
174
|
-
|
|
175
172
|
if outer_style is None:
|
|
176
|
-
|
|
177
|
-
|
|
173
|
+
column_widths = [(width - margin * (self._num_column - 1)) / self._num_column] * self._num_column
|
|
174
|
+
row_heights = [(height - margin * (self._num_row - 1)) / self._num_row] * self._num_row
|
|
175
|
+
column_margins = [0] + [margin] * (self._num_column - 1) + [0]
|
|
176
|
+
row_margins = [0] + [margin] * (self._num_row - 1) + [0]
|
|
178
177
|
else:
|
|
179
|
-
|
|
180
|
-
|
|
178
|
+
column_widths = [(width - margin * (self._num_column + 1)) / self._num_column] * self._num_column
|
|
179
|
+
row_heights = [(height - margin * (self._num_row + 1)) / self._num_row] * self._num_row
|
|
180
|
+
column_margins = [margin] * (self._num_column + 1)
|
|
181
|
+
row_margins = [margin] * (self._num_row + 1)
|
|
181
182
|
|
|
182
183
|
self.draw_flexible(
|
|
183
184
|
xy=xy,
|
|
@@ -197,7 +198,7 @@ class GridLayout:
|
|
|
197
198
|
column_margins: List[float],
|
|
198
199
|
row_heights: List[float],
|
|
199
200
|
row_margins: List[float],
|
|
200
|
-
outer_r: int =
|
|
201
|
+
outer_r: Optional[int] = None,
|
|
201
202
|
outer_style: Union[str, ShapeStyle, None] = None,
|
|
202
203
|
) -> None:
|
|
203
204
|
"""Draw the grid layout with flexible column widths and row heights.
|
|
@@ -232,19 +233,31 @@ class GridLayout:
|
|
|
232
233
|
outer_style = dtheme.rectanglestyles.get(outer_style)
|
|
233
234
|
outer_style.halign = "left"
|
|
234
235
|
outer_style.valign = "bottom"
|
|
236
|
+
if outer_r is None:
|
|
237
|
+
outer_r = self._default_r
|
|
238
|
+
|
|
235
239
|
rectangle(
|
|
236
240
|
xy=xy,
|
|
237
|
-
width=sum(column_widths),
|
|
238
|
-
height=sum(row_heights),
|
|
241
|
+
width=sum(column_widths) + sum(column_margins),
|
|
242
|
+
height=sum(row_heights) + sum(row_margins),
|
|
239
243
|
r=outer_r,
|
|
240
244
|
style=outer_style,
|
|
241
245
|
)
|
|
242
246
|
|
|
243
247
|
# utility
|
|
244
|
-
def
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
+
def get_position(column_index: int, row_index: int) -> Tuple[float, float]:
|
|
249
|
+
x, y = xy
|
|
250
|
+
if column_index == 0:
|
|
251
|
+
new_x = x + column_margins[0]
|
|
252
|
+
else:
|
|
253
|
+
new_x = x + sum(column_margins[: column_index + 1]) + sum(column_widths[:column_index])
|
|
254
|
+
|
|
255
|
+
if row_index == 0:
|
|
256
|
+
new_y = y + row_margins[0]
|
|
257
|
+
else:
|
|
258
|
+
new_y = y + sum(row_margins[: row_index + 1]) + sum(row_heights[:row_index])
|
|
259
|
+
|
|
260
|
+
return (new_x, new_y)
|
|
248
261
|
|
|
249
262
|
for item in self._items:
|
|
250
263
|
column_range = item.column_range
|
|
@@ -259,25 +272,17 @@ class GridLayout:
|
|
|
259
272
|
rr0 = row_range[0]
|
|
260
273
|
rr1 = row_range[1]
|
|
261
274
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
height = sum_till_index(row_heights, rr1 + 1) - lb_xy[1]
|
|
266
|
-
|
|
267
|
-
# get margins
|
|
268
|
-
margin_left = column_margins[cr0] if cr0 == 0 else column_margins[cr0] / 2
|
|
269
|
-
margin_right = column_margins[cr1 + 1] if cr1 + 1 == self._num_column else column_margins[cr1 + 1] / 2
|
|
270
|
-
margin_bottom = row_margins[rr0] if rr0 == 0 else row_margins[rr0] / 2
|
|
271
|
-
margin_top = row_margins[rr1 + 1] if rr1 + 1 == self._num_row else row_margins[rr1 + 1] / 2
|
|
275
|
+
item_xy_left_bottom = get_position(cr0, rr0)
|
|
276
|
+
t = get_position(cr1, rr1)
|
|
277
|
+
item_xy_right_top = (t[0] + column_widths[cr1], t[1] + row_heights[rr1])
|
|
272
278
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
279
|
+
width, height = (
|
|
280
|
+
item_xy_right_top[0] - item_xy_left_bottom[0],
|
|
281
|
+
item_xy_right_top[1] - item_xy_left_bottom[1],
|
|
282
|
+
)
|
|
277
283
|
|
|
278
|
-
# draw
|
|
279
284
|
rectangle(
|
|
280
|
-
xy=
|
|
285
|
+
xy=item_xy_left_bottom,
|
|
281
286
|
width=width,
|
|
282
287
|
height=height,
|
|
283
288
|
r=r,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
drawlib/__init__.py,sha256=
|
|
1
|
+
drawlib/__init__.py,sha256=pyjdLbbUAFUzhoVCy3PoW8t4cN_seywKer9Rf10ioYI,2690
|
|
2
2
|
drawlib/__main__.py,sha256=UDsH6DiEIWBEwlClbYI10aWYBw_gOmaNCB0TSImWZ-c,604
|
|
3
3
|
drawlib/apis.py,sha256=Q1Uz4U6IK63ZtjaV_UTWPZq7xDpxTz99qHfpGsL8SnI,531
|
|
4
4
|
drawlib/assets/__init__.py,sha256=bYT4EWquLr0oyEziAuixlD9M4EPnMY6PyhknOxJjxqY,437
|
|
@@ -46,7 +46,7 @@ drawlib/v0_2/private/smartarts/boxtree.py,sha256=f6EXkPMEkU8v4vvBxA2Bu2_vV6nJ1nI
|
|
|
46
46
|
drawlib/v0_2/private/smartarts/bubblespeech.py,sha256=2ynQt0W5A0EGRpE1MX-1DQnd01NzM4zIjEUGunEWnIE,4219
|
|
47
47
|
drawlib/v0_2/private/smartarts/bulletpoints.py,sha256=2wOa5O7pq1qlrdagPaiA9t3UrSCKYAZ5HuVGgrG04u4,6039
|
|
48
48
|
drawlib/v0_2/private/smartarts/dsart.py,sha256=3wKpD4x_ZqZFG3QJAtD3NhKL7_lDlwJ3tY08sfUF02o,1245
|
|
49
|
-
drawlib/v0_2/private/smartarts/gridlayout.py,sha256=
|
|
49
|
+
drawlib/v0_2/private/smartarts/gridlayout.py,sha256=BNaF44K1NJRELCWB0v4QuoCbOVQ1kEnMsu7wBrqdjn0,11870
|
|
50
50
|
drawlib/v0_2/private/smartarts/pyramid.py,sha256=k2zIFQkrLGzLuhS5X0LwiV48wEsny75mVUQmhdWuFAo,14926
|
|
51
51
|
drawlib/v0_2/private/smartarts/sourcecode.py,sha256=VkPrmxNeYR_E0kyfFsezAKJE7dVNIdrIJUsq348iqyE,8922
|
|
52
52
|
drawlib/v0_2/private/smartarts/table.py,sha256=Fyji-xUt8JnZQPzbjt0GgibVB0qcr4zA2VgqDXddPmw,25407
|
|
@@ -75,8 +75,8 @@ drawlib/v0_2/private/validators/smartarts.py,sha256=fOAlC0syvZVk-GCLQgaPhhfWr3gc
|
|
|
75
75
|
drawlib/v0_2/private/validators/style.py,sha256=R7aLlaVfzdo33L7GLQ3WVfzzD_EsgV2-Y7ERcbFq7QI,3308
|
|
76
76
|
drawlib/v0_2/private/validators/text.py,sha256=ELT87nekr9hMx7m-wpVTku0QPxL3qCIX4cxI5RbFoIc,1126
|
|
77
77
|
drawlib/v0_2/private/validators/types.py,sha256=KtiIgivuaFyFaxIGeqr5N8xpzqIk9soiacSzcFDdjSA,4155
|
|
78
|
-
drawlib-0.2.3.
|
|
79
|
-
drawlib-0.2.3.
|
|
80
|
-
drawlib-0.2.3.
|
|
81
|
-
drawlib-0.2.3.
|
|
82
|
-
drawlib-0.2.3.
|
|
78
|
+
drawlib-0.2.3.dev7.dist-info/LICENSE.txt,sha256=h_ZiliCgEDqIYpxmUPmqGGP87VBcUHil1S4wUI48ZKg,11344
|
|
79
|
+
drawlib-0.2.3.dev7.dist-info/METADATA,sha256=Jl62LmhaUAhBgsh5XF-GfIQXhGIJvZvMIO0luZn4nAM,4007
|
|
80
|
+
drawlib-0.2.3.dev7.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
81
|
+
drawlib-0.2.3.dev7.dist-info/entry_points.txt,sha256=Lp6mbrRMP-g6c7P6Iz21CEjceLITCWrma3b0ncP30oQ,49
|
|
82
|
+
drawlib-0.2.3.dev7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|