# -*- coding: utf-8 -*-
from __future__ import unicode_literals
"""
***************************************************************************
*   Copyright (c) 2014 2015 2016 2017 2018 2019 2020 2021 <mario52>       *
*                                                                         *
*   This file is a supplement to the FreeCAD CAx development system.      *
*                                                                         *
*   This program is free software; you can redistribute it and/or modify  *
*   it under the terms of the GNU Lesser General Public License (LGPL)    *
*   as published by the Free Software Foundation; either version 2 of     *
*   the License, or (at your option) any later version.                   *
*   for detail see the LICENCE text file.                                 *
**                                                                       **
*   Use at your own risk. The author assumes no liability for data loss.  *
*              It is advised to backup your data frequently.              *
*             If you do not trust the software do not use it.             *
**                                                                       **
*   This software is distributed in the hope that it will be useful,      *
*   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
*   GNU Library General Public License for more details.                  *
*                                                                         *
*   You should have received a copy of the GNU Library General Public     *
*   License along with this macro; if not, write to the Free Software     *
*   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  *
*   USA                                                                   *
***************************************************************************
*   http://www.freecadweb.org/wiki/index.php?title=Macro_FCCircularText   *
*           WARNING! All changes in this file will be lost and            *
*                  may cause malfunction of the program                   *
***************************************************************************
"""
# FCCircularText.FCMacro    # Icon fromTheme FreeCAD
# ver 0.14-2 #00.14-4 #00.15 (rmu)#00.16 #0.16b #0.16c #0.16d #0.17 2020/09/26 #0.17b 2020/09/28#0.18 2021/01/19 #0.19 2021/03/15 #0.20 2021/04/05
#
##################################################################################################
#OS: Windows 10 (10.0)
#Word size of FreeCAD: 64-bit
#Version: 0.20.24665 (Git)
#Build type: Release
#Branch: master
#Hash: 5d49bf78de785a536f941f1a6d06d432582a95d3
#Python version: 3.8.8
#Qt version: 5.12.9
#Coin version: 4.0.0
#OCC version: 7.5.1
#Locale: French/Mars (fr_MA)
##################################################################################################
#
__Title__    = "FCCircularText"
__Author__   = "Mario52"
__Version__  = "0.20"
__Date__     = "2021/04/05" #YYYY/MMM/DD

__Comment__  = "This macro creates a text around a cylinder"
__Web__      = "https://forum.freecadweb.org/viewtopic.php?f=3&t=7384%22"
__Wiki__     = "https://wiki.freecadweb.org/Macro_FCCircularText"
__Icon__     = "/usr/lib/freecad/Mod/plugins/icons/FCCircularTextButtom.png"
__IconW__    = "C:/Users/YourUserName/AppData/Roaming/FreeCAD/Macro"
__Help__     = "start the macro and follow the instructions"
__Status__   = "stable"
__Requires__ = "freecad 0.19 and higher"
__Communication__ = "https://wiki.freecadweb.org/index.php?title=User:Mario52"
#

import PySide2
from PySide2 import (QtWidgets, QtCore, QtGui)
from PySide2.QtWidgets import (QWidget, QApplication, QSlider, QGraphicsView, QGraphicsScene, QVBoxLayout, QStyle)
from PySide2.QtGui import (QPainter, QColor, QIcon)
from PySide2.QtSvg import *

import Draft, Part, FreeCAD, math, PartGui, FreeCADGui
from math import sqrt, pi, sin, cos, asin, degrees, radians, tan
from FreeCAD import Base
import os, time, sys

App=FreeCAD
Gui=FreeCADGui
import WebGui

#### Detect version macro ########################################### #22/03/2021
import urllib
from urllib import request
#### Detect version macro ########################################### #22/03/2021
def vesionSearch():
    try:
        contentPage = request.urlopen("https://wiki.freecadweb.org/Macro_" + __Title__).readlines()
        versionDetect = dateDetect = ""
        effacer = 0
        for i in contentPage:
            if "ctEven macro-version" in str(i):
                versionDetect = str((str(i).split(">")[1]))
                versionDetect = versionDetect.split("\\")[0]
            if "ctEven macro-date" in str(i):
                dateDetect = str((str(i).split(">")[1]))
                dateDetect = dateDetect.split("\\")[0]
            if (versionDetect != "") and (dateDetect != ""):
                break
        try:
            if (versionDetect == __Version__) and (dateDetect == __Date__):
                None
            else:
                msg = ("New version availlable : " + "\n" + 
                      str(versionDetect) + ":" + str(dateDetect) + "\n" + 
                      "You can install with AddonManager")
                FreeCAD.Console.PrintMessage("your actual version    : " + str(__Version__) + " : " + str(__Date__) + "\n")
                FreeCAD.Console.PrintMessage("new version availlable : " + str(versionDetect) + " : " + str(dateDetect) + "\n")
                diag = QtWidgets.QMessageBox(QtWidgets.QMessageBox.Information, 'New Version', msg)
                diag.setWindowModality(QtCore.Qt.ApplicationModal)
                diag.setWindowFlags(PySide2.QtCore.Qt.WindowStaysOnTopHint)  # PySide cette fonction met la fenetre en avant
                diag.exec_()
        except Exception:
            None
        return versionDetect, dateDetect
    except Exception:
        FreeCAD.Console.PrintError("Not search version not connected for testing or internal error" + "\n")
#
global switchVersionSearch; switchVersionSearch = 0  # Search version switchable in 
                                                     # Tools/Edit parameter/BaseApp/Preferences/Macros/FCMmacros/FCCircularText
switchVersionSearch = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).GetBool("switchVersionSearch")
if switchVersionSearch == 1:
    vesionSearch()
#### Detect version macro ###########################################

import sys,traceback
def sayexc(mess=''):
    exc_type, exc_value, exc_traceback = sys.exc_info()
    ttt=repr(traceback.format_exception(exc_type, exc_value,exc_traceback))
    lls=eval(ttt)
    l=len(lls)
    l2=lls[(l-3):]
    FreeCAD.Console.PrintError(mess + "\n" +"-->  ".join(l2))

import platform
global verPython ;  verPython = sys.version_info

class ConfigManager():

    def __init__(self,name):
        self.name="Plugins/"+name

    def get(self,param,default,defaultWindows=None,defaultMac=None):
            global verPython
            os=platform.system()
            #os='Linux'
            #os='Windows'
            #os='Darwin'
            v=False
            if not defaultWindows:
                defaultWindows=default
            if not defaultMac:
                defaultMac=default
            if os =='Windows' :
                default= defaultWindows
            if os =='Darwin' :
                default= defaultMac

            if verPython.major < 3:
                if default.__class__ == unicode:
                    default=str(default)
            else:
#                encoder = str(encoder)
#                return encoder
                None

            if default.__class__ == int:
                v=FreeCAD.ParamGet('User parameter:'+self.name).GetInt(param)
                if not v:
                    FreeCAD.ParamGet('User parameter:'+self.name).SetInt(param,default)
            if default.__class__ == float:
                v=FreeCAD.ParamGet('User parameter:'+self.name).GetFloat(param)
                if not v:
                    FreeCAD.ParamGet('User parameter:'+self.name).SetFloat(param,default)
            if default.__class__ == str:
                v=FreeCAD.ParamGet('User parameter:'+self.name).GetString(param)
                if not v:
                    FreeCAD.ParamGet('User parameter:'+self.name).SetString(param,default)
            if default.__class__ == bool:
                v=FreeCAD.ParamGet('User parameter:'+self.name).GetBool(param)
                if not v:
                    FreeCAD.ParamGet('User parameter:'+self.name).SetBool(param,default)
            if not v:
                v=default
            return v

global ui               ;ui = ""
global s                ;s  = ""
global points           ;points   = 0.0
global coor_X           ;coor_X   = 0.0
global coor_Y           ;coor_Y   = 0.0
global coor_Z           ;coor_Z   = 0.0
global vec              ;vec      = 0

global PolicePath

cm=ConfigManager("circular text")
PolicePath=cm.get("PolicePath","/usr/share/fonts/","C:/Windows/Fonts/ARIAL.TTF","/Library/Fonts/Arial.ttf")

import FreeCADGui
Gui=FreeCADGui
global rayon            ;rayon            = 10.0               # radius
global texte            ;texte            = "FreeCAD the best" #FreeCad The Best your text
global debut            ;debut            = 0                  # begin text
global rotation         ;rotation         = 360                # must exceed the number of characters of text
global SizeCaractere    ;SizeCaractere    = 2.0                # size font

global precision        ;precision        = 0.0                #
global correctionAngle  ;correctionAngle  = 5.0                #
global correctionRayon  ;correctionRayon  = 0.15               #
global debout           ;debout           = 1                  # 1=stand   0=flat
global exterieur        ;exterieur        = 1                  # 1=exteral 0=internal
global baseHelix        ;baseHelix        = 0.0                # base of helix
global endHelix         ;endHelix         = 0.0                # end of helix (heigth)
global pasHelix         ;pasHelix         = 2.0                # Pas of helix
global nombreCarParTour ;nombreCarParTour = 10                 # number char by Pas

global PlacementX       ;PlacementX       = 0.0                # Placement character axis X
global PlacementY       ;PlacementY       = 0.0                # Placement characher axis Y
global PlacementZ       ;PlacementZ       = 0.0                # Placement characher axis Z

global inclinaisonX     ;inclinaisonX     = 0                  # inclination character axis X
global inclinaisonY     ;inclinaisonY     = 0                  # inclination character axis Y
global inclinaisonZ     ;inclinaisonZ     = 0                  # inclination character axis Z + correctionAngle

global cercleClock      ;cercleClock      = rayon              # diameter support clock
global nombreFaces      ;nombreFaces      = 0                  # number Faces of support 0=none 1=circle 2=rectangle 3=triangle 4,5 ... polygon
global romain           ;romain           = 0                  # number type roman or arabic
global redressement     ;redressement     = 0                  # character V or circular

global comP             ;comP             = ""                 # contener 
global nameL            ;nameL            = ""                 # contener 
global epaisseurExtrus  ;epaisseurExtrus  = 0.0                # epaisseur extrusion caracteres
global epaisSupportClock;epaisSupportClock= 0.0                # epaisseur extrusion support clock

global compount1        ;compount1        = 0                  # cree un compose des caracteres

#### for delete last object
global FcString         ##;FcString        = ""                 # conteneur
global FcStringPoints   ##;FcStringPoints  = ""                 # conteneur
global circleGuide      ##;circleGuide     = ""                 # cercle guide repere
global helixGuide       ##;helixGuide      = ""                 # helix guide repere
global suppExtrude      ##;suppExtrude     = ""                 # extrusion support clock
global createCompound   ##;createCompound  = ""                 # compound texte
#### for delete last object

# pointColor
global red              ;red   = 1.0  # 1 = 255 [ color num x = (1/255)*x ]
global green            ;green = 0.0  #
global blue             ;blue  = 0.0  #

#### section color
global setStyleBase     ; setStyleBase     = "background-color: QPalette.Base"
global setStylePathR    ; setStylePathR    = "background-color: #F8E0E0"   # Red   (248, 224, 224)
global setStylePathG    ; setStylePathG    = "background-color: #E0F8E0"   # Green (224, 248, 224)
global setStyleRed      ; setStyleRed      = "background-color: #e00000"   # rgb   (224, 0, 0)
global setStyleOrange   ; setStyleOrange   = "background-color: #ffa500"   # rgb   (255, 165, 0)
global setStyleBlueLight; setStyleBlueLight= "background-color: #c3d0e8"   # rgb   (195, 208, 232)

if FreeCAD.ParamGet("User parameter:BaseApp/Preferences/MainWindow").GetString("StyleSheet") != "":
    setStyleBlueLight = setStylePathR = setStylePathG = setStyleRed = setStyleOrange = setStyleBase
    #print("StyleSheet desactivated")
#### section color

#path#################################################################
global path                                                          #
#path  = FreeCAD.ConfigGet("AppHomePath")                             # path FreeCAD installation
#path  = FreeCAD.ConfigGet("UserAppData")                             # path FreeCAD User data
#path  = "your path"                                                  # your directory path
param = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macro") # macro path
path  = param.GetString("MacroPath","") + "/"                        # macro path
path  = path.replace("\\","/")                                       # convert the "\" to "/"
#FreeCAD.Console.PrintMessage( "Path for the icons : " + path  + "\n")# 
######################################################################

#### Section Icones ####
## icon fromTheme by FreeCAD
## base64 easyw-fc method
## https://forum.freecadweb.org/viewtopic.php?f=9&t=24742&start=100#p363271
import base64
#FCCText_Icon_b64=\
#"""
#[encoded data, 96184 characters]
#"""
####
outDoor_Icon_b64=\
"""
[encoded data, 8632 characters]
"""
outDoorWord_Icon_b64=\
"""
[encoded data, 8220 characters]
"""
inDoor_Icon_b64=\
"""
[encoded data, 6188 characters]
"""
inDoorWord_Icon_b64=\
"""
[encoded data, 6204 characters]
"""
FlatInDoor_Icon_b64=\
"""
[encoded data, 4824 characters]
"""
FlatInDoorWord_Icon_b64=\
"""
[encoded data, 5032 characters]
"""
FlatOutDoor_Icon_b64=\
"""
[encoded data, 10056 characters]
"""
FlatOutDoorWord_Icon_b64=\
"""
[encoded data, 9220 characters]
"""
####
helix_Icon_b64=\
"""
[encoded data, 16176 characters]
"""
####
ClockArabicAxis_Icon_b64=\
"""
[encoded data, 4252 characters]
"""
ClockRomanAxis_Icon_b64=\
"""
iVBORw0KGgoAAAANSUhEUgAAAMgAAABaCAIAAABylI6BAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAKnRFWHRBdXRob3IARnJlZUNBRCAoaHR0cDovL3d3dy5mcmVlY2Fkd2ViLm9yZylLpZ5SAAAAKHRFWHRDcmVhdGlvbiBUaW1lAHZlbi4gbWFycyAyNiAyMzozOToyOCAyMDIxNyAJugAAAYp6VFh0RGVzY3JpcHRpb24AACiRVZLdTuMwEIXv+xSW7+P/3W0iN4gFIa1E0YpSxK0Jo2AgDnLcpvv2a6dNwb6wdGaOP8+MrS8O3Qfagx9s71aYE4YRuKZ/sa5d4e3DTbHEFzVa6PWf35coet1QHQa7wq8hfFaUjuNIRkl631LBGKdP69tN8wqdKawbgnENYBT9levvTAfDp2ngmL/tGxOmO0+ktx34F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Lk7mMJ41cv3Abwyw9PrF64DRJODYgzTxazkyPr4weXH55ALKQmX5JOBAeJFUtkwyuPGIArj046Mggplv/I2scCcPXPk7pWuuq1rQB31oL6WEFAYsUSuJ/SIcUKAhIrFhCbZjn215d2LcT0y2kLAcQ5TRSO6aMIttmpwJqavvLbBkJBpE+FRDCROxUSgYUUi/AEWW+QEgFHfcVasWCTrvGWe8fj1oj7qy33jrt3SAu73thhmNZPf/c7TwrLannQn94TBZMIY1D7Y/zTD2DFgk32GucQkPNuZJrPa1q6xu1FQevDft8dkpmP+oqFicGf648ZgOz5hQC//vhM9vxCeH830v5aJV+3lAT1FYsx3HhyBkD2/ELG7AaO1Z95pljOk4ogvvHkjO+uyNgnFIplk2S0xws/CKX82WRhkyuE5z7WxL+RFwD85tOBaRXLzbJ5BbrGO36fnCJc8XpRbPhl6vppufl0QNeKlmvxJw0DYVGsW88GdW17KiPW7qOWzSu49WzQvXVWrguJn23ColiYEK3bzwedVU6uWI6jAGDJ3HyA334+uGRufpJD3IfLPqL8EoToEfvbz4dEfMQtxq1PQOy5DMO0HB6b2XWpfbmChEixXo7xF0O6tm3J3DwAAB9/MTSjyBEITx/rVbDTGaZ2lch1SSDFmpk7/57Vta3urhK5LgmkWLPgl/+GpwYWuS4hrKtr2G8bCAUhxSI8gfpYhCeQYhGe8D/VKzz4EoGwzAAAAABJRU5ErkJggg==
"""
####
PathBase_Icon_b64=\
"""
[encoded data, 5816 characters]
"""
PathCenter_Icon_b64=\
"""
[encoded data, 5576 characters]
"""
PathTop_Icon_b64=\
"""
[encoded data, 5564 characters]
"""
PathBaseOrthogonal_Icon_b64=\
"""
[encoded data, 5352 characters]
"""
PathCenterOrthogonal_Icon_b64=\
"""
[encoded data, 5144 characters]
"""
PathTopOrthogonal_Icon_b64=\
"""
[encoded data, 5252 characters]
"""
####



helpIcon = [
"24 24 4 1",
"   c None",
".  c #016AC5",
"+  c #F8F8FF",
"@  c #FFFFFF",
"........................",
".++++++++++++++++++++++.",
".++++++++++++++++++++++.",
".++..................++.",
".++..................++.",
".++......@@@@@@......++.",
".++.....@@@@@@@@.....++.",
".++.....@@@..@@@.....++.",
".++.....@@....@@.....++.",
".++.....@@....@@.....++.",
".++...........@@.....++.",
".++..........@@@.....++.",
".++.........@@@......++.",
".++........@@@.......++.",
".++........@@........++.",
".++........@@........++.",
".++..................++.",
".++........@@........++.",
".++........@@........++.",
".++..................++.",
".++..................++.",
".++++++++++++++++++++++.",
".++++++++++++++++++++++.",
"........................"]

executeIcon = [
"24 24 3 1",
"   c None",
".  c #4E9A06",
"+  c #FFFFFF",
"                        ",
"                        ",
"                        ",
"                  .     ",
"                 .+.    ",
"                .+.+.   ",
"               .+...+.  ",
"              .+.....+. ",
"     .       .+.......+.",
"    .+.     .+.......+. ",
"   .+.+.   .+.......+.  ",
"  .+...+. .+.......+.   ",
" .+.....+.+.......+.    ",
".+.......+.......+.     ",
" .+.............+.      ",
"  .+...........+.       ",
"   .+.........+.        ",
"    .+.......+.         ",
"     .+.....+.          ",
"      .+...+.           ",
"       .+.+.            ",
"        .+.             ",
"         .              ",
"                        "]

quitIcon = [
"24 24 3 1",
"   c None",
".  c #FFFFFF",
"+  c #CC0000",
"          ....          ",
"++++++++++....++++++++++",
"+.......++....++.......+",
"+.......++....++.......+",
"+.......++....++.......+",
"+...++++++....++++++...+",
"+...++++++....++++++...+",
"+...+++++......+++++...+",
"+...+++++......+++++...+",
"+...+++++......+++++...+",
"+...+++++......+++++...+",
"+...+++++......+++++...+",
"+...+++++......+++++...+",
"+...++++++++++++++++...+",
"+...++++++++++++++++...+",
"+...++++++++++++++++...+",
"+...++++++++++++++++...+",
"+...++++++++++++++++...+",
"+...++++++++++++++++...+",
"+...++++++++++++++++...+",
"+......................+",
"+......................+",
"+......................+",
"++++++++++++++++++++++++"]

resetIcon = [
"24 24 3 1",
"   c None",
".  c #3465A4",
"+  c #888A85",
"                        ",
"      ........          ",
"     .++++++++.         ",
"    .++..+....+.  ..... ",
"    .+.. .+....+. .+++. ",
"    .+.   .+....+..+.+. ",
"    ...    .+....+.+.+. ",
"            .+....+..+. ",
"             .+......+. ",
"              .+.....+. ",
"               .+....+. ",
"  ......        .+...+. ",
"  .++++.         .++++. ",
"  .+...+.        ...... ",
"  .+....+.              ",
"  .+.....+.             ",
"  .+......+.            ",
"  .+..+....+.           ",
"  .+.+.+....+.    ...   ",
"  .+.+..+....+.   .+.   ",
"  .+++. .+....+. ..+.   ",
"  .....  .+....+..++.   ",
"          .++++++++.    ",
"           ........     "]

setIconNoReset = [
"24 24 4 1",
" 	c None",
".	c #A40000",
"+	c #3465A4",
"@	c #888A85",
"                        ",
"      ++++++++          ",
"     +@@@@@@@@+         ",
"    +@@++@++++@+  +++++ ",
"    +@++ +@++++@+ +@@@+ ",
".   +@+   +@++++@++@+@+.",
"... +++    +@++++@+@+...",
".....       +@++++@.....",
".......      +@++.......",
" ........     +........ ",
"   ........  ........@+ ",
"  +++..............++@+ ",
"  +@@@@..........+@@@@+ ",
"  +@+++..........++++++ ",
"  +@+..............     ",
"  +........  ........   ",
" ........+@+   ........ ",
".......++++@+    .......",
".....@+@++++@+    +.....",
"...@+@++@++++@+   +@+...",
". +@@@+ +@++++@+ ++@+  .",
"  +++++  +@++++@++@@+   ",
"          +@@@@@@@@+    ",
"           ++++++++     "
]

standIcon = [
"16 16 9 1",
"   c None",
".  c #010400",
"+  c #28090D",
"@  c #4C0000",
"#  c #770000",
"$  c #AE0000",
"%  c #262826",
"&  c #CB0000",
"*  c #FD0705",
"***********     ",
"***********     ",
"**  ***  **     ",
"**  *...........",
"    *...........",
"    *..  ...  ..",
"    ***  ...    ",
"    ***  ...    ",
"    ***  ...    ",
"    ***  ...    ",
"    ***  ...    ",
"   ***** ...    ",
"         ...    ",
"         ...    ",
"        .....   ",
"                "]

flatIcon = [
"16 16 9 1",
"   c None",
".  c #020400",
"+  c #2B0500",
"@  c #620502",
"#  c #770301",
"$  c #970300",
"%  c #B40100",
"&  c #E60002",
"*  c #FE0004",
"                ",
"                ",
"                ",
"                ",
"    **    .     ",
"   ***   ...    ",
"   **    ...    ",
"  ***   ..      ",
"  ***   ..      ",
"  ****&#...     ",
" *****$+.....%  ",
" **  &.+%@...@. ",
" **  ..#*&%@....",
"**** ...  *&$...",
" ***  ..   ** ..",
"               ."]

