(self, dialect)
Set the current state to match dialect instance.
Set the current state to match dialect instance.
Set the current state to match dialect instance .
def setDialect(self, dialect):
        # type: (csv.Dialect) -> None
        """
        Set the current state to match dialect instance.
        """
        changed = False
        delimiter = dialect.delimiter
        presets = [d for _, d in CSVOptionsWidget.PresetDelimiters]
        try:
            index = presets.index(delimiter)
        except ValueError:
            index = CSVOptionsWidget.DelimiterOther
            if self._delimiter_custom != delimiter:
                self._delimiter_custom = delimiter
                changed = True

        if self._delimiter_idx != index:
            self._delimiter_idx = index
            self.delimiter_cb.setCurrentIndex(index)
            self.delimiteredit.setText(delimiter)
            changed = True
        if self._quotechar != dialect.quotechar:
            self._quotechar = dialect.quotechar
            self.quoteedit.setText(dialect.quotechar or '')
            changed = True

        if changed:
            self.optionsChanged.emit()
def setDialect ( self , dialect ) : # type: (csv.Dialect) -> None changed = False delimiter = dialect . delimiter presets = [ d for _ , d in CSVOptionsWidget . PresetDelimiters ] try : index = presets . index ( delimiter ) except ValueError : index = CSVOptionsWidget . DelimiterOther if self . _delimiter_custom != delimiter : self . _delimiter_custom = delimiter changed = True if self . _delimiter_idx != index : self . _delimiter_idx = index self . delimiter_cb . setCurrentIndex ( index ) self . delimiteredit . setText ( delimiter ) changed = True if self . _quotechar != dialect . quotechar : self . _quotechar = dialect . quotechar self . quoteedit . setText ( dialect . quotechar or '' ) changed = True if changed : self . optionsChanged . emit ( )