def showDlg(self):
        logger.debug(util.funcName('begin', obj=self))
        dlg = dutil.createDialog(self.unoObjs, _dlgdef)
        if not dlg:
            return
        ctrl_getter = dutil.ControlGetter(dlg)
        self.evtHandler = DlgEventHandler(self)
        self.dlgCtrls = DlgControls(self.unoObjs, ctrl_getter, self.evtHandler)
        self.evtHandler.setCtrls(self.dlgCtrls)

        styleNames = styles.getListOfStyles('ParagraphStyles', self.unoObjs)
        self.paraStyleNames = dict(styleNames)
        paraStyleDispNames = tuple([dispName for dispName, name in styleNames])

        styleNames = styles.getListOfStyles('CharacterStyles', self.unoObjs)
        self.charStyleNames = dict(styleNames)
        charStyleDispNames = tuple([dispName for dispName, name in styleNames])
        self.dlgCtrls.loadValues(paraStyleDispNames,
                                 charStyleDispNames, self.fileItem,
                                 self.getTypesTuple(), self.fileTypeDict,
                                 self.fillFieldList)
        self.dlgCtrls.enableDisable(self.filetype)

        self.dlgClose = dlg.endExecute
        self.dlgDispose = dlg.dispose
        logger.debug(util.funcName('end', obj=self))
        dlg.execute()
Пример #2
0
    def showDlg(self):
        logger.debug(util.funcName(obj=self))
        dlg = dutil.createDialog(self.unoObjs, _dlgdef)
        if not dlg:
            return
        ctrl_getter = dutil.ControlGetter(dlg)
        self.evtHandler = DlgEventHandler(self)
        self.dlgCtrls = None
        self.dlgCtrls = DlgControls(
            self.unoObjs, ctrl_getter, self.evtHandler)
        self.evtHandler.setCtrls(self.dlgCtrls)

        logger.debug("Getting styles...")
        styleNames = styles.getListOfStyles('ParagraphStyles', self.unoObjs)
        self.paraStyleNames = dict(styleNames)
        paraStyleDispNames = tuple([dispName for dispName, name in styleNames])
        styleNames = styles.getListOfStyles('CharacterStyles', self.unoObjs)
        self.charStyleNames = dict(styleNames)
        charStyleDispNames = tuple([dispName for dispName, name in styleNames])
        self.dlgCtrls.loadValues(
            self.userVars, paraStyleDispNames, charStyleDispNames)
        self.dlgCtrls.enableDisable(self)

        ## Display the dialog

        self.dlgClose = dlg.endExecute
        dlg.execute()

        if self.convertOnClose:
            self.app.doConversions_writer()
        dlg.dispose()
 def load_values(self):
     family = 'ParagraphStyles'
     if self.styleType == StyleType.CHAR:
         family = 'CharacterStyles'
     namesList = styles.getListOfStyles(family, self.unoObjs)
     self.styleNames.update(dict(namesList))
     displayNames = tuple([dispName for dispName, dummy_name in namesList])
     dutil.fill_list_ctrl(self.ctrl, displayNames)
Пример #4
0
    def loadValues(self, userVars, abbrevList):
        logger.debug(util.funcName('begin'))
        abbrevList.loadUserVars()
        dutil.fill_list_ctrl(self.listboxAbbrevs, abbrevList.getItemTextList())

        styleNames = styles.getListOfStyles("ParagraphStyles", self.unoObjs)
        displayNames = [dispName for dispName, name in styleNames]
        selectedValue = userVars.get("SearchParaStyle")
        if selectedValue == "":
            userVarsGrammar = UserVars(Prefix.GRAMMAR, self.unoObjs.document,
                                       logger)
            selectedValue = userVarsGrammar.get("StyleName_Gloss")
        dutil.fill_list_ctrl(self.cmbxSearchParaStyle, displayNames,
                             selectedValue)

        searchAffix = userVars.get("SearchAffix")
        if searchAffix == "suffix":
            self.optSearchSuffix.setState(True)
        elif searchAffix == "prefix":
            self.optSearchPrefix.setState(True)
        elif searchAffix == "any":
            self.optSearchAny.setState(True)

        varname = "MaxSearchLength"
        if userVars.isEmpty(varname):
            defaultCtrlText = "5"
            userVars.store(varname, defaultCtrlText)
            userVarVal = defaultCtrlText
        else:
            userVarVal = userVars.getInt(varname)
        self.txtMaxSearchLength.setText(userVarVal)

        if userVars.getInt("SearchUpperCase") == 1:
            self.chkSearchUpperCase.setState(True)

        self.addRemainingListeners()
        logger.debug(util.funcName('end'))
Пример #5
0
def underlying_style_names():
    styleNames = styles.getListOfStyles('ParagraphStyles', unoObjs)
    for styleName in styleNames:
        print(
            "disp_name=" + styleName[0] +
            ", underlying_name=" + styleName[1] + ";")