romanIcon = [
"16 16 5 1",
"   c None",
".  c #FD9806",
"+  c #FD9904",
"@  c #FD9905",
"#  c #FD9906",
"                ",
"                ",
"             @@ ",
"         @@@@@  ",
"     @@@@@  @@  ",
"  @@@@  @@  @@  ",
"@@  @@  @@   @@ ",
"@@@ @@   @@  @@ ",
" @@@@    @@  @@ ",
"  +@@    @@  @@ ",
"   #@@@   @  @@@",
"  @@ .@@  @@@@  ",
"  @#  @@@@@     ",
" +@@@@@         ",
" @@             ",
"                "]

arabicIcon = [
"16 16 5 1",
"   c None",
".  c #F6972B",
"+  c #F6982B",
"@  c #F5972B",
"#  c #F7982B",
"                ",
"                ",
"                ",
"          ..    ",
"   ..   .....   ",
"  ...       ..  ",
"    .      ..   ",
"    .+     ..   ",
"    .+    @.    ",
"    .+   #....  ",
"    ...  ...    ",
"  ....          ",
"            ... ",
"     .......    ",
"   ...          ",
"                "]

redressIcon = [
"16 16 4 1",
"   c None",
".  c #010400",
"+  c #000000",
"@  c #FD9905",
"                ",
"                ",
"..   ..+        ",
" .     .        ",
" .    ++  ..    ",
" .   +     .    ",
"...  ...   .    ",
"           .    ",
"   @      ...   ",
"   @            ",
"   @   @    ..+ ",
"   @  @       . ",
"   @@@       .+ ",
"   @@         . ",
"            ..+ ",
"                "]

axialIcon = [
"16 16 4 1",
"   c None",
".  c #000000",
"+  c #010400",
"@  c #FD9905",
"                ",
"                ",
"++   ++.        ",
" +     +        ",
" +    ..     +. ",
" +   .       +. ",
"+++  +++    +   ",
"          ++    ",
"   @       +    ",
"   @            ",
"   @   @        ",
"   @  @    +   +",
"   @@@     + + +",
"   @@      .+.+.",
"                ",
"                "]

setIconDel = [
"24 24 4 1",
" 	c None",
".	c #EF0013",
"+	c #EF0113",
"@	c #FFFFFF",
"                        ",
"      .           .     ",
"     .@.         .@.    ",
"    .@.@.       .@.@.   ",
"   .@..+@.     .@+..@.  ",
"  .@..+++@.   .@+++..@. ",
"   .@.+.++@. .@+++++@.  ",
"    .@+..++@.@+++++@.   ",
"     .@++.++@+++++@.    ",
"      .@+++++++++@.     ",
"       .@+++++++@.      ",
"        .@+++++@.       ",
"       .@+++++++@.      ",
"      .@+++++++++@.     ",
"     .@+++++@+++++@.    ",
"    .@+++++@.@+++++@.   ",
"   .@+++++@. .@+++++@.  ",
"  .@..+++@.   .@+++..@. ",
"   .@..+@.     .@+..@.  ",
"    .@.@.       .@.@.   ",
"     .@.         .@.    ",
"      .           .     ",
"                        ",
"                        "]

setIconCommand = [
"24 24 5 1",
" 	c None",
".	c #A40000",
"+	c #8F5902",
"@	c #C17D11",
"#	c #EDD400",
"                        ",
"            #           ",
"           ###          ",
"            #           ",
"   ##    ++++++    ##   ",
"   ##  +++@@@@+++  ##   ",
"     #++@@++++@@++#     ",
"     ++@++  # ++@++     ",
"     +@+#   #   +@+     ",
"    ++@+ #  #  #+@++    ",
"  # +@+   ++++#  +@+    ",
" ###+@+###+@@+   +@+ #  ",
"  # +@+   +@@+###+@+### ",
"    +@+   ++++   +@+ #  ",
"    ++@+ # #  # +@++    ",
"     +@+#  #   #+@+     ",
"     ++@++ #  ++@++     ",
"      ++@@++++@@++#     ",
"      #+++@@@@+++  ##   ",
"    ##   ++++++    ##   ",
"    ##     #            ",
"          ###           ",
"           #            ",
"                        "
]

setIconHelix = [
"24 24 5 1",
" 	c None",
".	c #A40000",
"+	c #3566A4",
"@	c #729FCF",
"#	c #EDD400",
"                        ",
"                        ",
"                        ",
"                        ",
"        #++@@++         ",
"      ##.++@@++         ",
"      ..##+@@++         ",
"        ..###++         ",
"         +...##         ",
"         ++@@..##       ",
"         ++@@++..#      ",
"         ++@@++##.      ",
"        #++@@++..       ",
"      ##.++@@++         ",
"      ## ++@@++         ",
"      ..##+@@++         ",
"        ..###++         ",
"         +...##         ",
"         ++@@..##       ",
"         ++@@++..#      ",
"         ++@@++##       ",
"                        ",
"                        ",
"                        "
]

setIconClock = [
"24 24 8 1",
" 	c None",
".	c #C17D11",
"+	c #8F5902",
"@	c #BABDB6",
"#	c #EDD400",
"$	c #A40000",
"%	c #CE5C00",
"&	c #171018",
"                        ",
"         .....          ",
"      ++........        ",
"     +...++++++...      ",
"    +..@@@@#@@@++..     ",
"   +..#@@@@#@@@@#+..    ",
"  +..@@#@@@#@@$#@@+..   ",
"  +.#@@@%@@%@@$@@@#+.   ",
" +..@#@@@@@#@$@@@#@+..  ",
" +.@@@%@@@@@$$@@%@@@+.  ",
" +.@@@@@@@@@$$@@@@@@+.  ",
" +.@@@@@@@@&&@@@@@@@+.  ",
" +.###%@@@@&&@@@%###+.  ",
" +.@@@@@@@@$$@@@@@@@+.  ",
" +.@@@%@@@@@$$@@%@@@+.  ",
" +..@#@@@@@#$$$@@#@+..  ",
"  +.#@@@%@@%@$$@@@#+.   ",
"   ..@@#@@@#@@$$@@+..   ",
"   +..#@@@@#@@@$#+..    ",
"    +..@@@@#@@@++..     ",
"     +...++++++...      ",
"      ++........        ",
"         ......         ",
"                        "
]

setIconPath = [
"24 24 4 1",
" 	c None",
".	c #905902",
"+	c #FFFFFF",
"@	c #EDD400",
".+...@                  ",
".+...@                  ",
"..+...@                 ",
"..+....@                ",
"....+...@               ",
"....+....@              ",
"@........@              ",
"@.........@             ",
" @....+...@             ",
" @....+...@@@           ",
"  @....+.....@@         ",
"  @....+.......@        ",
"   @............@@      ",
"   @@.....++......@     ",
"    @.......++.....@@@  ",
"    @@@..............@@ ",
"       @........++.....@",
"        @@........++....",
"          @.............",
"           @............",
"            @@.......+..",
"              @......++.",
"              @@@.....+.",
"                        "
]

setIconProgress = [
"24 24 3 1",
" 	c None",
".	c #3465A4",
"+	c #729FCF",
"                        ",
"                        ",
"  ............          ",
"  .++++++++..           ",
"  .+++++++..            ",
"  .++++++..             ",
"  .++++++..             ",
"  .+++++++..            ",
"  .++++++++..           ",
"  .+++++++++..          ",
"  .++..++++++..         ",
"  .+....++++++..        ",
"  ...  ..++++++..       ",
"  ..    ..++++++..      ",
"  .      ..++++++..     ",
"          ..++++++..    ",
"           ..++++++..   ",
"            ..++++...   ",
"             ..++...    ",
"              .....     ",
"               ...      ",
"                .       ",
"                        ",
"                        "
]

setIconInDoor = [
"24 24 9 1",
" 	c None",
".	c #A30500",
"+	c #555755",
"@	c #EF2B29",
"#	c #2F65A5",
"$	c #888A88",
"%	c #6D9FD0",
"&	c #BCBCB3",
"*	c #DDDFDC",
"                        ",
"   #                    ",
"  #%#      @.           ",
" #%%%#    @@#.          ",
"  #%%%#  @@##..         ",
"   #%%%#@@###...        ",
"    #%%####%#....       ",
"     ##%##%%#$....      ",
"     @##%%%%#*$....     ",
"    @@##%%%%#**$....    ",
"   @@##%%%%%#***$....   ",
"  @@##%%%%%%#****$....  ",
"  @##########*****$...  ",
"  @@***************$..  ",
"   $**&$+++**&&&&&*$    ",
"   $**&$+++**%###%*$    ",
"   $**$$+++**%###%*$    ",
"   $**$$+++**%###%*$    ",
"   $**&$+++**+++++*$    ",
"   $**&$+++********$    ",
"   $**&$$++********$    ",
"   $$$$$$$$$$$$$$$$$    ",
"                        ",
"                        "
]

setIconOutDoor = [
"24 24 9 1",
" 	c None",
".	c #A30500",
"+	c #555755",
"@	c #EF2B29",
"#	c #2F65A5",
"$	c #888A88",
"%	c #6D9FD0",
"&	c #BCBCB3",
"*	c #DDDFDC",
"                        ",
" ##########             ",
" #%%%%%%## @.           ",
" #%%%%%## @@..          ",
" #%%%%%# @@@@..         ",
" #%%%%%#@@@@@...        ",
" #%%%%%%#@@*$....       ",
" #%###%%%#***$....      ",
" ### @#%%%#***$....     ",
" ## @@@#%%%#***$....    ",
" # @@@@*#%%%#***$....   ",
"  @@@@***#%#*****$....  ",
"  @@@*****#*******$...  ",
"  @@***************$..  ",
"   $**&$+++**&&&&&*$    ",
"   $**&$+++**%###%*$    ",
"   $**$$+++**%###%*$    ",
"   $**$$+++**%###%*$    ",
"   $**&$+++**+++++*$    ",
"   $**&$+++********$    ",
"   $**&$$++********$    ",
"   $$$$$$$$$$$$$$$$$    ",
"                        ",
"                        "
]

setIconFree = [
"24 24 8 1",
" 	c None",
".	c #7D94C9",
"+	c #6480C0",
"@	c #3E62B0",
"#	c #AABBDE",
"$	c #C3D0E8",
"%	c #92A5D3",
"&	c #000000",
"                        ",
"           ..+          ",
"      @@@@#$$#.         ",
"     +#$#%$$###+++      ",
"    +$%###$$#%#$##.     ",
"    %+%#+%$$$##$#%%+    ",
"  @+@#$$#@@+##%#%%.+@   ",
"  %$$$$$###%@%%+..+.+   ",
" .$$$$$$#$$#.@@#$$%@@@  ",
"@.##$$$####%+%#$$$#%#+  ",
"+#$$$$###%%..+$$$$#$$%+ ",
"@$$###%#%%%%%+$$$####%+ ",
"+##%%%%%%%%%%+$##$#%%.+ ",
" +%%....+++++.####%%%.%+",
"  @@@@@   .#%%%%%%%%%%%+",
"           %###%%%%...+@",
"            @@@@@@@@@@@ ",
"                        ",
"                        ",
"                        ",
"     &         &&    &  ",
"      & &&       & &&   ",
"      &&          &     ",
"      &                 "
]

setIconStamp = [
"24 24 8 1",
" 	c None",
".	c #787670",
"+	c #CE6E21",
"@	c #A37D5E",
"#	c #E48234",
"$	c #C69165",
"%	c #ACADAA",
"&	c #D6D9D5",
"          @@@@@         ",
"         @####$$        ",
"         @####+$        ",
"         @####+$        ",
"         @+##++$        ",
"         @+++++$        ",
"          @+++@         ",
"          .&%%.         ",
"          .&%%.         ",
"        ...&%%...       ",
"     .....%&%%&.....    ",
"    ...&&&%&%%&&&&...   ",
"   ..&&&&&%&%%&&&&&&..  ",
"   ..&&&&&%&%%&&&&&&..  ",
"   .&&&&&&&%%%&&&&&&&.  ",
"   .&&&&&&&%%&&&&&&&&.  ",
"   ..&&&&&&&&&&&&&&&..  ",
"    .&&&&&&&&&&&&&&&.   ",
"    ...&&&&&&&&&&&...   ",
"    &&...&&&&&&&...&&   ",
"     %&&.........&&%    ",
"      %%&&&&&&&&&%%     ",
"        %%%%%%%%%       ",
"                        "
]

#### matplotlib debut 1/5 #################################################################
#import PySide2
#from PySide2 import (QtWidgets, QtCore, QtGui)
#from PySide2.QtWidgets import (QWidget, QApplication, QSlider, QGraphicsView, QGraphicsScene, QVBoxLayout, QStyle)

import re
import operator
from operator import itemgetter #, attrgetter, methodcaller    # pour sort 

setIconTTF = [
"16 16 6 1",
"   c None",
".  c #204A87",
"+  c None",
"@  c #729FCF",
"#  c #CC0000",
"$  c #EDD400",
".+++++++++++@@@@",
".++++++++@+@++@@",
".++#####++++@@+@",
".+++$#$$$++@+@+@",
".++++#$+++++++@+",
".++++#$#####++++",
".++++#$+$#$$$+++",
".++++#$++#$+++++",
".@++++$++#$+###+",
".@@++++++#$+#$$$",
"..@@+++++#$+#$++",
"...@@+++++$+###+",
"....@@++++++#$$$",
".....@@+++++#$++",
"......@@+++++$++",
"................"]

setIconFON = [
"16 16 6 1",
"   c None",
".  c #204A87",
"+  c None",
"@  c #F57900",
"#  c #CC0000",
"$  c #EDD400",
".+++++++++++@@@@",
".++++++++@+@++@@",
".++###++++++@@+@",
".++#$$$++++@+@+@",
".++#$+++++++++@+",
".++###+###++++++",
".++#$$$#$#$+++++",
".++#$++#$#$+++++",
".@++$++#$#$##+#+",
".@@++++#$#$##$#$",
"..@@+++###$#$##$",
"...@@+++$$$#$##$",
"....@@+++++#$+#$",
".....@@++++#$+#$",
"......@@++++$++$",
"................"]

setIconOTF = [
"16 16 6 1",
"   c None",
".  c #204A87",
"+  c None",
"@  c #4E9A06",
"#  c #CC0000",
"$  c #EDD400",
".+++++++++++@@@@",
".++++++++@+@++@@",
".++###++++++@@+@",
".++#$#$++++@+@+@",
".++#$#$+++++++@+",
".++#$#$###++++++",
".++#$#$+#$$+++++",
".++###$+#$++++++",
".@++$$$+#$+###++",
".@@+++++#$+#$$$+",
"..@@++++#$+#$+++",
"...@@++++$+###++",
"....@@+++++#$$$+",
".....@@++++#$+++",
"......@@++++$+++",
"................"]

setIconPOL = [
"16 16 12 1",
"   c None",
".  c #204A87",
"+  c None",
"@  c #06989A",
"#  c #73D216",
"$  c #000000",
"%  c #75507B",
"&  c #729FCF",
"*  c #CC0000",
"=  c #F57900",
"-  c #EDD400",
";  c #4E9A06",
".+++++++++++@#$%",
".++++++++$+#++&$",
".++***++++++=@+%",
".++*-*-++++*+&+$",
".++*-*-+++++++*+",
".++***-***++++++",
".++*---*-*-+++++",
".++*-++*-*-+++++",
".$++-++*-*-*++++",
".*@++++*-*-*-+++",
"..#*+++***-*-+++",
"...;#+++---*-+++",
"....%=+++++*-+++",
".....;$++++****+",
"......@%++++----",
"................"]

#import glob
#files_TTF = glob.glob(self.pathFont + "/*.TTF") 
##################################
import matplotlib
import matplotlib.font_manager
import matplotlib.font_manager as fontman
import matplotlib.font_manager as fontconfig
from matplotlib.font_manager import FontProperties
#from matplotlib.ft2font import FT2Font
##################################

#### Config Begin matplotlib font #######################
                                                        # # https://en.wikipedia.org/wiki/Web_colors
global setColorTTF       ; setColorTTF       = "blue"   # .TTF   color by "extension name" or hexa "#0000FF" 
global setColorFON       ; setColorFON       = "orange" # .FON   color by "extension name" or hexa "#FFA500"
global setColorOTF       ; setColorOTF       = "green"  # .OTF   color by "extension name" or hexa "#008000"
global setColorPOL       ; setColorPOL       = "black"  # .OTHER color by "extension name" or hexa "#000000"
                                                      #####
global switchModeTextList; switchModeTextList= 1        # 0 = mode text normal (et noir) coupe le switchFontComBox
                                                        # 1 = permet le switchFontComBox 1 (default)
                                                      #####
global switchFontComBox  ; switchFontComBox  = 0        # 0 = (et switchModeTextList= 1) mode texte (en couleur) dans liste ComboBox plus rapide (default)
                                                        # 1 = (et switchModeTextList= 1) fontFamily dans liste ComboBox plus lent mais plus beau!
                                                      #####
global setSystemFonts    ; setSystemFonts    = 1        # 0 = matplotlib.font_manager.findSystemFonts("C:/", "ttf") 
                                                        #     fait toutes les fontes (dans tous les dossiers et sous dossiers du DD) time !!
                                                        # 1 = fontman.findSystemFonts(self.pathFont)
                                                        #     fait toutes les fontes du repertoire (et dans tous les sous dossiers) (default)
                                                      #####
global seTtextAlignement ; seTtextAlignement = 0        # 0 = AlignLeft (default)
                                                        # 1 = AlignCenter
                                                        # 2 = AlignRight
                                                      #####
global setFontByDefault  ; setFontByDefault  = "ARIAL"  # Font by Default
                                                      #####
#### Config End matplotlib font #########################
                                                      #####
global switchResetFALSE  ; switchResetFALSE  = 0        # 0 = reset (False by default)
                                                        # 1 = pas de reset (non conseille) certains switch peuvent rester ouvert ou fermer inopinement !
                                                      #####
global setPathOrthogonal ; setPathOrthogonal = 0        # 
global setPathTangent    ; setPathTangent    = 1        # 
global setPositionBase   ; setPositionBase   = 1        # 
global setPositionCenter ; setPositionCenter = 0        # 
global setPositionTop    ; setPositionTop    = 0        # 
                                                      #####
global setMainWindowMoveX; #setMainWindowMoveX= 0        # position X macro window
global setMainWindowMoveY; #setMainWindowMoveY= 0        # position Y macro window
global setFrameWindowSizeX #setFrameWindowSizeX=0        # dimension X macro window
global setFrameWindowSizeY #setFrameWindowSizeY=0        # dimension Y macro window
#### Config #############################################

def createSpace(texte):    # detecte majuscule et ajoute un espace devant la lettre
    # return createSpace(TexTe) = Tex Te , if createSpace(TEXTE) = TEXTE
    if texte.isupper():
        stringSpace = texte
    else:
        try:
            stringSpace = texte[0]
            for i in texte[1:]:
                if re.search(r"[A-Z]", i): i = " " +  i
                stringSpace += i
        except Exception:
            stringSpace = texte
    return stringSpace

def family(chaine):
    # return family(chaine)[1] = Family , family(chaine)[2] = typeCar (form [a, b, c ...]
    famille = typeCar = ""
    try:
        if chaine.find('-') != -1:
            famille = chaine[:chaine.find('-')]
            typeCar = chaine[chaine.find('-')+1:]
        else:
            famille = chaine
            typeCar = ""
    except Exception:
        famille = chaine
        typeCar = ""
    typeCar = str(createSpace(typeCar)).split()
    return [createSpace(famille), typeCar]

class MyLabelPatience():        # fenetre image d'attente de chargement
    global path
    label = QtWidgets.QLabel()
    label.setText("<img src=" + path + "FCCircularTextButtom.png><b><center>Wait please</center> \n\n<center>i search the fonts !\n\n</right></b>")
    ecran = FreeCADGui.getMainWindow().frameGeometry()
    xF = 250; yF = 250
    xW = (ecran.width()/2) - (xF/2)
    yW = (ecran.height()/2)- (yF/2)
    label.setGeometry(xW, yW, xF, yF)
    label.setStyleSheet("QLabel {background-color : #F0C300;font: 12pt; }");
    label.setWindowFlags(PySide2.QtCore.Qt.WindowFlags(PySide2.QtCore.Qt.FramelessWindowHint))        # pas de bords
    label.setWindowFlags(PySide2.QtCore.Qt.WindowStaysOnTopHint)         # PySide cette fonction met la fenetre en avant
#### matplotlib fin 1/5 #################################################################

try:
    _fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
    def _fromUtf8(s):
        return s

try:
    _encoding = QtGui.QApplication.UnicodeUTF8
    def _translate(context, text, disambig):
        return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
    def _translate(context, text, disambig):
        return QtGui.QApplication.translate(context, text, disambig)

class Ui_MainWindow(object):

    def __init__(self):
        global path
        self.path          = path

    #### matplotlib debut 2/5 apres __init__ #################################################################
        #### matplotlib font textEdit
        self.FontTextSize  = 20
        self.fonteComp     = ""
        self.font          = QtGui.QFont()
        self.tableau       = [] #Index (), [chemin plus nom fichier (nomPathPolice), nom sans extension (nomSimple), nomSimpleExt (nomSimple + Ext)]
        self.index         = 0  #Index ()
        #### matplotlib font textEdit
    def searchFont(self,pathSearch):
        global PolicePath
        global setSystemFonts
        global seTtextAlignement
        global switchFontComBox
        global switchModeTextList
        global setFontByDefault

        MyLabelPatience.label.show()
        FreeCADGui.updateGui()                                 # rafraichi l'ecran

        files_All_Fonts = ""
        ##https://matplotlib.org/_modules/matplotlib/font_manager.html

        if setSystemFonts == 0:
            files_All_Fonts = matplotlib.font_manager.findSystemFonts(pathSearch, "ttf")  # fait toutes les fontes ? ()
        else:
            files_All_Fonts = fontman.findSystemFonts(pathSearch)                         # fait toutes les fontes (et dans tous les sous dossiers)

        if len(files_All_Fonts) > 0:           
            self.tableau = []
            self.index = 0

            for fonte in files_All_Fonts:
                ####
                nomPathPolice = nomFichier = nomSimpleExt = nomSimple = nomExtension = nameName = ""

                nomPathPolice = fonte.replace("\\","/")     # convert the "\" to "/"
                nomFichier    = nomPathPolice.split("/")    # complet split
                nomSimpleExt  = nomFichier[-1]              # nom avec extension
                nomSimple     = nomFichier[-1][:-4]         # nom sans extension
                nomExtension  = nomSimpleExt[nomSimpleExt.rfind('.')+1:].upper() # extension

                ####
                try:
