Kaydet (Commit) c2a393fb authored tarafından László Németh's avatar László Németh Kaydeden (comit) Andras Timar

LibreLogo Writer extension

Change-Id: I31a61f0773689a054b5d5008ca9d4eb0bd9d7a19
Reviewed-on: https://gerrit.libreoffice.org/998Reviewed-by: 's avatarAndras Timar <atimar@suse.com>
Tested-by: 's avatarAndras Timar <atimar@suse.com>
üst 207ed1b1
This diff is collapsed.
2012-11-06 László Németh:
* uppercase/translation icon:
- expands and uppercase Logo commands (fd -> FORWARD)
- translation between supported languages (commands, decimal sign, for/in order)
* new icon for clear screen
* add English manual (see LibreLogo/Logo/Turtle graphics in Help)
2012-10-25 László Németh:
* fix positioning to the faulty program line
* program cache depends from the (modified) language of the document, too
2012-10-21 László Németh:
* speed up command line
* add multiline tooltip to the command line (it works well from LibO 3.6.2)
* random color constants: ~color, eg. '~orange', '~green' etc.
* handle modulo operator
* ask before the compilation of long documents (avoid freezings)
* add compilation cache to the multiline programs
* better help window caption in the command line
2012-06-27 László Németh:
* fix __string__ (use localized decimal sign)
* fix repcount in loops with inner picture block
* handle reopened documents
* modified argument list of custom dashed penstyle
* fix warning messages at maximum recursion depth and memory
* add hatching styles (fillstyle num or
fillstyle [line count(max 3), color, distance, degree]
* add localized set(), range(), sorted()
* fix turtle selection at program start
* modified turtle colors
* fix showturtle
* fix LineStyle_SOLID and LineStyle_DASHED
* add repcount to the infinite loop
* add logical expression and better list support to the simple LibreLogo expression parser
* add string size limit for Print()
* support "pic" without block: new shape
* use localized __string__ for STR instead of str
* add min, max, and regex functions: sub, search, findall
* fix double round in localizations
* more stable dotted lines in the PDF export (implemented as arrays of dot-headed arrows)
* circles with dotted lines
* working pos and pagesize indices in expressions
2012-05-17 László Németh:
* fix opt. suffix syntax of for+in (eg. with Finnish :ssa, Hungarian -ban)
* add dashed outline of turtle to show "pen up" state
* fix initial turtle focus for OpenOffice.org and older LibreOffice versions
* parsing simple (with 0 or 1 argument) user functions in complex expressions
* add localized "global"
* add localized operator "in" for logical expressions
* parsing user functions with 2 or more arguments in simple numerical expressions
* function heading supports coordinates
* function position supports drawing
* function pensize supports argument any
* set SizeProtect feature of turtle shape
* replace random while repcount variable with iterator
* fix repcount checking in conditions of "while" loops
* add repcount support to "for x in y" loops
* fix OUTPUT and STOP for lines with multiple commands
* fix = -> == conversion in logical expressions in OUTPUT
* fix multiple document support using CreationDate instead of Title
* better OpenOffice.org 3.2 compatibility (optional usage of feature Visible)
2012-05-08 László Németh:
* picture [] handles left hanging shapes better
* function random works on lists or list-convertable objects (string, tuple, dict, set), too
* faster "label" (remove unnecessary shape search)
* document-level turtle states
* clean name spaces
* localization of "pi" (localizations support greek letter pi as alternative)
* localized "float"
* int & float support localized decimal signs and measurements (float '10,5cm')
* print, label, text support localized decimal sign
2012-05-02 László Németh:
* fix slow drawing of new line shapes (unnecessary shape search)
* "circle" and "square" are synonyms of ellipse and rectangle, eg.
square num = rectangle [num, num]
2012-04-27 László Németh:
* Initial release
This diff is collapsed.
# dummy UNO component to get the path of the localizations
import uno, unohelper, os, sys
from com.sun.star.lang import XMain
class LibreLogoDummyComponent(XMain, unohelper.Base):
def __init__( self, ctx ):
self.ctx = ctx
def get_path(self):
import librelogodummy_path
return librelogodummy_path.get_path()
g_ImplementationHelper = unohelper.ImplementationHelper()
g_ImplementationHelper.addImplementation( \
LibreLogoDummyComponent,"org.openoffice.comp.pyuno.LibreLogoDummy",("org.openoffice.LibreLogo.LibreLogoDummy",),)
<?xml version="1.0" encoding="UTF-8"?>
<manifest:manifest>
<manifest:file-entry manifest:media-type="application/vnd.sun.star.uno-component;type=Python" manifest:full-path="LibreLogoDummy.py"/>
<manifest:file-entry manifest:media-type="application/vnd.sun.star.framework-script" manifest:full-path="LibreLogo"/>
<manifest:file-entry manifest:full-path="Office/UI/StartModuleWindowState.xcu" manifest:media-type="application/vnd.sun.star.configuration-data"/>
<manifest:file-entry manifest:full-path="Office/UI/WriterWindowState.xcu" manifest:media-type="application/vnd.sun.star.configuration-data"/>
<manifest:file-entry manifest:full-path="Addons.xcu" manifest:media-type="application/vnd.sun.star.configuration-data"/>
<manifest:file-entry manifest:media-type="application/vnd.sun.star.help" manifest:full-path="help"/>
</manifest:manifest>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<oor:component-data xmlns:oor="http://openoffice.org/2001/registry"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
oor:name="StartModuleWindowState"
oor:package="org.openoffice.Office.UI">
<node oor:name="UIElements">
<node oor:name="States">
<node oor:name="private:resource/toolbar/addon_LibreLogo.OfficeToolBar" oor:op="replace">
<prop oor:name="UIName" oor:type="xs:string">
<value lang="en">Logo</value>
<value lang="hu">Logo</value>
</prop>
<prop oor:name="Visible" oor:type="xs:boolean">
<value>false</value>
</prop>
<prop oor:name="Locked" oor:type="xs:boolean">
<value>false</value>
</prop>
</node>
</node>
</node>
</oor:component-data>
<?xml version="1.0" encoding="UTF-8"?>
<oor:component-data xmlns:oor="http://openoffice.org/2001/registry"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
oor:name="WriterWindowState"
oor:package="org.openoffice.Office.UI">
<node oor:name="UIElements">
<node oor:name="States">
<node oor:name="private:resource/toolbar/addon_LibreLogo.OfficeToolBar" oor:op="replace">
<prop oor:name="UIName" oor:type="xs:string">
<value lang="en">Logo</value>
<value lang="hu">Logo</value>
</prop>
<prop oor:name="Visible" oor:type="xs:boolean">
<value>false</value>
</prop>
<prop oor:name="Locked" oor:type="xs:boolean">
<value>false</value>
</prop>
</node>
</node>
</node>
</oor:component-data>
LibreOffice Logo 0.2 RC2
License: GNU LGPL & GPL, MPL
Home page: http://www.numbertext.org/logo
(c) László Németh (nemeth at numbertextdotorg)
FSF.hu Foundation, http://www.fsf.hu
Icons copyright: OpenOffice.org/LibreOffice
Introduction
============
LibreLogo is a Logo-like progamming language with interactive vectorgraphics for education and DTP
- presentation: http://www.numbertext.org/logo/librelogo.pdf
- basic Logo syntax for back compability with educational Logo systems
- interactive vectorgraphics in LibreOffice Writer
- native commands (easily translatable)
- Python data structures (list, tuple, set, dictionary) and other Python features
Usage
=====
See Logo in LibreOffice Help and http://www.numbertext.org/logo for documentation.
Translation
===========
create your_language_id.lng in LibreOffice/ based on en.lng.
Compilation:
python make.py
Development
===========
LibreLogo uses the PyUNO scripting framework, so Addons.xcu URLs depend from the
full name of the package. Modify them according to the package name with the
version number.
Programming language and environment for education, graphic design and desktop publishing. Usage: View→Toolbars→Logo toolbar in Writer. See Logo in LibreOffice Help.
Programozási nyelv és környezet oktatáshoz, számítógépes grafikához és kiadványszerkesztéshez. Használat: Nézet→Eszköztárak→Logo eszköztár a Writerben. L. Logo a LibreOffice Súgóban.
<?xml version="1.0" encoding="UTF-8"?>
<description xmlns="http://openoffice.org/extensions/description/2006"
xmlns:d="http://openoffice.org/extensions/description/2006"
xmlns:xlink="http://www.w3.org/1999/xlink">
<identifier value="org.openoffice.comp.pyuno.LibreLogo" />
<display-name>
<name lang="en-US">LibreLogo</name>
</display-name>
<version value="0.2rc2" />
<publisher>
<name lang="en" xlink:href="http://www.numbertext.org/logo">László Németh</name>
<name lang="hu" xlink:href="http://www.numbertext.org/logo">Németh László</name>
</publisher>
<extension-description>
<src lang="en" xlink:href="description-en.txt" />
<src lang="hu" xlink:href="description-hu.txt" />
</extension-description>
<dependencies>
<OpenOffice.org-minimal-version value="3.2" d:name="OpenOffice.org 3.2" />
</dependencies>
</description>
This diff is collapsed.
This diff is collapsed.
#!/bin/sh
cat doc.txt | awk 'BEGIN{system("cat head")}/^ /{code = code $0 "<br/>";next}{if (code != ""){print "<paragraph role=\"code\">" gensub(" ", "\\&#160;", "g", code) "</paragraph>";code=""}}/^=+/{l=length($1);print "<paragraph role=\"heading\" level=\"" l "\">"substr($0, l+2, length($0)-l*2-2)"</paragraph>";next}/^[{][|]/{print "<table><tablerow>";next}/^[|]}/{print "</tablerow></table>";next}/^[|]-/{print "</tablerow><tablerow>";next}/^[|]/{print "<tablecell>"gensub("^.*[|]","","g")"</tablecell>";next}{print "<paragraph role=\"paragraph\">" $0 "</paragraph>" }END{print "</body></helpdocument>"}' >LibreLogo.xhp
<?xml version="1.0" encoding="UTF-8"?>
<helpdocument version="1.0">
<meta>
<topic id="LibreLogo" indexer="include" status="PUBLISH">
<title id="title">LibreLogo</title>
<filename>/LibreLogo/LibreLogo.xhp</filename>
</topic>
</meta>
<body>
<bookmark xml-lang="en" branch="index" id="bm1">
<bookmark_value>LibreLogo</bookmark_value>
<bookmark_value>Logo</bookmark_value>
<bookmark_value>Turtle graphics</bookmark_value>
</bookmark>
<?xml version="1.0" encoding="UTF-8"?>
<!--
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
-->
<tree_view>
<help_section application="swriter" id="02" title="Presenter Console Keyboard Shortcuts">
<node id="0211" title="LibreLogo">
<topic id="LibreLogo/LibreLogo.xhp">LibreLogo</topic>
</node>
</help_section>
</tree_view>
# -*- encoding: UTF-8 -*-
import sys, os, zipfile
distname = 'librelogo-0.2.oxt'
z = zipfile.ZipFile(distname, mode='w', compression = zipfile.ZIP_DEFLATED)
for i in ["LibreLogo/LibreLogo.py", "pythonpath/en.properties", "pythonpath/hu.properties", \
"META-INF/manifest.xml", "description.xml", "Addons.xcu", "README", \
"Office/UI/WriterWindowState.xcu", "Office/UI/StartModuleWindowState.xcu", \
"help/en-US/LibreLogo/LibreLogo.xhp", "help/en-US/help.tree", "pythonpath/librelogodummy_path.py", \
"description-en.txt", "description-hu.txt", "LibreLogoDummy.py" ] + \
"""icons/lc_arrowshapes.circular-arrow.png
icons/lc_arrowshapes.circular-leftarrow.png
icons/lc_arrowshapes.down-arrow.png
icons/lc_arrowshapes.up-arrow.png
icons/lc_basicstop.png
icons/lc_editglossary.png
icons/lc_navigationbarleft.png
icons/lc_newdoc.png
icons/lc_runbasic.png
icons/sc_arrowshapes.circular-arrow.png
icons/sc_arrowshapes.circular-leftarrow.png
icons/sc_arrowshapes.down-arrow.png
icons/sc_arrowshapes.up-arrow.png
icons/sc_basicstop.png
icons/sc_editglossary.png
icons/sc_navigationbarleft.png
icons/sc_newdoc.png
icons/sc_runbasic.png""".split("\n"):
z.writestr(i, open(i, "r").read())
# turtle graphics
FORWARD=forward|fd
BACKWARD=back|bk
TURNLEFT=left|turnleft|lt
TURNRIGHT=right|turnright|rt
PENUP=penup|pu
PENDOWN=pendown|pd
HOME=home
POINT=point
CIRCLE=circle
ELLIPSE=ellipse
SQUARE=square
RECTANGLE=rectangle
LABEL=label
PENCOLOR=pencolor|pencolour|linecolor|pc
ANY=any
PENWIDTH=pensize|penwidth|linewidth|ps
PENSTYLE=penstyle|linestyle
PENJOINT=penjoint|linejoint
NONE=none
BEVEL=bevel
MITER=miter
ROUNDED=round
SOLID=solid
DASH=dashed
DOTTED=dotted
CLOSE=close
FILL=fill
FILLCOLOR=fillcolor|fillcolour|fc
FILLSTYLE=fillstyle
FONTCOLOR=fontcolor|textcolor|textcolour
FONTHEIGHT=fontsize|textsize|textheight
FONTWEIGHT=fontweight
FONTSTYLE=fontstyle
BOLD=bold
ITALIC=italic
UPRIGHT=upright|normal
NORMAL=normal
FONTFAMILY=fontfamily
CLEARSCREEN=clearscreen|cs
TEXT=text
HIDETURTLE=hideturtle|ht|hideme
SHOWTURTLE=showturtle|st|showme
POSITION=position|pos|setpos
HEADING=heading|setheading|seth
PAGESIZE=pagesize
GROUP=picture|pic
# control structures
TO=to
END=end
STOP=stop
REPEAT=repeat|forever
REPCOUNT=repcount
BREAK=break
CONTINUE=continue
WHILE=while
FOR=for
IN=in
IF=if
OUTPUT=output
LEFTSTRING=\u201c|\u2018
RIGHTSTRING=\u201d|\u2019
TRUE=true
FALSE=false
NOT=not
AND=and
OR=or
INPUT=input
PRINT=print
SLEEP=sleep
GLOBAL=global
# functions
RANDOM=random
INT=int
FLOAT=float
STR=str
SQRT=sqrt
SIN=sin
COS=cos
ROUND=round
ABS=abs
COUNT=count
SET=set
RANGE=range
LIST=list
TUPLE=tuple
SORTED=sorted
RESUB=sub
RESEARCH=search
REFINDALL=findall
MIN=min
MAX=max
PI=pi|\u03c0
# measurement
DECIMAL=.
DEG=\u00b0
HOUR=h
MM=mm
CM=cm
PT=pt
INCH=in|"
# color codes
INVISIBLE=invisible
BLACK=black
SILVER=silver
GRAY=gray|grey
WHITE=white
MAROON=maroon
RED=red
PURPLE=purple
FUCHSIA=fuchsia|magenta
GREEN=green
LIME=lime
OLIVE=olive
YELLOW=yellow
NAVY=navy
BLUE=blue
TEAL=teal
AQUA=aqua|cyan
PINK=pink
TOMATO=tomato
ORANGE=orange
GOLD=gold
VIOLET=violet
SKYBLUE=skyblue
CHOCOLATE=chocolate
BROWN=brown
# messages
LIBRELOGO=LibreLogo
ERROR=Error (in line %s)
ERR_ZERODIVISION=Division by zero.
ERR_NAME=Unknown name: \u2018%s\u201d.
ERR_ARGUMENTS=%s takes %s arguments (%s given).
ERR_BLOCK=Error (extra or missing spaces at brackets?)
ERR_KEY=Unknown element: %s
ERR_INDEX=Index out of range.
ERR_STOP=Program terminated:
ERR_MAXRECURSION=maximum recursion depth (%d) exceeded.
ERR_MEMORY=not enough memory.
ERR_NOTAPROGRAM=Do you want to run this text document?
# turtle graphics
FORWARD=el\u0151re|e
BACKWARD=h\u00e1tra|h
TURNLEFT=balra|b
TURNRIGHT=jobbra|j
PENUP=tollatfel|tf
PENDOWN=tollatle|tl
HOME=haza
POINT=pont
CIRCLE=k\u00f6r
ELLIPSE=ellipszis
SQUARE=n\u00e9gyzet
RECTANGLE=t\u00e9glalap
LABEL=c\u00edmke
PENCOLOR=tollsz\u00edn|tollsz\u00edn!|tsz!?|vonalsz\u00edn
ANY=tetsz\u0151leges|tetsz
PENWIDTH=tollvastags\u00e1g|tollvastags\u00e1g!|tv!?|vonalvastags\u00e1g
PENSTYLE=tollst\u00edlus|vonalst\u00edlus
PENJOINT=tollsarok|vonalsarok
NONE=nincs
BEVEL=tompa
ROUNDED=kerek
MITER=hegyes
SOLID=folyamatos
DASH=szaggatott
DOTTED=pontozott
CLOSE=z\u00e1r
FILL=t\u00f6lt
FILLCOLOR=t\u00f6lt\u0151sz\u00edn|t\u00f6lt\u0151sz\u00edn!|tlsz!?
FILLSTYLE=t\u00f6lt\u0151st\u00edlus
FONTCOLOR=bet\u0171sz\u00edn
FONTHEIGHT=bet\u0171m\u00e9ret
FONTWEIGHT=bet\u0171vastags\u00e1g
FONTSTYLE=bet\u0171st\u00edlus
BOLD=f\u00e9lk\u00f6v\u00e9r|k\u00f6v\u00e9r|vastag
ITALIC=kurz\u00edv|d\u0151lt
UPRIGHT=\u00e1ll\u00f3|norm\u00e1l
NORMAL=norm\u00e1l
FONTFAMILY=bet\u0171csal\u00e1d
CLEARSCREEN=t\u00f6r\u00f6lk\u00e9perny\u0151|t\u00f6r\u00f6lk\u00e9p|t\u00f6r\u00f6lrajzlap|tr
TEXT=sz\u00f6veg
HIDETURTLE=l\u00e1thatatlan|elrejttekn\u0151c|rejttek|elrejt
SHOWTURTLE=l\u00e1that\u00f3
POSITION=hely|hely!|poz\u00edci\u00f3|xy!
HEADING=ir\u00e1ny|ir\u00e1ny!
PAGESIZE=oldalm\u00e9ret
GROUP=k\u00e9p
# control structures
TO=ez|elj\u00e1r\u00e1s|elj|tanuld
END=v\u00e9ge
STOP=stop|visszat\u00e9r
OUTPUT=eredm\u00e9ny
REPEAT=ism\u00e9t|ism|ism\u00e9tl\u00e9s|v\u00e9gtelenszer|vszer
REPCOUNT=h\u00e1nyadik
BREAK=kil\u00e9p
CONTINUE=\u00fajra
WHILE=am\u00edg
FOR=fut
IN=-ban|-ben
IF=ha
LEFTSTRING=\u201e
RIGHTSTRING=\u201d
TRUE=igaz
FALSE=hamis
NOT=nem
AND=\u00e9s
OR=vagy
INPUT=be
PRINT=ki|ki\u00edr
SLEEP=v\u00e1r|v\u00e1rj
GLOBAL=glob\u00e1lis|glob\u00e1lisv\u00e1ltoz\u00f3|globv\u00e1l
# functions
RANDOM=v\u00e9letlen|v\u00e9letlensz\u00e1m|vsz\u00e1m|kiv\u00e1laszt
INT=eg\u00e9szsz\u00e1m|eg\u00e9sz
FLOAT=t\u00f6rtsz\u00e1m|t\u00f6rt
STR=karakterl\u00e1nc|l\u00e1nc
SQRT=gy\u00f6k
SIN=sin
COS=cos
ROUND=kerek|kerek\u00edt\u00e9s
ABS=abszol\u00fat\u00e9rt\u00e9k|absz?
COUNT=darab|db|elemsz\u00e1m
SET=halmaz
RANGE=sor
LIST=lista
TUPLE=fix
SORTED=rendez
RESUB=cser\u00e9l
RESEARCH=keres
REFINDALL=tal\u00e1l
MIN=min
MAX=max
PI=pi|\u03c0
# measurement
DECIMAL=,
DEG=\u00b0
HOUR=\u00f3|h
MM=mm
CM=cm
PT=pt
INCH=in|"
# color constants
INVISIBLE=l\u00e1thatatlan
BLACK=fekete
SILVER=vil\u00e1gossz\u00fcrke|ez\u00fcst
GRAY=sz\u00fcrke
WHITE=feh\u00e9r
MAROON=s\u00f6t\u00e9tbarna
RED=piros|v\u00f6r\u00f6s
PURPLE=lila
FUCHSIA=b\u00edbor|cikl\u00e1men
GREEN=z\u00f6ld
LIME=vil\u00e1gosz\u00f6ld
OLIVE=olajz\u00f6ld
YELLOW=s\u00e1rga
NAVY=s\u00f6t\u00e9tk\u00e9k
BLUE=k\u00e9k
TEAL=k\u00e9kesz\u00f6ld
AQUA=ci\u00e1nk\u00e9k|ci\u00e1n
PINK=r\u00f3zsasz\u00edn
TOMATO=vil\u00e1gospiros
ORANGE=narancss\u00e1rga|narancs
GOLD=aranys\u00e1rga|arany
VIOLET=ibolyak\u00e9k|ibolya|viola
SKYBLUE=\u00e9gsz\u00ednk\u00e9k|vil\u00e1gosk\u00e9k
CHOCOLATE=vil\u00e1gosbarna
BROWN=barna
# messages
LIBRELOGO=LibreLogo
ERROR=Hiba (%s. sor)
ERR_ZERODIVISION=Oszt\u00e1s null\u00e1val.
ERR_NAME=Ismeretlen n\u00e9v: \u201e%s\u201d.
ERR_ARGUMENTS=%s: %s adatot v\u00e1r, de %s lett megadva.
ERR_BLOCK=Hiba (hi\u00e1nyz\u00f3 vagy felesleges sz\u00f3k\u00f6z a kapcsos z\u00e1r\u00f3jeln\u00e9l?)
ERR_KEY=Ismeretlen elem: %s
ERR_INDEX=Nem l\u00e9tez\u0151 elemre hivatkoz\u00e1s.
ERR_STOP=A fut\u00e1s le\u00e1ll\u00edtva:
ERR_MAXRECURSION=el\u00e9rve az \u00fajrah\u00edv\u00e1si korl\u00e1t (%d).
ERR_MEMORY=nincs el\u00e9g mem\u00f3ria.
ERR_NOTAPROGRAM=Futtatni akarja ezt a sz\u00f6veges dokumentumot?
import uno, re, sys, os, traceback
def get_path():
return os.path.join(os.path.dirname(sys.modules[__name__].__file__), __name__ + ".py")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment