def useDialog(innerSelf): filepath = os.path.join(util.TESTDATA_FOLDER, data.filename) testutil.modifyFilePicker(filepath) if innerSelf.dlgCtrls.listboxFiles.getItemCount() > 0: innerSelf.evtHandler.actionPerformed( MyActionEvent("FileRemove")) innerSelf.evtHandler.actionPerformed(MyActionEvent("FileAdd")) innerSelf.evtHandler.actionPerformed(MyActionEvent("OK"))
def useDialog(innerSelf): filepath = os.path.join(util.TESTDATA_FOLDER, "Sena Int.flextext") testutil.modifyFilePicker(filepath) innerSelf.evtHandler.actionPerformed(MyActionEvent("FileAdd")) innerSelf.dlgCtrls.txtPrefix.setText("A") innerSelf.dlgCtrls.chkDontUseSegnum.setState(True) innerSelf.evtHandler.textChanged( MyTextEvent(innerSelf.dlgCtrls.txtPrefix)) filepath = os.path.join(util.TESTDATA_FOLDER, "FWtextPigFox.xml") testutil.modifyFilePicker(filepath) innerSelf.evtHandler.actionPerformed(MyActionEvent("FileAdd")) innerSelf.dlgCtrls.txtPrefix.setText("B") innerSelf.dlgCtrls.chkDontUseSegnum.setState(False) innerSelf.evtHandler.textChanged( MyTextEvent(innerSelf.dlgCtrls.txtPrefix)) innerSelf.evtHandler.actionPerformed(MyActionEvent("OK"))
def useDialog(innerSelf): filepath = os.path.join(util.TESTDATA_FOLDER, "FWtextPigFox.xml") testutil.modifyFilePicker(filepath) if innerSelf.dlgCtrls.listboxFiles.getItemCount() > 0: innerSelf.evtHandler.actionPerformed( MyActionEvent("FileRemove")) innerSelf.evtHandler.actionPerformed(MyActionEvent("FileAdd")) innerSelf.dlgCtrls.chkOuterTable.setState( 1 if data.outerTable else 0) innerSelf.dlgCtrls.chkNumbering.setState( 1 if data.numbering else 0) innerSelf.dlgCtrls.chkFT_inQuotes.setState( 1 if data.ftQuoted else 0) if data.useFrames: innerSelf.dlgCtrls.optFrames.setState(1) else: innerSelf.dlgCtrls.optTables.setState(1) innerSelf.evtHandler.actionPerformed(MyActionEvent("OK"))
def useDialog(innerSelf): filepath = os.path.join( util.TESTDATA_FOLDER, "TbxIntHunt06.xml") testutil.modifyFilePicker(filepath) if innerSelf.dlgCtrls.listboxFiles.getItemCount() > 0: innerSelf.evtHandler.actionPerformed( MyActionEvent("FileRemove")) innerSelf.evtHandler.actionPerformed( MyActionEvent("FileAdd")) TAG_VARS = dict(GrammarTags.TAG_VARS) innerSelf.userVars.store(TAG_VARS['word1'], 'or') innerSelf.userVars.store(TAG_VARS['word2'], 'tx') innerSelf.userVars.store(TAG_VARS['morph1'], 'mbor') innerSelf.userVars.store(TAG_VARS['morph2'], 'mb') innerSelf.userVars.store("SFM_Baseline", "WordLine2") innerSelf.dlgCtrls.chkWordLine1.setState(0) innerSelf.dlgCtrls.chkWordLine2.setState(1) innerSelf.dlgCtrls.chkMorphLine1.setState(0) innerSelf.dlgCtrls.chkMorphLine2.setState(1) innerSelf.dlgCtrls.chkPOS_Line.setState(0) innerSelf.dlgCtrls.chkMorphsSeparate.setState(1) innerSelf.dlgCtrls.chkPOS_aboveGloss.setState(0) innerSelf.dlgCtrls.chkNumbering.setState(1) newState = int(setVal) if setting == 'word1': innerSelf.dlgCtrls.chkWordLine1.setState(newState) elif setting == 'word2': innerSelf.dlgCtrls.chkWordLine2.setState(newState) elif setting == 'morph1': innerSelf.dlgCtrls.chkMorphLine1.setState(newState) elif setting == 'morph2': innerSelf.dlgCtrls.chkMorphLine2.setState(newState) elif setting == 'ps': innerSelf.dlgCtrls.chkPOS_Line.setState(newState) elif setting == 'sepCols': innerSelf.dlgCtrls.chkMorphsSeparate.setState(newState) elif setting == 'psAbove': innerSelf.dlgCtrls.chkPOS_Line.setState(1) innerSelf.dlgCtrls.chkPOS_aboveGloss.setState(newState) elif setting == 'numbering': innerSelf.dlgCtrls.chkNumbering.setState(newState) innerSelf.dlgCtrls.optTables.setState(1) self.setOrthographicFont(innerSelf.userVars) innerSelf.evtHandler.actionPerformed(MyActionEvent("OK"))
def useDialog(innerSelf): if len(innerSelf.fileItems) == 0: filepath = os.path.join(util.TESTDATA_FOLDER, "TbxIntJPDN60.xml") testutil.modifyFilePicker(filepath) innerSelf.evtHandler.actionPerformed(MyActionEvent("FileAdd")) innerSelf.dlgCtrls.txtPrefix.setText("A") innerSelf.evtHandler.textChanged( MyTextEvent(innerSelf.dlgCtrls.txtPrefix)) filepath = os.path.join(util.TESTDATA_FOLDER, "FWtextPigFox.xml") testutil.modifyFilePicker(filepath) innerSelf.evtHandler.actionPerformed(MyActionEvent("FileAdd")) innerSelf.dlgCtrls.txtPrefix.setText("B") innerSelf.evtHandler.textChanged( MyTextEvent(innerSelf.dlgCtrls.txtPrefix)) innerSelf.dlgCtrls.optFrames.setState(1) # This size may need to be adjusted depending on system settings. RESIZE_PERCENT = 15 innerSelf.dlgCtrls.txtNumColWidth.setText(RESIZE_PERCENT) innerSelf.evtHandler.actionPerformed(MyActionEvent("OK"))
def test5_fileList(self): def useDialog(dummy_innerSelf): pass DlgInterlinSettings.useDialog = useDialog self.dlg.showDlg() self.assertEqual(self.dlg.dlgCtrls.listboxFiles.getItemCount(), 0) filepath = os.path.join(util.TESTDATA_FOLDER, "testText1.xml") testutil.modifyFilePicker(filepath) self.dlg.evtHandler.actionPerformed(MyActionEvent("FileAdd")) self.assertEqual(self.dlg.dlgCtrls.listboxFiles.getItemCount(), 1) self.assertEqual(len(self.dlg.fileItems), 1) filepath = os.path.join(util.TESTDATA_FOLDER, "testText2.xml") testutil.modifyFilePicker(filepath) self.dlg.evtHandler.actionPerformed(MyActionEvent("FileAdd")) self.assertEqual(self.dlg.dlgCtrls.listboxFiles.getItemCount(), 2) self.assertEqual(len(self.dlg.fileItems), 2) self.assertEqual(self.dlg.dlgCtrls.listboxFiles.getSelectedItemPos(), 1) filepath = os.path.join(util.TESTDATA_FOLDER, "a_testText3.xml") testutil.modifyFilePicker(filepath) self.dlg.evtHandler.actionPerformed(MyActionEvent("FileAdd")) self.assertEqual(self.dlg.dlgCtrls.listboxFiles.getItemCount(), 3) self.assertEqual(len(self.dlg.fileItems), 3) self.assertEqual(self.dlg.dlgCtrls.listboxFiles.getSelectedItemPos(), 0) self.dlg.dlgCtrls.listboxFiles.selectItemPos(1, True) # testText1.xml self.dlg.dlgCtrls.txtPrefix.setText("PREF-") self.dlg.evtHandler.textChanged( MyTextEvent(self.dlg.dlgCtrls.txtPrefix)) fileItem = self.dlg.fileItems[1] self.assertEqual(fileItem.prefix, "PREF-") self.assertEqual(str(fileItem), "PREF- testText1.xml") self.dlg.evtHandler.actionPerformed(MyActionEvent("FileRemove")) self.assertEqual(self.dlg.dlgCtrls.listboxFiles.getItemCount(), 2) self.assertEqual(len(self.dlg.fileItems), 2) self.assertEqual(self.dlg.dlgCtrls.listboxFiles.getSelectedItemPos(), 1) fileItem = self.dlg.fileItems[1] self.assertEqual(str(fileItem), "testText2.xml") self.dlg.evtHandler.actionPerformed(MyActionEvent("FileRemove")) self.assertEqual(self.dlg.dlgCtrls.listboxFiles.getItemCount(), 1) self.assertEqual(len(self.dlg.fileItems), 1) self.assertEqual(self.dlg.dlgCtrls.listboxFiles.getSelectedItemPos(), 0) fileItem = self.dlg.fileItems[0] self.assertEqual(str(fileItem), "a_testText3.xml") self.dlg.evtHandler.actionPerformed(MyActionEvent("FileRemove")) self.assertEqual(self.dlg.dlgCtrls.listboxFiles.getItemCount(), 0) self.assertEqual(len(self.dlg.fileItems), 0)