#                    nameFamily    = matplotlib.font_manager.FontProperties(fname=fonte).get_family()            ##['sans-serif']
#                    nameStyle     = matplotlib.font_manager.FontProperties(fname=fonte).get_style()              #normal
#                    nameVariant   = matplotlib.font_manager.FontProperties(fname=fonte).get_variant()            #normal
#                    nameWeight    = matplotlib.font_manager.FontProperties(fname=fonte).get_weight()             #normal
#                    nameStretch   = matplotlib.font_manager.FontProperties(fname=fonte).get_stretch()            #normal
#                    nameFileComp  = matplotlib.font_manager.FontProperties(fname=fonte).get_file()              ##c:\windows\fonts\NotoNaskhArabicUI-Regular.ttf
#                    nameSize      = matplotlib.font_manager.FontProperties(fname=fonte).get_size()               #10.0
                    nameName      = matplotlib.font_manager.FontProperties(fname=fonte).get_name()              ##Noto Naskh Arabic UI
#                    nameSizePoint = matplotlib.font_manager.FontProperties(fname=fonte).get_size_in_points()     #10.0
#                    nameSlant     = matplotlib.font_manager.FontProperties(fname=fonte).get_slant()              #normal
#                    namePattern   = matplotlib.font_manager.FontProperties(fname=fonte).get_fontconfig_pattern() #:family=sans-serif:style=normal:variant=normal:weight=normal:stretch=normal:file=c:\windows\fonts\NotoNaskhArabicUI-Regular.ttf:size=10.0
                except Exception:
                    nameFamily = nameStyle = nameVariant = nameWeight = nameStretch = nameFileComp = nameSize = nameName = nameSizePoint = nameSlant = namePattern = ""
                ####
                if nameName == "" :
                    nameName = nomSimple
                self.tableau.append([0, nomPathPolice, nomSimple, nomSimpleExt.upper(), nomExtension.upper(), nameName])
                
            self.tableau = sorted(self.tableau, key=itemgetter(3))          # sorted by nomSimple.upper()

            try:
                for line in range(len(self.tableau)):                       # enleve les doubles (bon)
                    if self.tableau[line][2] == self.tableau[line + 1][2]:  # enleve les doubles (bon)
                        del(self.tableau[line + 1])                         # enleve les doubles (bon)
            except Exception:
                None

            self.comboBoxPy.clear()
            for line in range(len(self.tableau)): 
                try:
                    self.tableau[line][0] = line                 # ajoute le numero de ligne
                    if self.tableau[line][2].upper() == setFontByDefault.upper(): # detecte la fonte de base
                        self.index = line
                        PolicePath = self.tableau[line][1]
                    ####Section common color and font begin ######################
                    model = self.comboBoxPy.model()

                    if switchModeTextList == 1:
                        if self.tableau[line][4] == "TTF":
                            item = QtGui.QStandardItem(QtGui.QPixmap(setIconTTF), str(line))
                            item.setForeground(QtGui.QColor(setColorTTF))
                        elif self.tableau[line][4] == "FON":
                            item = QtGui.QStandardItem(QtGui.QPixmap(setIconFON), str(line))
                            item.setForeground(QtGui.QColor(setColorFON))
                        elif self.tableau[line][4] == "OTF":
                            item = QtGui.QStandardItem(QtGui.QPixmap(setIconOTF), str(line))
                            item.setForeground(QtGui.QColor(setColorOTF))
                        else:
                            item = QtGui.QStandardItem(QtGui.QPixmap(setIconPOL), str(line))
                            item.setForeground(QtGui.QColor(setColorPOL))

                        if   seTtextAlignement == 0:
                            item.setTextAlignment(QtCore.Qt.AlignLeft)
                        elif seTtextAlignement == 1:
                            item.setTextAlignment(QtCore.Qt.AlignCenter)
                        elif seTtextAlignement == 2:
                            item.setTextAlignment(QtCore.Qt.AlignRight)
                        else:
                            self.comboBoxPy.addItem(self.tableau[line][2])    
                        model.appendRow(item)
                    else:
                        self.comboBoxPy.addItem("")
                    self.comboBoxPy.setItemText(line, self.tableau[line][2])
                    ####Section item color and font end ##########################

                    ####Section setfont Family switchFontComBox begin#############
                    if (switchFontComBox == 1) and (switchModeTextList == 1):
                        typeCar = font = ""
                        font = QtGui.QFont()
                        #font = item.font()

                        typeCar   = family(self.tableau[line][2])[1]
                        font.setBold(False)
                        font.setItalic(False)

                        if len(typeCar) > 0:
                            for option in typeCar:
                                if option == "Bold":
                                    font.setBold(True)
                                if (option == "Italic") or (option == "It") or (option == "Slanted"):
                                    font.setItalic(True)
                                if option == "Oblique":
                                    font.setItalic(True)
                        #'Bold''Regular''Slanted''Italic''Medium''Extra''Light''Condensed''Black''It''Semibold'
                        
                        font.setFamily(self.tableau[line][5])
                        font.setPixelSize(15)
                        if switchModeTextList == 1:
                            item.setFont(font)
                        else:
                            self.comboBoxPy.addItem("")
                    ####Section setfont Family switchFontComBox end###############

                except Exception:
                    FreeCAD.Console.PrintMessage("searchFont()" + "\n")
                    None

            self.lineEdit_NameFile.setText("(" + str(self.index + 1) + "/" + str(len(self.tableau)) + ") " + self.tableau[self.index][1])
            self.comboBoxPy.setCurrentIndex(self.index)
            self.fonteComp = self.tableau[self.index][1]
            MyLabelPatience.label.close()
            #### matplotlib fin 2/5 apres __init__ #################################################################

    def setupUi(self, MainWindow):
        self.window = MainWindow

        global ui
        global PolicePath
        global rayon
        global texte
        global rotation
        global SizeCaractere
        global debout
        global exterieur

        global precision
        global correctionAngle
        global correctionRayon
        global baseHelix
        global endHelix
        global nombreCarParTour

        global epaisseurExtrus
        global epaisSupportClock
        
        global setPathOrthogonal
        global setPathTangent
        global setPositionBase
        global setPositionCenter
        global setPositionTop
        global switchResetFALSE
        global setMainWindowMoveX
        global setMainWindowMoveY
        global setFrameWindowSizeX
        global setFrameWindowSizeY

        MainWindow.setObjectName(_fromUtf8("MainWindow"))
#        MainWindow.setMaximumSize(QtCore.QSize(370, 638))
#        MainWindow.setMinimumSize(QtCore.QSize(400, 640))
#        MainWindow.move(setMainWindowMoveX, setMainWindowMoveY) # position macro
        MainWindow.setGeometry(setMainWindowMoveX, setMainWindowMoveY, setFrameWindowSizeX, setFrameWindowSizeY)

        self.centralWidget = QtWidgets.QWidget(MainWindow)
        self.centralWidget.setObjectName(_fromUtf8("centralWidget"))
        self.groupBox_00 = QtWidgets.QGroupBox()
        self.groupBox_01 = QtWidgets.QGroupBox()

        ####
        self.textEdit = QtWidgets.QTextEdit()
        self.textEdit.textChanged.connect(self.on_textEdit_Changed)
#        self.textEdit.setMaximumHeight(100)
        ####
        self.frame_Option = QtWidgets.QFrame()
        self.frame_Option.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.frame_Option.setFrameShadow(QtWidgets.QFrame.Plain) #Raised Sunken
        self.PB_Reverse = QtWidgets.QPushButton()
        self.PB_Reverse.clicked.connect(self.on_PB_Reverse)
        self.CB_Word = QtWidgets.QCheckBox()
        self.CB_Word.setText(_fromUtf8("Word"))
        self.CB_Word.clicked.connect(self.on_CB_Word)
        ####
        self.PB_Help = QtWidgets.QPushButton(MainWindow)
        self.PB_Help.setIcon(QtGui.QIcon(QtGui.QPixmap(helpIcon)))      # help icone dans une variable
        self.PB_Help.clicked.connect(self.on_PB_Help_clicked)           # help
        ####
        #### matplotlib debut 3/5 setupUi #################################################################
        self.lineEdit_NameFile = QtWidgets.QLineEdit()
        #self.lineEdit_NameFile.returnPressed.connect(self.on_lineEdit_NameFile) 
        self.comboBoxPy = QtWidgets.QComboBox()
        ####
        self.pathFont = PolicePath[:len(PolicePath)-(PolicePath[::-1].index("/"))-1]
        ####
        ui.searchFont(self.pathFont)
        QtCore.QObject.connect(self.comboBoxPy, QtCore.SIGNAL("currentIndexChanged(int)"), self.on_fontComboBoxPython)
        #### matplotlib fin 3/5 setupUi #################################################################
        ####
        self.groupBox_02 = QtWidgets.QGroupBox()

        self.DS_Radius_Circle = QtWidgets.QDoubleSpinBox()
        self.DS_Radius_Circle.setMinimum(-99999999.0)
        self.DS_Radius_Circle.setMaximum(99999999.0)
        self.DS_Radius_Circle.setValue(rayon)
        self.DS_Radius_Circle.valueChanged.connect(self.on_DS_Radius_Circle) #connection doubleSpinBox
        self.label_10 = QtWidgets.QLabel()

        self.DS_Size_Character = QtWidgets.QDoubleSpinBox()
        self.DS_Size_Character.setMinimum(0.0)
        self.DS_Size_Character.setMaximum(99999999.0)
        self.DS_Size_Character.setSingleStep(1.0)
        self.DS_Size_Character.setValue(SizeCaractere)
        self.DS_Size_Character.valueChanged.connect(self.on_DS_Size_Character) #connection doubleSpinBox
        self.label_4 = QtWidgets.QLabel()

        self.S_Begin_Angle = QtWidgets.QSpinBox()
        self.S_Begin_Angle.setMaximum(360.0)
        self.S_Begin_Angle.setValue(debut)
        self.S_Begin_Angle.valueChanged.connect(self.on_S_Begin_Angle) #connection SpinBox
        self.label_13 = QtWidgets.QLabel()

        self.S_End_Angle = QtWidgets.QSpinBox()
        self.S_End_Angle.setMaximum(360)
        self.S_End_Angle.setValue(rotation)
        self.S_End_Angle.valueChanged.connect(self.on_S_End_Angle) #connection SpinBox
        self.label_14 = QtWidgets.QLabel()

        self.DS_Correction_Angle = QtWidgets.QDoubleSpinBox()
        self.DS_Correction_Angle.setMinimum(-359.00)
        self.DS_Correction_Angle.setMaximum(359.00)
        self.DS_Correction_Angle.setValue(correctionAngle)
        self.DS_Correction_Angle.valueChanged.connect(self.on_DS_Correction_Angle) #connection doubleSpinBox
        self.label_7 = QtWidgets.QLabel()

        self.DS_Correction_Radius = QtWidgets.QDoubleSpinBox()
        self.DS_Correction_Radius.setMinimum(-99999999.0)
        self.DS_Correction_Radius.setMaximum(99999999.0)
        self.DS_Correction_Angle.setValue(correctionAngle)
        self.DS_Correction_Radius.setValue(correctionRayon)
        self.DS_Correction_Radius.valueChanged.connect(self.on_DS_Correction_Radius) #connection doubleSpinBox
        self.label_8 = QtWidgets.QLabel()

        self.DS_Extrude = QtWidgets.QDoubleSpinBox()
        self.DS_Extrude.setEnabled(False)
        self.DS_Extrude.setMinimum(-99999999.0)
        self.DS_Extrude.setMaximum(99999999.0)
        self.DS_Extrude.setValue(epaisseurExtrus)
        self.DS_Extrude.valueChanged.connect(self.on_DS_Extrude) #connection doubleSpinBox

        self.CH_Extrude = QtWidgets.QCheckBox()
        self.CH_Extrude.clicked.connect(self.on_CH_Extrude) #connection checkBox

        self.DS_PlacementX = QtWidgets.QDoubleSpinBox()
        self.DS_PlacementX.setEnabled(False)
        self.DS_PlacementX.setSpecialValueText(_fromUtf8(""))
        self.DS_PlacementX.setMinimum(-9999999.0)
        self.DS_PlacementX.setMaximum(9999999.99)
        self.DS_PlacementX.valueChanged.connect(self.on_DS_PlacementX) #connection doubleSpinBox

        self.DS_PlacementY = QtWidgets.QDoubleSpinBox()
        self.DS_PlacementY.setEnabled(False)
        self.DS_PlacementY.setSpecialValueText(_fromUtf8(""))
        self.DS_PlacementY.setMinimum(-9999999.0)
        self.DS_PlacementY.setMaximum(9999999.99)
        self.DS_PlacementY.valueChanged.connect(self.on_DS_PlacementY) #connection doubleSpinBox

        self.DS_PlacementZ = QtWidgets.QDoubleSpinBox()
        self.DS_PlacementZ.setEnabled(False)
        self.DS_PlacementZ.setSpecialValueText(_fromUtf8(""))
        self.DS_PlacementZ.setMinimum(-9999999.0)
        self.DS_PlacementZ.setMaximum(9999999.99)
        self.DS_PlacementZ.valueChanged.connect(self.on_DS_PlacementZ) #connection doubleSpinBox

        self.CH_Sp_Placement = QtWidgets.QCheckBox()
        self.CH_Sp_Placement.clicked.connect(self.on_CH_Sp_Placement) #connection checkBox

        self.DS_InclinaisonX = QtWidgets.QSpinBox()
        self.DS_InclinaisonX.setEnabled(False)
        self.DS_InclinaisonX.setMinimum(-360.0)
        self.DS_InclinaisonX.setMaximum(360.0)
        self.DS_InclinaisonX.setValue(inclinaisonX)
        self.DS_InclinaisonX.valueChanged.connect(self.on_DS_InclinaisonX) #connection doubleSpinBox

        self.DS_InclinaisonY = QtWidgets.QSpinBox()
        self.DS_InclinaisonY.setEnabled(False)
        self.DS_InclinaisonY.setMinimum(-360)
        self.DS_InclinaisonY.setMaximum(360)
        self.DS_InclinaisonY.setValue(inclinaisonY)
        self.DS_InclinaisonY.valueChanged.connect(self.on_DS_InclinaisonY) #connection doubleSpinBox

        self.DS_InclinaisonZ = QtWidgets.QSpinBox()
        self.DS_InclinaisonZ.setEnabled(False)
        self.DS_InclinaisonZ.setMinimum(-360.0)
        self.DS_InclinaisonZ.setMaximum(360.0)
        self.DS_InclinaisonZ.setValue(inclinaisonZ)
        self.DS_InclinaisonZ.valueChanged.connect(self.on_DS_InclinaisonZ) #connection doubleSpinBox

        self.CH_Sp_Inclination = QtWidgets.QCheckBox()
        self.CH_Sp_Inclination.clicked.connect(self.on_CH_Sp_Inclination) #connection checkBox

        ####
        self.groupBox_03 = QtWidgets.QGroupBox()

        self.graphicsView = QtWidgets.QGraphicsView()
        ####Screen Graphic BitMap
        ##https://doc.qt.io/qtforpython/PySide2/QtCore/Qt.html
        self.graphicsView = QtWidgets.QGraphicsView()
        self.graphicsView.setObjectName("graphicsView")
        self.graphicsView.setFixedSize(210,100)
        pic = QtGui.QPixmap()
        pic.loadFromData(base64.b64decode(outDoor_Icon_b64))  #indoor_Icon_b64  # bmp converti
        self.scene = QtWidgets.QGraphicsScene()
        self.scene.addPixmap(QtGui.QPixmap(pic))
        self.graphicsView.setScene(self.scene)

#        pic = QtGui.QPixmap(outDoorIcon)          # xpm
#        self.scene = QtWidgets.QGraphicsScene()   # xpm bmp converti (general)
#        self.scene.addPixmap(QtGui.QPixmap(pic))  # xpm bmp converti (general)
#        self.graphicsView.setScene(self.scene)    # xpm bmp converti (general)
#        ####Screen Graphic BitMap
        ####

        self.RA_Choice_Outdoor = QtWidgets.QRadioButton()
        self.RA_Choice_Outdoor.setChecked(True)
        self.RA_Choice_Outdoor.setIcon(QtGui.QIcon(QtGui.QPixmap(setIconOutDoor))) # icone dans une variable 
        self.RA_Choice_Outdoor.clicked.connect(self.on_RA_Choice_Outdoor) #connection radioButton

        self.RA_Choice_Indoor = QtWidgets.QRadioButton()
        self.RA_Choice_Indoor.setIcon(QtGui.QIcon(QtGui.QPixmap(setIconInDoor))) # icone dans une variable 
        self.RA_Choice_Indoor.clicked.connect(self.on_RA_Choice_Indoor) #connection radioButton

        self.RA_Choice_Helix = QtWidgets.QRadioButton()
        self.RA_Choice_Helix.setIcon(QtGui.QIcon(QtGui.QPixmap(setIconHelix))) # icone dans une variable 
        self.RA_Choice_Helix.clicked.connect(self.on_RA_Choice_Helix) #connection radioButton

        self.RA_Choice_Clock = QtWidgets.QRadioButton()
        self.RA_Choice_Clock.setIcon(QtGui.QIcon(QtGui.QPixmap(setIconClock))) # icone dans une variable 
        self.RA_Choice_Clock.clicked.connect(self.on_RA_Choice_Clock) #connection radioButton

        #self.RA_Choice_Stamp = QtWidgets.QRadioButton()
        #self.RA_Choice_Stamp.setIcon(QtGui.QIcon(QtGui.QPixmap(setIconStamp))) # icone dans une variable 
        #self.RA_Choice_Stamp.clicked.connect(self.on_RA_Choice_Stamp) #connection radioButton 

        self.PU_Flat = QtWidgets.QPushButton()
        self.PU_Flat.setEnabled(True)
        self.PU_Flat.setIcon(QtGui.QIcon(QtGui.QPixmap(standIcon))) # icone dans une variable 
        self.PU_Flat.clicked.connect(self.on_PU_Flat)
        ####
        #### Tab Onglets
        self.tabWidget = QtWidgets.QTabWidget()
        self.tabWidget.setTabPosition(QtWidgets.QTabWidget.North)
        self.tabWidget.setTabShape(QtWidgets.QTabWidget.Rounded)

        self.tabWidget.blockSignals(False) #just for not showing the initial message
        self.tabWidget.tabBarClicked.connect(self.on_tabWidget) #changed!
        #self.tabWidget.currentChanged.connect(self.on_tabWidget) #changed!

        self.DS_Step_Of_The_Helix = QtWidgets.QDoubleSpinBox()
        self.DS_Step_Of_The_Helix.setMaximum(99999999.99)
        self.DS_Step_Of_The_Helix.setValue(pasHelix)
        self.DS_Step_Of_The_Helix.valueChanged.connect(self.on_DS_Step_Of_The_Helix) #connection doubleSpinBox
        self.label_12 = QtWidgets.QLabel()

        self.DS_Number_Char_Per_Turn = QtWidgets.QSpinBox()
        self.DS_Number_Char_Per_Turn.setMaximum(99999999)
        self.DS_Number_Char_Per_Turn.setValue(nombreCarParTour)
        self.DS_Number_Char_Per_Turn.valueChanged.connect(self.on_DS_Number_Char_Per_Turn) #connection doubleSpinBox
        self.label = QtWidgets.QLabel()

        self.DS_Base_Helix = QtWidgets.QDoubleSpinBox()
        self.DS_Base_Helix.setEnabled(False)
        self.DS_Base_Helix.setMinimum(-99999999.0)
        self.DS_Base_Helix.setMaximum(99999999.0)
        self.DS_Base_Helix.setValue(baseHelix)
        self.DS_Base_Helix.valueChanged.connect(self.on_DS_Base_Helix) #connection doubleSpinBox
        self.label_2 = QtWidgets.QLabel()

        self.DS_End_Helix = QtWidgets.QDoubleSpinBox()
        self.DS_End_Helix.setEnabled(False)
        self.DS_End_Helix.setMinimum(-99999999.0)
        self.DS_End_Helix.setMaximum(99999999.0)
        self.DS_End_Helix.setValue(endHelix)
        self.DS_End_Helix.valueChanged.connect(self.on_DS_End_Helix) #connection doubleSpinBox
        self.label_3 = QtWidgets.QLabel()

        #### clock

        self.DS_Number_Faces_Support = QtWidgets.QSpinBox()
        self.DS_Number_Faces_Support.setMaximum(999)
        self.DS_Number_Faces_Support.setValue(nombreFaces)
        self.DS_Number_Faces_Support.valueChanged.connect(self.on_DS_Number_Faces_Support) #connection SpinBox
        self.label_5 = QtWidgets.QLabel()

        self.CB_RomanOrArabic = QtWidgets.QCheckBox() # replace by CheckBox pour ne plus avoir le flip/flop
        self.CB_RomanOrArabic.setIcon(QtGui.QIcon(QtGui.QPixmap(arabicIcon))) # icone dans une variable 
        self.CB_RomanOrArabic.clicked.connect(self.on_PU_Roman)

        self.DS_Radius_Support = QtWidgets.QDoubleSpinBox()
        self.DS_Radius_Support.setMaximum(99999999.99)
        self.DS_Radius_Support.setValue(cercleClock)
        self.DS_Radius_Support.setEnabled(False)
        self.DS_Radius_Support.valueChanged.connect(self.on_DS_Radius_Support) #connection doubleSpinBox
        self.label_11 = QtWidgets.QLabel()

        self.CB_RedressChiffres = QtWidgets.QCheckBox() # replace by CheckBox pour ne plus avoir le flip/flop
        self.CB_RedressChiffres.setIcon(QtGui.QIcon(QtGui.QPixmap(axialIcon))) # icone dans une variable 
        self.CB_RedressChiffres.clicked.connect(self.on_PU_Redress)

        self.DS_Extrude_Support = QtWidgets.QDoubleSpinBox()
        self.DS_Extrude_Support.setMaximum(99999999.0)
        self.DS_Extrude_Support.setEnabled(False)
        self.DS_Extrude_Support.setValue(epaisSupportClock)
        self.DS_Extrude_Support.valueChanged.connect(self.on_DS_Extrude_Support) #connection doubleSpinBox
        self.label_6 = QtWidgets.QLabel()

        #### Path

        self.frame_Path = QtWidgets.QFrame()
        self.frame_Path.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.frame_Path.setFrameShadow(QtWidgets.QFrame.Plain) #Raised) Sunken
        self.RB_Path_01 = QtWidgets.QRadioButton()
        self.RB_Path_01.setChecked(setPathOrthogonal)
        self.RB_Path_01.clicked.connect(self.on_RB_Path_Image)
        self.RB_Path_02 = QtWidgets.QRadioButton()
        self.RB_Path_02.setChecked(setPathTangent)
        self.RB_Path_02.clicked.connect(self.on_RB_Path_Image)

        self.frame_Position = QtWidgets.QFrame()
        self.frame_Position.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.frame_Position.setFrameShadow(QtWidgets.QFrame.Plain) #.Raised) Sunken
        self.RB_Position_01 = QtWidgets.QRadioButton()
        self.RB_Position_01.setChecked(setPositionBase)
        self.RB_Position_01.clicked.connect(self.on_RB_Path_Image)
        self.RB_Position_02 = QtWidgets.QRadioButton()
        self.RB_Position_02.setChecked(setPositionCenter)
        self.RB_Position_02.clicked.connect(self.on_RB_Path_Image)
        self.RB_Position_03 = QtWidgets.QRadioButton()
        self.RB_Position_03.setChecked(setPositionTop)
        self.RB_Position_03.clicked.connect(self.on_RB_Path_Image)

