# Path: drawingDimensioning/py3_helpers.py
#     def unicode(*args):
# def translate(*args):
# def encode_if_py2(unicode_object):
# def map(function, arg):
# 
# Path: drawingDimensioning/svgLib.py
# class SvgTextRenderer:
#     def __init__(self, font_family='inherit', font_size='inherit', fill='rgb(0,0,0)'):
#         self.font_family = font_family
#         self.font_size = font_size
#         self.fill = fill
#     def __call__(self, x, y, text, text_anchor='inherit', rotation=None):
#         '''
#         text_anchor = start | middle | end | inherit
#         rotation is in degress, and is done about x,y
#         '''
#         try:
#             XML = '''<text x="%f" y="%f" font-family="%s" font-size="%s" fill="%s" text-anchor="%s" %s >%s</text>'''  % (  x, y, self.font_family, self.font_size,  self.fill, text_anchor, 'transform="rotate(%f %f,%f)"' % (rotation,x,y) if rotation != None else '', text )
#         except UnicodeDecodeError:
#             text_utf8 = unicode( text, 'utf8' )
#             XML = '''<text x="%f" y="%f" font-family="%s" font-size="%s" fill="%s" text-anchor="%s" %s >%s</text>'''  % (  x, y, self.font_family, self.font_size,  self.fill, text_anchor, 'transform="rotate(%f %f,%f)"' % (rotation,x,y) if rotation != None else '', text_utf8 )
#         return XML
#     def __repr__(self):
#         return '<svgLib_dd.SvgTextRenderer family="%s" font_size="%s" fill="%s">' % (self.font_family, self.font_size, self.fill )


import sys
import FreeCAD
from drawingDimensioning.py3_helpers import unicode, unicode_type, map, encode_if_py2
from PySide import QtGui, QtCore, QtSvg
from drawingDimensioning.svgConstructor import SvgTextRenderer
    b = (v >>  8) - (v >> 16 << 8 )
    return r, g, b 

def unsignedToRGBText(v):
    return 'rgb(%i,%i,%i)' % unsignedToRGB(v)


def DimensioningTaskDialog_generate_row_hbox( label, inputWidget ):
    hbox = QtGui.QHBoxLayout()
    hbox.addWidget( QtGui.QLabel(label) )
    hbox.addStretch(1)
    if inputWidget != None:
        hbox.addWidget(inputWidget)
    return hbox

class RepeatCheckBox:
    def __init__(self, dimensioningProcess, endFunction_parm_name):
        self.d = dimensioningProcess
        self.endFunction = dimensioningProcess.endFunction
        self.parmName = endFunction_parm_name
        self.defaultValue = True
        self.dd_parms = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Drawing_Dimensioning")
    def stateChanged( self, arg1):
        c = self.checkbox.isChecked()
        self.d.endFunction = self.endFunction if self.checkbox.isChecked() else None
        self.dd_parms.SetBool( self.parmName, c )
    def generateWidget( self, dimensioningProcess ):
        self.checkbox = QtGui.QCheckBox('repeat')
        c = self.dd_parms.GetBool( self.parmName, self.defaultValue )
        self.checkbox.setChecked( c )

# Path: drawingDimensioning/py3_helpers.py
#     def unicode(*args):
# def translate(*args):
# def encode_if_py2(unicode_object):
# def map(function, arg):
# 
# Path: drawingDimensioning/svgLib.py
# class SvgTextRenderer:
#     def __init__(self, font_family='inherit', font_size='inherit', fill='rgb(0,0,0)'):
#         self.font_family = font_family
#         self.font_size = font_size
#         self.fill = fill
#     def __call__(self, x, y, text, text_anchor='inherit', rotation=None):
#         '''
#         text_anchor = start | middle | end | inherit
#         rotation is in degress, and is done about x,y
#         '''
#         try:
#             XML = '''<text x="%f" y="%f" font-family="%s" font-size="%s" fill="%s" text-anchor="%s" %s >%s</text>'''  % (  x, y, self.font_family, self.font_size,  self.fill, text_anchor, 'transform="rotate(%f %f,%f)"' % (rotation,x,y) if rotation != None else '', text )
#         except UnicodeDecodeError:
#             text_utf8 = unicode( text, 'utf8' )
#             XML = '''<text x="%f" y="%f" font-family="%s" font-size="%s" fill="%s" text-anchor="%s" %s >%s</text>'''  % (  x, y, self.font_family, self.font_size,  self.fill, text_anchor, 'transform="rotate(%f %f,%f)"' % (rotation,x,y) if rotation != None else '', text_utf8 )
#         return XML
#     def __repr__(self):
#         return '<svgLib_dd.SvgTextRenderer family="%s" font_size="%s" fill="%s">' % (self.font_family, self.font_size, self.fill )


# Path: drawingDimensioning/command/preferences.py
import sys
import FreeCAD
from drawingDimensioning.py3_helpers import unicode, unicode_type, map, encode_if_py2
from PySide import QtGui, QtCore, QtSvg
from drawingDimensioning.svgConstructor import SvgTextRenderer

    b = (v >>  8) - (v >> 16 << 8 )
    return r, g, b 

def unsignedToRGBText(v):
    return 'rgb(%i,%i,%i)' % unsignedToRGB(v)


def DimensioningTaskDialog_generate_row_hbox( label, inputWidget ):
    hbox = QtGui.QHBoxLayout()
    hbox.addWidget( QtGui.QLabel(label) )
    hbox.addStretch(1)
    if inputWidget != None:
        hbox.addWidget(inputWidget)
    return hbox

class RepeatCheckBox:
    def __init__(self, dimensioningProcess, endFunction_parm_name):
        self.d = dimensioningProcess
        self.endFunction = dimensioningProcess.endFunction
        self.parmName = endFunction_parm_name
        self.defaultValue = True
        self.dd_parms = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Drawing_Dimensioning")
    def stateChanged( self, arg1):
        c = self.checkbox.isChecked()
        self.d.endFunction = self.endFunction if self.checkbox.isChecked() else None
        self.dd_parms.SetBool( self.parmName, c )
    def generateWidget( self, dimensioningProcess ):
        self.checkbox = QtGui.QCheckBox('repeat')
        c = self.dd_parms.GetBool( self.parmName, self.defaultValue )
        self.checkbox.setChecked( c )

        self.d.endFunction = self.endFunction if self.checkbox.isChecked() else None