Exemple #1
0
    def loadValues(self, userVars, paraStyleDispNames, charStyleDispNames):
        converter = ConverterSettings(userVars)
        converter.loadUserVars()
        self.txtConverterName.setText(converter.convName)
        self.chkDirectionReverse.setState(not converter.forward)
        self.chkVerify.setState(
            userVars.getInt('AskEachChange'))

        ## Option buttons

        dutil.selectRadio(self.radiosWhichScope, userVars.get('WhichScope'))
        dutil.selectRadio(self.radiosWhichTarget, userVars.get('WhichTarget'))
        dutil.selectRadio(self.radiosScopeFont, userVars.get('ScopeFontType'))
        dutil.selectRadio(
            self.radiosTargetFont, userVars.get('TargetFontType'))

        ## Combo box lists

        ComboTuple = collections.namedtuple(
            'ComboTuple', ['ctrl', 'varname', 'data'])
        self.combos = [
            ComboTuple(ctrl=self.comboScopeParaStyle,
                       varname='ScopeParaStyle',
                       data=paraStyleDispNames),
            ComboTuple(ctrl=self.comboScopeCharStyle,
                       varname='ScopeCharStyle',
                       data=charStyleDispNames),
            ComboTuple(ctrl=self.comboScopeFont,
                       varname='ScopeFont',
                       data=styles.getListOfFonts(self.unoObjs)),
            ComboTuple(ctrl=self.comboTargetParaStyle,
                       varname='TargetParaStyle',
                       data=paraStyleDispNames),
            ComboTuple(ctrl=self.comboTargetCharStyle,
                       varname='TargetCharStyle',
                       data=charStyleDispNames)]
        for combo in self.combos:
            dutil.fill_list_ctrl(
                combo.ctrl, combo.data, userVars.get(combo.varname))

        dutil.fill_list_ctrl(
            self.listTargetStyleFont,
            styles.getListOfFonts(self.unoObjs, addBlank=True))
        logger.debug("Finished populating font and styles lists.")

        ## Other fields

        varname = 'SFM_Markers'
        if userVars.isEmpty(varname):
            defaultCtrlText = "\\tx \\mb"
            userVars.store(varname, defaultCtrlText)
            userVarVal = defaultCtrlText
        else:
            userVarVal = userVars.get(varname)
        self.txtSFM.setText(userVarVal)
        self.addRemainingListeners()
    def loadValues(self):
        settings = MkoxtSettings(self.userVars)
        settings.loadUserVars()
        self.txtLangName.setText(settings.langname)
        self.txtOutfile.setText(settings.outfile)
        self.fctlWordList.setText(settings.dict)
        self.listboxScriptType.selectItemPos(0, True)
        self.txtLangTag.setText(settings.langtag)
        self.txtWordFormingPunct.setText(settings.word)
        self.txtFont.setText(settings.font)
        self.fctlAffix.setText(settings.affix)
        dutil.selectRadio(self.radiosNormalize, settings.normalize)
        self.txtVersion.setText(settings.version)
        self.listDictType.selectItem(settings.dicttype, True)
        self.txtPublisher.setText(settings.publisher)
        self.txtPublisherURL.setText(settings.puburl)

        self.addRemainingListeners()
    def loadValues(self, userVars):
        converter = ConverterSettings(userVars)
        converter.loadUserVars()
        self.txtConverterName.setText(converter.convName)
        self.chkDirectionReverse.setState(not converter.forward)
        self.chkVerify.setState(
            userVars.getInt('AskEachChange'))

        ## Option buttons

        dutil.selectRadio(self.radiosWhichScope, userVars.get('WhichScope'))
        dutil.selectRadio(self.radiosWhichTarget, userVars.get('WhichTarget'))
        dutil.selectRadio(self.radiosScopeFont, userVars.get('ScopeFontType'))
        dutil.selectRadio(
            self.radiosTargetFont, userVars.get('TargetFontType'))

        ## Combo box lists

        ComboTuple = collections.namedtuple(
            'ComboTuple', ['ctrl', 'varname', 'data'])
        self.combos = [
            ComboTuple(ctrl=self.comboScopeFont,
                       varname='ScopeFont',
                       data=styles.getListOfFonts(self.unoObjs))]
        for combo in self.combos:
            logger.debug("Filling Scope Font list.")
            #XXX: Sometimes hangs here.
            dutil.fill_list_ctrl(
                combo.ctrl, combo.data, userVars.get(combo.varname))

        logger.debug("Filling Target Font list.")
        dutil.fill_list_ctrl(
            self.listTargetFont,
            styles.getListOfFonts(self.unoObjs, addBlank=True))
        logger.debug("Finished populating font and styles lists.")

        ## Other fields

        self.addRemainingListeners()
 def fill(self, styleType, *dummy_args):
     dutil.selectRadio(self.radios, styleType)
     self.style_checkbox_handler.enableDisable(styleType)
 def fill(self, fontType, *dummy_args):
     dutil.selectRadio(self.radios, fontType)
 def load_values(self):
     userVars = self.app.userVars
     if not userVars.isEmpty(self.USERVAR):
         self.whichScope = userVars.getInt(self.USERVAR)
     dutil.selectRadio(self.radios, self.whichScope)