mirror of
https://github.com/Escartem/AnimeWwise.git
synced 2026-06-22 04:02:58 +08:00
better progress bar
This commit is contained in:
9
app.py
9
app.py
@@ -87,6 +87,8 @@ class AnimeWwise(QMainWindow):
|
|||||||
sys.stdout = TextEditStream(self.console)
|
sys.stdout = TextEditStream(self.console)
|
||||||
self.extract = extract.WwiseExtract()
|
self.extract = extract.WwiseExtract()
|
||||||
self.checkUpdates()
|
self.checkUpdates()
|
||||||
|
self.totalProgress.setMaximum(10000)
|
||||||
|
self.fileProgress.setMaximum(10000)
|
||||||
|
|
||||||
# utils
|
# utils
|
||||||
self.selectFolder = lambda: QFileDialog.getExistingDirectory(self, "Select Folder")
|
self.selectFolder = lambda: QFileDialog.getExistingDirectory(self, "Select Folder")
|
||||||
@@ -210,10 +212,13 @@ class AnimeWwise(QMainWindow):
|
|||||||
# workers
|
# workers
|
||||||
@pyqtSlot(list)
|
@pyqtSlot(list)
|
||||||
def progressBarSlot(self, progress):
|
def progressBarSlot(self, progress):
|
||||||
|
progress_value = math.ceil(progress[1]*100)
|
||||||
if progress[0] == "total":
|
if progress[0] == "total":
|
||||||
self.totalProgress.setValue(math.ceil(progress[1]))
|
self.totalProgress.setValue(progress_value)
|
||||||
|
self.totalProgress.setFormat("%.02f %%" % (progress_value / 100))
|
||||||
elif progress[0] == "file":
|
elif progress[0] == "file":
|
||||||
self.fileProgress.setValue(math.ceil(progress[1]))
|
self.fileProgress.setValue(progress_value)
|
||||||
|
self.fileProgress.setFormat("%.02f %%" % (progress_value / 100))
|
||||||
|
|
||||||
@pyqtSlot(dict)
|
@pyqtSlot(dict)
|
||||||
def handleFinished(self, data):
|
def handleFinished(self, data):
|
||||||
|
|||||||
@@ -371,8 +371,8 @@ class WwiseExtract:
|
|||||||
|
|
||||||
def update_progress(self, current, total, step):
|
def update_progress(self, current, total, step):
|
||||||
base = 100 / self.steps
|
base = 100 / self.steps
|
||||||
self.progress(["total", current * base // total + base * (step - 1)])
|
self.progress(["total", current * base / total + base * (step - 1)])
|
||||||
self.progress(["file", current * 100 // total])
|
self.progress(["file", current * 100 / total])
|
||||||
|
|
||||||
def reset(self):
|
def reset(self):
|
||||||
self.mapper = None
|
self.mapper = None
|
||||||
|
|||||||
Reference in New Issue
Block a user