Skip to content
Snippets Groups Projects

Implement file search

Merged Kien Le requested to merge feature-#10-search_folder_list into master
1 unresolved thread
1 file
+ 21
19
Compare changes
  • Side-by-side
  • Inline
@@ -77,6 +77,15 @@ class UIMainWindow(object):
"""
self.plotting_widget: Union[SOHWidget, None] = None
"""
search_line_edit: textbox for user to search in
self.open_file_list
"""
self.search_line_edit: Union[QLineEdit, None] = None
"""
clear_button: clear search_line_edit
"""
self.clear_search_action: Optional[QAction] = None
"""
open_files_list: Widget that display the list of directories in
current directory for user to select
"""
@@ -87,15 +96,6 @@ class UIMainWindow(object):
"""
self.from_data_card_check_box: Union[QCheckBox, None] = None
"""
search_line_edit: textbox for user to search in
self.open_file_list
"""
self.search_line_edit: Union[QLineEdit, None] = None
"""
clear_button: clear search_line_edit
"""
self.clear_search_action: Optional[QAction] = None
"""
replot_button: reset plotting without re-loading data
"""
self.replot_button: Union[QPushButton, None] = None
@@ -368,14 +368,6 @@ class UIMainWindow(object):
"""
self.open_files_list = QListWidget(
self.central_widget)
left_layout.addWidget(self.open_files_list, 1)
pal = self.open_files_list.palette()
pal.setColor(QtGui.QPalette.Highlight, QtGui.QColor(128, 255, 128))
pal.setColor(QtGui.QPalette.HighlightedText, QtGui.QColor(0, 0, 0))
self.open_files_list.setPalette(pal)
# allow multiple-line selection
self.open_files_list.setSelectionMode(
QAbstractItemView.ExtendedSelection)
search_layout = QHBoxLayout()
left_layout.addLayout(search_layout)
@@ -383,7 +375,8 @@ class UIMainWindow(object):
self.search_line_edit.setPlaceholderText('Search...')
self.search_line_edit.setToolTip('Filter the list of files based on '
'the content.')
self.search_line_edit.textChanged.connect(self.main_window.filter_folder_list)
self.search_line_edit.textChanged.connect(
self.main_window.filter_folder_list)
self.search_line_edit.setClearButtonEnabled(True)
try:
# This value was obtained from the C++ source of QT. We use it here
@@ -398,13 +391,22 @@ class UIMainWindow(object):
)
except IndexError:
# If the name of the clear button is changed in the C++ source of
# QT, nothing will be found. So, we raise an error to indicate this
# QT, nothing will be found. We raise an error to indicate this
# problem.
raise ValueError('No clear button could be found. Check its '
'objectName attribute using QObject.findChildren '
'without a name.')
search_layout.addWidget(self.search_line_edit)
left_layout.addWidget(self.open_files_list, 1)
pal = self.open_files_list.palette()
pal.setColor(QtGui.QPalette.Highlight, QtGui.QColor(128, 255, 128))
pal.setColor(QtGui.QPalette.HighlightedText, QtGui.QColor(0, 0, 0))
self.open_files_list.setPalette(pal)
# allow multiple-line selection
self.open_files_list.setSelectionMode(
QAbstractItemView.ExtendedSelection)
read_option_grid = QGridLayout()
left_layout.addLayout(read_option_grid)
self.from_data_card_check_box = QCheckBox(
Loading