#### plus tard
#        self.horizontalSlider_01_Str = QtWidgets.QSlider()
#        self.horizontalSlider_01_Str.setOrientation(QtCore.Qt.Horizontal)
#        self.label_Path_01 = QtWidgets.QLabel()
#        self.horizontalSlider_02_Car = QtWidgets.QSlider()
#        self.horizontalSlider_02_Car.setOrientation(QtCore.Qt.Horizontal)
#        self.label_Path_02 = QtWidgets.QLabel()
#        self.horizontalSlider_03_Tra = QtWidgets.QSlider()
#        self.horizontalSlider_03_Tra.setOrientation(QtCore.Qt.Horizontal)
#        self.label_Path_03 = QtWidgets.QLabel()
#### plus tard

        #### Command

        self.CB_01_Points = QtWidgets.QCheckBox()
        self.CB_01_Points.setIcon(QtGui.QIcon.fromTheme("Draft",QtGui.QIcon(":/icons/Draft_Dot.svg")))
        self.CB_02_Circle = QtWidgets.QCheckBox()
        self.CB_02_Circle.setIcon(QtGui.QIcon.fromTheme("Draft",QtGui.QIcon(":/icons/Draft_Circle.svg")))
        self.CB_03_BBox = QtWidgets.QCheckBox()
        self.CB_03_BBox.setIcon(QtGui.QIcon.fromTheme("Draft",QtGui.QIcon(":/icons/sel-bbox.svg")))
        self.CB_04_Progression = QtWidgets.QCheckBox()
        self.CB_04_Progression.setIcon(QtGui.QIcon(QtGui.QPixmap(setIconProgress))) # progress icone dans une variable 
        self.CB_05_Reset = QtWidgets.QCheckBox()
        if switchResetFALSE == 1:
            self.CB_05_Reset.setChecked(True)
            self.CB_05_Reset.setIcon(QtGui.QIcon(QtGui.QPixmap(setIconNoReset))) # reset icone dans une variable 
        else:
            self.CB_05_Reset.setChecked(False)
            self.CB_05_Reset.setIcon(QtGui.QIcon(QtGui.QPixmap(resetIcon))) # reset icone dans une variable 
        self.CB_05_Reset.clicked.connect(self.on_CB_05_Reset)

        self.CB_06_ModeFree = QtWidgets.QCheckBox()
        self.CB_06_ModeFree.setIcon(QtGui.QIcon(QtGui.QPixmap(setIconFree))) # progress icone dans une variable 
        self.CB_06_ModeFree.clicked.connect(self.on_CB_06_ModeFree)

        self.PB_Delete_Last = QtWidgets.QPushButton()
        self.PB_Delete_Last.setIcon(QtGui.QIcon(QtGui.QPixmap(setIconDel))) # del icone dans une variable 
        self.PB_Delete_Last.clicked.connect(self.on_PB_Delete_Last)

        self.PU_Exit = QtWidgets.QPushButton()
        self.PU_Exit.setIcon(QtGui.QIcon(QtGui.QPixmap(quitIcon))) # quit icone dans une variable 
        #self.PU_Exit.setIconSize(QtCore.QSize(26, 26))
        self.PU_Exit.clicked.connect(self.on_PU_Exit)

        self.PU_Reset = QtWidgets.QPushButton()
        self.PU_Reset.setEnabled(True)
        self.PU_Reset.setIcon(QtGui.QIcon(QtGui.QPixmap(resetIcon)))  # reset icone dans une variable 
        self.PU_Reset.clicked.connect(self.on_PU_Reset)

        self.PU_Benchmarks = QtWidgets.QPushButton()
        self.PU_Benchmarks.setIcon(QtGui.QIcon(QtGui.QPixmap(executeIcon)))# execute icone dans une variable 
        self.PU_Benchmarks.clicked.connect(self.on_PU_Benchmarks)

        self.PU_Execute = QtWidgets.QPushButton()
        self.PU_Execute.setIcon(QtGui.QIcon(QtGui.QPixmap(executeIcon)))# execute icone dans une variable 
        self.PU_Execute.clicked.connect(self.on_PU_Execute)
        #### Tab Onglets
        ####
        #### gridLayout begin #######################
        self.gridLayout = QtWidgets.QGridLayout(self.centralWidget)
        self.gridLayout.setContentsMargins(10, 10, 10, 10)
        ##
        self.gridLayout_2 = QtWidgets.QGridLayout(self.groupBox_00)
        self.gridLayout_2.setContentsMargins(10, 10, 10, 10)
        ##
        self.gridLayout_Texte = QtWidgets.QGridLayout(self.groupBox_01)  # groupes .....
        self.gridLayout_Texte.setContentsMargins(10, 10, 10, 10)
        self.gridLayout_Texte.addWidget(self.textEdit, 0, 0, 1, 1)
        ##
        self.gridLayout_frame_Option = QtWidgets.QGridLayout(self.frame_Option)
        self.gridLayout_frame_Option.setContentsMargins(10, 10, 10, 10)
        self.gridLayout_frame_Option.addWidget(self.PB_Reverse, 0, 0, 1, 1)
        self.gridLayout_frame_Option.addWidget(self.CB_Word, 1, 0, 1, 1)
        self.gridLayout_Texte.addWidget(self.frame_Option, 0, 1, 1, 1)
        ##
        self.gridLayout_Texte.addWidget(self.lineEdit_NameFile,1, 0, 1, 1)#_Font
        self.gridLayout_Texte.addWidget(self.comboBoxPy,2, 0, 1, 1)
        self.gridLayout_Texte.addWidget(self.PB_Help,2, 1, 1, 1)
        self.gridLayout_2.addWidget(self.groupBox_01, 0, 0, 1, 1)
        ####
        self.gridLayout_Config = QtWidgets.QGridLayout(self.groupBox_02)
        self.gridLayout_Config.setContentsMargins(10, 10, 10, 10)
        self.gridLayout_Config.addWidget(self.groupBox_03, 0, 0, 7, 2)
        self.gridLayout_Choice = QtWidgets.QGridLayout(self.groupBox_03)
        self.gridLayout_Choice.addWidget(self.RA_Choice_Outdoor, 0, 0, 1, 1)
        self.gridLayout_Choice.addWidget(self.RA_Choice_Indoor, 1, 0, 1, 1)
        self.gridLayout_Choice.addWidget(self.RA_Choice_Helix, 0, 1, 1, 1)  # Visible False not used but stay cause new TAB
        self.gridLayout_Choice.addWidget(self.RA_Choice_Clock, 1, 1, 1, 1)  # Visible False not used but stay cause new TAB 
        #self.gridLayout_Choice.addWidget(self.RA_Choice_Stamp,2, 1, 1, 1)
        self.gridLayout_Choice.addWidget(self.PU_Flat, 2, 0, 1, 2)
        self.gridLayout_Choice.addWidget(self.graphicsView, 3, 0, 1, 2)
        ##
        self.gridLayout_Config.addWidget(self.DS_Radius_Circle, 0, 2, 1, 1)
        self.gridLayout_Config.addWidget(self.label_10, 0, 3, 1, 1)
        self.gridLayout_Config.addWidget(self.DS_Size_Character, 1, 2, 1, 1)
        self.gridLayout_Config.addWidget(self.label_4, 1, 3, 1, 1)
        self.gridLayout_Config.addWidget(self.S_Begin_Angle, 2, 2, 1, 1)
        self.gridLayout_Config.addWidget(self.label_13, 2, 3, 1, 1)
        self.gridLayout_Config.addWidget(self.S_End_Angle, 3, 2, 1, 1)
        self.gridLayout_Config.addWidget(self.label_14, 3, 3, 1, 1)
        self.gridLayout_Config.addWidget(self.DS_Correction_Angle, 4, 2, 1, 1)
        self.gridLayout_Config.addWidget(self.label_7, 4, 3, 1, 1)
        self.gridLayout_Config.addWidget(self.DS_Correction_Radius, 5, 2, 1, 1)
        self.gridLayout_Config.addWidget(self.label_8, 5, 3, 1, 1)
        self.gridLayout_Config.addWidget(self.DS_Extrude, 6, 2, 1, 1)
        self.gridLayout_Config.addWidget(self.CH_Extrude, 6, 3, 1, 1)
        self.gridLayout_Config.addWidget(self.DS_PlacementX, 7, 0, 1, 1)
        self.gridLayout_Config.addWidget(self.DS_PlacementY, 7, 1, 1, 1)
        self.gridLayout_Config.addWidget(self.DS_PlacementZ, 7, 2, 1, 1)
        self.gridLayout_Config.addWidget(self.CH_Sp_Placement, 7, 3, 1, 1)
        self.gridLayout_Config.addWidget(self.DS_InclinaisonX, 8, 0, 1, 1)
        self.gridLayout_Config.addWidget(self.DS_InclinaisonY, 8, 1, 1, 1)
        self.gridLayout_Config.addWidget(self.DS_InclinaisonZ, 8, 2, 1, 1)
        self.gridLayout_Config.addWidget(self.CH_Sp_Inclination, 8, 3, 1, 1)
        self.gridLayout_2.addWidget(self.groupBox_02, 1, 0, 1, 1)
        ####
        self.TAB_Command = QtWidgets.QWidget()
        self.gridLayout_Command = QtWidgets.QGridLayout(self.TAB_Command)
        self.gridLayout_Command.setContentsMargins(10, 10, 10, 10)
        self.gridLayout_Command.addWidget(self.CB_01_Points, 0, 0, 1, 1)
        self.gridLayout_Command.addWidget(self.CB_02_Circle, 0, 1, 1, 1)
        self.gridLayout_Command.addWidget(self.CB_03_BBox, 0, 2, 1, 1)
        self.gridLayout_Command.addWidget(self.CB_04_Progression, 0, 3, 1, 1)
        self.gridLayout_Command.addWidget(self.CB_06_ModeFree, 1, 0, 1, 1)
        self.gridLayout_Command.addWidget(self.CB_05_Reset, 1, 2, 1, 1)
        self.gridLayout_Command.addWidget(self.PB_Delete_Last, 1, 3, 1, 1)
        self.gridLayout_Command.addWidget(self.PU_Execute, 2, 0, 1, 1)
        self.gridLayout_Command.addWidget(self.PU_Benchmarks, 2, 1, 1, 1)
        self.gridLayout_Command.addWidget(self.PU_Reset, 2, 2, 1, 1)
        self.gridLayout_Command.addWidget(self.PU_Exit, 2, 3, 1, 1)
        self.tabWidget.addTab(self.TAB_Command, QtGui.QIcon(QtGui.QPixmap(setIconCommand)), "")
        ####
        self.gridLayout_2.addWidget(self.tabWidget, 2, 0, 1, 2)     #linge, colonne, ligne case, nombre de cases)
        self.TAB_Helix = QtWidgets.QWidget()
        self.gridLayout_Helix = QtWidgets.QGridLayout(self.TAB_Helix)
        self.gridLayout_Helix.setContentsMargins(10, 10, 10, 10)
        self.gridLayout_Helix.addWidget(self.DS_Step_Of_The_Helix, 0, 0, 1, 1)
        self.gridLayout_Helix.addWidget(self.label_12, 0, 1, 1, 1)
        self.gridLayout_Helix.addWidget(self.DS_Number_Char_Per_Turn, 0, 2, 1, 1)
        self.gridLayout_Helix.addWidget(self.label, 0, 3, 1, 1)
        self.gridLayout_Helix.addWidget(self.DS_Base_Helix, 1, 0, 1, 1)
        self.gridLayout_Helix.addWidget(self.label_2, 1, 1, 1, 1)
        self.gridLayout_Helix.addWidget(self.DS_End_Helix, 1, 2, 1, 1)
        self.gridLayout_Helix.addWidget(self.label_3, 1, 3, 1, 1)
        self.tabWidget.addTab(self.TAB_Helix, QtGui.QIcon(QtGui.QPixmap(setIconHelix)), "")
        ####
        self.TAB_Clock = QtWidgets.QWidget()
        self.gridLayout_Clock = QtWidgets.QGridLayout(self.TAB_Clock)
        self.gridLayout_Clock.addWidget(self.DS_Number_Faces_Support, 0, 0, 1, 1)
        self.gridLayout_Clock.addWidget(self.label_5, 0, 1, 1, 1)
        self.gridLayout_Clock.addWidget(self.CB_RomanOrArabic, 0, 2, 1, 1)
        self.gridLayout_Clock.addWidget(self.DS_Radius_Support, 1, 0, 1, 1)
        self.gridLayout_Clock.addWidget(self.label_11, 1, 1, 1, 1)
        self.gridLayout_Clock.addWidget(self.CB_RedressChiffres, 1, 2, 1, 1)
        self.gridLayout_Clock.addWidget(self.DS_Extrude_Support, 2, 0, 1, 1)
        self.gridLayout_Clock.addWidget(self.label_6, 2, 1, 1, 1)
        self.tabWidget.addTab(self.TAB_Clock, QtGui.QIcon(QtGui.QPixmap(setIconClock)), "")
        ####
        self.TAB_Path = QtWidgets.QWidget()
        self.gridLayout_Path = QtWidgets.QGridLayout(self.TAB_Path)
        self.gridLayout_Path.setContentsMargins(10, 10, 10, 10)
        self.gridLayout_frame_Path = QtWidgets.QGridLayout(self.frame_Path)
        self.gridLayout_frame_Path.setContentsMargins(10, 10, 10, 10)
        self.gridLayout_frame_Path.addWidget(self.RB_Path_01, 0, 1, 1, 1)
        self.gridLayout_frame_Path.addWidget(self.RB_Path_02, 0, 2, 1, 1)
        self.gridLayout_Path.addWidget(self.frame_Path, 0, 0, 1, 1)
        ##
        self.gridLayout_frame_Position = QtWidgets.QGridLayout(self.frame_Position)
        self.gridLayout_frame_Position.setContentsMargins(10, 10, 10, 10)
        self.gridLayout_frame_Position.addWidget(self.RB_Position_01, 0, 0, 1, 1)
        self.gridLayout_frame_Position.addWidget(self.RB_Position_02, 0, 1, 1, 1)
        self.gridLayout_frame_Position.addWidget(self.RB_Position_03, 0, 2, 1, 1)
        self.gridLayout_Path.addWidget(self.frame_Position, 1, 0, 1, 1)
        self.tabWidget.addTab(self.TAB_Path, QtGui.QIcon(QtGui.QPixmap(setIconPath)), "")
        ####
