def createTable(self): # print('create table called', len(self)) if len(self) == 0: return if self.nRows == 0: self.nRows = 1 if self.nCols == 0: self.nCols = 1 print('nb images ' + str(len(self)) + ' nRows:' + str(self.nRows) + ' nCols:' + str(self.nCols)) if self.nCols * self.nRows < len(self): while self.nCols * self.nRows < len(self): self.nRows += 1 # for img in self: counter = 0 # maybe bug is just because of not properly handling set to with and set to height # why the hell do I have a figure in panel really need to recode that from deprecated_demos.ezfig_tests.col import col fig = col(space=self.space) self.rows=[] # TODO recode that and do not go through rows for that # if it is None for i in range(self.nRows): row = None last_size = None for j in range(self.nCols): if i * self.nCols + j < len(self): img = self.images[i * self.nCols + j] last_size = img.boundingRect() print('last_size', last_size) if row is None: row = Row(img) else: row += img else: # not enough images so adding empty images with same size as last one if last_size is not None: logger.debug('not enough images so adding empty images with same size as last entry') row += Image2D(width=last_size.width(), height=last_size.height()) if row is not None and not row.isEmpty(): row.packX(self.space) self.rows.append(row) fig += row if len(fig) == 0: logger.error('empty panel created there has to be an error somewhere') # not necessarily that by the way fig.packY(space=self.space) print('width here', self.width()) # on dirait que ça marche mais faudrait distinguer la width de la desired width... if self.width() != 0: fig.setToWidth(self.width()) # or settoheight by the way self.updateBoudingRect()
def __init__(self, parent=None, demo=False): QtWidgets.QWidget.__init__(self, parent) self.shapes_to_draw = [] self.lastPoint = None if demo: self.shapes_to_draw.append( Polygon2D(0, 0, 10, 0, 10, 20, 0, 20, 0, 0, color=0x00FF00)) self.shapes_to_draw.append( Polygon2D(100, 100, 110, 100, 110, 120, 10, 120, 100, 100, color=0x0000FF, fill_color=0x00FFFF, stroke=2)) self.shapes_to_draw.append( Line2D(0, 0, 110, 100, color=0xFF0000, stroke=3)) self.shapes_to_draw.append(Rect2D(200, 150, 250, 100, stroke=10)) self.shapes_to_draw.append(Ellipse2D(0, 50, 600, 200, stroke=3)) self.shapes_to_draw.append(Circle2D(150, 300, 30, color=0xFF0000)) self.shapes_to_draw.append( PolyLine2D(10, 10, 20, 10, 20, 30, 40, 30, color=0xFF0000, stroke=2)) self.shapes_to_draw.append( PolyLine2D(10, 10, 20, 10, 20, 30, 40, 30, color=0xFF0000, stroke=2)) self.shapes_to_draw.append( Point2D(128, 128, color=0xFF0000, stroke=6)) self.shapes_to_draw.append( Point2D(128, 128, color=0x00FF00, stroke=1)) self.shapes_to_draw.append( Point2D(10, 10, color=0x000000, stroke=6)) self.shapes_to_draw.append( Rect2D(0, 0, 512, 512, color=0xFF00FF, stroke=6)) img0 = Image2D( '/media/D/Sample_images/sample_images_PA/trash_test_mem/counter/00.png' ) # img0 = Image2D('D:/dataset1/unseen/100708_png06.png') # size is not always respected and that is gonna be a pb but probably size would be ok for journals as they would not want more than 14 pt size ???? # ci dessous la font size marche mais je comprend rien ... pkoi ça marche et l'autre marche pas les " et ' ou \' ont l'air clef... # in fact does not work font is super small # img0.setLetter(TAText2D(text='<font face="Comic Sans Ms" size=\'12\' color=yellow ><font size=`\'12\'>this is a <br>test</font></font>')) # img0.setLetter(TAText2D(text='<font face="Comic Sans Ms" color=yellow ><font size=12 >this is a <br>test</font></font>')) # img0.setLetter(TAText2D("<p style='font-size: large; font-color: yellow;'><b>Serial Number:</b></p> ")) # a l'air de marcher mais à tester # img0.setLetter(TAText2D('<html><body><p><font face="verdana" color="yellow" size="2000">font_face = "verdana"font_color = "green"font_size = 3</font></html>')) # try that https://www.learnpyqt.com/examples/megasolid-idiom-rich-text-editor/ # img0.setLetter(TAText2D(text='<html><font face="times" size=3 color=yellow>test</font></html>')) # img0.setLetter(TAText2D(text="<p style='font-size: 12pt; font-style: italic; font-weight: bold; color: yellow; text-align: center;'> <u>Don't miss it</u></p><p style='font-size: 12pt; font-style: italic; font-weight: bold; color: yellow; text-align: center;'> <u>Don't miss it</u></p>")) # this is really a one liner but a bit complex to do I find # chaque format different doit etre dans un span different --> facile # ça marche mais voir comment faire ça img0.setLetter( TAText2D( text= '<p style="text-align:left;color: yellow">This text is left aligned <span style="float:right;font-style: italic;font-size: 8pt;"> This text is right aligned </span><span style="float:right;font-size: 4pt;color:red"> This text is another text </span></p>' )) img1 = Image2D( '/media/D/Sample_images/sample_images_PA/trash_test_mem/counter/01.png' ) # img1 = Image2D('D:/dataset1/unseen/focused_Series012.png') # img1.setLetter(TAText2D(text="<font face='Comic Sans Ms' size=16 color='blue' >this is a <br>test</font>")) # ça ça marche vraiment en fait --> use css to write my text instead of that # ça ça a l'air de marcher --> pas trop mal en fait du coup # ça a l'air de marcher maintenant --> could use that and do a converter for ezfig ??? # img1.setLetter(TAText2D(text="<span style='font-size: 12pt; font-style: italic; font-weight: bold; color: yellow; paddind: 20px; text-align: center;'> <u>Don't miss it</u></span><span style='font-size: 4pt; font-style: italic; font-weight: bold; color: #00FF00; paddind: 3px; text-align: right;'> <u>test2</u></span>")) # TODO need remove <meta name="qrichtext" content="1" /> from the stuff otherwise alignment is not ok... TODO --> should I offer a change to that ??? maybe not test_text = ''' </style></head><body style=" font-family:'Comic Sans MS'; font-size:22pt; font-weight:400; font-style:normal;"> <p style="color:#00ff00;"><span style=" color:#ff0000;">toto</span><br />tu<span style=" vertical-align:super;">tu</span></p> ''' img1.setLetter(TAText2D(text=test_text)) # background-color: orange; # span div et p donnent la meme chose par contre c'est sur deux lignes # display:inline; float:left # to display as the same line .... --> does that work html to svg # https://stackoverflow.com/questions/10451445/two-div-blocks-on-same-line --> same line for two divs img2 = Image2D( '/media/D/Sample_images/sample_images_PA/trash_test_mem/counter/02.png' ) img3 = Image2D( '/media/D/Sample_images/sample_images_PA/trash_test_mem/counter/03.png' ) img4 = Image2D( '/media/D/Sample_images/sample_images_PA/trash_test_mem/counter/04.png' ) img5 = Image2D( '/media/D/Sample_images/sample_images_PA/trash_test_mem/counter/05.png' ) img6 = Image2D( '/media/D/Sample_images/sample_images_PA/trash_test_mem/counter/06.png' ) img7 = Image2D( '/media/D/Sample_images/sample_images_PA/trash_test_mem/counter/07.png' ) img8 = Image2D( '/media/D/Sample_images/sample_images_PA/trash_test_mem/counter/08.png' ) img9 = Image2D( '/media/D/Sample_images/sample_images_PA/trash_test_mem/counter/09.png' ) img10 = Image2D( '/media/D/Sample_images/sample_images_PA/trash_test_mem/counter/10.png' ) # img10 = Image2D('/media/D/Sample_images/sample_images_PA/trash_test_mem/counter/10.png') # img2 = Image2D('D:/dataset1/unseen/100708_png06.png') # img3 = Image2D('D:/dataset1/unseen/100708_png06.png') # img4 = Image2D('D:/dataset1/unseen/100708_png06.png') # img5 = Image2D('D:/dataset1/unseen/100708_png06.png') # img6 = Image2D('D:/dataset1/unseen/focused_Series012.png') # img7 = Image2D('D:/dataset1/unseen/100708_png06.png') # img8 = Image2D('D:/dataset1/unseen/100708_png06.png') # img9 = Image2D('D:/dataset1/unseen/100708_png06.png') # img10 = Image2D('D:/dataset1/unseen/focused_Series012.png') # is row really different from a panel ??? probably not that different # row = img1 + img2 # self.shapes_to_draw.append(row) # self.shapes_to_draw.append(row) # pkoi ça creerait pas plutot un panel # au lieu de creer une row faut creer des trucs # row2 = img4 + img5 # fig = row / row2 # fig = col(row, row2, width=512)# ça c'est ok # self.shapes_to_draw.append(fig) # TODO add image swapping and other changes and also implement sticky pos --> just need store initial pos # print(len(row)) # for img in row: # print(img.boundingRect()) # fig.setToWidth(512) # bug is really here I do miss something but what and why # print('rows', len(fig)) # for r in fig: # print('bounding rect', r.boundingRect()) # print('cols in row', len(r)) # self.shapes_to_draw.append(fig) # peut etre si rien n'est mis juste faire une row avec un panel row1 = Row(img0, img1, img2) # , img6, #, nCols=3, nRows=2 # marche pas en fait car un truc ne prend pas en charge les figs # ça marche donc en fait tt peut etre un panel en fait col1 = Column(img4, img5, img6) # , img6, img6, nCols=3, nRows=2, col2 = Column(img3, img7) # col1+=col2 col1 /= col2 # col1+=img3 # print('mega begin', panel2.nCols, panel2.nRows, panel2.orientation, len(panel2.images), type(panel2), panel2.boundingRect()) print('mega begin', len(col1.images), type(col1), col1.boundingRect()) row2 = Row(img8, img9) # row1+=row2 row1 /= row2 # row1+= img7 # all seems fine now # panel = Panel(img0)# , img1, img2, img3) # , img6, #, nCols=3, nRows=2 # # marche pas en fait car un truc ne prend pas en charge les figs # # # ça marche donc en fait tt peut etre un panel en fait # # panel2 = Panel(img4, img5) # , # panel2.setToWidth(256) # panel3.setToWidth(256) # panel.setToWidth(256) print(type(col1)) # tt marche # should I put align top left or right... col1.setToHeight(512) # panel3.setToWidth(512) row1.setToWidth(512) # can I add self to any of the stuff --> check --> if plus --> adds if divide --> stack it --> good idea and quite simple # fig = col(panel,panel2,panel3) # panel2+=panel # print(type(panel2)) # panel2.setToHeight(512) # panel2.setToWidth(512) # all seems fine now --> see how I can fix things # panel2+=panel3 # bug here cause does not resize the panel properly # print('mega final', panel2.nCols, panel2.nRows, panel2.orientation, len(panel2.images), type(panel2), panel2.boundingRect(), panel.boundingRect()) print('mega final', len(col1.images), type(col1), col1.boundingRect(), row1.boundingRect()) # on dirait que tt marche # maintenant ça marche mais reessayer qd meme # panel2.setToWidth(256) # seems still a very modest bug somewhere incompressible height and therefore ratio is complex to calculate for width with current stuff --> see how I can do --> should I ignore incompressible within stuff --> most likely yes... and should set its width and height irrespective of that # panel2.setToWidth(512) # seems still a very modest bug somewhere incompressible height and therefore ratio is complex to calculate for width with current stuff --> see how I can do --> should I ignore incompressible within stuff --> most likely yes... and should set its width and height irrespective of that # panel2.setToHeight(1024) #marche pas --> à fixer # panel2.setToHeight(128) # marche pas --> faut craiment le coder en fait --> voir comment je peux faire ça # marche pas non plus en fait --> bug qq part # panel2.setToHeight(82.65128578548527) # marche pas --> faut craiment le coder en fait --> voir comment je peux faire ça # panel += img7 # panel -= img0 # panel -= img1 # panel -= img10 # self.shapes_to_draw.append(panel) # panel2.set_P1(256, 300) # panel2.set_P1(512,0) # panel3.set_P1(1024, 0) # self.shapes_to_draw.append(panel2) self.shapes_to_draw.append(col1) self.shapes_to_draw.append(row1) # self.shapes_to_draw.append(fig) # panel2 | panel # panel2 | panel # for swapping panels # panel | panel2 # panel << img3 # ça ne marche pas pkoi # img3 >> panel # does not work --> need implement it in my image2D # panel >> img3 # cannot be dragged --> is it because self.is_set # row.packX() # row.packY() # ça marche mais finaliser le truc pr que ça soit encore plus simple à gerer # img.setP1(10,10) #translate it --> cool # self.shapes_to_draw.append(img1) # self.shapes_to_draw.append(img2) # self.shapes_to_draw.append(img3) self.shapes_to_draw.append(Square2D(300, 260, 250, stroke=3)) self.selected_shape = None
def __add__(self, other): from epyseg.figure.row import Row # KEEP Really required to avoid circular imports return Row(self, other)
def __truediv__(self, other): from epyseg.figure.row import Row return Row(self, other, space=self.space)
def __init__(self, parent=None, demo=False): QtWidgets.QWidget.__init__(self, parent) self.shapes_to_draw = [] self.lastPoint = None if demo: self.shapes_to_draw.append(Polygon2D(0, 0, 10, 0, 10, 20, 0, 20, 0, 0, color=0x00FF00)) self.shapes_to_draw.append( Polygon2D(100, 100, 110, 100, 110, 120, 10, 120, 100, 100, color=0x0000FF, fill_color=0x00FFFF, stroke=2)) self.shapes_to_draw.append(Line2D(0, 0, 110, 100, color=0xFF0000, stroke=3)) self.shapes_to_draw.append(Rect2D(200, 150, 250, 100, stroke=10, fill_color=0xFF0000)) self.shapes_to_draw.append(Ellipse2D(0, 50, 600, 200, stroke=3)) self.shapes_to_draw.append(Circle2D(150, 300, 30, color=0xFF0000, fill_color=0x00FFFF)) self.shapes_to_draw.append(PolyLine2D(10, 10, 20, 10, 20, 30, 40, 30, color=0xFF0000, stroke=2)) self.shapes_to_draw.append(PolyLine2D(10, 10, 20, 10, 20, 30, 40, 30, color=0xFF0000, stroke=2)) self.shapes_to_draw.append(Point2D(128, 128, color=0xFF0000, fill_color=0x00FFFF, stroke=0.65)) self.shapes_to_draw.append(Point2D(128, 128, color=0x00FF00, stroke=0.65)) self.shapes_to_draw.append(Point2D(10, 10, color=0x000000, fill_color=0x00FFFF, stroke=3)) self.shapes_to_draw.append(Rect2D(0, 0, 512, 512, color=0xFF00FF, stroke=6)) img0 = Image2D('/D/Sample_images/sample_images_PA/trash_test_mem/counter/00.png') inset = Image2D('/D/Sample_images/sample_images_PA/trash_test_mem/counter/01.png') inset2 = Image2D('/D/Sample_images/sample_images_PA/trash_test_mem/counter/01.png') inset3 = Image2D('/D/Sample_images/sample_images_PA/trash_test_mem/counter/01.png') # inset.setToHeight(32) # check inset scale_bar = ScaleBar(30, '<font color="#FF00FF">10µm</font>') scale_bar.set_P1(0,0) # scale_bar.set_scale(self.get_scale()) # # scale_bar.set_P1(self.get_P1().x()+extra_space, self.get_P1().y()+extra_space) img0.add_object(scale_bar, Image2D.TOP_LEFT) # scale_bar0 = ScaleBar(30, '<font color="#FF00FF">10µm</font>') # scale_bar0.set_P1(0, 0) # img0.add_object(scale_bar0, Image2D.TOP_LEFT) img0.add_object(inset3, Image2D.TOP_LEFT) # all seems fine and could even add insets to it --> not so hard I guess # check # see how to handle insets --> in a way they can be classical images and one should just determine what proportion of the parent image width they should occupy --> # need a boolean or need set fraction of orig --> jut one variable # maybe also need draw a square around it of a given size --> see how to do that ??? # img0.add_object(TAText2D(text='<font color="#FF0000">top right</font>'), Image2D.TOP_RIGHT) # img0.add_object(TAText2D(text='<font color="#FF0000">top right2</font>'), Image2D.TOP_RIGHT) # img0.add_object(TAText2D(text='<font color="#FF0000">top right3</font>'), Image2D.TOP_RIGHT) img0.add_object(inset, Image2D.BOTTOM_RIGHT) # ça marche meme avec des insets mais faudrait controler la taille des trucs... --> TODO # img0.add_object(inset2, Image2D.BOTTOM_RIGHT) # ça marche meme avec des insets mais faudrait controler la taille des trucs... --> TODO # img0.add_object(TAText2D(text='<font color="#FF0000">bottom right</font>'), Image2D.BOTTOM_RIGHT) # img0.add_object(TAText2D(text='<font color="#FF0000">bottom right2</font>'), Image2D.BOTTOM_RIGHT) img0.add_object(TAText2D(text='<font color="#FF0000">bottom right3</font>'), Image2D.BOTTOM_RIGHT) # ask whether a border should be drawn for the inset or not ??? and ask for its width... # ça a l'air de marcher mais voir comment faire pour gérer # img0.add_object(TAText2D(text='<font color="#FF0000">bottom left1</font>'), Image2D.BOTTOM_LEFT) # img0.add_object(TAText2D(text='<font color="#FF0000">bottom left2</font>'), Image2D.BOTTOM_LEFT) # img0.add_object(TAText2D(text='<font color="#FF0000">bottom left3</font>'), Image2D.BOTTOM_LEFT) # seems to work --> just finalize things up... # img0 = Image2D('D:/dataset1/unseen/100708_png06.png') # size is not always respected and that is gonna be a pb but probably size would be ok for journals as they would not want more than 14 pt size ???? # ci dessous la font size marche mais je comprend rien ... pkoi ça marche et l'autre marche pas les " et ' ou \' ont l'air clef... # in fact does not work font is super small # img0.setLetter(TAText2D(text='<font face="Comic Sans Ms" size=\'12\' color=yellow ><font size=`\'12\'>this is a <br>test</font></font>')) # img0.setLetter(TAText2D(text='<font face="Comic Sans Ms" color=yellow ><font size=12 >this is a <br>test</font></font>')) # img0.setLetter(TAText2D("<p style='font-size: large; font-color: yellow;'><b>Serial Number:</b></p> ")) # a l'air de marcher mais à tester # img0.setLetter(TAText2D('<html><body><p><font face="verdana" color="yellow" size="2000">font_face = "verdana"font_color = "green"font_size = 3</font></html>')) # try that https://www.learnpyqt.com/examples/megasolid-idiom-rich-text-editor/ # img0.setLetter(TAText2D(text='<html><font face="times" size=3 color=yellow>test</font></html>')) # img0.setLetter(TAText2D(text="<p style='font-size: 12pt; font-style: italic; font-weight: bold; color: yellow; text-align: center;'> <u>Don't miss it</u></p><p style='font-size: 12pt; font-style: italic; font-weight: bold; color: yellow; text-align: center;'> <u>Don't miss it</u></p>")) # this is really a one liner but a bit complex to do I find # chaque format different doit etre dans un span different --> facile # ça marche mais voir comment faire ça # img0.setLettering(TAText2D( # text='<p style="text-align:left;color: yellow">This text is left aligned <span style="float:right;font-style: italic;font-size: 8pt;"> This text is right aligned </span><span style="float:right;font-size: 4pt;color:red"> This text is another text </span></p>')) img0.setLettering('<font color="red">A</font>') # letter img0.annotation.append(Rect2D(88, 88, 200, 200, stroke=3, color=0xFF00FF)) img0.annotation.append(Ellipse2D(88, 88, 200, 200, stroke=3, color=0x00FF00)) img0.annotation.append(Circle2D(33,33, 200, stroke=3, color=0x0000FF)) img0.annotation.append(Line2D(33,33, 88,88, stroke=3, color=0x0000FF)) img0.annotation.append(Freehand2D(10, 10, 20, 10, 20, 30, 288, 30, color=0xFFFF00, stroke=3)) # img0.annotation.append(PolyLine2D(10, 10, 20, 10, 20, 30, 288, 30, color=0xFFFF00, stroke=3)) img0.annotation.append(Point2D(128, 128, color=0xFFFF00, stroke=6)) # everything seems to work but do check img1 = Image2D('/D/Sample_images/sample_images_PA/trash_test_mem/counter/01.png') # img1 = Image2D('D:/dataset1/unseen/focused_Series012.png') # img1.setLetter(TAText2D(text="<font face='Comic Sans Ms' size=16 color='blue' >this is a <br>test</font>")) # ça ça marche vraiment en fait --> use css to write my text instead of that # ça ça a l'air de marcher --> pas trop mal en fait du coup # ça a l'air de marcher maintenant --> could use that and do a converter for ezfig ??? # img1.setLetter(TAText2D(text="<span style='font-size: 12pt; font-style: italic; font-weight: bold; color: yellow; paddind: 20px; text-align: center;'> <u>Don't miss it</u></span><span style='font-size: 4pt; font-style: italic; font-weight: bold; color: #00FF00; paddind: 3px; text-align: right;'> <u>test2</u></span>")) # TODO need remove <meta name="qrichtext" content="1" /> from the stuff otherwise alignment is not ok... TODO --> should I offer a change to that ??? maybe not test_text = ''' </style></head><body style=" font-family:'Comic Sans MS'; font-size:22pt; font-weight:400; font-style:normal;"> <p style="color:#00ff00;"><span style=" color:#ff0000;">toto</span><br />tu<span style=" vertical-align:super;">tu</span></p> ''' img1.setLettering(TAText2D(text=test_text)) # background-color: orange; # span div et p donnent la meme chose par contre c'est sur deux lignes # display:inline; float:left # to display as the same line .... --> does that work html to svg # https://stackoverflow.com/questions/10451445/two-div-blocks-on-same-line --> same line for two divs img2 = Image2D('/D/Sample_images/sample_images_PA/trash_test_mem/counter/02.png') # crop is functional again but again a packing error img2.crop(left=60) img2.crop(right=30) img2.crop(bottom=90) img2.crop(top=60) # img2.crop(all=0) # reset crop # img2.crop(top=0) # reset crop --> seems ok # now seems ok --> see how to do that with figures/vector graphics ... # img2.crop(right=60) # img2.crop(bottom=60) img3 = Image2D('/D/Sample_images/sample_images_PA/trash_test_mem/counter/03.png') img4 = Image2D('/D/Sample_images/sample_images_PA/trash_test_mem/counter/04.png') img5 = Image2D('/D/Sample_images/sample_images_PA/trash_test_mem/counter/05.png') img6 = Image2D('/D/Sample_images/sample_images_PA/trash_test_mem/counter/06.png') img7 = Image2D('/D/Sample_images/sample_images_PA/trash_test_mem/counter/07.png') img8 = Image2D('/D/Sample_images/sample_images_PA/trash_test_mem/counter/08.png') # reference point is the original image and stroke should be constant irrespective of zoom --> most likely need the scaling factor too there # reference size is also the underlying original image --> TODO # img8.annotation.append(Line2D(0, 0, 110, 100, color=0xFF0000, stroke=3)) img8.annotation.append(Rect2D(60, 60, 100, 100, stroke=20, color=0xFF00FF)) # need make the scale rese # img8.annotation.append(Ellipse2D(0, 50, 600, 200, stroke=3)) img9 = Image2D('/D/Sample_images/sample_images_PA/trash_test_mem/counter/09.png') img10 = Image2D('/D/Sample_images/sample_images_PA/trash_test_mem/counter/10.png') # Data for plotting import numpy as np import matplotlib.pyplot as plt t = np.arange(0.0, 2.0, 0.01) s = 1 + np.sin(2 * np.pi * t) fig, ax = plt.subplots() ax.plot(t, s) ax.set(xlabel='time (s)', ylabel='voltage (mV)', title='About as simple as it gets, folks') ax.grid() # plt.show() # fig.savefig("test.png") # plt.show() # ça marche --> voici deux examples de shapes # first graph test --> TODO improve that graph2d = VectorGraphics2D(fig) graph2d.crop(all=20) # not great neither vectorGraphics = VectorGraphics2D('/D/Sample_images/sample_images_svg/cartman.svg') # nb cropping marche en raster mais pas en svg output --> besoin de faire un masque d'ecretage --> pourrait aussi dessiner un rectangle de la meme taille de facon à le faire # TODO KEEP unfortunately cropping does not work when saved as svg but works when saved as raster... vectorGraphics.crop(left=10, right=30, top=10, bottom=10) animatedVectorGraphics = VectorGraphics2D('/D/Sample_images/sample_images_svg/animated.svg') # bug cause shears the stuff --> would need crop the other dimension too to maintain AR animatedVectorGraphics.crop(left=30)#, top=20, bottom=20 # self.shapes_to_draw.append(graph2d) # img10 = Image2D('/D/Sample_images/sample_images_PA/trash_test_mem/counter/10.png') # img2 = Image2D('D:/dataset1/unseen/100708_png06.png') # img3 = Image2D('D:/dataset1/unseen/100708_png06.png') # img4 = Image2D('D:/dataset1/unseen/100708_png06.png') # img5 = Image2D('D:/dataset1/unseen/100708_png06.png') # img6 = Image2D('D:/dataset1/unseen/focused_Series012.png') # img7 = Image2D('D:/dataset1/unseen/100708_png06.png') # img8 = Image2D('D:/dataset1/unseen/100708_png06.png') # img9 = Image2D('D:/dataset1/unseen/100708_png06.png') # img10 = Image2D('D:/dataset1/unseen/focused_Series012.png') # is row really different from a panel ??? probably not that different # row = img1 + img2 # self.shapes_to_draw.append(row) # self.shapes_to_draw.append(row) # pkoi ça creerait pas plutot un panel # au lieu de creer une row faut creer des trucs # row2 = img4 + img5 # fig = row / row2 # fig = col(row, row2, width=512)# ça c'est ok # self.shapes_to_draw.append(fig) # TODO add image swapping and other changes and also implement sticky pos --> just need store initial pos # print(len(row)) # for img in row: # print(img.boundingRect()) # fig.setToWidth(512) # bug is really here I do miss something but what and why # print('rows', len(fig)) # for r in fig: # print('bounding rect', r.boundingRect()) # print('cols in row', len(r)) # self.shapes_to_draw.append(fig) # peut etre si rien n'est mis juste faire une row avec un panel row1 = Row(img0, img1, img2, graph2d, animatedVectorGraphics) #, graph2d, animatedVectorGraphics # , img6, #, nCols=3, nRows=2 #le animated marche mais faut dragger le bord de l'image mais pas mal qd meme # see how I should handle size of graphs but I'm almost there # marche pas en fait car un truc ne prend pas en charge les figs # ça marche donc en fait tt peut etre un panel en fait col1 = Column(img4, img5, img6, vectorGraphics) # , vectorGraphics# , img6, img6, nCols=3, nRows=2, col2 = Column(img3, img7, img10) # # col1.setLettering('<font color="#FFFFFF">A</font>') # col1+=col2 col1 /= col2 # col1+=img3 # print('mega begin', panel2.nCols, panel2.nRows, panel2.orientation, len(panel2.images), type(panel2), panel2.boundingRect()) # print('mega begin', len(col1.images), type(col1), col1.boundingRect()) # ok need increment and need see how to change the font of the stuff and bg color and fg color --> TODO but ok for now row2 = Row(img8, img9) row2.setLettering('<font color="#FFFFFF">a</font>') # row1+=row2 row1 /= row2 # row1+= img7 # all seems fine now # panel = Panel(img0)# , img1, img2, img3) # , img6, #, nCols=3, nRows=2 # # marche pas en fait car un truc ne prend pas en charge les figs # # # ça marche donc en fait tt peut etre un panel en fait # # panel2 = Panel(img4, img5) # , # panel2.setToWidth(256) # panel3.setToWidth(256) # panel.setToWidth(256) # print(type(col1)) # tt marche # should I put align top left or right... # should I put align top left or right... col1.setToHeight(512) # creates big bugs now # panel3.setToWidth(512) row1.setToWidth(512) # row1.setLettering('<font color="#FF00FF">B</font>') # row1.setLettering(' ') # remove letters # row1.setToWidth(1024) # ça a l'air de marcher... # it now seems ok # from epyseg.figure.alignment import alignRight, alignLeft, alignTop, alignBottom, alignCenterH, alignCenterV # alignLeft(row1, col1) # alignRight(row1, col1) # alignTop(row1, col1) # alignBottom(row1, col1) # alignCenterH(row1, col1) # alignCenterV(row1, col1) # can I add self to any of the stuff --> check --> if plus --> adds if divide --> stack it --> good idea and quite simple # fig = col(panel,panel2,panel3) # panel2+=panel # print(type(panel2)) # panel2.setToHeight(512) # panel2.setToWidth(512) # all seems fine now --> see how I can fix things # panel2+=panel3 # bug here cause does not resize the panel properly # print('mega final', panel2.nCols, panel2.nRows, panel2.orientation, len(panel2.images), type(panel2), panel2.boundingRect(), panel.boundingRect()) # print('mega final', len(col1.images), type(col1), col1.boundingRect(), row1.boundingRect()) # on dirait que tt marche # maintenant ça marche mais reessayer qd meme # panel2.setToWidth(256) # seems still a very modest bug somewhere incompressible height and therefore ratio is complex to calculate for width with current stuff --> see how I can do --> should I ignore incompressible within stuff --> most likely yes... and should set its width and height irrespective of that # panel2.setToWidth(512) # seems still a very modest bug somewhere incompressible height and therefore ratio is complex to calculate for width with current stuff --> see how I can do --> should I ignore incompressible within stuff --> most likely yes... and should set its width and height irrespective of that # panel2.setToHeight(1024) #marche pas --> à fixer # panel2.setToHeight(128) # marche pas --> faut craiment le coder en fait --> voir comment je peux faire ça # marche pas non plus en fait --> bug qq part # panel2.setToHeight(82.65128578548527) # marche pas --> faut craiment le coder en fait --> voir comment je peux faire ça # panel += img7 # panel -= img0 # panel -= img1 # panel -= img10 # self.shapes_to_draw.append(panel) # panel2.set_P1(256, 300) # panel2.set_P1(512,0) # panel3.set_P1(1024, 0) # self.shapes_to_draw.append(panel2) self.shapes_to_draw.append(col1) self.shapes_to_draw.append(row1) # big bug marche pas # packX(3, None, *[img0, img1, img2]) # ça marche presque de nouveau # print(img0.boundingRect(), img1.boundingRect(), img2.boundingRect()) # # self.shapes_to_draw.append(img0) # self.shapes_to_draw.append(img1) # self.shapes_to_draw.append(img2) img4.setLettering('<font color="#0000FF">Z</font>') # ça marche mais voir comment faire en fait # self.shapes_to_draw.append(fig) # panel2 | panel # panel2 | panel # for swapping panels # panel | panel2 # panel << img3 # ça ne marche pas pkoi # img3 >> panel # does not work --> need implement it in my image2D # panel >> img3 # cannot be dragged --> is it because self.is_set # row.packX() # row.packY() # ça marche mais finaliser le truc pr que ça soit encore plus simple à gerer # img.setP1(10,10) #translate it --> cool # self.shapes_to_draw.append(img1) # self.shapes_to_draw.append(img2) # self.shapes_to_draw.append(img3) self.shapes_to_draw.append(Square2D(300, 260, 250, stroke=3)) self.selected_shape = None