mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-09 05:14:16 +02:00
fix: arch checking dependencies regression | pausing the progress when a confirmation dialog is displayed
This commit is contained in:
@@ -20,10 +20,15 @@ def check_missing_deps(pkgdir: str, watcher: ProcessWatcher) -> List[str]:
|
|||||||
error_lines = []
|
error_lines = []
|
||||||
for s in depcheck.stderr:
|
for s in depcheck.stderr:
|
||||||
if s:
|
if s:
|
||||||
line = s.decode().strip()
|
line = s.decode()
|
||||||
if line:
|
if line:
|
||||||
error_lines.append(line)
|
error_lines.append(line)
|
||||||
|
|
||||||
|
line_strip = line.strip()
|
||||||
|
|
||||||
|
if line_strip:
|
||||||
|
watcher.print(line)
|
||||||
|
|
||||||
if error_lines:
|
if error_lines:
|
||||||
error_str = ''.join(error_lines)
|
error_str = ''.join(error_lines)
|
||||||
|
|
||||||
|
|||||||
@@ -278,6 +278,7 @@ class AnimateProgress(QThread):
|
|||||||
self.sleep = 0.05
|
self.sleep = 0.05
|
||||||
self.last_progress = 0
|
self.last_progress = 0
|
||||||
self.manual = False
|
self.manual = False
|
||||||
|
self.paused = False
|
||||||
|
|
||||||
def _reset(self):
|
def _reset(self):
|
||||||
self.progress_value = 0
|
self.progress_value = 0
|
||||||
@@ -287,34 +288,44 @@ class AnimateProgress(QThread):
|
|||||||
self.sleep = 0.05
|
self.sleep = 0.05
|
||||||
self.last_progress = 0
|
self.last_progress = 0
|
||||||
self.manual = False
|
self.manual = False
|
||||||
|
self.paused = False
|
||||||
|
|
||||||
def set_progress(self, val: int):
|
def set_progress(self, val: int):
|
||||||
if 0 <= val <= 100:
|
if 0 <= val <= 100:
|
||||||
self.limit = val
|
self.limit = val
|
||||||
self.manual = True
|
self.manual = True
|
||||||
self.increment = 0.5
|
self.increment = 0.5
|
||||||
|
self.paused = False
|
||||||
|
|
||||||
|
def pause(self):
|
||||||
|
self.paused = True
|
||||||
|
|
||||||
|
def animate(self):
|
||||||
|
self.paused = False
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|
||||||
current_increment = self.increment
|
current_increment = self.increment
|
||||||
|
|
||||||
while not self.stop:
|
while not self.stop:
|
||||||
if self.progress_value != self.last_progress:
|
if not self.paused:
|
||||||
self.signal_change.emit(self.progress_value)
|
if self.progress_value != self.last_progress:
|
||||||
self.last_progress = self.progress_value
|
self.signal_change.emit(self.progress_value)
|
||||||
|
self.last_progress = self.progress_value
|
||||||
|
|
||||||
if not self.manual:
|
if not self.manual:
|
||||||
if self.progress_value >= self.limit:
|
if self.progress_value >= self.limit:
|
||||||
current_increment = -self.increment
|
current_increment = -self.increment
|
||||||
elif self.progress_value <= 0:
|
elif self.progress_value <= 0:
|
||||||
current_increment = self.increment
|
current_increment = self.increment
|
||||||
else:
|
|
||||||
if self.progress_value >= self.limit:
|
|
||||||
current_increment = 0
|
|
||||||
else:
|
else:
|
||||||
current_increment = self.increment
|
if self.progress_value >= self.limit:
|
||||||
|
current_increment = 0
|
||||||
|
else:
|
||||||
|
current_increment = self.increment
|
||||||
|
|
||||||
|
self.progress_value += current_increment
|
||||||
|
|
||||||
self.progress_value += current_increment
|
|
||||||
time.sleep(self.sleep)
|
time.sleep(self.sleep)
|
||||||
|
|
||||||
self.signal_change.emit(100)
|
self.signal_change.emit(100)
|
||||||
|
|||||||
@@ -308,16 +308,21 @@ class ManageWindow(QWidget):
|
|||||||
return action
|
return action
|
||||||
|
|
||||||
def _ask_confirmation(self, msg: dict):
|
def _ask_confirmation(self, msg: dict):
|
||||||
|
self.thread_animate_progress.pause()
|
||||||
diag = ConfirmationDialog(title=msg['title'],
|
diag = ConfirmationDialog(title=msg['title'],
|
||||||
body=msg['body'],
|
body=msg['body'],
|
||||||
locale_keys=self.i18n,
|
locale_keys=self.i18n,
|
||||||
components=msg['components'],
|
components=msg['components'],
|
||||||
confirmation_label=msg['confirmation_label'],
|
confirmation_label=msg['confirmation_label'],
|
||||||
deny_label=msg['deny_label'])
|
deny_label=msg['deny_label'])
|
||||||
self.signal_user_res.emit(diag.is_confirmed())
|
res = diag.is_confirmed()
|
||||||
|
self.thread_animate_progress.animate()
|
||||||
|
self.signal_user_res.emit(res)
|
||||||
|
|
||||||
def _show_message(self, msg: dict):
|
def _show_message(self, msg: dict):
|
||||||
|
self.thread_animate_progress.pause()
|
||||||
dialog.show_message(title=msg['title'], body=msg['body'], type_=msg['type'])
|
dialog.show_message(title=msg['title'], body=msg['body'], type_=msg['type'])
|
||||||
|
self.thread_animate_progress.animate()
|
||||||
|
|
||||||
def _show_warnings(self, warnings: List[str]):
|
def _show_warnings(self, warnings: List[str]):
|
||||||
if warnings:
|
if warnings:
|
||||||
|
|||||||
Reference in New Issue
Block a user