def convertInputEntryChanged(self, widget=None): inPath = self.convertInputEntry.get_text() inFormat = self.convertInputFormatCombo.getActive() if len(inPath) > 7: if inPath[:7]=='file://': inPath = urlToPath(inPath) self.convertInputEntry.set_text(inPath) inExt = getCopressedFileExt(inPath) inFormatNew = Glossary.extFormat.get(inExt) if not inFormatNew: return if not isfile(inPath): return if self.pref['auto_set_for']:## and not inFormat: self.convertInputFormatCombo.setActive(inFormatNew) self.status('Select output file') if self.pref['auto_set_out']: outFormat = self.convertOutputFormatCombo.getActive() outPath = self.convertOutputEntry.get_text() if outFormat: if not outPath and '.' in inPath: outPath = splitext(inPath)[0] + Glossary.formatsExt[outFormat][0] self.convertOutputEntry.set_text(outPath) self.status('Press "Convert"')
def convertInputEntryChanged(self, widget=None): inPath = self.convertInputEntry.get_text() inFormat = self.convertInputFormatCombo.getActive() if len(inPath) > 7: if inPath[:7] == 'file://': inPath = urlToPath(inPath) self.convertInputEntry.set_text(inPath) inExt = getCopressedFileExt(inPath) inFormatNew = Glossary.extFormat.get(inExt) if not inFormatNew: return if not isfile(inPath): return if self.pref['auto_set_for']: ## and not inFormat: self.convertInputFormatCombo.setActive(inFormatNew) self.status('Select output file') if self.pref['auto_set_out']: outFormat = self.convertOutputFormatCombo.getActive() outPath = self.convertOutputEntry.get_text() if outFormat: if not outPath and '.' in inPath: outPath = splitext( inPath)[0] + Glossary.formatsExt[outFormat][0] self.convertOutputEntry.set_text(outPath) self.status('Press "Convert"')
def convertInputEntryChanged(self, widget=None): inPath = self.convertInputEntry.get_text() inFormat = self.convertInputFormatCombo.getActive() if inPath.startswith("file://"): inPath = urlToPath(inPath) self.convertInputEntry.set_text(inPath) inExt = getCompressedFileExt(inPath) inFormatNew = Glossary.pluginByExt.get(inExt) if not inFormatNew: return if not isfile(inPath): return if self.pref["ui_autoSetFormat"] and not inFormat: self.convertInputFormatCombo.setActive(inFormatNew.name) self.status("Select output file") if self.pref["ui_autoSetOutputFileName"]: outFormat = self.convertOutputFormatCombo.getActive() outPath = self.convertOutputEntry.get_text() if outFormat: if not outPath and "." in inPath: outPath = splitext(inPath)[0] + \ Glossary.plugins[outFormat].extensions[0] self.convertOutputEntry.set_text(outPath) self.status("Press \"Convert\"")
def convertInputEntryChanged(self, widget=None): inPath = self.convertInputEntry.get_text() inFormat = self.convertInputFormatCombo.getActive() if inPath.startswith("file://"): inPath = urlToPath(inPath) self.convertInputEntry.set_text(inPath) inExt = getCopressedFileExt(inPath) inFormatNew = Glossary.extFormat.get(inExt) if not inFormatNew: return if not isfile(inPath): return if self.pref["ui_autoSetFormat"] and not inFormat: self.convertInputFormatCombo.setActive(inFormatNew) self.status("Select output file") if self.pref["ui_autoSetOutputFileName"]: outFormat = self.convertOutputFormatCombo.getActive() outPath = self.convertOutputEntry.get_text() if outFormat: if not outPath and "." in inPath: outPath = splitext(inPath)[0] + \ Glossary.formatsExt[outFormat][0] self.convertOutputEntry.set_text(outPath) self.status("Press \"Convert\"")
def entry_changed(self, event=None): #log.debug('entry_changed') #char = event.keysym pathI = self.entry_i.get() if self.pathI != pathI: formatD = self.combobox_i.get() if len(pathI) > 7: if pathI[:7] == 'file://': pathI = urlToPath(pathI) self.entry_i.delete(0, 'end') self.entry_i.insert(0, pathI) if self.pref['ui_autoSetFormat']: #format==noneItem: ext = os.path.splitext(pathI)[-1].lower() if ext in ('.gz', '.bz2', '.zip'): ext = os.path.splitext(pathI[:-len(ext)])[-1].lower() for i in range(len(Glossary.readExt)): if ext in Glossary.readExt[i]: self.combobox_i.set(Glossary.readDesc[i]) break if self.pref['ui_autoSetOutputFileName']: #format==noneItem: #pathI = self.entry_i.get() formatOD = self.combobox_o.get() pathO = self.entry_o.get() if formatOD != noneItem and not pathO and '.' in pathI: extO = Glossary.descExt[formatOD] pathO = ''.join(os.path.splitext(pathI)[:-1]) + extO self.entry_o.delete(0, 'end') self.entry_o.insert(0, pathO) self.pathI = pathI ############################################## pathO = self.entry_o.get() if self.pathO != pathO: formatD = self.combobox_o.get() if len(pathO) > 7: if pathO[:7] == 'file://': pathO = urlToPath(pathO) self.entry_o.delete(0, 'end') self.entry_o.insert(0, pathO) if self.pref['ui_autoSetFormat']: #format==noneItem: ext = os.path.splitext(pathO)[-1].lower() if ext in ('.gz', '.bz2', '.zip'): ext = os.path.splitext(pathO[:-len(ext)])[-1].lower() for i in range(len(Glossary.writeExt)): if ext in Glossary.writeExt[i]: self.combobox_o.set(Glossary.writeDesc[i]) break self.pathO = pathO
def entry_changed(self, event=None): #log.debug('entry_changed') #char = event.keysym pathI = self.entry_i.get() if self.pathI != pathI: formatD = self.combobox_i.get() if len(pathI)>7: if pathI[:7]=='file://': pathI=urlToPath(pathI) self.entry_i.delete(0, 'end') self.entry_i.insert(0, pathI) if self.pref['ui_autoSetFormat']:#format==noneItem: ext = os.path.splitext(pathI)[-1].lower() if ext in ('.gz', '.bz2', '.zip'): ext = os.path.splitext(pathI[:-len(ext)])[-1].lower() for i in range(len(Glossary.readExt)): if ext in Glossary.readExt[i]: self.combobox_i.set(Glossary.readDesc[i]) break if self.pref['ui_autoSetOutputFileName']:#format==noneItem: #pathI = self.entry_i.get() formatOD = self.combobox_o.get() pathO = self.entry_o.get() if formatOD != noneItem and not pathO and '.' in pathI: extO=Glossary.descExt[formatOD] pathO=''.join(os.path.splitext(pathI)[:-1])+extO self.entry_o.delete(0, 'end') self.entry_o.insert(0, pathO) self.pathI = pathI ############################################## pathO = self.entry_o.get() if self.pathO!=pathO: formatD = self.combobox_o.get() if len(pathO)>7: if pathO[:7]=='file://': pathO=urlToPath(pathO) self.entry_o.delete(0, 'end') self.entry_o.insert(0, pathO) if self.pref['ui_autoSetFormat']:#format==noneItem: ext = os.path.splitext(pathO)[-1].lower() if ext in ('.gz', '.bz2', '.zip'): ext = os.path.splitext(pathO[:-len(ext)])[-1].lower() for i in range(len(Glossary.writeExt)): if ext in Glossary.writeExt[i]: self.combobox_o.set(Glossary.writeDesc[i]) break self.pathO = pathO
def entry_changed(self, event=None): # log.debug("entry_changed") # char = event.keysym pathI = self.entry_i.get() if self.pathI != pathI: formatD = self.combobox_i.get() if pathI.startswith("file://"): pathI = urlToPath(pathI) self.entry_i.delete(0, "end") self.entry_i.insert(0, pathI) if self.pref["ui_autoSetFormat"]: # format==noneItem: ext = os.path.splitext(pathI)[-1].lower() if ext in (".gz", ".bz2", ".zip"): ext = os.path.splitext(pathI[:-len(ext)])[-1].lower() for i in range(len(Glossary.readExt)): if ext in Glossary.readExt[i]: self.combobox_i.set(Glossary.readDesc[i]) break if self.pref["ui_autoSetOutputFileName"]: # format==noneItem: # pathI = self.entry_i.get() formatOD = self.combobox_o.get() pathO = self.entry_o.get() if formatOD != noneItem and not pathO and "." in pathI: extO = Glossary.descExt[formatOD] pathO = "".join(os.path.splitext(pathI)[:-1]) + extO self.entry_o.delete(0, "end") self.entry_o.insert(0, pathO) self.pathI = pathI ############################################## pathO = self.entry_o.get() if self.pathO != pathO: formatD = self.combobox_o.get() if pathO.startswith("file://"): pathO = urlToPath(pathO) self.entry_o.delete(0, "end") self.entry_o.insert(0, pathO) if self.pref["ui_autoSetFormat"]: # format==noneItem: ext = os.path.splitext(pathO)[-1].lower() if ext in (".gz", ".bz2", ".zip"): ext = os.path.splitext(pathO[:-len(ext)])[-1].lower() for i in range(len(Glossary.writeExt)): if ext in Glossary.writeExt[i]: self.combobox_o.set(Glossary.writeDesc[i]) break self.pathO = pathO
def reverseInputEntryChanged(self, widget=None): inPath = self.reverseInputEntry.get_text() inFormat = self.reverseInputFormatCombo.getActive() if inPath.startswith("file://"): inPath = urlToPath(inPath) self.reverseInputEntry.set_text(inPath) if not inFormat and self.config["ui_autoSetFormat"]: inputArgs = Glossary.detectInputFormat(inPath, quiet=True) if inputArgs: inFormat = inputArgs[1] self.reverseInputFormatCombo.setActive(inFormat)
def textview_merge_changed(self, *args): (stderr, sys.stderr) = (sys.stderr, sys.__stderr__) b = self.merge_buffer lines = buffer_get_text(b).split('\n') for i in xrange(len(lines)): if len(lines[i]) > 7: if lines[i][:7]=='file://': lines[i] = urlToPath(lines[i]) #if not lines[-1]: # lines.pop(-1) b.set_text('\n'.join(lines)) sys.stderr = stderr
def convertInputEntryChanged(self, widget=None): inPath = self.convertInputEntry.get_text() inFormat = self.convertInputFormatCombo.getActive() if inPath.startswith("file://"): inPath = urlToPath(inPath) self.convertInputEntry.set_text(inPath) if self.config["ui_autoSetFormat"] and not inFormat: inputArgs = Glossary.detectInputFormat(inPath, quiet=True) if inputArgs: inFormatNew = inputArgs[1] self.convertInputFormatCombo.setActive(inFormatNew) if not isfile(inPath): return self.status("Select output file")
def inputEntryChanged(self, event=None): # char = event.keysym pathI = self.entryInputConvert.get() if self.pathI != pathI: if pathI.startswith("file://"): pathI = urlToPath(pathI) self.entryInputConvert.delete(0, "end") self.entryInputConvert.insert(0, pathI) if self.pref["ui_autoSetFormat"]: formatDesc = self.formatVarInputConvert.get() if not formatDesc: format = Glossary.detectInputFormat(pathI, quiet=True) if format: plugin = Glossary.plugins.get(format) if plugin: self.formatVarInputConvert.set(plugin.description) self.pathI = pathI
def entry_r_i_changed(self,*args): format=self.combobox_r_i.get_active_text() path = self.entry_r_i.get_text() if len(path)>7: if path[:7]=='file://': path=urlToPath(path) self.entry_r_i.set_text(path) #if True:## not format: path = self.entry_r_i.get_text() (name, ext) = os.path.splitext(path) if ext.lower() in ('.gz', '.bz2', '.zip'): (name, ext) = os.path.splitext(name) ext = ext.lower() for i in xrange(len(Glossary.readExt)): if ext in Glossary.readExt[i]: self.combobox_r_i.set_active(i) self.entry_r_o.set_text(name+'-reversed.txt') return
def convertOutputEntryChanged(self, widget=None): outPath = self.convertOutputEntry.get_text() outFormat = self.convertOutputFormatCombo.getActive() if not outPath: return #outFormat = self.combobox_o.get_active_text() if len(outPath)>7: if outPath[:7]=='file://': outPath = urlToPath(outPath) self.convertOutputEntry.set_text(outPath) if self.pref['auto_set_for']:## and not outFormat: outExt = getCopressedFileExt(outPath) try: outFormatNew = Glossary.extFormat[outExt] except KeyError: pass else: self.convertOutputFormatCombo.setActive(outFormatNew)
def entry_o_changed(self,*args): path = self.entry_o.get_text() if not path: return #format = self.combobox_o.get_active_text() if len(path)>7: if path[:7]=='file://': path = urlToPath(path) self.entry_o.set_text(path) #if True:## not format: path = self.entry_o.get_text() (name, ext) = os.path.splitext(path) if ext.lower() in ('.gz', '.bz2', '.zip'): ext = os.path.splitext(name)[1].lower() for i in xrange(len(Glossary.writeExt)): if ext in Glossary.writeExt[i]: self.combobox_o.set_active(i) break
def convertOutputEntryChanged(self, widget=None): outPath = self.convertOutputEntry.get_text() outFormat = self.convertOutputFormatCombo.getActive() if not outPath: return #outFormat = self.combobox_o.get_active_text() if len(outPath) > 7: if outPath[:7] == 'file://': outPath = urlToPath(outPath) self.convertOutputEntry.set_text(outPath) if self.pref['auto_set_for']: ## and not outFormat: outExt = getCopressedFileExt(outPath) try: outFormatNew = Glossary.extFormat[outExt] except KeyError: pass else: self.convertOutputFormatCombo.setActive(outFormatNew)
def reverseInputEntryChanged(self, widget=None): inPath = self.reverseInputEntry.get_text() inFormat = self.reverseInputFormatCombo.getActive() if inPath.startswith("file://"): inPath = urlToPath(inPath) self.reverseInputEntry.set_text(inPath) inExt = getCompressedFileExt(inPath) inFormatNew = Glossary.pluginByExt.get(inExt) if inFormatNew and self.pref["ui_autoSetFormat"] and not inFormat: self.reverseInputFormatCombo.setActive(inFormatNew.name) if self.pref["ui_autoSetOutputFileName"]: outExt = ".txt" outPath = self.reverseOutputEntry.get_text() if inFormatNew and not outPath: outPath = splitext(inPath)[0] + "-reversed" + outExt self.reverseOutputEntry.set_text(outPath)
def reverseInputEntryChanged(self, widget=None): inPath = self.reverseInputEntry.get_text() inFormat = self.reverseInputFormatCombo.getActive() if inPath.startswith("file://"): inPath = urlToPath(inPath) self.reverseInputEntry.set_text(inPath) inExt = getCopressedFileExt(inPath) inFormatNew = Glossary.extFormat.get(inExt) if inFormatNew and self.pref["ui_autoSetFormat"] and not inFormat: self.reverseInputFormatCombo.setActive(inFormatNew) if self.pref["ui_autoSetOutputFileName"]: outExt = ".txt" outPath = self.reverseOutputEntry.get_text() if inFormatNew and not outPath: outPath = splitext(inPath)[0] + "-reversed" + outExt self.reverseOutputEntry.set_text(outPath)
def reverseInputEntryChanged(self, widget=None): inPath = self.reverseInputEntry.get_text() inFormat = self.reverseInputFormatCombo.getActive() if len(inPath) > 7: if inPath[:7]=='file://': inPath = urlToPath(inPath) self.reverseInputEntry.set_text(inPath) inExt = getCopressedFileExt(inPath) inFormatNew = Glossary.extFormat.get(inExt) if inFormatNew and self.pref['auto_set_for']:## and not inFormat: self.reverseInputFormatCombo.setActive(inFormatNew) if self.pref['auto_set_out']: outExt = '.txt' outPath = self.reverseOutputEntry.get_text() if inFormatNew and not outPath: outPath = splitext(inPath)[0] + '-reversed' + outExt self.reverseOutputEntry.set_text(outPath)
def reverseInputEntryChanged(self, widget=None): inPath = self.reverseInputEntry.get_text() inFormat = self.reverseInputFormatCombo.getActive() if len(inPath) > 7: if inPath[:7] == 'file://': inPath = urlToPath(inPath) self.reverseInputEntry.set_text(inPath) inExt = getCopressedFileExt(inPath) inFormatNew = Glossary.extFormat.get(inExt) if inFormatNew and self.pref['auto_set_for']: ## and not inFormat: self.reverseInputFormatCombo.setActive(inFormatNew) if self.pref['auto_set_out']: outExt = '.txt' outPath = self.reverseOutputEntry.get_text() if inFormatNew and not outPath: outPath = splitext(inPath)[0] + '-reversed' + outExt self.reverseOutputEntry.set_text(outPath)
def outputEntryChanged(self, event=None): pathO = self.entryOutputConvert.get() if self.pathO != pathO: if pathO.startswith("file://"): pathO = urlToPath(pathO) self.entryOutputConvert.delete(0, "end") self.entryOutputConvert.insert(0, pathO) if self.pref["ui_autoSetFormat"]: formatDesc = self.formatVarOutputConvert.get() if not formatDesc: outputArgs = Glossary.detectOutputFormat( filename=pathO, inputFilename=self.entryInputConvert.get(), quiet=True, ) if outputArgs: outputFormat = outputArgs[1] self.formatVarOutputConvert.set( Glossary.plugins[outputFormat].description) self.pathO = pathO
def inputEntryChanged(self, event=None): # char = event.keysym pathI = self.entryInputConvert.get() if self.pathI == pathI: return if pathI.startswith("file://"): pathI = urlToPath(pathI) self.entryInputConvert.delete(0, "end") self.entryInputConvert.insert(0, pathI) if self.config["ui_autoSetFormat"]: formatDesc = self.formatButtonInputConvert.get() if not formatDesc: inputArgs = Glossary.detectInputFormat(pathI, quiet=True) if inputArgs: format = inputArgs[1] plugin = Glossary.plugins.get(format) if plugin: self.formatButtonInputConvert.set(plugin.description) self.inputFormatChanged() self.pathI = pathI
def convertOutputEntryChanged(self, widget=None): outPath = self.convertOutputEntry.get_text() outFormat = self.convertOutputFormatCombo.getActive() if not outPath: return if outPath.startswith("file://"): outPath = urlToPath(outPath) self.convertOutputEntry.set_text(outPath) if self.config["ui_autoSetFormat"] and not outFormat: outputArgs = Glossary.detectOutputFormat( filename=outPath, inputFilename=self.convertInputEntry.get_text(), quiet=True, ) if outputArgs: outFormat = outputArgs[1] self.convertOutputFormatCombo.setActive(outFormat) if outFormat: self.status("Press \"Convert\"") else: self.status("Select output format")
def convertOutputEntryChanged(self, widget=None): outPath = self.convertOutputEntry.get_text() outFormat = self.convertOutputFormatCombo.getActive() if not outPath: return # outFormat = self.combobox_o.get_active_text() if outPath.startswith("file://"): outPath = urlToPath(outPath) self.convertOutputEntry.set_text(outPath) if self.pref["ui_autoSetFormat"] and not outFormat: outExt = getCopressedFileExt(outPath) try: outFormatNew = Glossary.extFormat[outExt] except KeyError: pass else: self.convertOutputFormatCombo.setActive(outFormatNew) if self.convertOutputFormatCombo.getActive(): self.status("Press \"Convert\"") else: self.status("Select output format")
def convertInputEntryChanged(self, widget=None): inPath = self.convertInputEntry.get_text() inFormat = self.convertInputFormatCombo.getActive() if len(inPath) > 7: if inPath[:7]=='file://': inPath = urlToPath(inPath) self.convertInputEntry.set_text(inPath) if self.pref['auto_set_for']:## and not inFormat: inExt = getCopressedFileExt(inPath) try: inFormatNew = Glossary.extFormat[inExt] except KeyError: pass else: self.convertInputFormatCombo.setActive(inFormatNew) if self.pref['auto_set_out']: outFormat = self.convertOutputFormatCombo.getActive() outPath = self.convertOutputEntry.get_text() if outFormat and not outPath and '.' in inPath: outPath = os.path.splitext(inPath)[0] + Glossary.formatsExt[outFormat][0] self.convertOutputEntry.set_text(outPath)
def convertOutputEntryChanged(self, widget=None): outPath = self.convertOutputEntry.get_text() outFormat = self.convertOutputFormatCombo.getActive() if not outPath: return # outFormat = self.combobox_o.get_active_text() if outPath.startswith("file://"): outPath = urlToPath(outPath) self.convertOutputEntry.set_text(outPath) if self.pref["ui_autoSetFormat"] and not outFormat: outExt = getCompressedFileExt(outPath) try: outFormatNew = Glossary.pluginByExt[outExt].name except KeyError: pass else: self.convertOutputFormatCombo.setActive(outFormatNew) if self.convertOutputFormatCombo.getActive(): self.status("Press \"Convert\"") else: self.status("Select output format")
def entry_i_changed(self, *args): pathI = self.entry_i.get_text() formatD = self.combobox_i.get_active_text() if len(pathI) > 7: if pathI[:7]=='file://': pathI = urlToPath(pathI) self.entry_i.set_text(pathI) if self.pref['auto_set_for']:## not format: pathI = self.entry_i.get_text() (name, ext) = os.path.splitext(pathI) if ext.lower() in ('.gz', '.bz2', '.zip'): ext = os.path.splitext(name)[1].lower() for i in xrange(len(Glossary.readExt)): if ext in Glossary.readExt[i]: self.combobox_i.set_active(i) break if self.pref['auto_set_out']:## not format: #pathI = self.entry_i.get_text() formatOD = self.combobox_o.get_active_text() pathO = self.entry_o.get_text() if formatOD and not pathO and '.' in pathI: extO = Glossary.descExt[formatOD] pathO = os.path.splitext(pathI)[0] + extO self.entry_o.set_text(pathO)