-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 06abc63
Showing
17 changed files
with
837 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Auto detect text files and perform LF normalization | ||
* text=auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
share/python-wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
*.py,cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
cover/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
db.sqlite3-journal | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
.pybuilder/ | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# IPython | ||
profile_default/ | ||
ipython_config.py | ||
|
||
# pyenv | ||
# For a library or package, you might want to ignore these files since the code is | ||
# intended to run in multiple environments; otherwise, check them in: | ||
# .python-version | ||
|
||
# pipenv | ||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. | ||
# However, in case of collaboration, if having platform-specific dependencies or dependencies | ||
# having no cross-platform support, pipenv may install dependencies that don't work, or not | ||
# install all needed dependencies. | ||
#Pipfile.lock | ||
|
||
# poetry | ||
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. | ||
# This is especially recommended for binary packages to ensure reproducibility, and is more | ||
# commonly ignored for libraries. | ||
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control | ||
#poetry.lock | ||
|
||
# pdm | ||
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. | ||
#pdm.lock | ||
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it | ||
# in version control. | ||
# https://pdm.fming.dev/#use-with-ide | ||
.pdm.toml | ||
|
||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm | ||
__pypackages__/ | ||
|
||
# Celery stuff | ||
celerybeat-schedule | ||
celerybeat.pid | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
# pytype static type analyzer | ||
.pytype/ | ||
|
||
# Cython debug symbols | ||
cython_debug/ | ||
|
||
# PyCharm | ||
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can | ||
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore | ||
# and can be added to the global gitignore or merged into this file. For a more nuclear | ||
# option (not recommended) you can uncomment the following to ignore the entire idea folder. | ||
#.idea/ |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Virgil | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# ChatGPT-Feeder | ||
|
||
**ChatGPT-Feeder** is a Python application built using PySide6 for selecting and processing Python project files. It features a graphical user interface (GUI) that allows users to browse, select, and manage Python files in a project, including options to expand/collapse the file tree and apply various operations on the selected files. | ||
|
||
## Features | ||
|
||
- **File Selection**: Browse and select Python files from a project directory. | ||
- **Expand/Collapse**: Expand or collapse all directories in the file tree with a single click. | ||
- **Clipboard Integration**: Copy the contents of selected files to the clipboard. | ||
- **File Extension Filtering**: Lock and unlock file extensions to filter files in the tree. | ||
- **Persistent Selection**: Save and load file selections between sessions. | ||
- **Icons**: Uses a custom spoon emoji (`🥄`) as the app icon. | ||
|
||
## Screenshots | ||
|
||
 | ||
