Skip to content

Commit

Permalink
MapGen: Show busy indicator instead of steps
Browse files Browse the repository at this point in the history
we are unable to predefine number of steps it will take
to generate a map
and seeing progress stuck at on of the first steps
when all the work is done in it is somewhat annoying

(using --debug option to display more information about progress
significantly (2x) slows down generation process, so we won't
use that)
  • Loading branch information
Gatsik committed Jul 1, 2024
1 parent 427bd9d commit 232c2fd
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/mapGenerator/mapgenProcess.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from PyQt6.QtCore import Qt
from PyQt6.QtWidgets import QApplication
from PyQt6.QtWidgets import QMessageBox
from PyQt6.QtWidgets import QProgressBar
from PyQt6.QtWidgets import QProgressDialog

import fafpath
Expand All @@ -30,8 +31,11 @@ def __init__(self, gen_path, out_path, args):
)
self._progress.setAutoReset(False)
self._progress.setModal(1)
self._progress.setMinimum(0)
self._progress.setMaximum(30)
bar = QProgressBar()
bar.setMinimum(0)
bar.setMaximum(0)
bar.setTextVisible(False)
self._progress.setBar(bar)
self._progress.canceled.connect(self.close)
self.progressCounter = 1

Expand Down Expand Up @@ -89,8 +93,6 @@ def on_log_ready(self):
# Kinda fake progress bar. Better than nothing :)
if len(line) > 4:
self._progress.setLabelText(line[:25] + "...")
self.progressCounter += 1
self._progress.setValue(self.progressCounter)

def on_error_ready(self) -> None:
self._error_msgs_received += 1
Expand Down

0 comments on commit 232c2fd

Please sign in to comment.