Skip to content

Commit

Permalink
add list filter
Browse files Browse the repository at this point in the history
  • Loading branch information
hannesdelbeke committed Dec 18, 2023
1 parent 0f96645 commit 0f2eda7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions pip_qt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def __init__(self):
self.list_button.clicked.connect(self.list_packages)
self.search_button.clicked.connect(self.search_packages)
self.run_button.clicked.connect(self.run_command)
self.package_input.textChanged.connect(self.filter_packages)

# Create the layout
package_layout = QHBoxLayout()
Expand All @@ -77,6 +78,16 @@ def __init__(self):

self.resize(800, 300)

def filter_packages(self):
"""Filter the packages in the table based on the text in the package input field"""
filter_text = self.package_input.text().lower()
for i in range(self.output_table.rowCount()):
package_name = self.output_table.item(i, 0).text().lower()
if filter_text in package_name:
self.output_table.setRowHidden(i, False)
else:
self.output_table.setRowHidden(i, True)

def browse_path(self):
path = QFileDialog.getExistingDirectory(self, "Select Directory")
self.path_input.setText(path)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ classifiers = [
#dynamic = ["dependencies"]
dependencies = ['importlib-metadata; python_version<"3.7"', "qtpy", "py-pip"]
#dynamic = ["version"]
version = "0.0.8"
version = "0.0.9"

#[project.optional-dependencies]
#yaml = ["pyyaml"]
Expand Down

0 comments on commit 0f2eda7

Please sign in to comment.