|
||
## Installation | ||
|
||
### Prerequisites | ||
|
||
1. **Python**: Ensure you have Python 3.7 or higher installed. | ||
2. **Dependencies**: Install the required Python packages listed in the `requirements.txt` file. | ||
|
||
### Clone the Repository | ||
|
||
```bash | ||
git clone https://github.com/jiuvirgil/ChatGPT-Feeder.git | ||
cd ChatGPT-Feeder | ||
``` | ||
|
||
### Install Dependencies | ||
|
||
Install the required Python packages using pip: | ||
|
||
```bash | ||
pip install -r requirements.txt | ||
``` | ||
|
||
### Run the Application | ||
|
||
Once the dependencies are installed, you can run the application: | ||
|
||
```bash | ||
python main.py | ||
``` | ||
|
||
## Download the Executable | ||
|
||
If you don't want to run the application from source, you can download the standalone executable from the [Releases](https://github.com/jiuvirgil/ChatGPT-Feeder/releases) page. | ||
|
||
Simply download the latest release for your platform and run the executable. | ||
|
||
## Usage | ||
|
||
1. Launch the application. | ||
2. Use the file tree to browse and select Python files in your project directory. | ||
3. You can expand or collapse all directories using the `➕ Expand All` and `➖ Collapse All` buttons. | ||
4. Filter files by file extension using the input field at the top. | ||
5. After making your selection, click "Submit" to copy the contents of the selected files to the clipboard. | ||
|
||
## Requirements | ||
|
||
- **Python 3.7+** | ||
- **PySide6** | ||
- **pyperclip** | ||
|
||
These dependencies are listed in the `requirements.txt` file. | ||
|
||
## Contributing | ||
|
||
Contributions are welcome! If you find a bug or have a feature request, please open an issue. If you want to contribute code, feel free to fork the repository and submit a pull request. | ||
|
||
## License | ||
|
||
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details. | ||
|
||
## Acknowledgments | ||
|
||
- Special thanks to the PySide6 and Python communities for providing the tools and libraries that make this application possible. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from PySide6.QtWidgets import QApplication | ||
from ui.file_selector_ui import FileSelectorUI | ||
from utils.file_helpers import find_python_files, load_last_selection | ||
|
||
|
||
def main(): | ||
app = QApplication([]) | ||
|
||
python_files = find_python_files() | ||
last_selection = load_last_selection() | ||
|
||
window = FileSelectorUI(python_files, last_selection) | ||
window.show() | ||
|
||
app.exec() | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from PySide6.QtWidgets import QTreeWidgetItem | ||
from PySide6.QtCore import Qt | ||
|
||
|
||
class CheckableTreeWidgetItem(QTreeWidgetItem): | ||
def __init__(self, texts, parent=None): | ||
# Initialize QTreeWidgetItem with proper arguments | ||
super().__init__(parent) | ||
self.setText(0, texts[0]) # Set text for the first column | ||
self.setFlags( | ||
self.flags() | Qt.ItemIsUserCheckable | ||
) # Allow user checkable items | ||
self.setCheckState(0, Qt.Unchecked) # Default to unchecked | ||
|
||
# If multiple texts are passed, set them for the other columns | ||
for i, text in enumerate(texts[1:], start=1): | ||
self.setText(i, text) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
from PySide6.QtWidgets import QLineEdit, QPushButton, QVBoxLayout, QHBoxLayout, QLabel | ||
from PySide6.QtGui import QPalette | ||
from PySide6.QtCore import Qt, QSize | ||
|
||
|
||
class FileExtensionInput: | ||
def __init__(self, default_extension, on_update_callback): | ||
self.extension = default_extension | ||
self.is_locked = True # Start with the extension locked | ||
self.on_update_callback = on_update_callback | ||
|
||
# Vertical layout for the label and input components | ||
self.layout = QVBoxLayout() | ||
|
||
# Label for file extension input | ||
self.label = QLabel("File extension:") | ||
self.layout.addWidget(self.label) | ||
|
||
# Horizontal layout for the lock icon and input | ||
input_layout = QHBoxLayout() | ||
|
||
# Lock/Unlock icon button | ||
self.lock_button = QPushButton("🔒") # Locked by default | ||
self.lock_button.setFixedSize(QSize(24, 24)) # Size similar to a checkbox | ||
self.lock_button.clicked.connect(self.toggle_lock) | ||
input_layout.addWidget(self.lock_button) | ||
|
||
# File extension input | ||
self.input = QLineEdit(self.extension) | ||
self.input.setFixedWidth(100) # Adjust width to accommodate more characters | ||
self.input.setAlignment(Qt.AlignLeft) # Align the input to the left | ||
self.input.returnPressed.connect(self.handle_enter_press) # Lock on Enter press | ||
self.set_input_locked_appearance() # Set appearance based on lock state | ||
input_layout.addWidget(self.input) | ||
|
||
# Ensure the input is aligned to the left | ||
input_layout.addStretch() | ||
|
||
self.layout.addLayout(input_layout) | ||
|
||
def set_input_locked_appearance(self): | ||
"""Set the visual appearance of the input to indicate it's locked.""" | ||
palette = self.input.palette() | ||
app_palette = ( | ||
self.input.style().standardPalette() | ||
) # Get the application's standard palette | ||
|
||
# Get the main window's background color | ||
main_window_palette = self.input.window().palette() | ||
main_window_bg_color = main_window_palette.color(QPalette.Window) | ||
|
||
# Get the lock button's background color | ||
button_palette = self.lock_button.palette() | ||
button_bg_color = button_palette.color(QPalette.Button) | ||
|
||
if self.is_locked: | ||
# Locked state: Use main window's background color for the input field | ||
palette.setColor(QPalette.Base, main_window_bg_color) # Background color | ||
palette.setColor( | ||
QPalette.Text, app_palette.color(QPalette.Disabled, QPalette.Text) | ||
) # Text color | ||
self.input.setPalette(palette) | ||
self.input.setEnabled(False) # Disable input | ||
else: | ||
# Unlocked state: Use lock button's background color for the input field | ||
palette.setColor(QPalette.Base, button_bg_color) # Background color | ||
palette.setColor(QPalette.Text, Qt.white) | ||
self.input.setPalette(palette) | ||
self.input.setEnabled(True) # Enable input | ||
|
||
def handle_enter_press(self): | ||
"""Lock the input field when Enter is pressed.""" | ||
if not self.is_locked: # Only lock if it's currently unlocked | ||
self.toggle_lock() | ||
|
||
def toggle_lock(self): | ||
"""Toggle the lock state of the file extension input.""" | ||
self.is_locked = not self.is_locked | ||
self.set_input_locked_appearance() | ||
self.lock_button.setText("🔓" if not self.is_locked else "🔒") | ||
if self.is_locked: | ||
self.on_update_callback() # Apply filter when locking | ||
|
||
def get_extension(self): | ||
"""Return the current file extension.""" | ||
return self.input.text().strip() |
Oops, something went wrong.