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, paraStyleDispNames, charStyleDispNames, fileItem, typesList, fileTypeDict, fillFieldList): """Set default values of controls.""" self.fileControl.setText(fileItem.filepath) self.listboxFileType.addItems(typesList, 0) if fileItem.filetype in fileTypeDict: title = fileTypeDict[fileItem.filetype] self.listboxFileType.selectItem(title, True) fillFieldList() self.txtWS.setText(fileItem.writingSystem) self.comboParaStyle.addItems(paraStyleDispNames, 0) self.comboCharStyle.addItems(charStyleDispNames, 0) dutil.fill_list_ctrl(self.comboFont, styles.getListOfFonts(self.unoObjs)) self.checkboxMiss.setState(fileItem.includeMisspellings) self.checkboxSkipRow.setState(fileItem.skipFirstRow) self.checkboxSplit.setState(fileItem.splitByWhitespace) stringList = [str(df) for df in fileItem.thingsToGrab] logger.debug("len(thingsToGrab) = %d", len(fileItem.thingsToGrab)) logger.debug("Adding %d data field(s).", len(stringList)) self.listboxFields.addItems(tuple(stringList), 0) self.addRemainingListeners()
def __init__(self, unoObjs): self.scriptName = "" self.charset = dict() self.allFonts = styles.getListOfFonts(unoObjs) self.fontList = [] self.onlyKnownFonts = True theLocale.loadUnoObjs(unoObjs) self.fallbackFontDisplay = theLocale.getText("(Fallback Font)")
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 load_values(self): fontNames = styles.getListOfFonts(self.app.unoObjs, addBlank=True) dutil.fill_list_ctrl(self.comboFontName, fontNames)
def setUp(self): self.unoObjs = testutil.unoObjsForCurrentDoc() self.dlg = DlgDataConversion(self.unoObjs) self.availableFonts = styles.getListOfFonts(self.unoObjs)