#        self.TAB_Stamp = QtWidgets.QWidget() # tab Stamp
#        self.gridLayout_Stamp = QtWidgets.QGridLayout(self.TAB_Stamp)
#        self.gridLayout_Stamp.setContentsMargins(10, 10, 10, 10)
#
#        self.tabWidget.addTab(self.TAB_Stamp, QtGui.QIcon(QtGui.QPixmap(setIconStamp)), "")
        ####
        self.gridLayout.addWidget(self.groupBox_00, 0, 0, 1, 1)
        #### gridLayout end #######################
        ####
        ####
        MainWindow.setCentralWidget(self.centralWidget)
        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

    def retranslateUi(self, MainWindow):
        MainWindow.setWindowFlags(PySide2.QtCore.Qt.WindowStaysOnTopHint)                         # PySide cette fonction met la fenetre en avant
        MainWindow.setWindowTitle(_fromUtf8(__Title__))
        MainWindow.setWindowIcon(QtGui.QIcon(_fromUtf8(self.path + "FCCircularTextButtom.png")))  # change l'icone de la fenetre principale
        self.groupBox_00.setTitle(_fromUtf8("Ver : " + __Version__ + " : " +  __Date__) + " (rmu)")

        self.groupBox_01.setTitle(_fromUtf8("Text to be displayed  ( "+str(len(texte))+" characters )"))
        self.textEdit.setHtml(_fromUtf8(texte))
        self.textEdit.setToolTip(_fromUtf8("Your text to be displayed" + "\n"
                                           "the last character superpose de first character ! " + "\n"
                                           "you must adding one space after the last character" + "\n"
                                           "you must adding space for adjust, the space is consirdered as character"))
        self.PB_Reverse.setText(_fromUtf8("Reverse"))
        self.PB_Reverse.setToolTip(_fromUtf8("Reverse the text edited"))
        try:
            self.lineEdit_NameFile.setText(_fromUtf8("(" + str(self.index + 1) + "/" + str(len(self.tableau)) + ") " + self.tableau[self.index][1]))
        except Exception:
            None
        self.lineEdit_NameFile.setToolTip(_fromUtf8("(Number index / Number Fonts) Complete path and name of Font file"))
        self.PB_Help.setText(_fromUtf8("Help"))
        self.CB_Word.setText(_fromUtf8("Word"))
        self.CB_Word.setToolTip(_fromUtf8("If Word is checked, the text are clipped to each space" + "\n"
                                          "one space egual one character." + "\n\n"
                                          "If in mode Path you work with a circle," + "\n"
                                          "the last character superpose de first character ! " + "\n"
                                          "you must adding one space after the last character" + "\n"
                                          "for spacing the last and the first character" + "\n\n"
                                          "You must work with the space as the character"))

        #### matplotlib debut 4/5 retranslateUi #################################################################
        self.comboBoxPy.setToolTip("Choice your Font" + "\n" +
                                   "\n" +
                                   "You must modify the configuration of display" + "\n" +
                                   "Menu Edit parameter: User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__ + ":" + "\n" +
                                   "####" + "\n" +
                                   "switchModeTextList= 1\t# 0 = mode text normal (the switchFontComBox is enabled)" + "\n"
                                   "\t\t\t# 1 = switchFontComBox authorized (default)" + "\n"
                                   "\t\t\t#####" + "\n"
                                   "switchFontComBox  = 1\t# 0 = mode text in color .. faster" + "\n"
                                   "\t\t\t# 1 = fontFamily listed ComboBox slower but beautiful (default)" + "\n"
                                   "\t\t\t#####" + "\n"
                                   "setSystemFonts    = 1\t# 0 = matplotlib.font_manager.findSystemFonts" + "\n"
                                   "\t\t\t#   all fonts in System font" + "\n"
                                   "\t\t\t# 1 = fontman.findSystemFonts(self.pathFont) (default)" + "\n"
                                   "\t\t\t# all fonts in all directory and sub directory" + "\n"
                                   "\t\t\t#####" + "\n"
                                   "seTtextAlignement = 0\t# 0 = AlignLeft (default)" + "\n"
                                   "\t\t\t# 1 = AlignCenter" + "\n"
                                   "\t\t\t# 2 = AlignRight" + "\n"
                                   "\t\t\t#####" + "\n"
                                   "setFontByDefault = ""ARIAL""\t # ARIAL" + "\n"
                                   "\t\t\t#####" + "\n"
                                   "switchResetFALSE = 0\t # 0 by default." + "\n"
                                   "If you use this option [ switchResetFALSE = 1 ] some switch can be opened when it should not be" + "\n"
                                   "then it is advisable to do a reset after a change one option" + "\n"
                                   "####" + "\n"
                                   "Actual configuration : " + str(switchModeTextList) + ", " + str(switchFontComBox) + ", " + str(setSystemFonts) + ", "
                                                             + str(seTtextAlignement) + ", " + setFontByDefault + ", " + str(switchResetFALSE) + "\n"
                                   "####" + "\n" +
                                   "Read the info")
        #### matplotlib fin 4/5 retranslateUi #################################################################

        self.groupBox_02.setTitle(_fromUtf8("Configuration"))
        self.DS_Radius_Circle.setToolTip(_fromUtf8("Give the radius of circle"))
        self.DS_Radius_Circle.setSuffix(_fromUtf8(" mm"))
        self.label_10.setText(_fromUtf8("Radius of circle"))
        self.DS_Size_Character.setToolTip(_fromUtf8("Size of the font"))
        self.DS_Size_Character.setSuffix(_fromUtf8(" mm"))
        self.label_4.setText(_fromUtf8("Character size"))
        self.S_Begin_Angle.setToolTip(_fromUtf8("Starting text of the circle "))
        self.S_Begin_Angle.setSuffix(_fromUtf8(" deg"))
        self.label_13.setText(_fromUtf8("Starting angle"))
        self.S_End_Angle.setToolTip(_fromUtf8("End text of the circle "))
        self.S_End_Angle.setSuffix(_fromUtf8(" deg"))
        self.label_14.setText(_fromUtf8("Ending angle"))
        self.DS_Correction_Angle.setToolTip(_fromUtf8("Correct angle for tangent the text of thr circle or give a tilt angle" + "\n"
                                                      "this option is adding to the original angle (Sp. inclination)"))
        self.DS_Correction_Angle.setSuffix(_fromUtf8(" deg"))
        self.label_7.setText(_fromUtf8("Correction Angle"))
        self.DS_Correction_Radius.setToolTip(_fromUtf8("Correct of the radius (depend of correction angle)" + "\n"
                                                       "this option is adding to the original radius (Radius of circle)"))
        self.DS_Correction_Radius.setSuffix(_fromUtf8(" mm"))
        self.label_8.setText(_fromUtf8("Correction Radius"))
        self.DS_Extrude.setSuffix(_fromUtf8(" mm"))
        self.DS_Extrude.setToolTip(_fromUtf8("Thickness of the extrude of character. If thickness = 0 then not extrude"))
        self.CH_Extrude.setText(_fromUtf8("Extrude Char."))
        self.CH_Extrude.setToolTip(_fromUtf8("Choice extrude character or not"))
        ####
        self.DS_PlacementX.setSuffix(_fromUtf8(" X mm"))
        self.DS_PlacementX.setToolTip(_fromUtf8("Placement direction X" + "\n" 
                                                "Not used with the Clock option"))
        self.DS_PlacementY.setSuffix(_fromUtf8(" Y mm"))
        self.DS_PlacementY.setToolTip(_fromUtf8("Placement direction Y" + "\n" 
                                                "Not used with the Clock option"))
        self.DS_PlacementZ.setSuffix(_fromUtf8(" Z mm"))
        self.DS_PlacementZ.setToolTip(_fromUtf8("Placement direction Z"+ "\n"
                                                "For Clock option only this Z axis is available"))
        self.CH_Sp_Placement.setText(_fromUtf8("Placement"))
        self.CH_Sp_Placement.setToolTip(_fromUtf8("Placement of character in the choice"))
        #carDegrees = b' \xc2\xb0'.decode("utf-8")    #thanks wmayer    https://forum.freecadweb.org/viewtopic.php?f=13&t=36380&p=308476#p308357
        self.DS_InclinaisonX.setSuffix(_fromUtf8(" deg (Yaw)"))
        self.DS_InclinaisonX.setToolTip(_fromUtf8("Inclination character in axis Z"))
        self.DS_InclinaisonY.setSuffix(_fromUtf8(" deg (Pitch)"))
        self.DS_InclinaisonY.setToolTip(_fromUtf8("Inclination character axis Y"))
        self.DS_InclinaisonZ.setSuffix(_fromUtf8(" deg (Roll)"))
        self.DS_InclinaisonZ.setToolTip(_fromUtf8("Inclination character axis X"))
        self.CH_Sp_Inclination.setText(_fromUtf8("Sp. inclination"))
        self.CH_Sp_Inclination.setToolTip(_fromUtf8("Inclination of character in the choice or alls plane "))
        ####
        self.groupBox_03.setTitle(_fromUtf8("Choice"))
        self.RA_Choice_Outdoor.setText(_fromUtf8("Outdoor"))
        self.RA_Choice_Outdoor.setToolTip(_fromUtf8("Create the text on the outer face of the cylinder"))
        self.RA_Choice_Indoor.setText(_fromUtf8("Indoor"))
        self.RA_Choice_Indoor.setToolTip(_fromUtf8("Create the text on the inside of the cylinder"))
        self.RA_Choice_Helix.setText(_fromUtf8("Helix"))
        self.RA_Choice_Helix.setToolTip(_fromUtf8("Create the text in a helix"))
        self.RA_Choice_Clock.setText(_fromUtf8("Clock"))
        self.RA_Choice_Clock.setToolTip(_fromUtf8("Create the text to form a clock"))
        #self.RA_Choice_Stamp.setText(_fromUtf8("Stamp"))
        #self.RA_Choice_Stamp.setToolTip(_fromUtf8("Create stamp text (text reversed)"))
        self.PU_Flat.setText(_fromUtf8("Mode Stand"))
        self.PU_Flat.setToolTip(_fromUtf8("Click for create the text Flat"))
        ####
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.TAB_Helix), _fromUtf8("Helix"))
        self.tabWidget.setTabToolTip(1,_fromUtf8("Create one helix"))
        self.DS_Step_Of_The_Helix.setSuffix(_fromUtf8(" mm"))
        self.DS_Step_Of_The_Helix.setToolTip(_fromUtf8("Step of the text along the helix (min Size Caractere)"))
        self.label_12.setText(_fromUtf8("Step of Helix"))
        self.DS_Number_Char_Per_Turn.setToolTip(_fromUtf8("Number of characters for one turn of helix"))
        self.label.setText(_fromUtf8("Char. per turn"))
        self.DS_Base_Helix.setToolTip(_fromUtf8("Base (begin) of helix (to activate Step of Helix must be zero)"))
        self.DS_Base_Helix.setSuffix(_fromUtf8(" mm"))
        self.label_2.setText(_fromUtf8("Base Helix"))
        self.DS_End_Helix.setToolTip(_fromUtf8("Final height of the helix (to activate Step of Helix must be zero)"))
        self.DS_End_Helix.setSuffix(_fromUtf8(" mm"))
        self.label_3.setText(_fromUtf8("End Helix"))
        ####
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.TAB_Clock), _fromUtf8("Clock"))
        self.tabWidget.setTabToolTip(2,_fromUtf8("Create one clock with character mode Arabic or Roman"))
        self.DS_Radius_Support.setSuffix(_fromUtf8(" mm"))
        self.DS_Radius_Support.setToolTip(_fromUtf8("Radius of the support the clock (By defaut : Radius of circle)"))
        self.label_11.setText(_fromUtf8("Radius of support"))
        self.CB_RomanOrArabic.setText(_fromUtf8("Mode Arabic"))
        self.CB_RomanOrArabic.setToolTip(_fromUtf8("The characters is in Roman or Arabic (default)"))
        self.DS_Number_Faces_Support.setToolTip(_fromUtf8("Number of side of the support 0=none, 1=circle, 2=rectangle, 3=triangle, 4=square, 5=pentagon . . . . (Thickness egal extrude)"))
        self.label_5.setText(_fromUtf8("Support number face"))
        self.CB_RedressChiffres.setText(_fromUtf8("Axial"))
        self.CB_RedressChiffres.setToolTip(_fromUtf8("Click for activate the mode Redress"))
        self.DS_Extrude_Support.setToolTip(_fromUtf8("Thickness of the extrude the support." + "\n"
                                                     "If thickness = 0 then not extrude" + "\n"
                                                     "If thickness of support is bigger than character" + "\n"
                                                     "the SpinBox is colored in red" + "\n"
                                                     "if the CheckBox [Extrude Char.] is not checked" + "\n"
                                                     "the SpinBox is colored in orange for warn that the character is at the base of the support"))
        self.DS_Extrude_Support.setSuffix(_fromUtf8(" mm"))
        self.label_6.setText(_fromUtf8("Extrude support"))
        ####
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.TAB_Path), _fromUtf8("Path")) # tab Path
        self.tabWidget.setTabEnabled(3, False)
        self.tabWidget.setTabToolTip(3,_fromUtf8("The string follow the wire selected (Based on X, Y plane)" + "\n"
                                               "The buttons Outdoor, Helix, Indoor, Clock and"
                                               "the button Mode Stand / Flat are ignored" + "\n"
                                               "The direction of the text depend of the direction Left/Right of the wire selected" + "\n"
                                               "in this case use the Reverse Button"))
        self.RB_Path_01.setText(_fromUtf8("Orthogonal"))
        self.RB_Path_01.setToolTip(_fromUtf8("The character is orthogonal"))
        self.RB_Path_02.setText(_fromUtf8("Tangent"))
        self.RB_Path_02.setToolTip(_fromUtf8("The character is tangent on position wire selected"))

        self.RB_Position_01.setText(_fromUtf8("BB Base"))
        self.RB_Position_01.setToolTip(_fromUtf8("The BoundBox of the character is on Base"))
        self.RB_Position_02.setText(_fromUtf8("BB Center"))
        self.RB_Position_02.setToolTip(_fromUtf8("The BoundBox of the character is on BB Center"))
        self.RB_Position_03.setText(_fromUtf8("BB Top"))
        self.RB_Position_03.setToolTip(_fromUtf8("The BoundBox of the character is on BB Top"))
#  later      self.label_Path_01.setText(_fromUtf8("Rotation str"))
#  later      self.label_Path_02.setText(_fromUtf8("Rotation car"))
#  later      self.label_Path_03.setText(_fromUtf8("Translation"))
        ####
#        self.tabWidget.setTabText(self.tabWidget.indexOf(self.TAB_Stamp), _fromUtf8("Stamp")) # tab Stamp
#        self.tabWidget.setTabToolTip(4,_fromUtf8("Stamp"))
        ####
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.TAB_Command), _fromUtf8("Command"))
        self.tabWidget.setTabToolTip(0,_fromUtf8("Command section"))
        self.CB_01_Points.setText(_fromUtf8("Points"))
        self.CB_01_Points.setToolTip(_fromUtf8("Create points repere"))
        self.CB_02_Circle.setText(_fromUtf8("Circle"))
        self.CB_02_Circle.setToolTip(_fromUtf8("Create Circle repere" + "\n"
                                               "if helix is used one helix is created with the circle"))
        self.CB_03_BBox.setText(_fromUtf8("BoundBox"))
        self.CB_03_BBox.setToolTip(_fromUtf8("Create BoundBox on character"))
        self.CB_04_Progression.setText(_fromUtf8("Progression"))
        self.CB_04_Progression.setToolTip(_fromUtf8("Visualise the character in construction"))
        self.CB_05_Reset.setText(_fromUtf8("Reset"))
        self.CB_05_Reset.setToolTip(_fromUtf8("Reset checkBox False by default (reset on all push button execute)" + "\n"
                                              "If you check this option No reset is performed" + "\n"
                                              "and if the result is not good" + "\n"
                                              "ex: the old internal coordinate hare conserved or other..." + "\n"
                                              "push the Reset button or " + "\n"
                                              "uncheck this checkBox and try or restart FCCircularText"))
        self.CB_06_ModeFree.setText(_fromUtf8("Free"))
        self.CB_06_ModeFree.setToolTip(_fromUtf8("Mode Free, all pre-settings are ignored" + "\n"
                                                 "Free as a cloud"))
        self.PB_Delete_Last.setText(_fromUtf8("Del"))
        self.PB_Delete_Last.setToolTip(_fromUtf8("Delete the last object created"))
        self.PU_Exit.setText(_fromUtf8("Exit"))
        self.PU_Exit.setToolTip(_fromUtf8("Exit FCCircularText"))
        self.PU_Reset.setText(_fromUtf8("Reset"))
        self.PU_Reset.setToolTip(_fromUtf8("Reset all parameters of the macro"))
        self.PU_Execute.setText(_fromUtf8("Run"))
        self.PU_Execute.setToolTip("Execute the process") # without Compount
        self.PU_Benchmarks.setText(_fromUtf8("Run+Comp"))
        self.PU_Benchmarks.setToolTip(_fromUtf8("Execute the process and one Compount of the characters is create"))
        ####

    #### matplotlib debut 5/5 #################################################################
    def on_fontComboBoxPython(self,indeX):                                          # 0: for fontComboBoxPython
        global PolicePath
        global setFontByDefault

        self.index = indeX
        self.lineEdit_NameFile.setText("(" + str(self.index + 1) + "/" + str(len(self.tableau)) + ") " + self.tableau[self.index][1])
        PolicePath = self.tableau[self.index][1]

        famille = typeCar = self.font = ""
        self.font = QtGui.QFont()
        typeCar   = family(self.tableau[self.index][2])[1]
        self.font.setBold(False)
        self.font.setItalic(False)

        if len(typeCar) > 0:
            for option in typeCar:
                if option == "Bold":
                    self.font.setBold(True)
                if (option == "Italic") or (option == "It") or (option == "Slanted"):
                    self.font.setItalic(True)
                if option == "Oblique":
                    self.font.setItalic(True)
        #'Bold''Regular''Slanted''Italic''Medium''Extra''Light''Condensed''Black''It''Semibold'#+
        
        self.font.setFamily(self.tableau[self.index][5])
        self.font.setPointSize(self.FontTextSize)
        ####
        self.fonteComp   = self.tableau[self.index][1]
        setFontByDefault = self.tableau[self.index][2]
#        FreeCAD.Console.PrintMessage(str(self.index) + " , " + self.tableau[self.index][1] + " , " + self.tableau[self.index][2] + " , ' " + famille + "' , ' " + typeCar + " ' \n")
    #### matplotlib fin 5/5 #################################################################

    def on_lineEdit_NameFile(self):

        self.pathFont = self.lineEdit_NameFile.text() 
        try:
            self.pathFont  = self.pathFont.split(")") [1]
        except Exception:
            self.pathFont  = self.pathFont

        ui.searchFont(self.pathFont)
        QtCore.QObject.connect(self.comboBoxPy, QtCore.SIGNAL("currentIndexChanged(int)"), self.on_fontComboBoxPython)

    def on_textEdit_Changed(self):        #connection textEdit
        global ui

#        self.textEdit.setTextColor(QColor("red"))
#        self.textEdit.setTextColor(QColor("Base"))
        ui.on_CB_Word()

    def on_PB_Reverse(self):              #connection Reverse
        global texte

        texte = self.textEdit.toPlainText()
        texte = texte[::-1]
        self.textEdit.setText(_fromUtf8(texte))

    def on_CB_Word(self):
        global texte

        texte = ""
        texte = self.textEdit.toPlainText()

        try:
            selectedEdge = FreeCADGui.Selection.getSelectionEx()[0].SubObjects[0]
        except Exception:
            selectedEdge = ""

        if self.CB_Word.isChecked():
            texte = texte.split(" ")
            mot = "word"
        else:
            mot = "characters"

        if (texte.count(" ") == 1) or (texte.count(" ") == 0):
            espace = "space"
        else:
            espace = "spaces"

        if str(selectedEdge) != "":
            self.groupBox_01.setTitle("Text to be displayed  ( "+str(len(texte))+ " " + mot + " ) ( " + str(texte.count(" ")) + " " + espace + " ) ( Lenght " + str(round(selectedEdge.Length,3)) + " mm )")
        else:
            self.groupBox_01.setTitle("Text to be displayed  ( "+str(len(texte))+ " " + mot + " ) ( " + str(texte.count(" ")) + " " + espace + " )")

        if self.RA_Choice_Outdoor.isChecked():
            self.Image_RA_Choice_Outdoor()
        if self.RA_Choice_Indoor.isChecked():
            self.Image_RA_Choice_Indoor()

    def on_PU_Reset_Placement(self):           # Reset_Placement
        global PlacementX
        global PlacementY
        global PlacementZ
        global coor_X
        global coor_Y
        global coor_Z

        coor_X = coor_Y = coor_Z = 0.0
        PlacementX = PlacementY = PlacementZ = 0.0
        self.CH_Sp_Placement.setChecked(False)  ; self.CH_Sp_Placement.setStyleSheet(setStyleBase)
        self.DS_PlacementX.setValue(PlacementX)
        self.DS_PlacementX.setEnabled(False)    ; self.DS_PlacementX.setStyleSheet(setStyleBase)
        self.DS_PlacementY.setValue(PlacementY)
        self.DS_PlacementY.setEnabled(False)    ; self.DS_PlacementY.setStyleSheet(setStyleBase)
        self.DS_PlacementZ.setValue(PlacementZ)
        self.DS_PlacementZ.setEnabled(False)    ; self.DS_PlacementZ.setStyleSheet(setStyleBase)
#        App.Console.PrintMessage(str("on_PU_Reset_Placement ")+"\n")

    def on_PU_Reset_Inclination(self):           # Reset_Inclination
        global inclinaisonX
        global inclinaisonY
        global inclinaisonZ

        inclinaisonX = inclinaisonY = inclinaisonZ = 0.0
        self.CH_Sp_Inclination.setChecked(False); self.CH_Sp_Inclination.setStyleSheet(setStyleBase)
        self.DS_InclinaisonX.setValue(inclinaisonX)
        self.DS_InclinaisonX.setEnabled(False)  ; self.DS_InclinaisonX.setStyleSheet(setStyleBase)
        self.DS_InclinaisonY.setValue(inclinaisonY)
        self.DS_InclinaisonY.setEnabled(False)  ; self.DS_InclinaisonY.setStyleSheet(setStyleBase)
        self.DS_InclinaisonZ.setValue(inclinaisonZ)
        self.DS_InclinaisonZ.setEnabled(False)  ; self.DS_InclinaisonZ.setStyleSheet(setStyleBase)
#        App.Console.PrintMessage(str("on_PU_Reset_Inclination ")+"\n")

    def Image_RA_Choice_Outdoor(self):        #
        global debout

        ####
        pic = QtGui.QPixmap()
        if debout == 1:
            if self.CB_Word.isChecked():
                pic.loadFromData(base64.b64decode(outDoorWord_Icon_b64))    # bmp converti
            else:
                pic.loadFromData(base64.b64decode(outDoor_Icon_b64))    # bmp converti
        else:
            if self.CB_Word.isChecked():
                pic.loadFromData(base64.b64decode(FlatOutDoorWord_Icon_b64))    # bmp converti
            else:
                pic.loadFromData(base64.b64decode(FlatOutDoor_Icon_b64))    # bmp converti

        self.scene = QtWidgets.QGraphicsScene()
        self.scene.addPixmap(QtGui.QPixmap(pic))
        self.graphicsView.setScene(self.scene)
        ####

    def on_RA_Choice_Outdoor(self):           #
        global ui
        global exterieur
        global epaisseurExtrus
        global switchResetFALSE

        ui.Image_RA_Choice_Outdoor()
        epaisseurExtrus = 0.0
        self.tabWidget.setCurrentIndex(0)
        self.DS_Extrude.setValue(epaisseurExtrus)
        self.DS_Extrude.setEnabled(False)
        self.DS_Extrude.setStyleSheet(setStyleBase) # origin system
        self.CH_Extrude.setChecked(False)
        exterieur = 1
        self.S_Begin_Angle.setEnabled(True)
        self.S_End_Angle.setEnabled(True)
        self.DS_Correction_Radius.setEnabled(True)
        self.DS_Correction_Angle.setEnabled(True)
        self.PU_Flat.setEnabled(True)
        if switchResetFALSE == 0:    # zero (False) by default = reset
            ui.on_PU_Reset_Placement()
            ui.on_PU_Reset_Inclination()
#        App.Console.PrintMessage(str("on_RA_Choice_Outdoor ")+" "+str(exterieur)+"\n")

    def Image_RA_Choice_Indoor(self):       #
        global debout

        ####
        pic = QtGui.QPixmap()
        if debout == 1:
            if self.CB_Word.isChecked():
                pic.loadFromData(base64.b64decode(inDoorWord_Icon_b64))    # bmp converti
            else:
                pic.loadFromData(base64.b64decode(inDoor_Icon_b64))    # bmp converti
        else:
            if self.CB_Word.isChecked():
                pic.loadFromData(base64.b64decode(FlatInDoorWord_Icon_b64))    # bmp converti
            else:
                pic.loadFromData(base64.b64decode(FlatInDoor_Icon_b64))    # bmp converti
            self.scene = QtWidgets.QGraphicsScene()
        self.scene.addPixmap(QtGui.QPixmap(pic))
        self.graphicsView.setScene(self.scene)
        ####

    def on_RA_Choice_Indoor(self):          #
        global ui
        global exterieur
        global epaisseurExtrus
        global switchResetFALSE

        ui.Image_RA_Choice_Indoor()
        epaisseurExtrus = 0.0
        self.tabWidget.setCurrentIndex(0)
        self.DS_Extrude.setValue(epaisseurExtrus)
        self.DS_Extrude.setEnabled(False)
        self.CH_Extrude.setChecked(False)
        exterieur = 0
        self.S_Begin_Angle.setEnabled(True)
        self.S_End_Angle.setEnabled(True)
        self.DS_Correction_Radius.setEnabled(True)
        self.DS_Correction_Angle.setEnabled(True)
        self.PU_Flat.setEnabled(True)
        if switchResetFALSE == 0:    # zero (False) by default = reset
            ui.on_PU_Reset_Placement()
            ui.on_PU_Reset_Inclination()
#        App.Console.PrintMessage(str("on_RA_Choice_Indoor ")+" "+str(exterieur)+"\n")


    def Image_RA_Choice_Helix(self):              #
        ####
        pic = QtGui.QPixmap()
        pic.loadFromData(base64.b64decode(helix_Icon_b64))    # bmp converti
        self.scene = QtWidgets.QGraphicsScene()
        self.scene.addPixmap(QtGui.QPixmap(pic))
        self.graphicsView.setScene(self.scene)
        ####

    def on_RA_Choice_Helix(self):              #
        global ui
        global exterieur
        global cercleClock
        global nombreFaces
        global debout
        global epaisseurExtrus
        global switchResetFALSE

        ui.Image_RA_Choice_Helix()
        ui.tabWidget.setTabEnabled(1, True)
        ui.tabWidget.setCurrentIndex(1)
        epaisseurExtrus = 0.0
        self.DS_Extrude.setValue(epaisseurExtrus)
        self.DS_Extrude.setEnabled(False)
        self.CH_Extrude.setChecked(False)
        exterieur = 2
        nombreFaces = 0
        self.DS_Number_Faces_Support.setValue(nombreFaces)
        cercleClock = 0
        self.DS_Radius_Support.setValue(cercleClock)
        self.DS_Radius_Support.setEnabled(False)
        debout = 1
        self.PU_Flat.setText(_fromUtf8("Mode Stand"))

        self.S_Begin_Angle.setEnabled(True)
        self.S_End_Angle.setEnabled(True)
        self.DS_Correction_Radius.setEnabled(True)
        self.DS_Correction_Angle.setEnabled(True)
        self.PU_Flat.setEnabled(False)##
        if switchResetFALSE == 0:    # zero (False) by default = reset
            ui.on_PU_Reset_Placement()
            ui.on_PU_Reset_Inclination()

    def Image_RA_Choice_Clock(self):
        global redressement

        ####
        pic = QtGui.QPixmap()
        if self.CB_RomanOrArabic.isChecked():
            if redressement == 1:
                pic.loadFromData(base64.b64decode(ClockRomanRedress_Icon_b64))    # bmp converti
            else:
                pic.loadFromData(base64.b64decode(ClockRomanAxis_Icon_b64))    # bmp converti
        else:
            if redressement == 1:
                pic.loadFromData(base64.b64decode(ClockArabicRedress_Icon_b64))    # bmp converti
            else:
                pic.loadFromData(base64.b64decode(ClockArabicAxis_Icon_b64))    # bmp converti
        self.scene = QtWidgets.QGraphicsScene()
        self.scene.addPixmap(QtGui.QPixmap(pic))
        self.graphicsView.setScene(self.scene)
        ####

    def on_RA_Choice_Clock(self):
        global ui
        global exterieur
        global debout
        global correctionRayon
        global correctionAngle
        global epaisseurExtrus
        global switchResetFALSE
        global romain

        ui.Image_RA_Choice_Clock()
        ui.tabWidget.setTabEnabled(2, True)
        ui.tabWidget.setCurrentIndex(2)
        epaisseurExtrus = 0.0
        self.DS_Extrude.setValue(epaisseurExtrus)
        self.DS_Extrude.setEnabled(False)
        self.CH_Extrude.setChecked(False)
        exterieur = 3
        debout = 0
        self.PU_Flat.setEnabled(False)
        self.S_Begin_Angle.setEnabled(False)
        self.S_End_Angle.setEnabled(False)
