[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - librelogo/source
librelogo/source/LibreLogo/LibreLogo.py |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit eae6ac5550d28379a5523af022da7f1f936d Author: László Németh nem...@numbertext.org Date: Mon Oct 28 14:03:46 2013 +0100 fdo#70951 librelogo: fix parsing problem of functions (almost cherry picked from commit 850871e04e247262242836180d8a5cf59b2f95ef) Change-Id: I6cbe99d405cf45c0d7b04f0ad76a555096024f65 Reviewed-on: https://gerrit.libreoffice.org/6462 Reviewed-by: Caolán McNamara caol...@redhat.com Tested-by: Caolán McNamara caol...@redhat.com diff --git a/librelogo/source/LibreLogo/LibreLogo.py b/librelogo/source/LibreLogo/LibreLogo.py index bfe5686..1367f3b 100644 --- a/librelogo/source/LibreLogo/LibreLogo.py +++ b/librelogo/source/LibreLogo/LibreLogo.py @@ -1509,7 +1509,7 @@ def __compil__(s): (?:[^\n]*(?!\b(%(END)s))\n)* # 0 or more lines (not END) [^\n]*\b(?:%(OUTPUT)s)\b[^\n]*\n # line with OUTPUT (functions = procedures with OUTPUT) (?:[^\n]*(?!\b(?:%(END)s))\n)* # 0 or more lines (not END) -(?:%(END)s)\b % __l12n__(_.lng), s, re.X) ] # final END (XXX multiple names of END doesn't supported) +[ \t]*\b(?:%(END)s)\b % __l12n__(_.lng), s, re.X) ] # final END (XXX multiple names of END doesn't supported) # add line breaks before procedure calls procedures = set(subnames) - set(functions) if len(procedures) 0: ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - librelogo/source
librelogo/source/LibreLogo/LibreLogo.py | 36 ++-- 1 file changed, 30 insertions(+), 6 deletions(-) New commits: commit 1d0c9f7d6bca4aedfc791681efdcf60c97654204 Author: László Németh nem...@numbertext.org Date: Fri Oct 25 11:46:45 2013 +0200 fdo#70858 librelogo: fix Logo program halt at font settings (Windows) Change-Id: I3c51ba693caa80c8b530a9eee932a48a125e2eca (cherry picked from commit 317d255aa7f1497cdfb929b884066202f721672c) Reviewed-on: https://gerrit.libreoffice.org/6431 Reviewed-by: Caolán McNamara caol...@redhat.com Tested-by: Caolán McNamara caol...@redhat.com diff --git a/librelogo/source/LibreLogo/LibreLogo.py b/librelogo/source/LibreLogo/LibreLogo.py index 1367f3b..c0c6447 100644 --- a/librelogo/source/LibreLogo/LibreLogo.py +++ b/librelogo/source/LibreLogo/LibreLogo.py @@ -1313,6 +1313,30 @@ def __float__(x): # handle eg. float(10,5cm) x = eval(x) return float(x) +def fontheight(n = -1): +if n != -1: +_.fontheight = n +else: +return _.fontheight + +def fontweight(n = -1): +if n != -1: +_.fontweight = n +else: +return _.fontweight + +def fontfamily(s = -1): +if s != -1: +_.fontfamily = s +else: +return _.fontfamily + +def fontstyle(n = -1): +if n != -1: +_.fontstyle = n +else: +return _.fontstyle + def __loadlang__(lang, a): global comp, __colors__ __colors__[lang] = {} @@ -1383,13 +1407,13 @@ def __loadlang__(lang, a): [r(?!:)\b(?:%s)(\s+|$) % a['FILLCOLOR'], \n)fillcolor(], [r(?!:)\b(?:%s)(\s+|$) % a['FILLSTYLE'], \n)fillstyle(], [r(?!:)\b(?:%s)(\s+|$) % a['FONTCOLOR'], \n)fontcolor(], -[r(?!:)\b(?:%s)(\s+|$) % a['FONTFAMILY'], \nglobal _\n_.fontfamily=], -[r(?!:)\b(?:%s)(\s+|$) % a['FONTHEIGHT'], \nglobal _\n_.fontheight=], -[r(?!:)\b(?:%s)(\s+|$) % a['FONTWEIGHT'], \nglobal _\n_.fontweight=], -[r(?!:)\b(?:%s)(\s+|$) % a['FONTSTYLE'], \nglobal _\n_.fontstyle=], +[r(?!:)\b(?:%s)(\s+|$) % a['FONTFAMILY'], \n)fontfamily(], +[r(?!:)\b(?:%s)(\s+|$) % a['FONTHEIGHT'], \n)fontheight(], +[r(?!:)\b(?:%s)(\s+|$) % a['FONTWEIGHT'], \n)fontweight(], +[r(?!:)\b(?:%s)(\s+|$) % a['FONTSTYLE'], \n)fontstyle(], [r(?!:)\b(?:%s)(\s+|$) % a['PENWIDTH'], \n)pensize(], -[r(?!:)\b(?:%s)\b % a['PENDOWN'], \nglobal _\n__pen__(1)], -[r(?!:)\b(?:%s)\b % a['PENUP'], \nglobal _\n__pen__(0)], +[r(?!:)\b(?:%s)\b % a['PENDOWN'], \n__pen__(1)], +[r(?!:)\b(?:%s)\b % a['PENUP'], \n__pen__(0)], [r(?!:)\b(?:%s)\b % a['HIDETURTLE'], \nhideturtle()], [r(?!:)\b(?:%s)\b % a['SHOWTURTLE'], \nshowturtle()], [r(?!:)\b(?:%s)\b\[ % a['POSITION'], position()[], ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - librelogo/source
librelogo/source/LibreLogo/LibreLogo.py | 17 - 1 file changed, 12 insertions(+), 5 deletions(-) New commits: commit c24493db0d4b4d2685ef5b8fcca51f163531394d Author: László Németh nem...@numbertext.org Date: Thu Oct 24 16:11:33 2013 +0200 librelogo: fix Writer/Draw synchronization in cropped SVG export Change-Id: Id7dc7a2853a8c56ee56eab55c078650e16c278fd (cherry picked from commit d0af3045c3ff850387385599fdcef7f9ecf407cb) Reviewed-on: https://gerrit.libreoffice.org/6420 Reviewed-by: Caolán McNamara caol...@redhat.com Tested-by: Caolán McNamara caol...@redhat.com diff --git a/librelogo/source/LibreLogo/LibreLogo.py b/librelogo/source/LibreLogo/LibreLogo.py index c0c6447..913ae6b 100644 --- a/librelogo/source/LibreLogo/LibreLogo.py +++ b/librelogo/source/LibreLogo/LibreLogo.py @@ -1255,7 +1255,7 @@ def create_valid_svg_file(filename): f.write(s) def __groupend__(name = ): -global __group__, __grouplefthang__, __groupstack__ +global __group__, __grouplefthang__, __groupstack__, __halt__ g = 0 if __group__.getCount() 1: if __grouplefthang__ 0: @@ -1283,19 +1283,26 @@ def __groupend__(name = ): d = ctx.ServiceManager.createInstanceWithContext(com.sun.star.frame.Desktop, ctx) draw = d.loadComponentFromURL(private:factory/sdraw, _blank, 0, ()) drawpage = draw.getDrawPages().getByIndex(0) + while XSCRIPTCONTEXT.getDocument() != draw: +if XSCRIPTCONTEXT.getDocument() not in [draw, _.doc, None]: + __halt__ = True + return +__time__.sleep(0.1) __dispatcher__(.uno:Paste, (), draw) __dispatcher__(.uno:FormatGroup, (), draw) pic = drawpage.getByIndex(0) pic.setPosition(__Point__((g.BoundRect.Width - g.Size.Width)//2, (g.BoundRect.Height - g.Size.Height)//2)) drawpage.Height, drawpage.Width = g.BoundRect.Height, g.BoundRect.Width - __time__.sleep(1) # avoid writing problem if not os.path.isabs(name): name = os.path.expanduser('~') + os.path.sep + name __dispatcher__(.uno:ExportTo, (__getprop__(URL, unohelper.systemPathToFileUrl(name)), __getprop__(FilterName, draw_svg_Export)), draw) - __time__.sleep(1) - create_valid_svg_file(name) draw.close(True) - + while XSCRIPTCONTEXT.getDocument() != _.doc: +if XSCRIPTCONTEXT.getDocument() not in [draw, _.doc, None]: + __halt__ = True + return +__time__.sleep(0.1) + create_valid_svg_file(name) __group__ = __groupstack__.pop() if __group__ and g: __group__.add(g) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - librelogo/source
librelogo/source/LibreLogo/LibreLogo.py |8 1 file changed, 4 insertions(+), 4 deletions(-) New commits: commit 223e1295b8f553228951d5165d8c3ee052c45944 Author: László Németh nem...@numbertext.org Date: Fri Oct 25 08:30:30 2013 +0200 librelogo: fix division with measurements Change-Id: I2204002533bbb3e7c801b3228b0310a42b19a882 (cherry picked from commit 7744c4a0016be338c6c14b14f620d8af7d76111e) diff --git a/librelogo/source/LibreLogo/LibreLogo.py b/librelogo/source/LibreLogo/LibreLogo.py index 216bb0f..bfe5686 100644 --- a/librelogo/source/LibreLogo/LibreLogo.py +++ b/librelogo/source/LibreLogo/LibreLogo.py @@ -1352,7 +1352,7 @@ def __loadlang__(lang, a): [r(?=\n)__repeat__([^\n]*\w[^\n]*):(?=\n), for %s in range(1, 1+int(\\1)): % repcount], # repeat block [r(?=\d)[%s](?=\d) % a['DECIMAL'], .], # decimal sign [r(?!/)/(?!/), *1.0/], # fix division: /1 - /1.0, but not with // -[r\b([0-9]+([,.][0-9]+)?)(%s)\b % a['HOUR'], \\1*30], # 12h = 12*30° +[r\b([0-9]+([,.][0-9]+)?)(%s)\b % a['HOUR'], lambda r: str(float(r.group(1).replace(,, .))*30)], # 12h = 12*30° [r(?=\d)(%s) % a['DEG'], ], # 1° - 1 [r(?!:)\b(?:__def__)[ \t]+(\w+)\b[ \t]*([:]?\w[^\n]*), \ndef \\1(\\2):\n[], [r(?!:)\b(?:__def__)\s+(\w+), \ndef \\1():\n[], @@ -1424,9 +1424,9 @@ def __loadlang__(lang, a): [r(?!:)\b(?:%s)\b % a['PRINT'], \n)Print(], [r(?!:)\b(?:%s)\b % a['TURNLEFT'], \n)turnleft(], [r\b([0-9]+([,.][0-9]+)?)(%s)\b % a['PT'], \\1], -[r\b([0-9]+([,.][0-9]+)?)(%s)(?!\w) % a['INCH'], \\1*72], -[r\b([0-9]+([,.][0-9]+)?)(%s)\b % a['MM'], \\1*%s % __MM_TO_PT__], -[r\b([0-9]+([,.][0-9]+)?)(%s)\b % a['CM'], \\1*%s*10 % __MM_TO_PT__], +[r\b([0-9]+([,.][0-9]+)?)(%s)(?!\w) % a['INCH'], lambda r: str(float(r.group(1).replace(,, .))*72)], +[r\b([0-9]+([,.][0-9]+)?)(%s)\b % a['MM'], lambda r: str(float(r.group(1).replace(,, .))*__MM_TO_PT__)], +[r\b([0-9]+([,.][0-9]+)?)(%s)\b % a['CM'], lambda r: str(float(r.group(1).replace(,, .))*__MM_TO_PT__*10)], [r\b(__(?:int|float|string)__len|round|abs|sin|cos|sqrt|set|list|tuple|sorted)\b ((?:\w|\d+([,.]\d+)?|0[xX][0-9a-fA-F]+|[-+*/]| )+)\) , \\1(\\2)) ], # fix parsing: (1 + sqrt x) - (1 + sqrt(x)) [r(?=[-*/=+,]) ?\n\)(\w+)\(, \\1()], # read attributes, eg. x = fillcolor [r(?=return) ?\n\)(\w+)\(, \\1()], # return + user function ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - librelogo/source
librelogo/source/LibreLogo/LibreLogo.py |1 + 1 file changed, 1 insertion(+) New commits: commit 5a51dde06cd7840132b26626312beb8c2cbc31b8 Author: László Németh nem...@numbertext.org Date: Thu Oct 24 08:46:46 2013 +0200 librelogo: fix blinking LABEL Change-Id: I807dda255b741996480116fab22377b39bf963b4 (cherry picked from commit 022c955f138e350d9a431489380c054d9766a4d0) Reviewed-on: https://gerrit.libreoffice.org/6413 Reviewed-by: Miklos Vajna vmik...@collabora.co.uk Tested-by: Miklos Vajna vmik...@collabora.co.uk diff --git a/librelogo/source/LibreLogo/LibreLogo.py b/librelogo/source/LibreLogo/LibreLogo.py index 84be810..216bb0f 100644 --- a/librelogo/source/LibreLogo/LibreLogo.py +++ b/librelogo/source/LibreLogo/LibreLogo.py @@ -1027,6 +1027,7 @@ def label(st): # get text size shape = _.doc.createInstance( com.sun.star.drawing.TextShape) shape.TextAutoGrowWidth = True +shape.Visible = False actual = __getshape__(__ACTUAL__) _.drawpage.add(shape) text(shape, st[2]) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - librelogo/source
librelogo/source/LibreLogo/LibreLogo.py |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit d6ee64b75581cbeb92534271ee6f4e87f07aa5cd Author: László Németh nem...@numbertext.org Date: Tue Oct 22 17:34:23 2013 +0200 librelogo: fix black (not refreshed) invisible filling color Change-Id: Iabfd91f7c72f3dc30f9f1cebe3dfb45a7d1f6763 Reviewed-on: https://gerrit.libreoffice.org/6381 Reviewed-by: Miklos Vajna vmik...@collabora.co.uk Tested-by: Miklos Vajna vmik...@collabora.co.uk diff --git a/librelogo/source/LibreLogo/LibreLogo.py b/librelogo/source/LibreLogo/LibreLogo.py index f0b78bf..84be810 100644 --- a/librelogo/source/LibreLogo/LibreLogo.py +++ b/librelogo/source/LibreLogo/LibreLogo.py @@ -48,7 +48,7 @@ __COLORS__ = ['BLACK', 0x00], ['SILVER', 0xc0c0c0], ['GRAY', 0x808080], \ ['AQUA', 0x00], ['PINK', 0xffc0cb], ['TOMATO', 0xff6347], \ ['ORANGE', 0xffa500], ['GOLD', 0xffd700], ['VIOLET', 0x9400d3], \ ['SKYBLUE', 0x87ceeb], ['CHOCOLATE', 0xd2691e], ['BROWN', 0xa52a2a], \ -['INVISIBLE', 0xff00] +['INVISIBLE', 0x] __STRCONST__ = [i[0] for i in __COLORS__] + ['NONE', 'BEVEL', 'MITER', 'ROUNDED', 'SOLID', 'DASH', 'DOTTED', 'BOLD', 'ITALIC', 'UPRIGHT', 'NORMAL', HOUR, PT, INCH, MM, CM] __SLEEP_SLICE_IN_MILLISECONDS__ = 500 __PT_TO_TWIP__ = 20 ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - librelogo/source
librelogo/source/LibreLogo/LibreLogo.py |7 --- 1 file changed, 4 insertions(+), 3 deletions(-) New commits: commit cd53ac3dbf66b75ea9685121fcf6c5bb6c84feef Author: László Németh nem...@numbertext.org Date: Fri Sep 6 17:30:25 2013 +0200 fdo#69041 LibreLogo: fix SVG/SMIL timing with filled polylines Change-Id: Icebd47d57a830986c371a62ec7dab81ca8fd930a Reviewed-on: https://gerrit.libreoffice.org/5845 Reviewed-by: Miklos Vajna vmik...@collabora.co.uk Tested-by: Miklos Vajna vmik...@collabora.co.uk diff --git a/librelogo/source/LibreLogo/LibreLogo.py b/librelogo/source/LibreLogo/LibreLogo.py index 84e7a2b..f0b78bf 100644 --- a/librelogo/source/LibreLogo/LibreLogo.py +++ b/librelogo/source/LibreLogo/LibreLogo.py @@ -784,7 +784,7 @@ def __dots__(n, pos, dx, dy, r = -1, q = 0): # dots for dotted polyline or circl dots += [(__Point__(px, py), __Point__(px + 7, py + 7))] return dots -def __draw__(d): +def __draw__(d, count = True): shape = _.doc.createInstance( com.sun.star.drawing. + d) shape.AnchorType = __AT_PAGE__ shape.TextWrap = __THROUGHT__ @@ -796,7 +796,8 @@ def __draw__(d): _.drawpage.add(shape) if __group__: __group__.add(shape) -_.shapecache[next(_.shapecount)] = str(_.time) +if count: +_.shapecache[next(_.shapecount)] = str(_.time) return shape def __zoom__(): @@ -892,7 +893,7 @@ def __fillit__(filled = True): __removeshape__(__ACTUAL__) # FIXME close dotted polyline return if oldshape and LineShape in oldshape.ShapeType: -shape = __draw__(PolyPolygonShape) +shape = __draw__(PolyPolygonShape, False) shape.PolyPolygon = oldshape.PolyPolygon shape.setPosition(oldshape.getPosition()) shape.LineStyle, shape.LineDash = __linestyle__(_.linestyle) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - librelogo/source
librelogo/source/ChangeLog | 15 ++ librelogo/source/LibreLogo/LibreLogo.py | 69 +--- 2 files changed, 69 insertions(+), 15 deletions(-) New commits: commit 1a03ecaf22843345849db7ba3e25ac9cbdd10dbf Author: László Németh nem...@numbertext.org Date: Thu Aug 29 18:36:16 2013 +0200 LibreLogo fixes (eg. fdo#68713 fix SVG cropping), see ChangeLog Conflicts: helpcontent2 Change-Id: Ibb1cb41f526b4117e2d7ef39a2101286511bf48f Reviewed-on: https://gerrit.libreoffice.org/5687 Reviewed-by: Fridrich Strba fridr...@documentfoundation.org Tested-by: Fridrich Strba fridr...@documentfoundation.org diff --git a/librelogo/source/ChangeLog b/librelogo/source/ChangeLog index e056c19..6391760 100644 --- a/librelogo/source/ChangeLog +++ b/librelogo/source/ChangeLog @@ -1,3 +1,18 @@ +2013-08-29 László Németh: +* fix bad selection of invisible turtle after HIDETURTLE CLEARSCREEN +* fix SVG cropping in LibreOffice 4.1 +* fix vertical positions of labels in SVG export using RectangleShape +* fix double stroke-width attributes in SVG export +* LABEL supports relative positioning vector [X, Y, 'text'], where X, Y + 0: center, eg. as the default positioning: LABEL [0, 0, 'text'] + 1: left or bottom aligned to the turtle position and angle + -1: right or top aligned to the turtle position and angle + n: n * text_width/2 or text_height/2 +* simple SVG SMIL (animation) support using SLEEP, for example: + PICTURE 'animation.svg' [ CIRCLE 5 SLEEP 1000 CIRCLE 20 ] +* relative FORWARD (heading = y axis) with vector arg.: FORWARD [20, 10] +* rounded linejoint of turtle shape + 2013-07-15 László Németh: * optional named PICTURE blocks: PICTURE name [ CIRCLE 5 ] * save PICTURE as cropped SVG file using path names, for example: diff --git a/librelogo/source/LibreLogo/LibreLogo.py b/librelogo/source/LibreLogo/LibreLogo.py index b4e5936..84e7a2b 100644 --- a/librelogo/source/LibreLogo/LibreLogo.py +++ b/librelogo/source/LibreLogo/LibreLogo.py @@ -72,6 +72,8 @@ class __Doc__: except: self.drawpage = doc.DrawPages.getByIndex(0) # Draw, Impress self.shapecache = {} +self.shapecount = itertools.count() +self.time = 0 self.zoomvalue = 0 self.initialize() @@ -461,7 +463,7 @@ def __initialize__(): _.pencolor = shape.LineColor + (int(255.0 * shape.LineTransparence/100) 24) if shape.LineWidth != round((1 + _.pen * 2) * __PT_TO_TWIP__ / __MM10_TO_TWIP__) and shape.LineWidth != round(__LINEWIDTH__ / __MM10_TO_TWIP__): _.pensize = shape.LineWidth * __MM10_TO_TWIP__ -shape.LineJoint = __MITER__ +shape.LineJoint = __ROUNDED__ shape.Shadow = True shape.FillColor, transparence = __splitcolor__(_.areacolor) shape.FillTransparence = min(95, transparence) @@ -684,12 +686,14 @@ def __checkhalt__(): def __cs__(select = True): turtle = __getshape__(__TURTLE__) -if turtle: +visible = False +if turtle and turtle.Visible: __visible__(turtle, False) +visible = True if _.doc.CurrentController.select(_.drawpage) and \ _.doc.CurrentController.getSelection().ImplementationName == com.sun.star.drawing.SvxShapeCollection: __dispatcher__(.uno:Delete) -if turtle: +if turtle and visible: __visible__(turtle, True) if select: _.doc.CurrentController.select(_.drawpage) @@ -752,7 +756,10 @@ def rotate(shapename, deg): def forward(n): if type(n) == list: pos = position() -position([pos[0] + n[0], pos[1] + n[1]]) +angle = heading() +dx = n[1] * sin((pi/180) * angle) + n[0] * sin((pi/180)*(angle + 90)) +dy = n[1] * cos((pi/180) * angle) + n[0] * cos((pi/180)*(angle + 90)) +position([pos[0] + dx, pos[1] - dy]) else: __go__(__TURTLE__, -n * __PT_TO_TWIP__) @@ -789,6 +796,7 @@ def __draw__(d): _.drawpage.add(shape) if __group__: __group__.add(shape) +_.shapecache[next(_.shapecount)] = str(_.time) return shape def __zoom__(): @@ -1013,18 +1021,31 @@ def rectangle(l): __boxshape__(Rectangle, l) def label(st): -turtle = __getshape__(__TURTLE__) -shape = __draw__(TextShape) -shape.RotateAngle = turtle.RotateAngle -pos = turtle.getPosition() -pos.X = pos.X + turtle.BoundRect.Width / 2.0 -pos.Y = pos.Y + turtle.BoundRect.Height / 2.0 -shape.setSize(__Size__(1, 1)) +if type(st) != type([]): +st = [0, 0, st] +# get text size +shape = _.doc.createInstance( com.sun.star.drawing.TextShape) shape.TextAutoGrowWidth = True -text(shape, st) -shape.setPosition(__Point__(pos.X - shape.BoundRect.Width/2, pos.Y - shape.BoundRect.Height/2)) -__visible__(shape, True) -__lefthang__(shape) +actual = __getshape__(__ACTUAL__)
[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - librelogo/source
librelogo/source/LibreLogo/LibreLogo.py | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) New commits: commit 703b0fc230ca1fe271f6eca981ce3121ede5bf7d Author: László Németh nem...@numbertext.org Date: Thu Jul 18 14:51:17 2013 +0200 librelogo: fix LibO SVG export for W3C Validator/Wikipedia Change-Id: I19b01b08ab08540cc8e9f7255d13663ba7ce1d02 Reviewed-on: https://gerrit.libreoffice.org/4969 Reviewed-by: Andras Timar ati...@suse.com Tested-by: Andras Timar ati...@suse.com diff --git a/librelogo/source/LibreLogo/LibreLogo.py b/librelogo/source/LibreLogo/LibreLogo.py index 49983d3..b4e5936 100644 --- a/librelogo/source/LibreLogo/LibreLogo.py +++ b/librelogo/source/LibreLogo/LibreLogo.py @@ -1205,6 +1205,15 @@ def __groupstart__(name = ): __group__ = uno.getComponentContext().ServiceManager.createInstance('com.sun.star.drawing.ShapeCollection') __grouplefthang__ = 0 +def create_valid_svg_file(filename): +with open(filename, r) as f: +s = f.read() +s = re.sub('(?s)(g\\sid=[^]*)\(([^]*)\)', '\\1\\2', s) # bad (, ) in xml:id +s = re.sub('(?s)g\\sooo:[^]*', '', s) # remove non standard attributes +s = re.sub('(?s)svg\\s+version=1.2', 'svg version=1.1', s) # for W3C Validator +with open(filename, 'w') as f: +f.write(s) + def __groupend__(name = ): global __group__, __grouplefthang__, __groupstack__ g = 0 @@ -1243,7 +1252,8 @@ def __groupend__(name = ): name = os.path.expanduser('~') + os.path.sep + name __dispatcher__(.uno:ExportTo, (__getprop__(URL, unohelper.systemPathToFileUrl(name)), __getprop__(FilterName, draw_svg_Export)), draw) __time__.sleep(1) - draw.dispose() + create_valid_svg_file(name) + draw.close(True) __group__ = __groupstack__.pop() if __group__ and g: ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - librelogo/source
librelogo/source/ChangeLog | 16 +++- librelogo/source/LibreLogo/LibreLogo.py | 42 +--- 2 files changed, 49 insertions(+), 9 deletions(-) New commits: commit 8a8f7fb852c7ce2713b107d8d9a33450199ae86b Author: László Németh nem...@numbertext.org Date: Mon Jul 15 12:41:37 2013 +0200 librelogo: hexa arguments fdo#66917 and cropped SVG saving Change-Id: I12ad6b63221bce0ed7d988f5c0f91dce81055ec0 Reviewed-on: https://gerrit.libreoffice.org/4916 Reviewed-by: Németh László nem...@numbertext.org Tested-by: Németh László nem...@numbertext.org diff --git a/librelogo/source/ChangeLog b/librelogo/source/ChangeLog index 0a04813..e056c19 100644 --- a/librelogo/source/ChangeLog +++ b/librelogo/source/ChangeLog @@ -1,4 +1,18 @@ -2012-02-24 László Németh: +2013-07-15 László Németh: +* optional named PICTURE blocks: PICTURE name [ CIRCLE 5 ] +* save PICTURE as cropped SVG file using path names, for example: + PICTURE example.svg [ CIRCLE 5 CIRCLE 20 ] ; save in the home directory + PICTURE /home/user/example.svg [ CIRCLE 10 ] ; absolute path (on Linux) + PICTURE tmp/example.svg [ CIRCLE 10 ] ; relative to the home directory +* support hexadecimal arguments + +2013-06-26 László Németh +* clockwise HEADING + +2013-04-30 László Németh +* fix hide/show turtle + +2013-02-24 László Németh: * fix Asian and CTL language support. Language recognition depends from the UI language of LibreOffice and the language(s) of the document. * fix turtle shape, the problem with the old arrow-like turtle shape diff --git a/librelogo/source/LibreLogo/LibreLogo.py b/librelogo/source/LibreLogo/LibreLogo.py index bf925c8..49983d3 100644 --- a/librelogo/source/LibreLogo/LibreLogo.py +++ b/librelogo/source/LibreLogo/LibreLogo.py @@ -694,10 +694,13 @@ def __cs__(select = True): if select: _.doc.CurrentController.select(_.drawpage) -def __dispatcher__(s, properties = ()): +def __dispatcher__(s, properties = (), doc = 0): ctx = XSCRIPTCONTEXT.getComponentContext() d = ctx.ServiceManager.createInstanceWithContext(com.sun.star.frame.DispatchHelper, ctx) -d.executeDispatch(_.doc.CurrentController.Frame, s, , 0, properties) +if doc != 0: + d.executeDispatch(doc.CurrentController.Frame, s, , 0, properties) +else: + d.executeDispatch(_.doc.CurrentController.Frame, s, , 0, properties) def __getshape__(shapename): try: @@ -1192,15 +1195,17 @@ def position(n = -1): pos.X, pos.Y = pos.X + turtle.BoundRect.Width / 2.0, pos.Y + turtle.BoundRect.Height / 2.0 return [ pos.X * __MM10_TO_TWIP__ / __PT_TO_TWIP__, pos.Y * __MM10_TO_TWIP__ / __PT_TO_TWIP__ ] -def __groupstart__(): +def __groupstart__(name = ): global __group__, __grouplefthang__, __groupstack__ __removeshape__(__ACTUAL__) __groupstack__.append(__group__) +if name != : # store pic name (for correct repcount) + __groupstack__.append(name) __groupstack__.append(__grouplefthang__) __group__ = uno.getComponentContext().ServiceManager.createInstance('com.sun.star.drawing.ShapeCollection') __grouplefthang__ = 0 -def __groupend__(): +def __groupend__(name = ): global __group__, __grouplefthang__, __groupstack__ g = 0 if __group__.getCount() 1: @@ -1220,6 +1225,26 @@ def __groupend__(): elif __group__.getCount() == 1: g = __group__.getByIndex(0) __grouplefthang__ = min(__groupstack__.pop(), __grouplefthang__) +if name != : + name = __groupstack__.pop() +if name and .SVG == name[-4:].upper() and g: + _.doc.CurrentController.select(g) + __dispatcher__(.uno:Copy) + ctx = XSCRIPTCONTEXT.getComponentContext() + d = ctx.ServiceManager.createInstanceWithContext(com.sun.star.frame.Desktop, ctx) + draw = d.loadComponentFromURL(private:factory/sdraw, _blank, 0, ()) + drawpage = draw.getDrawPages().getByIndex(0) + __dispatcher__(.uno:Paste, (), draw) + pic = drawpage.getByIndex(0) + pic.setPosition(__Point__((g.BoundRect.Width - g.Size.Width)//2, (g.BoundRect.Height - g.Size.Height)//2)) + drawpage.Height, drawpage.Width = g.BoundRect.Height, g.BoundRect.Width + __time__.sleep(1) # avoid writing problem + if not os.path.isabs(name): +name = os.path.expanduser('~') + os.path.sep + name + __dispatcher__(.uno:ExportTo, (__getprop__(URL, unohelper.systemPathToFileUrl(name)), __getprop__(FilterName, draw_svg_Export)), draw) + __time__.sleep(1) + draw.dispose() + __group__ = __groupstack__.pop() if __group__ and g: __group__.add(g) @@ -1252,7 +1277,8 @@ def __loadlang__(lang, a): { i: repcount + str(next(loopi)), j: repcount, orig: re.sub( r(?ui)(?!:)\b%s\b % repcount, repcount + str(next(loopi)-1), r.group(0)) } __comp__[lang] = [ [r(?i)(?!:)(\b|(?=[-:]))(?:%s)\b %
[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - librelogo/source
librelogo/source/LibreLogo/LibreLogo.py |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 0508a56fdf11daa7c0becc7020ad0b22acd56a7e Author: László Németh nem...@numbertext.org Date: Wed Jun 26 02:00:51 2013 +0200 fdo#66180 librelogo: clockwise HEADING Change-Id: I1154b29119fd3fbb30d50246e94b3906bea24220 diff --git a/librelogo/source/LibreLogo/LibreLogo.py b/librelogo/source/LibreLogo/LibreLogo.py index 2231646..bf925c8 100644 --- a/librelogo/source/LibreLogo/LibreLogo.py +++ b/librelogo/source/LibreLogo/LibreLogo.py @@ -722,7 +722,7 @@ def turnright(deg): def heading(deg = -1, go = False): turtle = __getshape__(__TURTLE__) if deg == -1: -return turtle.RotateAngle / 100 +return -turtle.RotateAngle / 100 + 360 else: if deg == u'any': turtle.RotateAngle = random.random() * 36000 @@ -739,7 +739,7 @@ def heading(deg = -1, go = False): if go and n 0: __go__(__TURTLE__, -n, False, a) else: -turtle.RotateAngle = deg * 100 +turtle.RotateAngle = -deg * 100 def rotate(shapename, deg): shape = __getshape__(shapename) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits