summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xkig/pykig/pykig.py120
1 files changed, 59 insertions, 61 deletions
diff --git a/kig/pykig/pykig.py b/kig/pykig/pykig.py
index 106c8a0c..50cd5f2b 100755
--- a/kig/pykig/pykig.py
+++ b/kig/pykig/pykig.py
@@ -6,7 +6,7 @@
# #
#--Maurizio Paolini-Daniele Zambelli-----------------------------2005---#
#
-# (licenza GPL)
+# (GPL license)
version="0.2.11"
@@ -112,18 +112,18 @@ def kig_relpoint(obj, displ):
#####
#####
-# Classe KigDocument
+# Class KigDocument
#####
class KigDocument(object):
- """ Classe che produce il documento kig.
+ """ This class creates the kig document.
- genealogia:
+ hierarchy:
KigDocument <- object
- attributi di classe:
+ class attributes:
- attributi:
+ attributes:
axes
grid
outfilename
@@ -140,7 +140,7 @@ class KigDocument(object):
shown
color
- metodi:
+ methods:
viewappend
hierarchyappend
setcallkig
@@ -234,24 +234,24 @@ class KigDocument(object):
def setinternal(self, v): self.internal=v
#####
-# Classe KigDOP
+# Class KigDOP
#####
#class KigDOP(KigOut):
class KigDOP(object):
- """Classe da cui deriva ogni elemento che ha un id: Data, Object, Property.
+ """Base class for all object containing an id: Data, Object, Property.
- genealogia:
+ hierarchy:
kigDOP <- object
- attributo di classe:
+ class attributes:
id-counter
- attributi:
+ attributes:
id
type
- metodi:
+ methods:
getid
str_hierarchy
"""
@@ -269,20 +269,20 @@ class KigDOP(object):
def str_hierarchy(self): pass
#####
-# Classe KigView
+# Class KigView
#####
#class KigView(KigOut):
class KigView(object):
- """ Classe con i dati di visualizzazione
+ """ Class containing visualization data
- genealogia:
+ hierarchy:
KigView <- object
- attributi di classe:
+ class attributes:
_kd
- attributi:
+ attributes:
shown
width
style
@@ -290,7 +290,7 @@ class KigView(object):
name
pointstyle
- metodi:
+ methods:
str_view
show
hide
@@ -308,9 +308,9 @@ class KigView(object):
KigView._kd.viewappend(self)
def str_view(self):
- """Produce la stringa che viene scritta sotto <View>.
+ """Creates the string written in <View>.
- esempio:
+ Example:
<Draw width="-1" point-style="Round" namecalcer="none"
style="SolidLine" shown=None color="#0000ff" object="3" />
"""
@@ -321,19 +321,19 @@ style="SolidLine" shown=None color="#0000ff" object="3" />
self.linestyle, self.shown, self.color, self.object.getid())
#####
-# Classe Data
+# Class Data
#####
class Data(KigDOP):
- """ Classe da cui deriva ogni elemento Data
+ """ Base class for all Data element
- genealogia:
+ hierarchy:
Data <- KigDOP <- object
- attributi:
+ attributes:
val
- metodi:
+ methods:
str_hierarchy
"""
def __init__(self, type, val):
@@ -341,32 +341,32 @@ class Data(KigDOP):
KigDOP.__init__(self, type)
def str_hierarchy(self):
- """Produce la stringa che viene scritta sotto <Data>.
+ """Creates the <Data> string.
- esempio:
+ Example:
<Data type="double" id="170" >0.1</Data>
"""
return ' <Data type="%s" id="%s" >%s</Data>\n' % \
(self._type, self.getid(), self.val)
#####
-# Classe PropObj
+# Class PropObj
#####
class PropObj(KigDOP):
- """ Classe da cui deriva ogni elemento visibile
+ """ Base class for all visible object
- genealogia:
+ hierarchy:
PropObj <- KigDOP <- object
- attributi di classe:
+ class attributes:
- attributi:
+ attributes:
prop
objvec
view
- metodi:
+ methods:
str_hierarchy
showname(self, n)
show(self)
@@ -393,8 +393,7 @@ class PropObj(KigDOP):
if internal:
self.view = None
else:
-# Qui si assume che, se viene dato un nome ad un oggetto,
-# si voglia anche visualizzare questo nome
+# Here we assume that if an object is named, the name should also be shown.
if name: n_id=self.showname(name, shown, width, pointstyle, linestyle,
color)
else: n_id=None
@@ -402,14 +401,14 @@ class PropObj(KigDOP):
color)
def str_hierarchy(self):
- """Produce la stringa che viene scritta sotto <Data>.
+ """Creates the <Data> string.
- esempio:
+ Example:
<Property which="mid-point" id="170" >
<Parent id="..." />
</Property>
- oppure:
+ or:
<Object type="ConstrainedPoint" id="14" >
<Parent id="13" />
<Parent id="10" />
@@ -448,13 +447,13 @@ class PropObj(KigDOP):
def setshown(self, s): self.view.shown=s
#####
-# Classe Property
+# Class Property
#####
class Property(PropObj):
- """ Classe da cui deriva ogni elemento Property
+ """ Base class for all Property elements
- genealogia:
+ hierarchy:
Property <- PropObj <- KigDOP <- object
"""
def __init__(self, type, parent, shown, name, internal,
@@ -464,13 +463,13 @@ class Property(PropObj):
# print shown
#####
-# Classe Object
+# Class Object
#####
class Object(PropObj):
- """ Classe da cui deriva ogni elemento Oggetto
+ """ Base class for all Object elements
- genealogia:
+ hierarchy:
Object <- PropObj <- KigDOP <- object
"""
@@ -509,7 +508,7 @@ for d in data:
#####
# Objects
#####
-"""Da aggiungere:
+"""To be added:
("ConvexHall", "ConvexHall", "polygon,", "(polygon,),"),
("EllipseByFocusFocusPoint", "EllipseBFFP", "p1, p2, p3,", "(p1, p2, p3,),"),
("HyperbolaByFocusFocusPoint", "HyperbolaBFFP", "p1, p2, p3,", "(p1, p2, p3,),"),
@@ -547,28 +546,27 @@ objects=(\
#####
("LineLineIntersection", "LineLineIntersection", "l1, l2,", "(l1, l2),"),
#####
-# Classe CircleCircleIntersection e ConicLineIntersection
-# l'intero "which" puo' assumere i valori 1 o -1 per indicare quale
-# delle due intersezioni si desidera ottenere
-# si potrebbe mettere un controllo...
+# Class CircleCircleIntersection and ConicLineIntersection
+# the value of the "which" integer (1 or -1) indicates which of the two
+# intersections we want to get.
#####
("CircleCircleIntersection", "CircleCircleIntersection",
"c1, c2, witch,", "(c1, c2, Int(witch),),"),
("ConicLineIntersection", "ConicLineIntersection",
"conic, line, witch,", "(conic, line, Int(witch),),"),
-###### Classe Triangle
+###### Class Triangle
("Triangle", "TriangleB3P", "p1, p2, p3,", "(p1, p2, p3),"),
-###### Classe Polygon (the only argument is a points vect)
+###### Class Polygon (the only argument is a points vect)
("Polygon", "PolygonBNP", "pvec,", "pvec,"),
-###### Classe PolygonBCV
-# Poligono regolare dati il centro e un vertice; il terzo argomento
-# e' un intero contenente il numero di lati
+###### Class PolygonBCV
+# Regular polygon given the center and a vertex; the third parameter
+# is an integer containing the number of sides.
("PolygonBCV", "PoligonBCV",
"center, vertex, n,", "(center, vertex, Int(n)),"),
-##### Classe PolygonVertex (poligono, intero >= 0)
+##### Class PolygonVertex (polygon, integer >= 0)
("PolygonVertex", "PolygonVertex",
"polygon, i,", "(polygon, Int(i)),"),
-##### Classe PolygonSide (poligono, intero >= 0)
+##### Class PolygonSide (polygon, integer >= 0)
("PolygonSide", "PolygonSide",
"polygon, i,", "(polygon, Int(i)),"),
###### vector, angle,...
@@ -677,7 +675,7 @@ for p in property:
#####
# Start of properties definitions as Object's metod
#####
-# da sistemare!
+# fixme!
points =(Point, ConstrainedPoint, RelativePoint, PolygonVertex)
lines=(Segment, Ray, Vector, InvertLine)
segments=(Segment, Vector, PolygonSide, InvertSegment)
@@ -774,9 +772,9 @@ def prog():
elif _opt in ("-o", "--output"):
_outfilename=_arg
_of=True
- _callKig=False # se c'è il file di output, non viene chiamato Kig
+ _callKig=False # if the output filename is provided, don't call Kig
if len(_args)==0:
- _infilename=raw_input("Nome del file di input: ")
+ _infilename=raw_input("Input filename: ")
if not _infilename:
print "No Input filename"
usage(2)
@@ -803,7 +801,7 @@ def prog():
execfile(_infilename, globals())
except:
print >> sys.stderr, 'syntax error in', _infilename
- _info = sys.exc_info() # vorrei stampare il traceback...
+ _info = sys.exc_info() # print the traceback
traceback.print_exc()
sys.exit(3)
kigdocument.close()