#        correctionRayon = 0
        self.DS_Correction_Radius.setEnabled(False)
        self.DS_Correction_Radius.setValue(0.0)
#        correctionAngle = 10.0
        self.DS_Correction_Angle.setEnabled(False)
        self.DS_Correction_Angle.setValue(0.0)
        if switchResetFALSE == 0:              # zero (False) by default = reset
            ui.on_PU_Reset_Placement()
            ui.on_PU_Reset_Inclination()
#        App.Console.PrintMessage(str("on_RA_Choice_Clock ")+str(exterieur)+"\n")

    def on_tabWidget(self, value):              # Tab 
        global ui
        global setStylePathG
        global setStyleBase

        if   value == 0:            # Command
            self.tabWidget.setStyleSheet(setStyleBase)
            None
        elif value == 1:            # Helix
            self.RA_Choice_Helix.setChecked(True)
            self.on_RA_Choice_Helix()
        elif value == 2:            # Clock
            self.RA_Choice_Clock.setChecked(True)
            self.on_RA_Choice_Clock()
        elif value == 3:            # Path
            self.tabWidget.setStyleSheet(setStylePathG)
            None
        elif value == 4:            # Stamp
            #self.RA_Choice_Stamp.setChecked(True)
            #self.on_RA_Choice_Stamp()
            #self.on_RA_Choice_Stamp()
            None

#        App.Console.PrintMessage("on_tabWidget "+str(value)+"\n")

    def on_PU_Flat(self):         # Flat or Stand
        global debout

        pic = QtGui.QPixmap()
        if debout == 1:
            debout = 0
            self.PU_Flat.setText(_fromUtf8("Mode Flat"))
            self.PU_Flat.setToolTip(_fromUtf8("Click for create the text Stand"))
            self.PU_Flat.setIcon(QtGui.QIcon(QtGui.QPixmap(flatIcon))) # icone dans une variable 
            # self.RA_Choice_Outdoor.setText(_fromUtf8("Indoor"))
            # self.RA_Choice_Indoor.setText(_fromUtf8("Outdoor"))
            if self.RA_Choice_Outdoor.isChecked():
                if self.CB_Word.isChecked():
                    pic.loadFromData(base64.b64decode(FlatOutDoorWord_Icon_b64))  # bmp converti
                else:
                    pic.loadFromData(base64.b64decode(FlatOutDoor_Icon_b64))      # bmp converti
            elif self.RA_Choice_Indoor.isChecked():
                if self.CB_Word.isChecked():
                    pic.loadFromData(base64.b64decode(FlatInDoorWord_Icon_b64))   # bmp converti
                else:
                    pic.loadFromData(base64.b64decode(FlatInDoor_Icon_b64))       # bmp converti
        else:
            debout = 1
            self.PU_Flat.setText(_fromUtf8("Mode Stand"))
            self.PU_Flat.setToolTip(_fromUtf8("Click for create the text Flat"))
            self.PU_Flat.setIcon(QtGui.QIcon(QtGui.QPixmap(standIcon))) # icone dans une variable 
            # self.RA_Choice_Outdoor.setText(_fromUtf8("Outdoor"))
            # self.RA_Choice_Indoor.setText(_fromUtf8("Indoor"))
            if self.RA_Choice_Outdoor.isChecked():
                pic.loadFromData(base64.b64decode(outDoor_Icon_b64))  # bmp converti
            elif self.RA_Choice_Indoor.isChecked():
                pic.loadFromData(base64.b64decode(inDoor_Icon_b64))  # bmp converti
        self.scene = QtWidgets.QGraphicsScene()
        self.scene.addPixmap(QtGui.QPixmap(pic))
        self.graphicsView.setScene(self.scene)
#        App.Console.PrintMessage(str("on_PU_Flat ")+str(debout)+"\n")

#    def on_RA_Choice_Stamp(self):
#        global ui
#
#        if self.RA_Choice_Helix.isChecked() or self.RA_Choice_Clock.isChecked():
#            self.RA_Choice_Outdoor.setChecked(True)
#            self.on_RA_Choice_Outdoor()
##        App.Console.PrintMessage("on_RA_Choice_Stamp"+"\n")

    def on_DS_Radius_Circle(self,value):
        global rayon
        global cercleClock

        rayon = value  
        cercleClock = rayon
        self.DS_Radius_Support.setValue(cercleClock)
#        App.Console.PrintMessage("on_DS_Radius_Circle Radius"+str(rayon)+"\n")

    def on_DS_Size_Character(self,value):
        global SizeCaractere

        SizeCaractere = value
#        App.Console.PrintMessage("on_DS_Size_Character Size"+str(SizeCaractere)+"\n")

    def on_S_Begin_Angle(self,value):          #
        global debut

        debut = value
#        App.Console.PrintMessage(str("on_S_Begin_Angle ")+str(debut)+"\n")

    def on_S_End_Angle(self,value):            #
        global rotation

        rotation = value
#        App.Console.PrintMessage(str("on_S_End_Angle ")+str(rotation)+"\n")

    def on_DS_PlacementX(self,value):          #
        global PlacementX

        PlacementX = value
#        App.Console.PrintMessage(str("on_DS_PlacementX ")+str(PlacementX)+"\n")

    def on_DS_PlacementY(self,value):          #
        global PlacementY

        PlacementY = value
#        App.Console.PrintMessage(str("on_DS_PlacementY ")+str(PlacementY)+"\n")

    def on_DS_PlacementZ(self,value):          #
        global PlacementZ

        PlacementZ = value
#        App.Console.PrintMessage(str("on_DS_PlacementZ ")+str(PlacementZ)+"\n")

    def on_CH_Sp_Placement(self):              # Placement or not Placement
        global ui

        if self.CH_Sp_Placement.isChecked(): 
            self.DS_PlacementX.setEnabled(True)
            self.DS_PlacementY.setEnabled(True)
            self.DS_PlacementZ.setEnabled(True)
#            App.Console.PrintMessage(str("on_CH_Sp_Placement ")+str("True")+"\n")
        else:
            ui.on_PU_Reset_Placement()
        if self.RA_Choice_Clock.isChecked():
            self.DS_PlacementX.setEnabled(False)
            self.DS_PlacementY.setEnabled(False)
#            App.Console.PrintMessage(str("on_CH_Sp_Placement ")+str("False")+"\n")

    def on_DS_Correction_Angle(self,value):    # 
        global correctionAngle

        correctionAngle = value
#        App.Console.PrintMessage(str("on_DS_Correction_Angle ")+str(correctionAngle)+"\n")

    def on_DS_Correction_Radius(self,value):   # 
        global correctionRayon

        correctionRayon = value
#        App.Console.PrintMessage(str("on_DS_Correction_Radius ")+str(correctionRayon)+"\n")

    def on_DS_Extrude(self,value):             # 
        global epaisseurExtrus
        global epaisSupportClock
        global setStyleBase
        global setStyleRed
        global setStyleOrange
        global setStyleBlueLight

        epaisseurExtrus = value
        if self.CB_06_ModeFree.isChecked():
            self.DS_Extrude.setStyleSheet(setStyleBlueLight)
        else:
            if self.RA_Choice_Clock.isChecked():
                if epaisseurExtrus > epaisSupportClock:
                    self.DS_Extrude_Support.setStyleSheet(setStyleBase) # origin system
                    self.DS_Extrude.setStyleSheet(setStyleBase) # origin system
                    self.CH_Extrude.setStyleSheet(setStyleBase) # origin system
                else:
                    if epaisSupportClock >= epaisseurExtrus:
                        self.DS_Extrude.setStyleSheet(setStyleRed)
                        self.DS_Extrude_Support.setStyleSheet(setStyleRed)
                    else:
                        self.DS_Extrude.setStyleSheet(setStyleOrange)
                if epaisseurExtrus == 0:
                    self.DS_Extrude.setStyleSheet(setStyleOrange)
#        App.Console.PrintMessage("on_DS_Extrude "+str(epaisseurExtrus)+"\n")

    def on_CH_Extrude(self):                   #
        global epaisseurExtrus
        global epaisSupportClock
        global setStyleBase
        global setStyleOrange
        global setStyleBlueLight

        if self.CH_Extrude.isChecked(): 
            self.DS_Extrude.setEnabled(True)
            epaisseurExtrus = 1.0
        else:
            self.DS_Extrude.setEnabled(False)
            self.DS_Extrude.setStyleSheet(setStyleBase) # origin system
            epaisseurExtrus = 0.0
        if self.CB_06_ModeFree.isChecked(): 
            self.DS_Extrude.setStyleSheet(setStyleBlueLight)
        else:
            if (epaisSupportClock != 0) and (epaisSupportClock >= epaisseurExtrus):
                self.DS_Extrude.setStyleSheet(setStyleOrange)
                self.DS_Extrude_Support.setStyleSheet(setStyleOrange)
                self.CH_Extrude.setStyleSheet(setStyleOrange)
            else:
                self.DS_Extrude.setStyleSheet(setStyleBase) # origin system
                self.CH_Extrude.setStyleSheet(setStyleBase) # origin system
        self.DS_Extrude.setValue(epaisseurExtrus)
#        App.Console.PrintMessage(str("on_CH_Extrude ")+" "+str(epaisseurExtrus)+"\n")

    def on_DS_InclinaisonX(self,value):        # 
        global inclinaisonX

        inclinaisonX = value
#        App.Console.PrintMessage(str("on_DS_InclinaisonX ")+str(inclinaisonX)+"\n")

    def on_DS_InclinaisonY(self,value):        # 
        global inclinaisonY

        inclinaisonY = value
#        App.Console.PrintMessage(str("on_DS_InclinaisonY ")+str(inclinaisonY)+"\n")

    def on_DS_InclinaisonZ(self,value):        # 
        global inclinaisonZ

        inclinaisonZ = value
#        App.Console.PrintMessage(str("on_DS_InclinaisonZ ")+str(inclinaisonZ)+"\n")

    def on_CH_Sp_Inclination(self):            #
        global ui

        if self.CH_Sp_Inclination.isChecked(): 
            self.DS_InclinaisonX.setEnabled(True)
            self.DS_InclinaisonY.setEnabled(True)
            self.DS_InclinaisonZ.setEnabled(True)
        else:
            ui.on_PU_Reset_Inclination()
#        App.Console.PrintMessage(str("on_CH_Sp_Inclination ")+str(self.CH_Sp_Inclination.isChecked())+"\n")

    def on_DS_Step_Of_The_Helix(self,value):   # 
        global pasHelix
        global baseHelix
        global endHelix

        pasHelix = value
        if pasHelix == 0:
            baseHelix = endHelix = 0.0
            self.DS_Base_Helix.setValue(baseHelix)
            self.DS_Base_Helix.setEnabled(True)
            self.DS_End_Helix.setValue(endHelix)
            self.DS_End_Helix.setEnabled(True)
        else:
            baseHelix = endHelix = 0.0
            self.DS_Base_Helix.setValue(baseHelix)
            self.DS_Base_Helix.setEnabled(False)
            self.DS_End_Helix.setValue(endHelix)
            self.DS_End_Helix.setEnabled(False)
#        App.Console.PrintMessage(str("on_DS_Step_Of_The_Helix ")+str(SizeCaractere)+"\n")

    def on_DS_Number_Char_Per_Turn(self,value):# 
        global nombreCarParTour

        nombreCarParTour = value
#        App.Console.PrintMessage(str("on_DS_Number_Char_Per_Turn ")+str(nombreCarParTour)+"\n")

    def on_DS_Base_Helix(self,value):          # 
        global baseHelix

        baseHelix = value
#        App.Console.PrintMessage(str("on_DS_Base_Helix ")+str(baseHelix)+"\n")

    def on_DS_End_Helix(self,value):           # 
        global endHelix

        endHelix = value
#        App.Console.PrintMessage(str("on_DS_End_Helix ")+str(endHelix)+"\n")

    def on_RB_Path_Image(self):      # Path Images a Afficher

        pic = QtGui.QPixmap()
        if self.RB_Path_01.isChecked():                # Orthogonal
            if self.RB_Position_01.isChecked():        # Path BB Base
                pic.loadFromData(base64.b64decode(PathBaseOrthogonal_Icon_b64))  # bmp converti
            elif self.RB_Position_02.isChecked():      # Path BB Center
                pic.loadFromData(base64.b64decode(PathCenterOrthogonal_Icon_b64))# bmp converti
            elif self.RB_Position_03.isChecked():      # Path BB Top
                pic.loadFromData(base64.b64decode(PathTopOrthogonal_Icon_b64))   # bmp converti
        elif self.RB_Path_02.isChecked():              # Follow on direction
            if self.RB_Position_01.isChecked():        # Path BB Base
                pic.loadFromData(base64.b64decode(PathBase_Icon_b64))   # bmp converti
            elif self.RB_Position_02.isChecked():      # Path BB Center
                pic.loadFromData(base64.b64decode(PathCenter_Icon_b64)) # bmp converti
            elif self.RB_Position_03.isChecked():      # Path BB Top
                pic.loadFromData(base64.b64decode(PathTop_Icon_b64))    # bmp converti
        self.scene = QtWidgets.QGraphicsScene()
        self.scene.addPixmap(QtGui.QPixmap(pic))
        self.graphicsView.setScene(self.scene)

    def on_DS_Radius_Support(self,value):      #  Clock
        global cercleClock

        cercleClock = value
#        App.Console.PrintMessage(str("on_DS_Radius_Support ")+str(cercleClock)+"\n")

    def on_DS_Number_Faces_Support(self,value): # number Faces of support 0=none 1=circle 2=rectangle 3=triangle 4,5 ... polygon
        global nombreFaces                     #  Clock
        global epaisSupportClock
        global cercleClock

        nombreFaces = value
        self.DS_Radius_Support.setEnabled(True)
        self.DS_Extrude_Support.setEnabled(True)
        self.DS_Extrude_Support.setStyleSheet(setStyleBase) # origin system
        if nombreFaces == 0:
            self.label_5.setText(_fromUtf8("Support number face"))
            epaisSupportClock = 0.0
            self.DS_Radius_Support.setEnabled(False)
            self.DS_Radius_Support.setValue(cercleClock)
            self.DS_Extrude_Support.setEnabled(False)
            self.DS_Extrude_Support.setValue(epaisSupportClock)
        elif nombreFaces == 1:
            self.label_5.setText(_fromUtf8("Support Circle"))
        elif nombreFaces == 2:
            self.label_5.setText(_fromUtf8("Support Rectangle"))
        elif nombreFaces == 3:
            self.label_5.setText(_fromUtf8("Support Triangle"))
        elif nombreFaces == 4:
            self.label_5.setText(_fromUtf8("Support Square"))
        else :
            self.label_5.setText(_fromUtf8("Support Polygone"))
#        App.Console.PrintMessage(str("on_DS_Number_Faces_Support ")+str(nombreFaces)+"\n")

    def on_DS_Extrude_Support(self,value):     #  Clock
        global epaisSupportClock
        global epaisseurExtrus
        global setStyleBase
        global setStyleRed
        global setStyleOrange

        epaisSupportClock = value
        if epaisSupportClock >= epaisseurExtrus:
            if self.CH_Extrude.isChecked():
                self.DS_Extrude.setStyleSheet(setStyleRed)
                self.DS_Extrude_Support.setStyleSheet(setStyleRed)
                self.CH_Extrude.setStyleSheet(setStyleBase)
            else:
                self.DS_Extrude.setStyleSheet(setStyleOrange)
                self.DS_Extrude_Support.setStyleSheet(setStyleOrange)
                self.CH_Extrude.setStyleSheet(setStyleOrange)
        else:
            self.DS_Extrude.setStyleSheet(setStyleBase)
            self.DS_Extrude_Support.setStyleSheet(setStyleBase)
            self.CH_Extrude.setStyleSheet(setStyleBase)
        if epaisSupportClock == 0:
            self.DS_Extrude.setStyleSheet(setStyleBase)
            self.DS_Extrude_Support.setStyleSheet(setStyleBase)
            self.CH_Extrude.setStyleSheet(setStyleBase)

        self.DS_PlacementZ.setEnabled(True)
#        App.Console.PrintMessage(str("on_DS_Extrude_Support ")+str(epaisSupportClock)+"\n")

    def on_PU_Roman(self):                     # Roman or Arabic Clock
        global redressement
        global romain

        pic = QtGui.QPixmap()
        if self.CB_RomanOrArabic.isChecked():
            ####
            if redressement == 1:
                pic.loadFromData(base64.b64decode(ClockRomanRedress_Icon_b64))    # bmp converti
            else:
                pic.loadFromData(base64.b64decode(ClockRomanAxis_Icon_b64))    # bmp converti
            ####
            romain = 1
            self.CB_RomanOrArabic.setText(_fromUtf8("Mode Roman"))
            self.CB_RomanOrArabic.setToolTip(_fromUtf8("Check for activate the mode Arabic"))
            self.CB_RomanOrArabic.setIcon(QtGui.QIcon(QtGui.QPixmap(romanIcon))) # icone dans une variable 
        else:
            ####
            if redressement == 1:
                pic.loadFromData(base64.b64decode(ClockArabicRedress_Icon_b64))    # bmp converti
            else:
                pic.loadFromData(base64.b64decode(ClockArabicAxis_Icon_b64))    # bmp converti
            ####
            romain = 0
            self.CB_RomanOrArabic.setText(_fromUtf8("Mode Arabic"))
            self.CB_RomanOrArabic.setToolTip(_fromUtf8("Check for activate the mode Roman"))
            self.CB_RomanOrArabic.setIcon(QtGui.QIcon(QtGui.QPixmap(arabicIcon))) # icone dans une variable 
        self.scene = QtWidgets.QGraphicsScene()
        self.scene.addPixmap(QtGui.QPixmap(pic))
        self.graphicsView.setScene(self.scene)
#        App.Console.PrintMessage(str("romain ")+str(romain)+"\n")

    def on_PU_Redress(self):                   # Redress or circumferencial Clock
        global redressement
        global romain

        pic = QtGui.QPixmap()
#        if redressement == 1:
        if self.CB_RedressChiffres.isChecked():
            ####
            if romain == 1:
                pic.loadFromData(base64.b64decode(ClockRomanRedress_Icon_b64))    # bmp converti
            else:
                pic.loadFromData(base64.b64decode(ClockArabicRedress_Icon_b64))    # bmp converti
            ####
            redressement = 1
            self.CB_RedressChiffres.setText(_fromUtf8("Redress"))
            self.CB_RedressChiffres.setIcon(QtGui.QIcon(QtGui.QPixmap(redressIcon))) # icone dans une variable 
            self.CB_RedressChiffres.setToolTip(_fromUtf8("Click for activate the mode Axial"))
        else:
            ####
            if romain == 1:
                pic.loadFromData(base64.b64decode(ClockRomanAxis_Icon_b64))    # bmp converti
            else:
                pic.loadFromData(base64.b64decode(ClockArabicAxis_Icon_b64))    # bmp converti
            ####
            redressement = 0
            self.CB_RedressChiffres.setText(_fromUtf8("Axial"))
            self.CB_RedressChiffres.setIcon(QtGui.QIcon(QtGui.QPixmap(axialIcon))) # icone dans une variable 
            self.CB_RedressChiffres.setToolTip(_fromUtf8("Click for activate the mode Redress"))
        self.scene = QtWidgets.QGraphicsScene()
        self.scene.addPixmap(QtGui.QPixmap(pic))
        self.graphicsView.setScene(self.scene)
#        App.Console.PrintMessage(str("redressement ")+str(redressement)+"\n")

    def on_CB_05_Reset(self):                  #
        global switchResetFALSE

        if self.CB_05_Reset.isChecked():
            switchResetFALSE = 1
            self.CB_05_Reset.setText(_fromUtf8("Not Reset"))
            self.CB_05_Reset.setIcon(QtGui.QIcon(QtGui.QPixmap(setIconNoReset))) # reset icone dans une variable 
            self.CB_05_Reset.setToolTip(_fromUtf8("Reset checkBox False by default (reset on all push button execute)" + "\n"
                                                  "If you check this option No reset is performed" + "\n"
                                                  "and if the result is not good" + "\n"
                                                  "ex: the old internal coordinate hare conserved or other..." + "\n"
                                                  "push the Reset button or " + "\n"
                                                  "uncheck this checkBox and try or restart FCCircularText" + "\n"
                                                  " ACTUAL TRUE NOT RESET"))
        else:
            switchResetFALSE = 0
            self.CB_05_Reset.setText(_fromUtf8("Reset"))
            self.CB_05_Reset.setIcon(QtGui.QIcon(QtGui.QPixmap(resetIcon))) # reset icone dans une variable 
            self.CB_05_Reset.setToolTip(_fromUtf8("Reset checkBox False by default (reset on all push button execute)" + "\n"
                                                  "If you check this option No reset is performed" + "\n"
                                                  "and if the result is not good" + "\n"
                                                  "ex: the old internal coordinate hare conserved or other..." + "\n"
                                                  "push the Reset button or " + "\n"
                                                  "uncheck this checkBox and try or restart FCCircularText" + "\n"
                                                  " ACTUAL FALSE RESET ALL PUSH EXECUTE BUTTON"))
