def _test5_do_dataSet(self, data, ctrlName):
        CHANGED_SIZE = 15.5
        PARASTYLE_FROM = "Heading 5"  # source para style
        PARASTYLE_TO = "Heading 4"  # target para style
        styleFonts = styles.StyleFonts(self.unoObjs)
        #print("%s %s" % (data.fontType, ctrlName))
        fontName, dummy = styleFonts.getFontOfStyle(styleName=PARASTYLE_TO,
                                                    fontType=data.fontType)
        paragraphs = [
            ("Begin", ),
            (data.testChar, ),
            ("End", ),
        ]
        self.setTextContent(paragraphs, True)
        oVC = self.unoObjs.viewcursor
        oVC.gotoStart(False)
        oVC.goDown(1, False)
        oVC.setPropertyValue("ParaStyleName", PARASTYLE_FROM)

        def useDialog(innerSelf):
            innerSelf.evtHandler.actionPerformed(MyActionEvent("NoConverter"))
            innerSelf.dlgCtrls.optScopeParaStyle.setState(1)
            innerSelf.dlgCtrls.comboScopeParaStyle.setText(PARASTYLE_FROM)
            innerSelf.dlgCtrls.comboTargetParaStyle.setText(PARASTYLE_TO)
            getattr(innerSelf.dlgCtrls, data.type_ctrl).setState(1)
            innerSelf.dlgCtrls.listTargetStyleFont.selectItem(
                CHANGED_FONT[fontName], True)
            innerSelf.dlgCtrls.txtFontSize.setText(str(CHANGED_SIZE))
            getattr(innerSelf.dlgCtrls, ctrlName).setState(1)
            innerSelf.evtHandler.actionPerformed(
                MyActionEvent("Close_and_Convert"))

        self.runDlg(useDialog)
        oVC.gotoStart(False)
        self._test5_check_dataSet(data, paragraphs, ctrlName, fontName)
    def _test2_do_dataSet(self, data, convName):
        CONTENT_LEN = 5  # arbitrary
        FORMAT_AT_INDEX = 3  # arbitrary
        textContent = data.testChar * CONTENT_LEN
        self.setTextContent(textContent)
        oVC = self.unoObjs.viewcursor
        oVC.gotoStart(False)
        oVC.goRight(FORMAT_AT_INDEX, False)
        oVC.goRight(1, True)  # select
        styleFonts = styles.StyleFonts(self.unoObjs)
        fontName, dummy = styleFonts.getFontOfStyle(
            styleName=testutil.getDefaultStyle(), fontType=data.fontType)
        fontDef = styles.FontDefStruct(CHANGED_FONT[fontName], data.fontType)
        # change font for one character
        styles.setFontAttrs(oVC, fontDef)
        oVC.goRight(0, False)  # deselect

        def useDialog(innerSelf):
            innerSelf.dlgCtrls.txtConverterName.setText(convName)
            innerSelf.dlgCtrls.optScopeFont.setState(1)
            getattr(innerSelf.dlgCtrls, data.ctrlName).setState(1)
            innerSelf.dlgCtrls.comboScopeFont.setText(fontDef.fontName)
            innerSelf.evtHandler.actionPerformed(
                MyActionEvent("Close_and_Convert"))

        self.runDlg(useDialog)
        expectedChars = list(textContent)
        expectedChars[FORMAT_AT_INDEX] = anyToHex(data.testChar)
        self.verifyTextContent("".join(expectedChars))
 def setOrthographicFont(self, userVars):
     """Font for several examples is Latha.
     They sometimes crash when using Mangal.
     """
     logger.debug(util.funcName('begin'))
     fontDef = styles.FontDefStruct("Latha", "Complex",
                                    styles.FONT_ORTH.fontSize)
     interlinStyles = styles.InterlinStyles(self.unoObjs, userVars)
     interlinStyles.createStyles()
     logger.debug(util.funcName() + ": Created interlinear styles.")
     styleFonts = styles.StyleFonts(self.unoObjs, interlinStyles.styleNames)
     styleFonts.setParaStyleWithFont(fontDef, styleKey="word2")
     styleFonts.setParaStyleWithFont(fontDef, styleKey="morph2")
Esempio n. 4
0
 def __init__(self, drawingUnoObjs):
     self.unoObjs = drawingUnoObjs
     self.userVars = uservars.UserVars(uservars.Prefix.DATA_CONV_DRAW,
                                       drawingUnoObjs.document, logger)
     self.msgbox = MessageBox(self.unoObjs)
     self.styleFonts = styles.StyleFonts(self.unoObjs)
     self.app = DataConversion(self.unoObjs, self.userVars, self.styleFonts)
     self.dlgCtrls = None
     self.evtHandler = None
     self.config = None
     self.converter = None
     self.convertOnClose = False
     self.dlgClose = None
 def _get_target_font(self, paraStyle2, data, ctrlName):
     styleFonts = styles.StyleFonts(self.unoObjs)
     if ctrlName == "optTargetParaStyle":
         fontName2, fontSizeObj = styleFonts.getFontOfStyle(
             styleName=paraStyle2, fontType=data.fontType)
         fontSize2 = fontSizeObj.size
     else:
         propSuffix = data.fontType
         if propSuffix == 'Western':
             propSuffix = ""
         oVC = self.unoObjs.viewcursor
         fontName2 = oVC.getPropertyValue('CharFontName' + propSuffix)
         fontSize2 = oVC.getPropertyValue('CharHeight' + propSuffix)
     return fontName2, fontSize2
Esempio n. 6
0
 def __init__(self, unoObjs):
     self.unoObjs = unoObjs
     self.userVars = uservars.UserVars(
         uservars.Prefix.DATA_CONVERSION, unoObjs.document, logger)
     self.msgbox = MessageBox(unoObjs)
     self.styleFonts = styles.StyleFonts(unoObjs)
     self.app = DataConversion(unoObjs, self.userVars, self.styleFonts)
     self.dlgCtrls = None
     self.evtHandler = None
     self.charStyleNames = []
     self.paraStyleNames = []
     self.config = None
     self.converter = None
     self.convertOnClose = False
     self.dlgClose = None
def getFontOfStyle(styleInfo, unoObjs):
    styleFonts = styles.StyleFonts(unoObjs)
    return styleFonts.getFontOfStyle(styleInfo.styleType, styleInfo.fontType,
                                     styleInfo.styleName)