Skip to content

Commit

Permalink
textimport: Use TextEditCombo from utils
Browse files Browse the repository at this point in the history
  • Loading branch information
ales-erjavec committed Dec 20, 2022
1 parent 5357f43 commit 663ceae
Showing 1 changed file with 1 addition and 21 deletions.
22 changes: 1 addition & 21 deletions Orange/widgets/utils/textimport.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@

from Orange.widgets.utils import encodings
from Orange.widgets.utils.overlay import OverlayWidget
from Orange.widgets.utils.combobox import TextEditCombo


__all__ = ["ColumnType", "RowSpec", "CSVOptionsWidget", "CSVImportWidget"]
Expand Down Expand Up @@ -233,27 +234,6 @@ def minimumSizeHint(self):
return super(LineEdit, self).sizeHint()


class TextEditCombo(QComboBox):
def text(self):
# type: () -> str
"""
Return the current text.
"""
return self.itemText(self.currentIndex())

def setText(self, text):
# type: (str) -> None
"""
Set `text` as the current text (adding it to the model if necessary).
"""
idx = self.findData(text, Qt.EditRole, Qt.MatchExactly)
if idx != -1:
self.setCurrentIndex(idx)
else:
self.addItem(text)
self.setCurrentIndex(self.count() - 1)


class CSVOptionsWidget(QWidget):
"""
A widget presenting common CSV options.
Expand Down

0 comments on commit 663ceae

Please sign in to comment.