Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yjg30737/pyqt-detailed-progress-dialog
PyQt Detailed Progress Dialog (Show the download/copy&paste progress in detail with QListWidget like adding the filename on QListWidget right after it was pasted)
https://github.com/yjg30737/pyqt-detailed-progress-dialog
pyqt pyqt-examples pyqt-gui pyqt-qthread pyqt5 pyqt5-examples pyqt5-gui pyqt5-qthread pyqt5-tutorial qprogressbar qprogressdialog qt qthread
Last synced: 2 days ago
JSON representation
PyQt Detailed Progress Dialog (Show the download/copy&paste progress in detail with QListWidget like adding the filename on QListWidget right after it was pasted)
- Host: GitHub
- URL: https://github.com/yjg30737/pyqt-detailed-progress-dialog
- Owner: yjg30737
- License: mit
- Created: 2022-01-24T04:57:43.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-02-05T04:37:59.000Z (almost 3 years ago)
- Last Synced: 2024-12-29T08:42:14.690Z (7 days ago)
- Topics: pyqt, pyqt-examples, pyqt-gui, pyqt-qthread, pyqt5, pyqt5-examples, pyqt5-gui, pyqt5-qthread, pyqt5-tutorial, qprogressbar, qprogressdialog, qt, qthread
- Language: Python
- Homepage:
- Size: 27.3 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pyqt-detailed-progress-dialog
PyQt Detailed Progress Dialog (Show the download/copy&paste progress in detail with QListWidget like adding the filename on QListWidget right after it was pasted)## Requirements
* PyQt5 >= 5.15## Setup
```pip3 install git+https://github.com/yjg30737/pyqt-detailed-progress-dialog.git --upgrade```## Description
This dialog's UI mainly consists of QProgressBar, QListWidget. QProgressBar shows how much an operation is being progressed, QListWidget shows the pasted filename like installed files list. QListWidget can be hidden by clicking the show/hide detail toggle button.Main operation of this dialog is copy and paste the files. You can give filenames which you want to copy to constructor. Then ```ProgressWorkingThread(QThread)``` which is connected with dialog will do the copy and paste operation.
## Usage
* ```canceled``` signal is emitted when the cancel button is clicked. This is connected to the close() method by default.
* ```completed``` signal is emitted when operation is finished.
* ```show()``` start the copy and paste operation. Dialog will show up and you can clearly see that QProgressBar and QListWidget do their job.
* Main class is DetailedProgressDialog. Constructor's format is ```DetailedProgressDialog(filenames: list)```.## Example
Code Sample
```python
import os
from PyQt5.QtWidgets import QMainWindow, QPushButton, QApplication
from pyqt_detailed_progress_dialog import DetailedProgressDialogclass MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.__initUi()def __initUi(self):
downloadStartBtn = QPushButton('Start the download')
downloadStartBtn.clicked.connect(self.__download)
self.setCentralWidget(downloadStartBtn)def getAllFilesInPath(self, pathname):
path_lst = []
for path, dir, files in os.walk(pathname):
for filename in files:
path_filename = os.path.join(path, filename)
path_lst.append(path_filename)
return path_lstdef __download(self):
filenames = self.getAllFilesInPath(os.path.join(os.path.dirname(__file__), 'src')) # Get all the filenames list in certain directory
self.__dialog = DetailedProgressDialog(filenames)
self.__dialog.canceled.connect(self.cancel)
self.__dialog.completed.connect(self.complete)
self.__dialog.show()def cancel(self):
print('cancel')def complete(self):
print('complete')if __name__ == "__main__":
import sysapp = QApplication(sys.argv)
mainWindow = MainWindow()
mainWindow.show()
sys.exit(app.exec_())
```Result
https://user-images.githubusercontent.com/55078043/150727857-2efcf017-82e9-4292-948d-ab45047b1c8d.mp4
This video is incomplete. It should've shown the progression completely, from 0% to 100%. But it failed. I can tell you why.
First, i can't help but start in the middle of progress. Because i don't know how to start the record the video immediately when i run certain script.
Second, when i clicked the hide button to hide the QListWidget, it make the video stop somehow. I don't know why that happened.
Sorry for that.