i try to show the progress using this code in pyQt5 Widget :
import sys
from PyQt5.QtWidgets import QApplication, QWidget, QLabel, QProgressBar, QVBoxLayout
from PyQt5.QtCore import QObject, pyqtSignal
import git
class Progress(QObject, git.remote.RemoteProgress):
progress_updated = pyqtSignal(int)
def __init__(self, update_frequency=1):
git.remote.RemoteProgress.__init__(self)
self._update_frequency = update_frequency
self._cur_count = 0
def update(self, op_code, cur_count, max_count=None, message=''):
if cur_count > self._cur_count + self._update_frequency or cur_count == max_count:
self._cur_count = cur_count
progress = int(cur_count / max_count * 100)
self.progress_updated.emit(progress)
but it shows me this error :
PS C:\Users\xxx\Desktop\VCSP\src> & C:/Users/sd94277/AppData/Local/Programs/Python/Python311/python.exe "c:/Users/sd94277/Desktop/VCSP/src/TEST/clone process 2.py"
Traceback (most recent call last):
File "c:\Users\sd94277\Desktop\VCSP\src\control\clone.py", line 6, in <module>
class Progress(QObject, git.remote.RemoteProgress):
TypeError: multiple bases have instance lay-out conflict
and this is the entire code :
import sys
from PyQt5.QtWidgets import QApplication, QWidget, QLabel, QProgressBar, QVBoxLayout
from PyQt5.QtCore import QObject, pyqtSignal
import git
class Progress(QObject, git.remote.RemoteProgress):
progress_updated = pyqtSignal(int)
def __init__(self, update_frequency=1):
git.remote.RemoteProgress.__init__(self)
self._update_frequency = update_frequency
self._cur_count = 0
def update(self, op_code, cur_count, max_count=None, message=''):
if cur_count > self._cur_count + self._update_frequency or cur_count == max_count:
self._cur_count = cur_count
progress = int(cur_count / max_count * 100)
self.progress_updated.emit(progress)
class Example(QWidget):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
self.label = QLabel("Starting...", self)
self.progressbar = QProgressBar(self)
self.progressbar.setValue(0)
vbox = QVBoxLayout()
vbox.addWidget(self.label)
vbox.addWidget(self.progressbar)
self.setLayout(vbox)
self.setGeometry(300, 300, 250, 150)
self.setWindowTitle('Git Progress')
self.show()
def update_progress(self, progress):
self.progressbar.setValue(progress)
self.label.setText(f"Progress: {progress}%")
if __name__ == '__main__':
app = QApplication(sys.argv)
ex = Example()
progress = Progress()
progress.progress_updated.connect(ex.update_progress)
# Some git operation that will trigger progress updates
repo = git.Repo('.')
repo.git.pull(progress=progress)
sys.exit(app.exec_())
can any one tell me what is the source of the probleme ?
i tried switch the order i tried import each constructor of each supper separated ect but i don't know it still does not work
i expect to get the progress of the clone push or pull