#        App.Console.PrintMessage("on_CB_05_Reset"+"\n")

    def on_PB_Delete_Last(self):                  # delete the last object created
        global FcString
        global FcStringPoints
        global circleGuide
        global helixGuide
        global suppExtrude
        global createCompound

        try:
            App.ActiveDocument.getObject(FcStringPoints.Name).removeObjectsFromDocument()
            App.ActiveDocument.removeObject(FcStringPoints.Name)
        except Exception: None
        try:
            App.ActiveDocument.getObject(FcString.Name).removeObjectsFromDocument()
            App.ActiveDocument.removeObject(FcString.Name)
        except Exception: None
        try:
            App.ActiveDocument.removeObject(circleGuide.Name)
        except Exception: None
        try:
            App.ActiveDocument.removeObject(helixGuide.Name)
        except Exception: None
        try:
            App.ActiveDocument.removeObject(suppExtrude.Name)
        except Exception: None
        try:
            App.ActiveDocument.removeObject(createCompound.Name)
        except Exception: None
        App.ActiveDocument.recompute()
#        App.Console.PrintMessage("on_PB_Delete_Last"+"\n")

    def on_CB_06_ModeFree(self):                #
        global ui
        global setStyleBlueLight
        global setStyleBase
        global debout

        if self.CB_06_ModeFree.isChecked():
            self.RA_Choice_Outdoor.setChecked(True)
            self.on_RA_Choice_Outdoor()
            debout = 0
            self.on_PU_Flat()
            self.PU_Flat.setEnabled(True)
            self.groupBox_03.setEnabled(False)
            self.tabWidget.setTabEnabled(1, False)
            self.tabWidget.setTabEnabled(2, False)
            self.tabWidget.setTabEnabled(4, False)
            self.S_Begin_Angle.setEnabled(False)
            self.S_End_Angle.setEnabled(False)
            self.DS_Correction_Angle.setEnabled(False)
            self.DS_Correction_Radius.setEnabled(False)

            self.CB_06_ModeFree.setStyleSheet(setStyleBlueLight)
            self.DS_Radius_Circle.setStyleSheet(setStyleBlueLight)
            self.label_10.setStyleSheet(setStyleBlueLight)
            self.DS_Size_Character.setStyleSheet(setStyleBlueLight)
            self.label_4.setStyleSheet(setStyleBlueLight)
            self.DS_Extrude.setStyleSheet(setStyleBlueLight)
            self.CH_Extrude.setStyleSheet(setStyleBlueLight)
            self.CH_Sp_Placement.setChecked(True)   ; self.CH_Sp_Placement.setStyleSheet(setStyleBlueLight)
            self.DS_PlacementX.setEnabled(True)     ; self.DS_PlacementX.setStyleSheet(setStyleBlueLight)
            self.DS_PlacementY.setEnabled(True)     ; self.DS_PlacementY.setStyleSheet(setStyleBlueLight)
            self.DS_PlacementZ.setEnabled(True)     ; self.DS_PlacementZ.setStyleSheet(setStyleBlueLight)
            self.CH_Sp_Inclination.setChecked(True) ; self.CH_Sp_Inclination.setStyleSheet(setStyleBlueLight)
            self.DS_InclinaisonX.setEnabled(True)   ; self.DS_InclinaisonX.setStyleSheet(setStyleBlueLight)
            self.DS_InclinaisonY.setEnabled(True)   ; self.DS_InclinaisonY.setStyleSheet(setStyleBlueLight)
            self.DS_InclinaisonZ.setEnabled(True)   ; self.DS_InclinaisonZ.setStyleSheet(setStyleBlueLight)
        else:
            self.CB_06_ModeFree.setStyleSheet(setStyleBase)
            self.groupBox_03.setEnabled(True)
            self.tabWidget.setTabEnabled(1, True)
            self.tabWidget.setTabEnabled(2, True)
            self.tabWidget.setTabEnabled(4, True)
            self.S_Begin_Angle.setEnabled(True)
            self.S_End_Angle.setEnabled(True)
            self.DS_Correction_Angle.setEnabled(True)
            self.DS_Correction_Radius.setEnabled(True)

            self.DS_Radius_Circle.setStyleSheet(setStyleBase)
            self.label_10.setStyleSheet(setStyleBase)
            self.DS_Size_Character.setStyleSheet(setStyleBase)
            self.label_4.setStyleSheet(setStyleBase)
            self.DS_Extrude.setStyleSheet(setStyleBase)
            self.CH_Extrude.setStyleSheet(setStyleBase)
            self.on_PU_Reset()

    def on_PU_Reset(self):                     #
        global ui
        global points
        global coor_X
        global coor_Y
        global coor_Z
        global vec

        global PolicePath

        global rayon
        global texte
        global debut
        global rotation
        global SizeCaractere

        global precision
        global correctionAngle
        global correctionRayon
        global debout
        global exterieur
        global baseHelix
        global endHelix
        global pasHelix
        global nombreCarParTour

        global PlacementX
        global PlacementY
        global PlacementZ

        global inclinaisonX
        global inclinaisonY
        global inclinaisonZ

        global cercleClock
        global nombreFaces
        global romain
        global redressement

        global comP
        global nameL
        global epaisseurExtrus
        global epaisSupportClock
        global compount1
        global setStyleBase

        texte = ""
        self.CB_Word.setChecked(False)

        exterieur = 1
        self.RA_Choice_Outdoor.setText(_fromUtf8("Outdoor"))
        self.RA_Choice_Indoor.setText(_fromUtf8("Indoor"))
        self.RA_Choice_Outdoor.setChecked(True)
        pic = QtGui.QPixmap()
        pic.loadFromData(base64.b64decode(outDoor_Icon_b64))  # bmp converti
        self.scene = QtWidgets.QGraphicsScene()
        self.scene.addPixmap(QtGui.QPixmap(pic))
        self.graphicsView.setScene(self.scene)
        self.tabWidget.setCurrentIndex(0)

        debout = 1
        self.PU_Flat.setText(_fromUtf8("Mode Stand"))
        self.PU_Flat.setToolTip(_fromUtf8("Click for create the text Flat"))
        self.PU_Flat.setEnabled(True)
        self.PU_Flat.setIcon(QtGui.QIcon(QtGui.QPixmap(standIcon))) # icone dans une variable 

        SizeCaractere = 2.0
        self.DS_Size_Character.setValue(SizeCaractere)
        self.DS_Size_Character.setStyleSheet(setStyleBase)
        rayon = 10.0
        self.DS_Radius_Circle.setValue(rayon)
        self.DS_Radius_Circle.setStyleSheet(setStyleBase)
        self.label_10.setStyleSheet(setStyleBase)

        debut = 0
        self.S_Begin_Angle.setValue(debut)
        self.S_Begin_Angle.setEnabled(True)
        rotation = 360
        self.S_End_Angle.setValue(rotation)
        self.S_End_Angle.setEnabled(True)

        correctionAngle = 10.0
        self.DS_Correction_Angle.setValue(correctionAngle)
        self.DS_Correction_Radius.setEnabled(True)
        correctionRayon = 0.15
        self.DS_Correction_Radius.setValue(correctionRayon)
        self.DS_Correction_Angle.setEnabled(True)

        epaisseurExtrus = 0.0
        self.DS_Extrude.setValue(epaisseurExtrus)
        self.DS_Extrude.setEnabled(False)
        self.DS_Extrude.setStyleSheet(setStyleBase)
        self.CH_Extrude.setChecked(False)
        self.CH_Extrude.setStyleSheet(setStyleBase)
        self.label_4.setStyleSheet(setStyleBase)

        ui.on_PU_Reset_Placement()
        ui.on_PU_Reset_Inclination()

        self.CB_06_ModeFree.setChecked(False)

        baseHelix = 0.0
        self.DS_Base_Helix.setValue(baseHelix)
        self.DS_Base_Helix.setEnabled(False)
        endHelix = 0.0
        self.DS_End_Helix.setValue(endHelix)
        self.DS_Base_Helix.setEnabled(False)
        pasHelix = 2.0
        self.DS_Step_Of_The_Helix.setValue(pasHelix)
        nombreCarParTour = 10
        self.DS_Number_Char_Per_Turn.setValue(nombreCarParTour)

        nombreFaces = 0
        self.DS_Number_Faces_Support.setValue(nombreFaces)
        self.label_5.setText(_fromUtf8("Support number face"))
        cercleClock = rayon
        self.DS_Radius_Support.setValue(cercleClock)
        self.DS_Radius_Support.setEnabled(False)
        epaisSupportClock   = 0.0
        self.DS_Extrude_Support.setEnabled(False)
        self.DS_Extrude_Support.setValue(epaisSupportClock)
        self.DS_Extrude_Support.setStyleSheet(setStyleBase)

        romain = 0
        self.CB_RomanOrArabic.setIcon(QtGui.QIcon(QtGui.QPixmap(arabicIcon))) # icone dans une variable 
        self.CB_RomanOrArabic.setText(_fromUtf8("Mode Arabic"))
        self.CB_RomanOrArabic.setChecked(False)

        redressement = 0
        self.CB_RedressChiffres.setText(_fromUtf8("Axial"))
        self.CB_RedressChiffres.setIcon(QtGui.QIcon(QtGui.QPixmap(axialIcon))) # icone dans une variable 
        self.CB_RedressChiffres.setToolTip(_fromUtf8("Check for activate the mode Redress"))
        self.CB_RedressChiffres.setChecked(False)

        compount1 = 0
        ui.on_CB_Word() # texte = self.textEdit.toPlainText()
#        App.Console.PrintMessage(str("on_PU_Reset ")+str()+"\n")

    def on_PU_Benchmarks(self):                # Benchmarks
      try:
        global compount1
        global ui

        compount1 = 1
        ui.on_PU_Execute()
      except:
        sayexc("Error")
#        App.Console.PrintMessage(str("Benchmarks")+"\n")

    def on_PU_Execute(self):         # Execute
        global ui
        global PolicePath
        global switchResetFALSE

        global points
        global coor_X
        global coor_Y
        global coor_Z
        
        global PlacementX
        global PlacementY
        global PlacementZ

        global inclinaisonX
        global inclinaisonY
        global inclinaisonZ

        global vec
        global rayon
        global texte
        global debut
        global rotation
        global SizeCaractere

        global ii
        global precision
        global correctionAngle
        global correctionRayon
        global debout
        global exterieur
        global baseHelix
        global endHelix
        global pasHelix
        global nombreCarParTour

        global cercleClock
        global nombreFaces
        global romain
        global redressement

        global comP
        global nameL

        global epaisseurExtrus
        global epaisSupportClock
        global compount1

        #### for delete
        global FcString
        global FcStringPoints
        global circleGuide
        global helixGuide
        global suppExtrude
        global createCompound
        #### for delete

        points   = []
        comP     = []
        nameL    = []

        del   points[:]
        del     comP[:]
        del    nameL[:]

        doc = FreeCAD.ActiveDocument
        if doc == None:
            doc = FreeCAD.newDocument("FCCircularText")

#### Path
        # create text on wire, arc, circle edge... 
        #
        try:
            ssel = FreeCADGui.Selection.getSelectionEx()
            selectedEdge = lineSelected = FreeCADGui.Selection.getSelectionEx()[0].SubObjects[0]  # select one element
        except Exception:
            selectedEdge = None
            ssel = ""
            Gui.Selection.clearSelection()
            None
        passNoOk = 0
        if (hasattr(selectedEdge,'Surface')) or (hasattr(selectedEdge,'Point')):
            passNoOk = 1

        if (len(ssel) != 0) and (passNoOk == 0):    # Path

            textLabel = texte[0:10]
            if self.CB_Word.isChecked():
                textLabel = textLabel[0]
            else:
                textLabel = textLabel[0:10]

            FreeCAD.ActiveDocument.openTransaction("FCCTp")
            FcString = doc.addObject("App::DocumentObjectGroup","FcStringP_" + textLabel)
            if self.CB_01_Points.isChecked():
                FcStringPoints = doc.addObject("App::DocumentObjectGroup","FcStringPoints_" + textLabel)

            try:
                numberOfPoints = len(texte)                                                        # Decomposition number (or precision you can change)
                points = selectedEdge.discretize(numberOfPoints)                                   # discretize the element
                pasTab = 0

                for position in range(len(texte)):                                                             # list and display the coordinates

                    ss=Draft.makeShapeString(String=texte[position],FontFile=PolicePath,Size=SizeCaractere,Tracking=0)

                    XLongueur = ss.Shape.BoundBox.XLength                                          # Length x boundBox rectangle
                    YLongueur = ss.Shape.BoundBox.YLength                                          # Length y boundBox rectangle
                    ZLongueur = ss.Shape.BoundBox.ZLength                                          # Length z boundBox rectangle
                    XXLongueur = 0.0
                    YYLongueur = 0.0
                    ZZLongueur = 0.0

                    if self.RB_Position_01.isChecked():
                        None
                    elif self.RB_Position_02.isChecked():
                        XXLongueur = -XLongueur/2.0; YYLongueur = -YLongueur/2.0; #ZZLongueur = -ZLongueur/2.0
                    elif self.RB_Position_03.isChecked():
                        XXLongueur = 0; YYLongueur = -YLongueur; #ZZLongueur = -ZLongueur

                    pl = FreeCAD.Placement()                                                # placement object

                    if self.RB_Path_01.isChecked():
#                        pl.Base=FreeCAD.Vector(points[position][0] - (XXLongueur), points[position][1] - (YYLongueur), points[position][2])
                        pl.Base=FreeCAD.Vector(points[position][0] + (XXLongueur), points[position][1] + (YYLongueur), points[position][2])
                        pl.Rotation = App.Rotation(inclinaisonX, inclinaisonY, inclinaisonZ)
                        pl = pl.multiply(App.Placement(App.Vector(PlacementX, PlacementY, PlacementZ), App.Rotation(0.0,0.0,0.0), App.Vector(0.0,0.0,0.0)))
                    else:
                        ##Extract macro_Perpendicular_To_Wire
                        if pasTab == 0:
                            pointsDirection = []
                            pointsDirection = lineSelected.discretize(Number = ((len(texte)-1) * 10))   # discretize the path line first selection
                            pasTab = 1
                        try:
                            v=pointsDirection[position*10].sub(pointsDirection[(position*10) + 1])      # avec vecteurs 1 et 2 (direction debut ligne)
                        except Exception:
                            v=pointsDirection[-2].sub(pointsDirection[-1])                              # avec vecteurs 1 et 2 (direction debut ligne)

                        r=App.Rotation(App.Vector(-1,0,0),v)
                        pl.Rotation.Q = r.Q
                        pl = pl.multiply(App.Placement(App.Vector(0.0,0.0,0.0), App.Rotation(inclinaisonX, inclinaisonY, inclinaisonZ), App.Vector(0.0,0.0,0.0)))

                        try:
                            pl.Base = pointsDirection[position*10]
                        except Exception:
                            pl.Base = pointsDirection[-1]
                        pl = pl.multiply(App.Placement(App.Vector(XXLongueur + PlacementX, YYLongueur + PlacementY, ZZLongueur + PlacementZ), App.Rotation(correctionAngle, 0.0,0.0), App.Vector(0.0,0.0,0.0)))

                    ####
                    if self.CB_03_BBox.isChecked():
                        ss.ViewObject.BoundingBox = True
                    ####
                    ss.Label = texte[position]
                    Draft.autogroup(ss)
#                    ss.Label = texte[position]
                    FcString.addObject(ss)  # contener character
#                    FcString = doc.addObject("App::DocumentObjectGroup","FcString")

                    ####
                    if epaisseurExtrus != 0:         # extrusion characrters
                        CharExtrude = Draft.extrude(ss,Base.Vector(0.0,0.0,epaisseurExtrus))
                        CharExtrude.Placement=pl 
                        CharExtrude.Label = texte[position]
                        App.ActiveDocument.getObject(CharExtrude.Name).recompute()
                        try:
                            CharExtrude.ViewObject.DisplayMode = u"Flat Lines"
                        except Exception:
                            None
                        ####
                        if self.CB_03_BBox.isChecked():
                            CharExtrude.ViewObject.BoundingBox = True
                        ####
                        comP.append(CharExtrude.Shape)
#                            nameL.append(CharExtrude.Name)
                        FcString.addObject(CharExtrude)  # contener extrude
                    else:
                        ss.Placement = pl
                        ss.Support=None
                        try:
                            ss.ViewObject.DisplayMode = u"Flat Lines"
                        except Exception:
                            None
                        comP.append(ss.Shape)
#                            nameL.append(ss.Name)
                    ####
                    if self.CB_01_Points.isChecked():
                        pointRepere = Draft.makePoint(pl.Base)
                        pointRepere.ViewObject.PointColor = (1.0,0.0,0.0)
                        pointRepere.Label = texte[position]
                        App.ActiveDocument.getObject(pointRepere.Name).recompute()
                        FcStringPoints.addObject(pointRepere)
                    ####
                    if self.CB_04_Progression.isChecked():
                        FreeCADGui.updateGui()                                 # rafraichi l'ecran
                    ####
            except Exception:
                App.Console.PrintError(str("Discretize Error or selection error")+"\n")
            FreeCAD.ActiveDocument.commitTransaction()
#### Path fin
#
#### Circular begin
        else:
            FreeCAD.ActiveDocument.openTransaction("FCCTc")
            if ((exterieur == 0) and (debout == 0)):    # normal circular
                vecligne=[FreeCAD.Vector(PlacementX,PlacementY,PlacementZ),FreeCAD.Vector(rayon + correctionRayon,0.0,0.0)]      # 
            else:
                if exterieur == 3:
                    vecligne=[FreeCAD.Vector(PlacementX,PlacementY,PlacementZ),FreeCAD.Vector(rayon - (SizeCaractere/2),0.0,0.0)]      # 
                elif debout == 0:
                    vecligne=[FreeCAD.Vector(PlacementX,PlacementY,PlacementZ),FreeCAD.Vector(rayon + correctionRayon - SizeCaractere,0.0,0.0)]      # 
                else:
                    vecligne=[FreeCAD.Vector(PlacementX,PlacementY,PlacementZ),FreeCAD.Vector(rayon + correctionRayon,0.0,0.0)]      # 

            ligne = Draft.makeWire(vecligne,closed=False,face=False,support=None)     # creation de la ligne de base
            lineName = ligne.Name

            ii  = -1
            ii2 = -1

            #nombre = len(texte) - 1    # moins - 1 pour aller de 0 degres a 0 degres dans la boucle pour compatible avec Path
            nombre = len(texte)        # si pas - 1 ex: pour 36 lettres va de 0 degres a 350 degres

            coor_Z = PlacementZ
            boucler = 1
            helixSpline = []

            texteLabel = texte[0:10]
            if (exterieur == 0) or (debout == 0):
                texte = texte[::-1]
                if (exterieur == 0) and (debout == 0):
                    texte = texte[::-1]

            if exterieur == 2:        # helix
                if nombreCarParTour == 0:
                    nombreCarParTour = 1
                    App.Console.PrintError("Insufficient number"+"\n")
                pas = 0.0
                nombre = nombreCarParTour
                if pasHelix != 0:
                    pas = pasHelix / (nombreCarParTour)
                else:
                    pas = ((((endHelix - SizeCaractere)-baseHelix)/(len(texte) / nombreCarParTour))/(nombreCarParTour)) # pas of helix
                    coor_Z += baseHelix
                boucler = int(len(texte) / nombreCarParTour)
                if (len(texte) % nombreCarParTour) != 0: # calcul number spires Helix
                    boucler += 1
            else:
                nombreCarParTour = 1

            if exterieur == 3:         # Clock
                FcString = doc.addObject("App::DocumentObjectGroup","FcClock")
                if self.CB_01_Points.isChecked():
                    FcStringPoints = doc.addObject("App::DocumentObjectGroup","FcStringPoints_Clock")
                nombre = 12
                if romain == 0:
                    texte = ["1","2","3","4","5","6","7","8","9","10","11","12"]
                    textLabel = "Arabic"
                else:
                    texte = ["I","II","III","IIII","V","VI","VII","VIII","IX","X","XI","XII"]
                    textLabel = "Roman"
                texte = texte[::-1]
            else:
                textLabel = texte[0:10]
                #print(textLabel)
                if self.CB_Word.isChecked():
                    textLabel = texteLabel[0]
                else:
                    textLabel = texteLabel[0:10]
                FcString = doc.addObject("App::DocumentObjectGroup","FcString_" + textLabel)
                if self.CB_01_Points.isChecked():
                    FcStringPoints = doc.addObject("App::DocumentObjectGroup","FcStringPoints_" + textLabel)

