batoolset-gui 0.2.0__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.
- batoolset/GUI/__init__.py +0 -0
- batoolset/GUI/customdialog.py +136 -0
- batoolset/GUI/exception_handler.py +74 -0
- batoolset/GUI/list_gui.py +514 -0
- batoolset/GUI/multi_image_display.py +1038 -0
- batoolset/GUI/open.py +325 -0
- batoolset/GUI/overlay_hints.py +45 -0
- batoolset/GUI/paint2.py +1369 -0
- batoolset/GUI/scrollablepaint.py +1165 -0
- batoolset/dialogs/__init__.py +0 -0
- batoolset/dialogs/opensave.py +228 -0
- batoolset/drawings/__init__.py +0 -0
- batoolset/drawings/math_text.py +294 -0
- batoolset/drawings/pdf_svg_renderer.py +376 -0
- batoolset/drawings/shapes/Position.py +183 -0
- batoolset/drawings/shapes/__init__.py +0 -0
- batoolset/drawings/shapes/automated_alignment_drawing_refactored.py +346 -0
- batoolset/drawings/shapes/circle2d.py +99 -0
- batoolset/drawings/shapes/compute_optimal_size_all_merged.py +328 -0
- batoolset/drawings/shapes/ellipse2d.py +336 -0
- batoolset/drawings/shapes/freehand2d.py +235 -0
- batoolset/drawings/shapes/group.py +1985 -0
- batoolset/drawings/shapes/image2d.py +3157 -0
- batoolset/drawings/shapes/line2d.py +579 -0
- batoolset/drawings/shapes/point2d.py +257 -0
- batoolset/drawings/shapes/polygon2d.py +357 -0
- batoolset/drawings/shapes/polyline2d.py +235 -0
- batoolset/drawings/shapes/rect2d.py +388 -0
- batoolset/drawings/shapes/rectangle2d.py +601 -0
- batoolset/drawings/shapes/scalebar.py +310 -0
- batoolset/drawings/shapes/serializablefont.py +133 -0
- batoolset/drawings/shapes/serializableguiparams.py +14 -0
- batoolset/drawings/shapes/square2d.py +102 -0
- batoolset/drawings/shapes/test_publication_style.py +220 -0
- batoolset/drawings/shapes/textorientation.py +45 -0
- batoolset/drawings/shapes/tools.py +467 -0
- batoolset/drawings/shapes/transform2D.py +350 -0
- batoolset/drawings/shapes/txt2d.py +615 -0
- batoolset/drawings/svg_clip_renderer.py +247 -0
- batoolset/drawings/svg_embed.py +165 -0
- batoolset/drawings/svg_text_renderer.py +183 -0
- batoolset/drawings/widgets/__init__.py +0 -0
- batoolset/drawings/widgets/col.py +343 -0
- batoolset/drawings/widgets/image_group.py +248 -0
- batoolset/drawings/widgets/image_organizer.py +96 -0
- batoolset/drawings/widgets/paint.py +184 -0
- batoolset/drawings/widgets/vectorial.py +256 -0
- batoolset/figure/__init__.py +0 -0
- batoolset/figure/alignment.py +822 -0
- batoolset/figure/column.py +1117 -0
- batoolset/figure/fig_tools.py +285 -0
- batoolset/figure/minimal_debugger_scale_etc.py +139 -0
- batoolset/figure/panel.py +697 -0
- batoolset/figure/row.py +852 -0
- batoolset/figure/user_selection.py +287 -0
- batoolset/icons/__init__.py +0 -0
- batoolset/icons/tools.py +248 -0
- batoolset/luts/__init__.py +0 -0
- batoolset/luts/lut_minimal_test.py +1308 -0
- batoolset/luts/lutcreatorfromformula.py +209 -0
- batoolset/luts/luteditor.py +243 -0
- batoolset/pyqts/__init__.py +0 -0
- batoolset/pyqts/pleasewaitdialog.py +14 -0
- batoolset/pyqts/tools.py +760 -0
- batoolset/serializations/__init__.py +0 -0
- batoolset/serializations/tools.py +1338 -0
- batoolset/theme.py +647 -0
- batoolset/uis/__init__.py +0 -0
- batoolset/uis/blinker.py +56 -0
- batoolset_gui-0.2.0.dist-info/METADATA +54 -0
- batoolset_gui-0.2.0.dist-info/RECORD +74 -0
- batoolset_gui-0.2.0.dist-info/WHEEL +5 -0
- batoolset_gui-0.2.0.dist-info/licenses/LICENSE +24 -0
- batoolset_gui-0.2.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
# try to find a code that finds the new scaling so that the image fits to the new size
|
|
2
|
+
# assume all images have the same height in a row and the same width in a column
|
|
3
|
+
|
|
4
|
+
# can I not even store everything as a big numpy array ???
|
|
5
|
+
|
|
6
|
+
# test with 3 rectangles
|
|
7
|
+
|
|
8
|
+
# keep AR the same --> need just apply a scaling to the image and in fact to all images the same, by the way
|
|
9
|
+
|
|
10
|
+
#
|
|
11
|
+
# def find_scaling_to_fit():
|
|
12
|
+
# incompressible_length = (len(widths)-1)*space_between_images
|
|
13
|
+
# image_width_to_fit_not_counting_incompressible_length = final_width-incompressible_length
|
|
14
|
+
# sum_individual = sum(widths)
|
|
15
|
+
# common_scaling = image_width_to_fit_not_counting_incompressible_length/sum_individual
|
|
16
|
+
#
|
|
17
|
+
# print(common_scaling)
|
|
18
|
+
#
|
|
19
|
+
# # print(widths*common_scaling)
|
|
20
|
+
# corrected_widths = [w*common_scaling for w in widths]
|
|
21
|
+
# print(widths)
|
|
22
|
+
# print(corrected_widths)
|
|
23
|
+
# print(sum(corrected_widths))
|
|
24
|
+
# print(sum(corrected_widths)+incompressible_length)
|
|
25
|
+
# print(incompressible_length)
|
|
26
|
+
# # print()
|
|
27
|
+
|
|
28
|
+
# ça marche super en fait et c'est vraiment facile
|
|
29
|
+
|
|
30
|
+
# computes the rescaling factor so that images get rescaled to fit the desired dimension --> much smarter that way than using brute force!!!
|
|
31
|
+
|
|
32
|
+
import os
|
|
33
|
+
from batoolset.settings.global_settings import set_UI # set the UI to qtpy
|
|
34
|
+
set_UI()
|
|
35
|
+
import sys
|
|
36
|
+
from qtpy import QtWidgets
|
|
37
|
+
from qtpy.QtCore import QRectF
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
# nb the pb asssumes AR is kept constant which is true for images but not with panels containing images and incompressible space between them --> need some extra computation then
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
common_value = 0
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def get_common_scaling_factor(dimensions_in_the_desired_dimension, desired_final_size, size_of_incompressible_elements_in_dimension=3):
|
|
47
|
+
incompressible_length = (len(dimensions_in_the_desired_dimension) - 1) * size_of_incompressible_elements_in_dimension
|
|
48
|
+
image_width_to_fit_not_counting_incompressible_length = desired_final_size - incompressible_length
|
|
49
|
+
sum_individual = sum(dimensions_in_the_desired_dimension)
|
|
50
|
+
common_scaling = image_width_to_fit_not_counting_incompressible_length / sum_individual
|
|
51
|
+
|
|
52
|
+
# print(common_scaling)
|
|
53
|
+
|
|
54
|
+
# print(widths*common_scaling)
|
|
55
|
+
# corrected_widths = [w * common_scaling for w in dimensions_in_the_desired_dimension]
|
|
56
|
+
# print(dimensions_in_the_desired_dimension)
|
|
57
|
+
# print(corrected_widths)
|
|
58
|
+
# print(sum(corrected_widths))
|
|
59
|
+
# print(sum(corrected_widths) + incompressible_length)
|
|
60
|
+
# print(incompressible_length)
|
|
61
|
+
|
|
62
|
+
return common_scaling
|
|
63
|
+
|
|
64
|
+
#########################################################KEEP EQUATIONS TO SOLVE THE CHANGE IN SIZE
|
|
65
|
+
# final_width = width_obj1 + width_obj2+ width_obj3 + (nb_of_objs-1)*space
|
|
66
|
+
# new_width = new_width_obj1 + new_width_obj2+ new_width_obj3 + (nb_of_objs-1)*space
|
|
67
|
+
# new_width = width_obj1*scaling + new_width_obj2*scaling+ new_width_obj3*scaling + (nb_of_objs-1)*space
|
|
68
|
+
# height = same whatever the condition but can change --> need solve the equa so that height is the same while width obeys the new stuff
|
|
69
|
+
# heightA = heightB = heightC # always
|
|
70
|
+
# comment relier la width à la height ???
|
|
71
|
+
|
|
72
|
+
# final_AR = widthA/heightA = (incomp_widthA+widthA_non_incom)/(incomp_heightA+heightA_non_incom)
|
|
73
|
+
# heightA =(incomp_heightA+heightA_non_incom)
|
|
74
|
+
# widthA = (incomp_widthA+withA_non_incom)
|
|
75
|
+
# AR = withA_non_incom/heightA_non_incom
|
|
76
|
+
# heightA_non_incomp = widthA_non_incomp/AR
|
|
77
|
+
# heightA = incomp_heightA+(widthA_non_incomp/AR)
|
|
78
|
+
# widthA = (incomp_widthA+withA_non_incom)
|
|
79
|
+
# --> with that can I compute the best change for all
|
|
80
|
+
# final_AR = ((scaling_x*current_widthA) +widthA_non_incom)/((scaling_y*current_heightA)+heightA_non_incom)
|
|
81
|
+
# new_widthA = ((scaling_xA*current_widthA) +widthA_non_incom)
|
|
82
|
+
# new_heightA = ((scaling_yA*current_heightA)+heightA_non_incom)
|
|
83
|
+
# I need find both scalings at the same time
|
|
84
|
+
# reorder equa for scaling -> TODO
|
|
85
|
+
# scaling_xA = (new_widthA - widthA_non_incom)/current_widthA
|
|
86
|
+
# scaling_yA = (current_heightA - heightA_non_incom)/current_heightA
|
|
87
|
+
# need find both so that everything fits
|
|
88
|
+
# --> easy in fact and that is what I need to have
|
|
89
|
+
# height is always related to width too given the incompressible AR ratio --> YES IN FACT IT MUST BE
|
|
90
|
+
# heightA = heightB = heightC # whatever happens the images all have the same height in a row
|
|
91
|
+
# so by definition
|
|
92
|
+
# height A is fixed but yet to an unknown value
|
|
93
|
+
# heightA = heightB = heightC
|
|
94
|
+
# width is fixed and height must be adjusted but the same in all cases
|
|
95
|
+
# --> how does one compute that
|
|
96
|
+
# that must be doable but complex
|
|
97
|
+
# j'ai 6 inconnues --> mes scalings en x et en y et j'ai une taille constante pour un et une egalite pour l'autre
|
|
98
|
+
#
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
# final AR = ((scalingx * old_compressible_dim_x)+incomp x)/((scalingy * old_compressible_dim_y)+incomp y)) = ((scalingx * old_compressible_dim_x)+incomp x)/((scalingy * (old_compressible_dim_x/AR))+incomp y))
|
|
102
|
+
# finalAR = final_dimx/final dimy
|
|
103
|
+
# final_dimx/final dimy = ((scalingx * old_compressible_dim_x)+incomp x)/((scalingy * (old_compressible_dim_x/AR))+incomp y))
|
|
104
|
+
# final_dimx = final dimy* (((scalingx * old_compressible_dim_x)+incomp x)/((scalingy * (old_compressible_dim_x/AR))+incomp y)))
|
|
105
|
+
# final_dimy = final dimx/(((scalingx * old_compressible_dim_x)+incomp x)/((scalingy * (old_compressible_dim_x/AR))+incomp y)))
|
|
106
|
+
# final_dimy1 = final_dimy2 =final_dimy3
|
|
107
|
+
# the early things are known and either the final height or width is known --> not true but i know they are eaqual --> so I can solve it
|
|
108
|
+
# and get all the parameters
|
|
109
|
+
|
|
110
|
+
# sum of dims + sum incomp = desired width
|
|
111
|
+
# sum(incomp)+sum(images) = desired_width
|
|
112
|
+
# I need get the 3 heights that would fulfill the criterion I want
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
# same height --> ????
|
|
116
|
+
# how do I do that
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
# faire ça
|
|
124
|
+
|
|
125
|
+
# start with just two images and solve it
|
|
126
|
+
# heightA = heightB
|
|
127
|
+
# final_width = widthA + widthB + incomp_width
|
|
128
|
+
# need find widthA and widthB so that the heights are the same
|
|
129
|
+
# final_width = scalingxA * original_widthA +scalingxB * original_widthB + incomp_width
|
|
130
|
+
# final_height = scalingyA * original_heightA+scalingyB * original_heightB
|
|
131
|
+
# how can I relate width and height
|
|
132
|
+
# final_AR is unknown
|
|
133
|
+
|
|
134
|
+
# in fact I don't find any other way than brute force but there has to be a way ??? --> too bad I forgot my basic math classes
|
|
135
|
+
# ratio = sizex/sizey --> ce n'est pas fixe mais ça depend des
|
|
136
|
+
# the pb is that this ratio is unknown
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
# height + ((leny-1)*space) = AR*width + ((lenx-1)*space)
|
|
140
|
+
# height = AR*width + ((lenx-1)*space)- ((leny-1)*space)
|
|
141
|
+
# heights of the three should be equal --> can compute
|
|
142
|
+
# y = ax+b # image1 --> what I want is a ???
|
|
143
|
+
# y = dx'+c
|
|
144
|
+
# all same height
|
|
145
|
+
#dx'+c = ax+b
|
|
146
|
+
# sum of width = fixed size
|
|
147
|
+
# dx'+c + ax+b= 512
|
|
148
|
+
# c and b are fixed
|
|
149
|
+
# dx'+ax = 512-c-b # --> equation 1
|
|
150
|
+
# need another equation
|
|
151
|
+
# need find d and b
|
|
152
|
+
# est ce que c'est ça ???
|
|
153
|
+
# https://calculis.net/systeme-n-equations#solutions
|
|
154
|
+
|
|
155
|
+
# dx'+c = ax+b
|
|
156
|
+
# d = (ax+b-c)/x'
|
|
157
|
+
# a = (dx'+c-b)/x
|
|
158
|
+
# deux equations à deux inconnues
|
|
159
|
+
# https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.fsolve.html or that ???
|
|
160
|
+
# https://numpy.org/doc/stable/reference/generated/numpy.linalg.solve.html # or that
|
|
161
|
+
|
|
162
|
+
# or solve for different heights
|
|
163
|
+
# y1 = a1*x1+b1
|
|
164
|
+
# y2 = a2*x2+b2
|
|
165
|
+
# y1 = y2
|
|
166
|
+
# a1x1 = a2*x2+b1-b2
|
|
167
|
+
# a1*x1+b1 + a2*x2+b2 + c = 512
|
|
168
|
+
# https://www.youtube.com/watch?v=QkkpcVbNLVE --> je pense que c'est ce que je cherche
|
|
169
|
+
# du coup voir comment le resoudre pratiquement
|
|
170
|
+
# or brute force solve it numerically
|
|
171
|
+
# see the smart and fastest way to do that
|
|
172
|
+
# i need find a1 and x1 and a2 and x2 -> need another equation then
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
# autre solution faire usr un systeme packé et le changer en non packé --> marche si et seulement si le truc est incompressible dans une seule dimension
|
|
177
|
+
#
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
#########################################################KEEP EQUATIONS TO SOLVE THE CHANGE IN SIZE
|
|
197
|
+
|
|
198
|
+
# worst case --> I can brute force it a bit but I would love not to
|
|
199
|
+
# or need a post process correction to fit in same height but pb is that it will also change width and therefore I will have trouble beacuse it will change width and I will need do that recursively until I reach the global minima
|
|
200
|
+
# -> think about it
|
|
201
|
+
# think about it
|
|
202
|
+
|
|
203
|
+
# AR = (real_width + incomp_width)/(real_height + incomp_height)
|
|
204
|
+
# incomp_width =
|
|
205
|
+
# width = sum_width_objects
|
|
206
|
+
# probably easy --> I just need to have in the formula the AR
|
|
207
|
+
# it should fit in the given space
|
|
208
|
+
# if same size --> incompressible fits
|
|
209
|
+
def get_common_scaling_factor_taking_incompressibility_into_account(dimensions_in_the_desired_dimension, desired_final_size, size_of_incompressible_elements_in_dimension=3):
|
|
210
|
+
incompressible_length = (len(dimensions_in_the_desired_dimension) - 1) * size_of_incompressible_elements_in_dimension
|
|
211
|
+
image_width_to_fit_not_counting_incompressible_length = desired_final_size - incompressible_length
|
|
212
|
+
sum_individual = sum(dimensions_in_the_desired_dimension)
|
|
213
|
+
common_scaling = image_width_to_fit_not_counting_incompressible_length / sum_individual
|
|
214
|
+
|
|
215
|
+
# print(common_scaling)
|
|
216
|
+
|
|
217
|
+
# print(widths*common_scaling)
|
|
218
|
+
# corrected_widths = [w * common_scaling for w in dimensions_in_the_desired_dimension]
|
|
219
|
+
# print(dimensions_in_the_desired_dimension)
|
|
220
|
+
# print(corrected_widths)
|
|
221
|
+
# print(sum(corrected_widths))
|
|
222
|
+
# print(sum(corrected_widths) + incompressible_length)
|
|
223
|
+
# print(incompressible_length)
|
|
224
|
+
|
|
225
|
+
return common_scaling
|
|
226
|
+
|
|
227
|
+
def get_master_bounds2(group_of_shapes):
|
|
228
|
+
# from batoolset.drawings.shapes.group import Group
|
|
229
|
+
bounds = QRectF()
|
|
230
|
+
|
|
231
|
+
if group_of_shapes is None:
|
|
232
|
+
return bounds
|
|
233
|
+
max_width = 0
|
|
234
|
+
max_height = 0
|
|
235
|
+
min_x=100000000
|
|
236
|
+
min_y=100000000
|
|
237
|
+
|
|
238
|
+
for shape in group_of_shapes:
|
|
239
|
+
# if isinstance(shape, Group):
|
|
240
|
+
# rect = shape.getRect()
|
|
241
|
+
# else:
|
|
242
|
+
# rect = shape.getRect(all=True)
|
|
243
|
+
rect = shape.getRect(all=True)
|
|
244
|
+
max_width = max(max_width, rect.x()+rect.width())
|
|
245
|
+
max_height = max(max_height, rect.y()+rect.height())
|
|
246
|
+
min_x = min(min_x, rect.x())
|
|
247
|
+
min_y = min(min_y, rect.y())
|
|
248
|
+
bounds.setX(min_x)
|
|
249
|
+
bounds.setY(min_y)
|
|
250
|
+
bounds.setWidth(max_width-min_x)
|
|
251
|
+
bounds.setHeight(max_height-min_y)
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
return bounds
|
|
256
|
+
#
|
|
257
|
+
# gets the master rect of a list of objects
|
|
258
|
+
# Nb should I allow negative bounds ??? --> maybe not in fact
|
|
259
|
+
# def get_master_bounds(group_of_shapes):
|
|
260
|
+
# bounds = QRectF()
|
|
261
|
+
# max_width = 0
|
|
262
|
+
# max_height = 0
|
|
263
|
+
# for shape in group_of_shapes:
|
|
264
|
+
# # rect = shape.boundingRect()
|
|
265
|
+
# rect = shape.getRect(all=True)
|
|
266
|
+
# max_width = max(max_width, rect.x()+rect.width())
|
|
267
|
+
# max_height = max(max_height, rect.y()+rect.height())
|
|
268
|
+
# bounds.setWidth(max_width)
|
|
269
|
+
# bounds.setHeight(max_height)
|
|
270
|
+
#
|
|
271
|
+
# # print('master rect detected', bounds)
|
|
272
|
+
#
|
|
273
|
+
# return bounds
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
if __name__ == '__main__':
|
|
278
|
+
|
|
279
|
+
# ça marche mais c'est super slow -> can i make it faster then ???
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
if True:
|
|
283
|
+
# test solving equation
|
|
284
|
+
import numpy as np
|
|
285
|
+
pass
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# minimal bug to get rid of size issues
|
|
2
|
+
# shall I assume all rects are rects or shall I allow rotation
|
|
3
|
+
# still need assume everything is packed
|
|
4
|
+
# --> think about that ???
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
# the selection is not good
|
|
8
|
+
# can one use words for that
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
from batoolset.drawings.shapes.image2d import Image2D
|
|
12
|
+
from batoolset.figure.alignment import packX
|
|
13
|
+
from batoolset.figure.column import Column
|
|
14
|
+
# from batoolset.figure.fig_tools import preview, get_common_scaling_factor
|
|
15
|
+
from batoolset.figure.row import Row
|
|
16
|
+
from timeit import default_timer as timer
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
img1 = Image2D('/E/Sample_images/counter/00.png')
|
|
20
|
+
img2 = Image2D('/E/Sample_images/counter/01.png')
|
|
21
|
+
img3 = Image2D('/E/Sample_images/counter/02.png')
|
|
22
|
+
img4 = Image2D('/E/Sample_images/counter/03.png')
|
|
23
|
+
img5 = Image2D('/E/Sample_images/counter/04.png')
|
|
24
|
+
img6 = Image2D('/E/Sample_images/counter/05.png')
|
|
25
|
+
img7 = Image2D('/E/Sample_images/counter/06.png')
|
|
26
|
+
img8 = Image2D('/E/Sample_images/counter/07.png')
|
|
27
|
+
img9 = Image2D('/E/Sample_images/counter/08.png')
|
|
28
|
+
img10 = Image2D('/E/Sample_images/counter/09.png')
|
|
29
|
+
|
|
30
|
+
if False:
|
|
31
|
+
row1 = Row(img1, img2)
|
|
32
|
+
row2 = Row(img3, img4, img5)
|
|
33
|
+
|
|
34
|
+
print(row1)
|
|
35
|
+
print(row2)
|
|
36
|
+
|
|
37
|
+
print(type(row1))
|
|
38
|
+
|
|
39
|
+
row1 /= row2
|
|
40
|
+
|
|
41
|
+
print(row1)
|
|
42
|
+
|
|
43
|
+
print(type(row1))
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
# size is ok if no set to width
|
|
47
|
+
row1.setToWidth(512) # --> indeed size is not ok there --> some update is not made properly in there
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
#
|
|
52
|
+
for elm in row1:
|
|
53
|
+
print("inner size", elm) # the size of these things is indeed 512 --> why isn't then the parent up to date ????
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
print(row1)
|
|
57
|
+
|
|
58
|
+
# row1.updateBoudingRect() # ça a marche --> pkoi marche pas n haut alors
|
|
59
|
+
#
|
|
60
|
+
# print(row1)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
preview(row1)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
# test the new resizing algo that is so much smarter and faster than the older one
|
|
67
|
+
if True:
|
|
68
|
+
row1 = Row(img1, img2, img3, img4, img5)
|
|
69
|
+
# row2 = Row(img6, img7, img8)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
col1 = Column(img6, img7, img8)
|
|
73
|
+
|
|
74
|
+
print(row1) # PyQt5.QtCore.QRectF(0.0, 0.0, 1269.6600575972946, 352.0)
|
|
75
|
+
for elm in row1:
|
|
76
|
+
print("inner size0", elm)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
if False:
|
|
80
|
+
# row1.sameHeight(3)
|
|
81
|
+
# print(row1)
|
|
82
|
+
sizes = []
|
|
83
|
+
for elm in row1:
|
|
84
|
+
sizes.append(elm.width())
|
|
85
|
+
# print("inner size", elm)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
# new way to compute size --> much smarter than previous way --> start replace everywhere
|
|
90
|
+
# sizes
|
|
91
|
+
scaling = get_common_scaling_factor(sizes, 512,3)
|
|
92
|
+
print('scaling, ',scaling)
|
|
93
|
+
# need set to scale
|
|
94
|
+
# need
|
|
95
|
+
|
|
96
|
+
for elm in row1:
|
|
97
|
+
# elm.setWidth(scaling*elm.width())
|
|
98
|
+
# elm.setHeight(scaling*elm.height())
|
|
99
|
+
elm.scale*=scaling
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
# pb there is a bug and the image and stuff don't match definitely my new code is better and smarter
|
|
104
|
+
# this does noyt work but why ????
|
|
105
|
+
# need pack them in x
|
|
106
|
+
packX(3,None, *row1.images)
|
|
107
|
+
row1.updateBoudingRect()
|
|
108
|
+
|
|
109
|
+
# why is the width an integer ??? --> do I do mistakes
|
|
110
|
+
# really need recode the changes in size because that is way smarter!!!
|
|
111
|
+
for elm in row1:
|
|
112
|
+
print("inner size2", elm)
|
|
113
|
+
|
|
114
|
+
print('--> row1',row1) # --> ça marche --> essayer donc de faire ça car tres smart et fast en fait
|
|
115
|
+
|
|
116
|
+
# preview(row1)
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
start_loop = timer()
|
|
120
|
+
|
|
121
|
+
print('end set to width', timer() - start_loop) # 0.006189999054186046
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
# row1|=col1
|
|
127
|
+
# row1|=col1 # --> still a row --> where is the bug then ???
|
|
128
|
+
col1/=row1 # --> still a row --> where is the bug then ???
|
|
129
|
+
row1 = col1
|
|
130
|
+
print(type(row1))
|
|
131
|
+
|
|
132
|
+
row1.setToWidth(512)
|
|
133
|
+
|
|
134
|
+
# for elm in row1:
|
|
135
|
+
# print("inner size", elm)
|
|
136
|
+
|
|
137
|
+
print(row1)
|
|
138
|
+
|
|
139
|
+
# preview(row1)
|