<s> from mojo . UI import CurrentGlyphWindow , UpdateCurrentGlyphView <EOL> from mojo . events import BaseEventTool , installTool , EditingTool <EOL> from AppKit import * <EOL> from defconAppKit . windows . baseWindow import BaseWindowController <EOL> from mojo . drawingTools import * <EOL> from mojo . extensions import ExtensionBundle <EOL> from vanilla import * <EOL> from mojo . extensions import getExtensionDefault , setExtensionDefault , getExtensionDefaultColor , setExtensionDefaultColor <EOL> from lib . tools . defaults import getDefault <EOL> from lib . tools import bezierTools <EOL> bundle = ExtensionBundle ( "<STR_LIT>" ) <EOL> toolbarIcon = bundle . getResourceImage ( "<STR_LIT>" ) <EOL> try : <EOL> toolbarIcon . setSize_ ( ( <NUM_LIT:16> , <NUM_LIT:16> ) ) <EOL> except : <EOL> pass <EOL> class TX : <EOL> @ classmethod <EOL> def formatStringValue ( cls , f ) : return format ( f , '<STR_LIT>' ) . rstrip ( '<STR_LIT:0>' ) . rstrip ( '<STR_LIT:.>' ) <EOL> @ classmethod <EOL> def getItalicOffset ( cls , yoffset , italicAngle ) : <EOL> '''<STR_LIT>''' <EOL> from math import radians , tan <EOL> ritalicAngle = radians ( italicAngle ) <EOL> xoffset = int ( round ( tan ( ritalicAngle ) * yoffset ) ) <EOL> return xoffset * - <NUM_LIT:1> <EOL> @ classmethod <EOL> def getItalicshowCoordinates ( cls , coords , italicAngle ) : <EOL> """<STR_LIT>""" <EOL> x , y = coords <EOL> x += cls . getItalicOffset ( y , italicAngle ) <EOL> return x , y <EOL> class BoundingTool ( EditingTool , BaseWindowController ) : <EOL> slantPointCoordinates = int ( getDefault ( "<STR_LIT>" ) ) <EOL> offsetPointCoordinates = getDefault ( "<STR_LIT>" ) <EOL> DEFAULTKEY = "<STR_LIT>" <EOL> DEFAULTKEY_FILLCOLOR = "<STR_LIT>" % DEFAULTKEY <EOL> DEFAULTKEY_STROKECOLOR = "<STR_LIT>" % DEFAULTKEY <EOL> DEFAULTKEY_SHOWCOORDINATES = "<STR_LIT>" % DEFAULTKEY <EOL> DEFAULTKEY_SHOWDIMENSIONS = "<STR_LIT>" % DEFAULTKEY <EOL> DEFAULTKEY_SELECTION = "<STR_LIT>" % DEFAULTKEY <EOL> DEFAULTKEY_DIVISIONSX = "<STR_LIT>" % DEFAULTKEY <EOL> DEFAULTKEY_DIVISIONSY = "<STR_LIT>" % DEFAULTKEY <EOL> DEFAULTKEY_USEITALIC = "<STR_LIT>" % DEFAULTKEY <EOL> FALLBACK_FILLCOLOR = NSColor . colorWithCalibratedRed_green_blue_alpha_ ( <NUM_LIT:1> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) <EOL> FALLBACK_STROKECOLOR = NSColor . colorWithCalibratedRed_green_blue_alpha_ ( <NUM_LIT:1> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) <EOL> VERSION = <NUM_LIT:1.0> <EOL> NAME = u'<STR_LIT>' <EOL> MANUAL = u"""<STR_LIT>""" <EOL> color = ( <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT> ) <EOL> alpha = <NUM_LIT:1> <EOL> divisionsStringList = [ '<STR_LIT:1>' , '<STR_LIT:2>' , '<STR_LIT:3>' , '<STR_LIT:4>' ] <EOL> divisionsList = [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> ] <EOL> def getToolbarTip ( self ) : <EOL> return self . NAME <EOL> def getToolbarIcon ( self ) : <EOL> return toolbarIcon <EOL> def getBox ( self , selected = True ) : <EOL> g = self . getGlyph ( ) <EOL> if g is not None and g . box is not None : <EOL> n = g <EOL> if selected : <EOL> hasSelection = False <EOL> copyGlyph = g . naked ( ) . selection . getCopyGlyph ( ) <EOL> if copyGlyph and copyGlyph [ <NUM_LIT:1> ] . get ( '<STR_LIT>' ) : <EOL> n = RGlyph ( copyGlyph [ <NUM_LIT:0> ] ) <EOL> else : <EOL> n = g <EOL> if self . w . useItalic . get ( ) : <EOL> italicAngle = g . getParent ( ) . info . italicAngle or <NUM_LIT:0> <EOL> if n . box : <EOL> boxTop = n . box [ <NUM_LIT:3> ] <EOL> boxBottom = n . box [ <NUM_LIT:1> ] <EOL> boxWidth = n . box [ <NUM_LIT:2> ] - n . box [ <NUM_LIT:0> ] <EOL> else : <EOL> boxTop = g . getParent ( ) . info . ascender <EOL> boxBottom = g . getParent ( ) . info . descender <EOL> boxWidth = g . width <EOL> try : <EOL> leftX = n . angledLeftMargin or <NUM_LIT:0> + g . getParent ( ) . lib . get ( '<STR_LIT>' ) or <NUM_LIT:0> <EOL> rightX = n . width - n . angledRightMargin or <NUM_LIT:0> + g . getParent ( ) . lib . get ( '<STR_LIT>' ) or <NUM_LIT:0> <EOL> except : <EOL> leftX = rightX = <NUM_LIT:0> <EOL> topY = n . box [ <NUM_LIT:3> ] <EOL> bottomY = n . box [ <NUM_LIT:1> ] <EOL> topX = TX . getItalicOffset ( topY , italicAngle ) <EOL> bottomX = TX . getItalicOffset ( bottomY , italicAngle ) <EOL> box = ( <EOL> ( leftX + bottomX , bottomY ) , <EOL> ( leftX + topX , topY ) , <EOL> ( rightX + topX , topY ) , <EOL> ( rightX + bottomX , bottomY ) , <EOL> ( n . naked ( ) . angledBounds [ <NUM_LIT:2> ] - n . naked ( ) . angledBounds [ <NUM_LIT:0> ] , n . naked ( ) . angledBounds [ <NUM_LIT:3> ] - n . naked ( ) . angledBounds [ <NUM_LIT:1> ] ) <EOL> ) <EOL> else : <EOL> box = ( <EOL> ( n . box [ <NUM_LIT:0> ] , n . box [ <NUM_LIT:1> ] ) , <EOL> ( n . box [ <NUM_LIT:0> ] , n . box [ <NUM_LIT:3> ] ) , <EOL> ( n . box [ <NUM_LIT:2> ] , n . box [ <NUM_LIT:3> ] ) , <EOL> ( n . box [ <NUM_LIT:2> ] , n . box [ <NUM_LIT:1> ] ) , <EOL> ( n . box [ <NUM_LIT:2> ] - n . box [ <NUM_LIT:0> ] , n . box [ <NUM_LIT:3> ] - n . box [ <NUM_LIT:1> ] ) <EOL> ) <EOL> else : <EOL> box = None <EOL> return box <EOL> def drawBackground ( self , scale ) : <EOL> g = self . getGlyph ( ) <EOL> self . fillColor . setFill ( ) <EOL> slantCoordinates = self . slantPointCoordinates <EOL> italicSlantOffset = <NUM_LIT:0> <EOL> if self . offsetPointCoordinates : <EOL> italicSlantOffset = g . getParent ( ) . lib . get ( '<STR_LIT>' ) or <NUM_LIT:0> <EOL> color = self . fillColor . colorUsingColorSpaceName_ ( NSCalibratedRGBColorSpace ) <EOL> red = color . redComponent ( ) <EOL> green = color . greenComponent ( ) <EOL> blue = color . blueComponent ( ) <EOL> alpha = color . alphaComponent ( ) <EOL> fill ( red , green , blue , alpha ) <EOL> stroke ( red , green , blue , alpha ) <EOL> strokeWidth ( <NUM_LIT:1> * scale ) <EOL> dashLine ( <NUM_LIT:1> ) <EOL> fontSizeValue = <NUM_LIT:8> <EOL> fontSize ( fontSizeValue * scale ) <EOL> showCoordinates = self . w . showCoordinates . get ( ) <EOL> showDimensions = self . w . showDimensions . get ( ) <EOL> selectedBox = self . getBox ( selected = True ) <EOL> if selectedBox : <EOL> divisionsY = int ( self . w . divisionsRadioX . get ( ) ) <EOL> divisionsX = int ( self . w . divisionsRadioY . get ( ) ) <EOL> pt1 , pt2 , pt3 , pt4 , dimensions = selectedBox <EOL> pt1X , pt1Y = pt1 <EOL> pt2X , pt2Y = pt2 <EOL> pt3X , pt3Y = pt3 <EOL> pt4X , pt4Y = pt4 <EOL> pt1X += italicSlantOffset <EOL> pt2X += italicSlantOffset <EOL> pt3X += italicSlantOffset <EOL> pt4X += italicSlantOffset <EOL> width , height = dimensions <EOL> startRectX = pt1X <EOL> startRectY = pt1Y <EOL> rectWidth = width / float ( divisionsY ) <EOL> rectHeight = height / float ( divisionsX ) <EOL> if self . w . useItalic . get ( ) : <EOL> italicAngle = g . getParent ( ) . info . italicAngle or <NUM_LIT:0> <EOL> else : <EOL> italicAngle = <NUM_LIT:0> <EOL> margin = <NUM_LIT:0> <EOL> f = g . getParent ( ) <EOL> asc = f . info . ascender + f . info . unitsPerEm <EOL> desc = f . info . descender - f . info . unitsPerEm <EOL> ascOffset = TX . getItalicOffset ( asc - pt3Y , italicAngle ) <EOL> descOffset = TX . getItalicOffset ( desc - pt1Y , italicAngle ) <EOL> line ( pt1X + descOffset , desc , pt2X + ascOffset , asc ) <EOL> line ( pt4X + descOffset , desc , pt3X + ascOffset , asc ) <EOL> line ( pt1X - f . info . unitsPerEm , pt1Y , pt4X + f . info . unitsPerEm , pt1Y ) <EOL> line ( pt2X - f . info . unitsPerEm , pt2Y , pt3X + f . info . unitsPerEm , pt2Y ) <EOL> margin = <NUM_LIT:10> * scale <EOL> if showDimensions : <EOL> widthYBump = <NUM_LIT:0> <EOL> if italicAngle : <EOL> widthYBump = <NUM_LIT:20> * scale <EOL> widthString = '<STR_LIT>' % ( TX . formatStringValue ( width ) ) <EOL> widthXPos = pt2X + ( width / <NUM_LIT> ) + TX . getItalicOffset ( margin , italicAngle ) - <NUM_LIT:10> * scale <EOL> widthYPos = pt2Y + margin + widthYBump <EOL> if divisionsY > <NUM_LIT:1> : <EOL> subWidthString = '<STR_LIT>' % ( TX . formatStringValue ( width / divisionsY ) ) <EOL> text ( subWidthString , widthXPos , widthYPos ) <EOL> widthYPos += fontSizeValue * scale <EOL> font ( "<STR_LIT>" ) <EOL> text ( widthString , <EOL> widthXPos , <EOL> widthYPos ) <EOL> if divisionsY >= <NUM_LIT:1> : <EOL> xoffset = pt1X <EOL> for divY in range ( divisionsY + <NUM_LIT:1> ) : <EOL> if divY != <NUM_LIT:0> and divY != divisionsY : <EOL> line ( <EOL> xoffset - TX . getItalicOffset ( margin , italicAngle ) , <EOL> pt1Y - margin , <EOL> xoffset + TX . getItalicOffset ( pt2Y - pt1Y , italicAngle ) + TX . getItalicOffset ( margin , italicAngle ) , <EOL> pt3Y + margin <EOL> ) <EOL> if showCoordinates : <EOL> font ( "<STR_LIT>" ) <EOL> x , y = bezierTools . angledPoint ( ( xoffset , pt1Y ) , italicAngle , roundValue = italicAngle , reverse = - <NUM_LIT:1> ) <EOL> text ( '<STR_LIT:%s>' % ( TX . formatStringValue ( x - italicSlantOffset ) ) , xoffset - TX . getItalicOffset ( margin , italicAngle ) + <NUM_LIT:2> * scale , pt1Y - margin - fontSizeValue ) <EOL> if italicAngle != <NUM_LIT:0> : <EOL> x , y = bezierTools . angledPoint ( ( xoffset , pt1Y ) , italicAngle , roundValue = italicAngle , reverse = - <NUM_LIT:1> ) <EOL> text ( '<STR_LIT:%s>' % ( TX . formatStringValue ( x - italicSlantOffset ) ) , xoffset + TX . getItalicOffset ( pt3Y - pt1Y , italicAngle ) + TX . getItalicOffset ( margin , italicAngle ) + <NUM_LIT:2> * scale , pt3Y + margin ) <EOL> xoffset += rectWidth <EOL> margin = <NUM_LIT:10> * scale <EOL> if showDimensions : <EOL> heightString = '<STR_LIT>' % ( TX . formatStringValue ( height ) ) <EOL> heightXPos = pt4X + TX . getItalicOffset ( height / <NUM_LIT> , italicAngle ) + margin <EOL> heightYPos = pt4Y + ( height / <NUM_LIT> ) - fontSizeValue / <NUM_LIT:2> <EOL> if divisionsX > <NUM_LIT:1> : <EOL> heightYPos -= fontSizeValue * scale / <NUM_LIT:2> <EOL> subHeightString = '<STR_LIT>' % ( TX . formatStringValue ( height / divisionsX ) ) <EOL> text ( <EOL> subHeightString , <EOL> heightXPos , <EOL> heightYPos , <EOL> ) <EOL> heightYPos += fontSizeValue * scale <EOL> font ( "<STR_LIT>" ) <EOL> text ( heightString , <EOL> heightXPos , <EOL> heightYPos <EOL> ) <EOL> if divisionsX >= <NUM_LIT:1> : <EOL> yoffset = pt1Y <EOL> for divX in range ( divisionsX + <NUM_LIT:1> ) : <EOL> if divX != <NUM_LIT:0> and divX != divisionsX : <EOL> line ( <EOL> pt1X + TX . getItalicOffset ( yoffset - pt1Y , italicAngle ) - margin , <EOL> yoffset , <EOL> pt1X + TX . getItalicOffset ( yoffset - pt1Y , italicAngle ) + width + margin , <EOL> yoffset <EOL> ) <EOL> if showCoordinates : <EOL> font ( "<STR_LIT>" ) <EOL> text ( '<STR_LIT:%s>' % ( TX . formatStringValue ( yoffset ) ) , <EOL> pt1X + TX . getItalicOffset ( yoffset - pt1Y , italicAngle ) - margin - <NUM_LIT> * scale , <EOL> yoffset ) <EOL> yoffset += rectHeight <EOL> def becomeActive ( self ) : <EOL> """<STR_LIT>""" <EOL> self . fillColor = getExtensionDefaultColor ( self . DEFAULTKEY_FILLCOLOR , self . FALLBACK_FILLCOLOR ) <EOL> self . strokeColor = getExtensionDefaultColor ( self . DEFAULTKEY_STROKECOLOR , self . FALLBACK_STROKECOLOR ) <EOL> self . w = FloatingWindow ( ( <NUM_LIT> , <NUM_LIT> ) , "<STR_LIT>" , minSize = ( <NUM_LIT:100> , <NUM_LIT:100> ) , closable = False ) <EOL> self . w . viewOptions = RadioGroup ( ( <NUM_LIT:10> , <NUM_LIT:10> , <NUM_LIT> , <NUM_LIT:20> ) , <EOL> [ '<STR_LIT>' , '<STR_LIT>' ] , <EOL> callback = self . selectionCallback , isVertical = False , sizeStyle = "<STR_LIT>" ) <EOL> self . w . viewOptions . set ( getExtensionDefault ( self . DEFAULTKEY_SELECTION , <NUM_LIT:0> ) ) <EOL> self . w . useItalic = CheckBox ( ( <NUM_LIT> , <NUM_LIT:10> , <NUM_LIT:100> , <NUM_LIT:20> ) , "<STR_LIT>" , value = getExtensionDefault ( self . DEFAULTKEY_USEITALIC , True ) , sizeStyle = "<STR_LIT>" , callback = self . useItalicCallback ) <EOL> self . w . xLabel = TextBox ( ( <NUM_LIT:10> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:20> ) , "<STR_LIT>" , sizeStyle = "<STR_LIT>" ) <EOL> self . w . divisionsRadioX = Slider ( ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:20> ) , <EOL> value = getExtensionDefault ( self . DEFAULTKEY_DIVISIONSX , <NUM_LIT:1> ) , <EOL> minValue = <NUM_LIT:1> , <EOL> maxValue = <NUM_LIT:4> , <EOL> tickMarkCount = <NUM_LIT:4> , <EOL> stopOnTickMarks = True , <EOL> continuous = True , <EOL> sizeStyle = "<STR_LIT>" , <EOL> callback = self . divisionsXCallback ) <EOL> self . w . yLabel = TextBox ( ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:20> ) , "<STR_LIT:Y>" , sizeStyle = "<STR_LIT>" ) <EOL> self . w . divisionsRadioY = Slider ( ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:20> ) , <EOL> value = getExtensionDefault ( self . DEFAULTKEY_DIVISIONSY , <NUM_LIT:1> ) , <EOL> minValue = <NUM_LIT:1> , <EOL> maxValue = <NUM_LIT:4> , <EOL> tickMarkCount = <NUM_LIT:4> , <EOL> stopOnTickMarks = True , <EOL> continuous = True , <EOL> sizeStyle = "<STR_LIT>" , <EOL> callback = self . divisionsYCallback ) <EOL> self . w . drawGuidesButton = Button ( ( <NUM_LIT:10> , <NUM_LIT:100> , <NUM_LIT> , <NUM_LIT:20> ) , '<STR_LIT>' , callback = self . drawDivGuides , sizeStyle = "<STR_LIT>" ) <EOL> self . w . drawBoxGuidesButton = Button ( ( <NUM_LIT> , <NUM_LIT:100> , <NUM_LIT> , <NUM_LIT:20> ) , '<STR_LIT>' , callback = self . drawBoxGuides , sizeStyle = "<STR_LIT>" , ) <EOL> x = <NUM_LIT:10> <EOL> y = <NUM_LIT> <EOL> self . w . showCoordinates = CheckBox ( ( x , y , <NUM_LIT> , <NUM_LIT:20> ) , "<STR_LIT>" , value = getExtensionDefault ( self . DEFAULTKEY_SHOWCOORDINATES , True ) , sizeStyle = "<STR_LIT>" , callback = self . showCoordinatesCallback ) <EOL> x += <NUM_LIT> <EOL> self . w . showDimensions = CheckBox ( ( x , y , <NUM_LIT> , <NUM_LIT:20> ) , "<STR_LIT>" , value = getExtensionDefault ( self . DEFAULTKEY_SHOWDIMENSIONS , True ) , sizeStyle = "<STR_LIT>" , callback = self . showDimensionsCallback ) <EOL> x += <NUM_LIT> <EOL> color = getExtensionDefaultColor ( self . DEFAULTKEY_FILLCOLOR , self . FALLBACK_FILLCOLOR ) <EOL> self . w . color = ColorWell ( ( x , y , <NUM_LIT:30> , <NUM_LIT> ) , <EOL> color = color , <EOL> callback = self . colorCallback ) <EOL> self . setUpBaseWindowBehavior ( ) <EOL> self . w . open ( ) <EOL> def becomeInactive ( self ) : <EOL> """<STR_LIT>""" <EOL> self . windowCloseCallback ( None ) <EOL> self . w . close ( ) <EOL> def colorCallback ( self , sender ) : <EOL> """<STR_LIT>""" <EOL> selectedColor = sender . get ( ) <EOL> r = selectedColor . redComponent ( ) <EOL> g = selectedColor . greenComponent ( ) <EOL> b = selectedColor . blueComponent ( ) <EOL> a = <NUM_LIT:1> <EOL> strokeColor = NSColor . colorWithCalibratedRed_green_blue_alpha_ ( r , g , b , a ) <EOL> setExtensionDefaultColor ( self . DEFAULTKEY_FILLCOLOR , selectedColor ) <EOL> setExtensionDefaultColor ( self . DEFAULTKEY_STROKECOLOR , strokeColor ) <EOL> self . fillColor = selectedColor <EOL> self . strokeColor = strokeColor <EOL> self . updateView ( ) <EOL> def showCoordinatesCallback ( self , sender ) : <EOL> setExtensionDefault ( self . DEFAULTKEY_SHOWCOORDINATES , sender . get ( ) ) <EOL> self . updateView ( ) <EOL> def showDimensionsCallback ( self , sender ) : <EOL> setExtensionDefault ( self . DEFAULTKEY_SHOWDIMENSIONS , sender . get ( ) ) <EOL> self . updateView ( ) <EOL> def divisionsXCallback ( self , sender ) : <EOL> setExtensionDefault ( self . DEFAULTKEY_DIVISIONSX , sender . get ( ) ) <EOL> self . updateView ( ) <EOL> def divisionsYCallback ( self , sender ) : <EOL> setExtensionDefault ( self . DEFAULTKEY_DIVISIONSY , sender . get ( ) ) <EOL> self . updateView ( ) <EOL> def selectionCallback ( self , sender ) : <EOL> setExtensionDefault ( self . DEFAULTKEY_SELECTION , sender . get ( ) ) <EOL> self . updateView ( ) <EOL> def useItalicCallback ( self , sender ) : <EOL> setExtensionDefault ( self . DEFAULTKEY_USEITALIC , sender . get ( ) ) <EOL> self . updateView ( ) <EOL> def drawDivGuides ( self , sender ) : <EOL> """<STR_LIT>""" <EOL> g = self . getGlyph ( ) <EOL> if self . w . viewOptions . get ( ) == <NUM_LIT:0> : <EOL> selectedBox = self . getBox ( selected = True ) <EOL> else : <EOL> selectedBox = self . getBox ( selected = False ) <EOL> if selectedBox : <EOL> divisionsX = int ( self . w . divisionsRadioY . get ( ) ) <EOL> divisionsY = int ( self . w . divisionsRadioX . get ( ) ) <EOL> pt1 , pt2 , pt3 , pt4 , dimensions = selectedBox <EOL> pt1X , pt1Y = pt1 <EOL> pt2X , pt2Y = pt2 <EOL> pt3X , pt3Y = pt3 <EOL> pt4X , pt4Y = pt4 <EOL> width , height = dimensions <EOL> italicAngle = <NUM_LIT:0> <EOL> if self . w . useItalic . get ( ) : <EOL> italicAngle = g . getParent ( ) . info . italicAngle or <NUM_LIT:0> <EOL> g . prepareUndo ( ) <EOL> offset = pt1X <EOL> advance = float ( width ) / divisionsX <EOL> for i in range ( divisionsX - <NUM_LIT:1> ) : <EOL> xmid = offset + advance <EOL> g . addGuide ( ( xmid , pt1Y ) , <NUM_LIT> + italicAngle ) <EOL> offset += advance <EOL> offset = pt1Y <EOL> advance = float ( height ) / divisionsY <EOL> for i in range ( divisionsY - <NUM_LIT:1> ) : <EOL> ymid = offset + advance <EOL> g . addGuide ( ( pt1X , ymid ) , <NUM_LIT:0> ) <EOL> offset += advance <EOL> g . performUndo ( ) <EOL> def drawBoxGuides ( self , sender ) : <EOL> """<STR_LIT>""" <EOL> g = self . getGlyph ( ) <EOL> selectedBox = self . getBox ( selected = True ) <EOL> if selectedBox : <EOL> divisionsX = int ( self . w . divisionsRadioY . get ( ) ) <EOL> divisionsY = int ( self . w . divisionsRadioX . get ( ) ) <EOL> pt1 , pt2 , pt3 , pt4 , dimensions = selectedBox <EOL> pt1X , pt1Y = pt1 <EOL> pt2X , pt2Y = pt2 <EOL> pt3X , pt3Y = pt3 <EOL> pt4X , pt4Y = pt4 <EOL> width , height = dimensions <EOL> italicAngle = <NUM_LIT:0> <EOL> if self . w . useItalic . get ( ) : <EOL> italicAngle = g . getParent ( ) . info . italicAngle or <NUM_LIT:0> <EOL> g . prepareUndo ( ) <EOL> g . addGuide ( ( pt1X , pt1Y ) , <NUM_LIT> + italicAngle ) <EOL> g . addGuide ( ( pt3X , pt3Y ) , <NUM_LIT> + italicAngle ) <EOL> g . addGuide ( ( pt1X , pt1Y ) , <NUM_LIT:0> ) <EOL> g . addGuide ( ( pt3X , pt3Y ) , <NUM_LIT:0> ) <EOL> g . performUndo ( ) <EOL> def updateView ( self , sender = None ) : <EOL> UpdateCurrentGlyphView ( ) <EOL> installTool ( BoundingTool ( ) ) </s>