#            if exterieur == 2:        # helix
#                boucler = int(len(texte) / nombreCarParTour)
#                if (len(texte) % nombreCarParTour) != 0: # calcul number spires Helix
#                    boucler += 1

            ####Boucle principale############################################################################
            for hel in range(boucler):
                ii = -1
                ####Boucle de travail#################################################
                #for angleTr in range(debut,rotation,((rotation-debut)/nombre)): # old
                for angleTrFloat in range((debut*10000),(rotation*10000),int((round(((float(rotation)-float(debut))/float(nombre)),4)*10000)) ): # 10000 pour 4 decimales
                    angleTr = (float(angleTrFloat)/10000.0)
                    ii  += 1
                    ii2 += 1
                    ligne.Placement = App.Placement(App.Vector(PlacementX,PlacementY,PlacementZ), App.Rotation(App.Vector(0.0,0.0,1.0),angleTr), App.Vector(0.0,0.0,0.0))
                    #print(ii+1," ",angleTr)
                    a = ligne.End # fin de ligne
                    coor_X = (a[0])
                    coor_Y = (a[1])

                    if (ii < nombre) and (ii2 < len(texte)):
                        if exterieur == 3:                  # clock
                            ligne.Placement = App.Placement(App.Vector(PlacementX,PlacementY,PlacementZ), App.Rotation(App.Vector(0.0,0.0,1.0),angleTr+90), App.Vector(0.0,0.0,0.0))

                            try:
                                a = ligne.Shape.Edges[0].Vertexes[1]                       # fin de ligne
                            except Exception:
                                a = ligne.End                                              # 0.19 fin de ligne

                            try:
                                coor_X = (a.Point.x)
                                coor_Y = (a.Point.y)
                            except Exception:
                                coor_X = (a.x)                                             # 0.19 fin de ligne
                                coor_Y = (a.y)

                        ss = Draft.makeShapeString(String=texte[ii2],FontFile=PolicePath,Size=SizeCaractere,Tracking=0)

                        ss.Label = texte[ii2]
                        FcString.addObject(ss)  # contener character

                        centreX = (ss.Shape.BoundBox.Center[0])
                        centreY = (ss.Shape.BoundBox.Center[1])
                        centreZ = (ss.Shape.BoundBox.Center[2])
                        lengthX = (ss.Shape.BoundBox.XLength)
                        lengthY = (ss.Shape.BoundBox.YLength)
                        lengthZ = (ss.Shape.BoundBox.ZLength)

                        plm=""
                        plm=FreeCAD.Placement()
                        plm.Base=FreeCAD.Vector(coor_X, coor_Y, coor_Z)

                        if self.CB_06_ModeFree.isChecked():
                            plm = App.Placement(App.Vector(coor_X, coor_Y, coor_Z), App.Rotation(angleTr+inclinaisonX+correctionAngle, inclinaisonY, inclinaisonZ), App.Vector(0.0, 0.0, 0.0)) # pitch,roll...1   
                        else:
                            if debout == 1:           # debout
                                if exterieur == 0:    # circumferential internal
                                    plm = App.Placement(App.Vector(coor_X,coor_Y,coor_Z), App.Rotation(angleTr-90-correctionAngle+inclinaisonX,inclinaisonY,90+inclinaisonZ), App.Vector(0.0,0.0,0.0)) # pitch,roll...1
                                elif exterieur == 1:  # circumferential external
                                    plm = App.Placement(App.Vector(coor_X,coor_Y,coor_Z), App.Rotation(angleTr+90+correctionAngle+inclinaisonX,inclinaisonY,90+inclinaisonZ), App.Vector(0.0,0.0,0.0)) # pitch,roll...1
                                elif exterieur == 2:  # circumferential helix
                                    plm = App.Placement(App.Vector(coor_X,coor_Y,coor_Z), App.Rotation(angleTr+90+correctionAngle+inclinaisonX,inclinaisonY,90+inclinaisonZ), App.Vector(0.0,0.0,0.0)) # pitch,roll...1
                                    coor_Z = coor_Z + pas
                            else:                     # a plat
                                if exterieur == 1:    # exterieur (superieur)
                                    plm = App.Placement(App.Vector(coor_X,coor_Y,coor_Z), App.Rotation(angleTr-90-correctionAngle+inclinaisonX,inclinaisonY,inclinaisonZ), App.Vector(0.0,0.0,0.0)) # pitch,roll...1
                                elif exterieur == 3:  # circumferential plat (clock)
                                    if redressement == 1:
                                        plm = App.Placement(App.Vector(coor_X-centreX,coor_Y-centreY,coor_Z), App.Rotation(inclinaisonX,inclinaisonY,inclinaisonZ), App.Vector(0.0,0.0,0.0)) # pitch,roll...1
                                    else:
                                        plm = App.Placement(App.Vector(coor_X-centreX,coor_Y-centreY,coor_Z), App.Rotation(angleTr+inclinaisonX,inclinaisonY,inclinaisonZ), App.Vector(centreX,centreY,centreZ)) # pitch,roll...1
                                else:                 # interieur  (inferieur)
                                    plm = App.Placement(App.Vector(-coor_X,-coor_Y,-coor_Z), App.Rotation(angleTr+90+correctionAngle+inclinaisonX,180+inclinaisonY,180+inclinaisonZ), App.Vector(0.0,0.0,0.0)) # pitch,roll...1   

                            #######################################################
                            #### plm = plm.multiply(App.Placement(App.Vector(0.0, 0.0, 0.0), App.Rotation(App.Vector(0.0, 0.0, 1.0), 0.0), App.Vector(0.0, 0.0, 0.0)))
                            #######################################################
                            #### ___________________Test_Memo
                            #### normal outdoor stand
                            #### Placement [Pos=(10,0,0), Yaw-Pitch-Roll=(90,0,90)]
                            #### _____
                            #### plus 90 degres "X" Yaw (macro) *Psi*
                            #### Placement [Pos=(10,0,0), Yaw-Pitch-Roll=(180,0,90)]
                            #### plus 90 Z (FC)
                            #### App.getDocument("FCCircularText").ShapeString.Placement=App.Placement(App.Vector(10,0,0), App.Rotation(180,0,90), App.Vector(0,0,0))
                            #### _____
                            #### plus 90 degres "Y" Pitch (macro) *Phi*
                            #### Placement [Pos=(10,0,0), Yaw-Pitch-Roll=(0,90,0)]
                            #### plus 90 Y (FC)
                            #### App.getDocument("FCCircularText").ShapeString.Placement=App.Placement(App.Vector(10,0,0), App.Rotation(90,90,90), App.Vector(0,0,0))
                            #### _____
                            #### plus 90 degres "Z" Roll (macro) *Theta*
                            #### Placement [Pos=(10,0,0), Yaw-Pitch-Roll=(90,0,180)]
                            #### plus 90 X (FC)
                            #### App.getDocument("FCCircularText").ShapeString.Placement=App.Placement(App.Vector(10,0,0), App.Rotation(90,0,180), App.Vector(0,0,0))
                            #### ____________________Test_Memo
                            ######################################################

                        if self.RA_Choice_Helix.isChecked():
                            helixSpline.append(plm.Base)    # helix

                        if epaisseurExtrus != 0:         # extrusion characrters
                            CharExtrude = Draft.extrude(ss,Base.Vector(0,0,epaisseurExtrus))
                            CharExtrude.Label = texte[ii2]
                            CharExtrude.Placement=plm 
                            try:
                                CharExtrude.ViewObject.DisplayMode = u"Flat Lines"
                            except Exception:
                                None
                            if self.CB_03_BBox.isChecked():
                                CharExtrude.ViewObject.BoundingBox = True
                            App.ActiveDocument.getObject(CharExtrude.Name).recompute()
                            comP.append(CharExtrude.Shape)
#                            nameL.append(CharExtrude.Name)
                            FcString.addObject(CharExtrude)  # contener extrude
                        else:                 # 
                            ss.Placement=plm 
                            ss.Support=None
                            try:
                                ss.ViewObject.DisplayMode = u"Flat Lines"
                            except Exception:
                                None
                            if self.CB_03_BBox.isChecked():
                                ss.ViewObject.BoundingBox = True
                            comP.append(ss.Shape)
#                            nameL.append(ss.Name)
#                            points += [FreeCAD.Vector(coor_X,coor_Y,coor_Z)]  # coordinates makeBSpline
                        ####
                        if self.CB_01_Points.isChecked():
                            pointRepere = Draft.makePoint(plm.Base)
                            pointRepere.ViewObject.PointColor = (1.0,0.,0.0)
                            pointRepere.Label = texte[ii2]
                            App.ActiveDocument.getObject(pointRepere.Name).recompute()
                            FcStringPoints.addObject(pointRepere)
                        ####
                        if self.CB_04_Progression.isChecked():
                            FreeCADGui.updateGui()                                 # rafraichi l'ecran
                        ####
            FreeCAD.ActiveDocument.commitTransaction()

            #BSpline = Draft.makeBSpline(points,closed=False)                  # makeBSpline repere
            App.ActiveDocument.removeObject(lineName)     # remove ligne de base directrice

        FreeCAD.ActiveDocument.openTransaction("FCCTc")
        if (self.CB_02_Circle.isChecked()) and (passNoOk == 0): # create Circle
            pll = FreeCAD.Placement()
            pll = App.Placement(App.Vector(PlacementX,PlacementY,PlacementZ), App.Rotation(App.Vector(0,0,1),0), App.Vector(0,0,0))
            circleGuide = Draft.makeCircle(radius=rayon, placement=pll, face=False, support=None)
            circleGuide.Label = "circleRepere_" + textLabel
            circleGuide.ViewObject.LineColor = (1.0,0.,0.0)
            Draft.autogroup(circleGuide)
            if self.RA_Choice_Helix.isChecked():        # helix
                helixGuide = Draft.makeBSpline(helixSpline, closed=False, face=False, support=None)
                helixGuide.Label = "helixRepere_" + textLabel
                helixGuide.ViewObject.LineColor = (1.0,0.,0.0)
                Draft.autogroup(helixGuide)            

        if compount1 == 1:                            # create compount
            comp = Part.makeCompound(comP)
            Part.show(comp)
            createCompound = App.ActiveDocument.ActiveObject
            createCompound.Label = "Comp_" + textLabel
        ####Boucle de travail fin########################################################################

        ####Extrude support clock#############################################
        if nombreFaces > 0:                           # support clock
            pl = FreeCAD.Placement()
            if nombreFaces == 1:                      # circle
                pl.Base = FreeCAD.Vector(0.0,0.0,0.0)
                supp = Draft.makeCircle(cercleClock,placement=pl,face=True,support=None)
            if nombreFaces == 2:                      # rectangle
                cercleClock = cercleClock * 2
                pl.Base = FreeCAD.Vector(-cercleClock, (-cercleClock / 2.0), 0.0)
                supp = Draft.makeRectangle((cercleClock * 2.0), cercleClock, placement=pl, face = True)
            if nombreFaces > 2:                       # polygone with number faces
                if nombreFaces == 4:
                    rotateSupport = 45
                else:
                    rotateSupport = 90
                pl = App.Placement(App.Vector(0.0,0.0,0.0), App.Rotation(rotateSupport,0,0), App.Vector(0,0,0))
                supp = Draft.makePolygon(nombreFaces,cercleClock,inscribed = False,placement = pl,face = True,support=None)
            supp.MakeFace = True

            App.activeDocument().recompute()
            FcString.addObject(supp)                  # contener support

            if epaisSupportClock != 0:                        # extrude support clock
                suppExtrude = Draft.extrude(supp,Base.Vector(0,0,epaisSupportClock))
                App.ActiveDocument.getObject(suppExtrude.Name).recompute()
                # try:
                suppExtrude.ViewObject.DisplayMode = u"Flat Lines"
                if self.CB_03_BBox.isChecked():
                    suppExtrude.ViewObject.BoundingBox = True
                # except Exception:
                    # None
                FcString.addObject(suppExtrude)       # contener support extrude

        if ui.RA_Choice_Helix.isChecked():
            ui.tabWidget.setCurrentIndex(1)
            ui.Image_RA_Choice_Helix()
        elif ui.RA_Choice_Clock.isChecked():
            ui.tabWidget.setCurrentIndex(2)
            ui.Image_RA_Choice_Clock()

        # deselectionner tous les objets
        try:
            for obj in FreeCAD.ActiveDocument.Objects:         # deselectionne tout
                FreeCADGui.Selection.removeSelection(obj)
        except Exception:
            None

        App.activeDocument().recompute()
        FreeCAD.ActiveDocument.commitTransaction()
#### Circular end

        ####Info################################################
        App.Console.PrintMessage("______________" +"\n")
        App.Console.PrintMessage( PolicePath + "\n")
        App.Console.PrintMessage("Texte         : " + str(texte) + "\n")
        App.Console.PrintMessage("Rayon         : " + str(rayon) + "\n")
        App.Console.PrintMessage("SizeCaractere : " + str(SizeCaractere) + "\n")
        App.Console.PrintMessage("Rotation      : " + str(debut) + "/" + str(rotation) + "\n")
        App.Console.PrintMessage("Debout        : " + str(debout) + "\n")
        App.Console.PrintMessage("Placement     : " + str(PlacementX) + ", " + str(PlacementY) + ", " + str(PlacementZ) + "\n")
        App.Console.PrintMessage("Rotation      : " + str(inclinaisonX) + ", " + str(inclinaisonY) + ", " + str(inclinaisonZ) + "\n")
        App.Console.PrintMessage("_______________" +"\n")

        ####Reset################################################
        if switchResetFALSE == 0:    # zero (False) by default = reset
            ui.on_PU_Reset()

    def on_PB_Help_clicked(self):
        WebGui.openBrowser("https://wiki.freecadweb.org/Macro_FCCircularText")
        App.Console.PrintMessage("https://wiki.freecadweb.org/Macro_FCCircularText" + "\n")
#        print("Help ")

    def on_PU_Exit(self):                      # Exit
        global ui
        global s
        global switchResetFALSE
        global setFontByDefault
        global switchModeTextList
        global switchFontComBox
        global setSystemFonts
        global seTtextAlignement
        global switchVersionSearch
        global setMainWindowMoveX
        global setMainWindowMoveY
        global setFrameWindowSizeX
        global setFrameWindowSizeY

        FreeCADGui.Selection.removeObserver(s)                              # desinstalle la fonction residente
        ###### Write Configuration begin ####
        FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).SetBool("switchResetFALSE", switchResetFALSE)     # True or False (False by default)
        FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).SetString("setFontByDefault", setFontByDefault)   # "Arial"
        FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).SetBool("switchModeTextList", switchModeTextList) # True or False
        FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).SetBool("switchFontComBox", switchFontComBox)     # True or False
        FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).SetBool("setSystemFonts", setSystemFonts)         # True or False
        FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).SetInt("seTtextAlignement", seTtextAlignement)    # 0, 1, 2
        #### geometry
        positionWindowXY = MainWindow.geometry()
        setMainWindowMoveX  = positionWindowXY.x()
        setMainWindowMoveY  = positionWindowXY.y()
        positionWindowXY = MainWindow.size()
        setFrameWindowSizeX = positionWindowXY.width()
        setFrameWindowSizeY = positionWindowXY.height()
        FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).SetInt("setMainWindowMoveX",  setMainWindowMoveX)      # setMainWindowMoveX
        FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).SetInt("setMainWindowMoveY",  setMainWindowMoveY)      # setMainWindowMoveY
        FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).SetInt("setFrameWindowSizeX", setFrameWindowSizeX)     # setFrameWindowSizeX
        FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).SetInt("setFrameWindowSizeY", setFrameWindowSizeY)     # setFrameWindowSizeY
        #### geometry
        FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).SetBool("setPathOrthogonal", ui.RB_Path_01.isChecked())    # True or False
        FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).SetBool("setPathTangent", ui.RB_Path_02.isChecked())       # True or False
        FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).SetBool("setPositionBase", ui.RB_Position_01.isChecked())  # True or False
        FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).SetBool("setPositionCenter", ui.RB_Position_02.isChecked())# True or False
        FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).SetBool("setPositionTop", ui.RB_Position_03.isChecked())   # True or False
        FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).SetBool("switchVersionSearch", switchVersionSearch)        # True or False
        ###### Write Configuration end   ####

        App.Console.PrintMessage("Fin FCCircularText"+"\n")
        self.window.hide()
####
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).SetString("Version",__Version__ + " (" + __Date__ + ")")# 
##StyleSheet       = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/MainWindow").GetString("StyleSheet")

###### Read Configuration begin ####
seTtextAlignement  = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).GetInt("seTtextAlignement")
setSystemFonts     = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).GetBool("setSystemFonts")
switchFontComBox   = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).GetBool("switchFontComBox")
switchModeTextList = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).GetBool("switchModeTextList")
setFontByDefault   = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).GetString("setFontByDefault")
switchResetFALSE   = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).GetBool("switchResetFALSE") 
#                    switchResetFALSE: desactive cree des erreurs de fonctionnement attention a l utilisation !!
setMainWindowMoveX = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).GetInt("setMainWindowMoveX")
setMainWindowMoveY = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).GetInt("setMainWindowMoveY")
setFrameWindowSizeX= FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).GetInt("setFrameWindowSizeX")
setFrameWindowSizeY= FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).GetInt("setFrameWindowSizeY")

setPathOrthogonal = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).GetBool("setPathOrthogonal")
setPathTangent    = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).GetBool("setPathTangent")
setPositionBase   = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).GetBool("setPositionBase")
setPositionCenter = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).GetBool("setPositionCenter")
setPositionTop    = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/" + __Title__).GetBool("setPositionTop")

if setFontByDefault == "":
    if platform.system()   == "Windows" :
        PolicePath = "C:/Windows/Fonts/"
        setFontByDefault = "ARIAL"
    elif platform.system() == "Linux" :
        PolicePath = "/usr/share/fonts/"
        setFontByDefault = "UBUNTU-M"
    elif platform.system() == "Darwin":
        PolicePath = "/Library/Fonts/"
        setFontByDefault = "Arial"
if platform.system() == "Linux" :
      PolicePath = "/usr/share/fonts/"

###### Read Configuration end   ####
##################################################################################################
class SelObserver:
    def addSelection(self, document, object, element, position):  # Selection
        global ui
        global PlacementX
        global PlacementY
        global PlacementZ
        global correctionAngle
        global setStylePathR # #F8E0E0
        global setStylePathG # #E0F8E0
        global setStyleBase

        if ui.CB_06_ModeFree.isChecked(): 
            None
        else:
            try:
                selectedEdge = FreeCADGui.Selection.getSelectionEx()[0].SubObjects[0]  # select one subElement
                if (hasattr(selectedEdge,'Surface')) or (hasattr(selectedEdge,'Point')):
                    if (hasattr(selectedEdge,'Point')):
                        PlacementX = position[0]
                        PlacementY = position[1]
                        PlacementZ = position[2]
                        ui.CH_Sp_Placement.setChecked(True)
                        ui.DS_PlacementX.setValue(PlacementX)
                        ui.DS_PlacementY.setValue(PlacementY)
                        ui.DS_PlacementZ.setValue(PlacementZ)
                        ui.on_CH_Sp_Placement()
                    elif (hasattr(selectedEdge,'Surface')):
                        None    # later
                else:
                    ui.tabWidget.setTabEnabled(3, True)
                    ui.tabWidget.setCurrentIndex(3)
                    ui.tabWidget.setStyleSheet(setStylePathG)
                    pathLength = "Path ( " + str(round(selectedEdge.Length, 2)) + " mm )"
                    ui.tabWidget.setTabText(3, _fromUtf8(pathLength))
                    ui.tabWidget.setTabEnabled(1, False)
                    ui.tabWidget.setTabEnabled(2, False)
                    ui.groupBox_03.setEnabled(False)
                    ui.groupBox_03.setStyleSheet(setStylePathR)
                    ui.DS_Radius_Circle.setEnabled(False)
                    ui.DS_Radius_Circle.setStyleSheet(setStylePathR)
                    ui.S_Begin_Angle.setEnabled(False)
                    ui.S_Begin_Angle.setStyleSheet(setStylePathR)
                    ui.S_End_Angle.setEnabled(False)
                    ui.S_End_Angle.setStyleSheet(setStylePathR)
                    ui.DS_Correction_Radius.setEnabled(False)
                    ui.DS_Correction_Radius.setStyleSheet(setStylePathR)
                    ui.CB_02_Circle.setChecked(False)
                    ui.CB_02_Circle.setEnabled(False)
                    ui.CB_02_Circle.setStyleSheet(setStylePathR)
                    correctionAngle = 0.0
                    ui.DS_Correction_Angle.setValue(correctionAngle)
                    ui.on_RB_Path_Image()
            except Exception:
                selectedEdge = None
                ui.tabWidget.setTabEnabled(1, True)
                ui.tabWidget.setTabEnabled(2, True)
                None

##    def setPreselection(self,doc,obj,sub):             # preselection
##        print "setPreselection"
##    def removeSelection(self,doc,obj,sub):             # Effacer l'objet selectionne
##        print "removeSelection"
##    def setSelection(self,doc):                        # Selection dans ComboView
##        print "SelObserver quit macro"
    def clearSelection(self,doc):                       # Si clic sur l'ecran, effacer la selection
        global ui

        if ui.CB_06_ModeFree.isChecked(): 
            None
        else:
            ui.tabWidget.setStyleSheet(setStyleBase) # tab 
            ui.tabWidget.setTabEnabled(3, False)     # tab Path
            ui.tabWidget.setTabEnabled(1, True)      # tab 
            ui.tabWidget.setTabEnabled(2, True)      # tab 
            ui.tabWidget.setTabText(3, _fromUtf8("Path"))
            ui.groupBox_03.setEnabled(True)
            ui.groupBox_03.setStyleSheet(setStyleBase)
            if ui.CB_06_ModeFree.isChecked(): 
                None
            else:
                ui.DS_Radius_Circle.setEnabled(True)
                ui.DS_Radius_Circle.setStyleSheet(setStyleBase)
                ui.S_Begin_Angle.setEnabled(True)
                ui.S_Begin_Angle.setStyleSheet(setStyleBase)
                ui.S_End_Angle.setEnabled(True)
                ui.S_End_Angle.setStyleSheet(setStyleBase)
                ui.DS_Correction_Radius.setEnabled(True)
                ui.DS_Correction_Radius.setStyleSheet(setStyleBase)
            ui.CB_02_Circle.setEnabled(True)
            ui.CB_02_Circle.setStyleSheet(setStyleBase)
            if ui.RA_Choice_Outdoor.isChecked():
                ui.Image_RA_Choice_Outdoor()
            elif ui.RA_Choice_Indoor.isChecked():
                ui.Image_RA_Choice_Indoor()
            elif ui.RA_Choice_Helix.isChecked():
                ui.Image_RA_Choice_Helix()
            elif ui.RA_Choice_Clock.isChecked():
                ui.Image_RA_Choice_Clock()

s=SelObserver()
FreeCADGui.Selection.addObserver(s)                    # installe la fonction en mode resident
###################################################################################################

# create new document
doc = FreeCAD.ActiveDocument
if doc == None:
    doc = FreeCAD.newDocument("FCCircularText")

# deselectionner tous les objets
try:
    for obj in FreeCAD.ActiveDocument.Objects:         # deselectionne tout
        FreeCADGui.Selection.removeSelection(obj)
except Exception:
    None

MainWindow = QtWidgets.QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
MainWindow.show()

