Module fig

Module fig



'fig' module - object-oriented interface to XFig files.

You can read fig files into a File object 'f' with:

import fig
f = fig.File(filename) # or pass a file-like object



Author: Hans Meine <hans_meine@gmx.net>

Classes
  Vector
  Rect
This is a simple, half-internal helper class for handling Rectangles (e.g.
  CustomColor
  Object
Base class of all fig objects.
  Arrow
Arrow objects store arrow parameters of other objects.
  ArcBase
Base class of Arc-like objects (PieArc, OpenArc).
  PieArc
Represents a closed arc object.
  OpenArc
Represents an open arc object.
  EllipseBase
Base class of Ellipse-like objects (Ellipse, Circle).
  Ellipse
Represents an ellipse object.
  Circle
Represents a circle object.
  PolylineBase
Base class of Polygon-like objects (Polygon, Polyline, PictureBBox).
  PolyBox
Represents a rectangular closed box object.
  ArcBox
Represents a rectangular box with rounded corners.
  Polygon
Represents a closed polygon object.
  Polyline
Represents an open polygon object.
  PictureBBox
Represents a picture embedded in an XFig file.
  SplineBase
Base class of Spline objects (ApproximatedSpline, InterpolatedSpline, XSpline).
  ApproximatedSpline
Represents an open or closed approximated spline object.
  InterpolatedSpline
Represents an open or closed interpolated spline object.
  XSpline
Represents an open or closed 'x-spline' object.
  Text
Represents a text object.
  Container
Container for fig objects, derived from the standard python list.
  ObjectProxy
An ObjectProxy is a special Container that is used for search results (see Container.findObjects) which offers two additional features:
  Compound
Represents a group of XFig objects.
  File
Main class of the fig module, represents an XFig document.
Functions
 
fillStyleShaded(percent)
Return a fillStyle for dark shades of the fill color.
 
fillStyleTinted(percent)
Return a fillStyle for light tinted fill colors.
 
parseSize(sizeStr)
Convenience function for parsing size strings into tuples:
 
parseGeometry(geometryString)
Convenience function for parsing geometry strings of various formats.
 
readArrow(params)
 
copyObjects(fileA, fileB)
Variables
  __version__ = ['909', '2007-08-28', '14:29:24Z']
  standardColors = [(0, 0, 0), (0, 0, 255), (0, 255, 0), (0, 255...
Mapping of the standard colors to RGB triples.
  paperSizes = ['Letter', 'Legal', 'Ledger', 'Tabloid', 'A', 'B'...
Valid paper sizes, cf.
  unitCM = 450
fig units per centimeter (used for positions, radii, ...)
    polygon type constants (cf. `PolylineBase.changeType()`)
  ptPolyline = 1
  ptBox = 2
  ptPolygon = 3
  ptArcBox = 4
  ptPictureBBox = 5
    ellipse type constants (cf. `EllipseBase.changeType()`)
  etEllipseRadii = 1
  etEllipseDiameter = 2
  etCircleRadius = 3
  etCircleDiameter = 4
    spline type constants (cf. `SplineBase.changeType()`)
  stOpenApproximated = 0
  stClosedApproximated = 1
  stOpenInterpolated = 2
  stClosedInterpolated = 3
  stOpenXSpline = 4
  stClosedXSpline = 5
    arc type constants (cf. `ArcBase.changeType()`)
  atOpen = 1
  atPie = 2
    arc directions (cf. ArcBase.direction property)
  adClockwise = 0
  adCounterClockwise = 1
    fill style constants (cf. `Object.fillStyle` property)
  fillStyleNone = -1
  fillStyleBlack = 0
  fillStyleSolid = 20
  fillStyleWhite = 40
  fillStyleStripes = 42
obsolete, use fillStyleRight30 instead
  fillStyleLeft30 = 41
30 degree left diagonal pattern
  fillStyleRight30 = 42
30 degree right diagonal pattern
  fillStyleCrossed30 = 44
30 degree cross-hatched pattern
  fillStyleLeft45 = 44
45 degree left diagonal pattern
  fillStyleRight45 = 45
45 degree right diagonal pattern
  fillStyleCrossed45 = 46
45 degree cross-hatched pattern
  fillStyleBricks = 47
bricks pattern
  fillStyleCircles = 48
circles pattern
  fillStyleHorizontalLines = 49
horizontal lines pattern
  fillStyleVerticalLines = 50
vertical lines pattern
  fillStyleCrosshatch = 51
crosshatch pattern
  fillStyleFishScales = 52
fish scales pattern
  fillStyleSmallFishScales = 53
small fish scales pattern
  fillStyleOctagons = 54
octagons pattern
  fillStyleHorizontalTireTreads = 55
horizontal "tire treads" pattern
  fillStyleVerticalTireTreads = 56
vertical "tire treads" pattern
    arrow type constants
  arStick = 0
stick-type, three-stroke arrow head (default in xfig 2.1 and earlier)
  arClosed = 1
closed triangle
  arClosedIndented = 2
closed with 'indented' butt
  arClosedPointed = 3
closed with 'pointed' butt
    arrow style constants
  asHollow = 0
filled with white
  asFilled = 1
filled with penColor
    line style constants (cf. `Object.lineStyle` property)
  lineStyleDefault = -1
  lineStyleSolid = 0
  lineStyleDashed = 1
  lineStyleDotted = 2
  lineStyleDashDotted = 3
  lineStyleDashDoubleDotted = 4
  lineStyleDashTripleDotted = 5
    cap style constants (cf. `Object.capStyle` property)
  capStyleButt = 0
  capStyleRound = 1
  capStyleProjecting = 2
    color constants (cf. `Object.penColor` and `Object.fillColor` properties)
  colorDefault = -1
  colorBlack = 0
  colorBlue = 1
  colorGreen = 2
  colorCyan = 3
  colorRed = 4
  colorMagenta = 5
  colorYellow = 6
  colorWhite = 7
  colorBlue4 = 8
  colorBlue3 = 9
  colorBlue2 = 10
  colorLightBlue = 11
  colorGreen4 = 12
  colorGreen3 = 13
  colorGreen2 = 14
  colorCyan4 = 15
  colorCyan3 = 16
  colorCyan2 = 17
  colorRed4 = 18
  colorRed3 = 19
  colorRed2 = 20
  colorMagenta4 = 21
  colorMagenta3 = 22
  colorMagenta2 = 23
  colorBrown4 = 24
  colorBrown3 = 25
  colorBrown2 = 26
  colorPink4 = 27
  colorPink3 = 28
  colorPink2 = 29
  colorLightPink = 30
  colorGold = 31
  colorCustom0 = 32
    join style constants (cf. `Object.joinStyle` property)
  joinStyleMiter = 0
  joinStyleRound = 1
  joinStyleBevel = 2
    alignment constants (cf. `Text.alignment` property)
  alignLeft = 0
  alignCentered = 1
  alignRight = 2
    PS font constants (cf. `Text.font` property, only valid if `Text.fontFlags` & ffPostScript)
  fontDefault = -1
  fontTimesRoman = 0
  fontTimesItalic = 1
  fontTimesBold = 2
  fontTimesBoldItalic = 3
  fontAvantGardeBook = 4
  fontAvantGardeBookOblique = 5
  fontAvantGardeDemi = 6
  fontAvantGardeDemiOblique = 7
  fontBookmanLight = 8
  fontBookmanLightItalic = 9
  fontBookmanDemi = 10
  fontBookmanDemiItalic = 11
  fontCourier = 12
  fontCourierOblique = 13
  fontCourierBold = 14
  fontCourierBoldOblique = 15
  fontHelvetica = 16
  fontHelveticaOblique = 17
  fontHelveticaBold = 18
  fontHelveticaBoldOblique = 19
  fontHelveticaNarrow = 20
  fontHelveticaNarrowOblique = 21
  fontHelveticaNarrowBold = 22
  fontHelveticaNarrowBoldOblique = 23
  fontNewCenturySchoolbookRoman = 24
  fontNewCenturySchoolbookItalic = 25
  fontNewCenturySchoolbookBold = 26
  fontNewCenturySchoolbookBoldItalic = 27
  fontPalatinoRoman = 28
  fontPalatinoItalic = 29
  fontPalatinoBold = 30
  fontPalatinoBoldItalic = 31
  fontSymbol = 32
  fontZapfChanceryMediumItalic = 33
  fontZapfDingbats = 34
    font flag constants (cf. `Text.fontFlags` property)
  ffRigid = 1
  ffSpecial = 2
  ffPostScript = 4
  ffHidden = 8
Function Details

parseGeometry(geometryString)

 

Convenience function for parsing geometry strings of various formats. Example usage:

>>> import fig
>>> fig.parseGeometry("320,240-640,480")
fig.Rect(320,240,640,480)
>>> fig.parseGeometry("50,50+50,50")
fig.Rect(50,50,100,100)
>>> fig.parseGeometry("40,40,320,240")
fig.Rect(40,40,320,240)
>>> r = fig.Rect(0,0,320,240)
>>> fig.parseGeometry(str(r)) == r
True

Variables Details

standardColors

Mapping of the standard colors to RGB triples.
Value:
[(0, 0, 0),
 (0, 0, 255),
 (0, 255, 0),
 (0, 255, 255),
 (255, 0, 0),
 (255, 0, 255),
 (255, 255, 0),
 (255, 255, 255),
...

paperSizes

Valid paper sizes, cf. File.paperSize.
Value:
['Letter',
 'Legal',
 'Ledger',
 'Tabloid',
 'A',
 'B',
 'C',
 'D',
...