qt DialogMirror.py argument 1 has unexpected type 'float' while selecting best mirror

Bug #2046639 reported by Mike T
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
software-properties (Ubuntu)
New
Undecided
Unassigned

Bug Description

While selecting the best mirror in software-properties-qt, there's a traceback:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/softwareproperties/qt/DialogMirror.py", line 227, in on_report_progress
    self.dialog.setValue(frac*100)
TypeError: setValue(self, progress: int): argument 1 has unexpected type 'float'

I didn't investigate thoroughly, but it looks like maybe someone updated how progress was being updated but didn't check types or test all the way through before releasing. It can be fixed with a simple patch:

diff --git a/softwareproperties/qt/DialogMirror.py b/softwareproperties/qt/DialogMirror.py
index 972c4fb..4d1c150 100644
--- a/softwareproperties/qt/DialogMirror.py
+++ b/softwareproperties/qt/DialogMirror.py
@@ -223,7 +223,7 @@ class DialogMirror(QDialog):
   def on_report_progress(self, current, max, borders=(0,1), mod=(0,0)):
       #self.dialog.setLabelText(_("Completed %s of %s tests") % \
       # (current + mod[0], max + mod[1]))
- frac = borders[0] + (borders[1] - borders[0]) / max * current
+ frac = int(borders[0] + (borders[1] - borders[0]) / max * current)
       self.dialog.setValue(frac*100)

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 23.10
Release: 23.10
Codename: mantic

$ apt-cache policy pkgname software-properties-qt
software-properties-qt:
  Installed: 0.99.39
  Candidate: 0.99.39
  Version table:
 *** 0.99.39 500
        500 https://mirror.it.ubc.ca/ubuntu mantic/universe amd64 Packages
        100 /var/lib/dpkg/status
N: Unable to locate package pkgname

Tags: patch
Revision history for this message
Mike T (trustdarkness) wrote :
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "patch to cast float to int for progress dialog" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.