Commit 229ae055 authored by Danial Behzadi's avatar Danial Behzadi
Browse files

fix progressbar

parent b264b372
...@@ -96,9 +96,10 @@ class StartButton(ToolButton): ...@@ -96,9 +96,10 @@ class StartButton(ToolButton):
def set_progress (self, stdout, condition): def set_progress (self, stdout, condition):
line = stdout.readline().decode("utf-8") line = stdout.readline().decode("utf-8")
if '%' in line: if '%' in line:
percentage = line.split()[5][:-1]
header_bar = self.get_parent() header_bar = self.get_parent()
progress_button = header_bar.get_children()[-1] progress_button = header_bar.get_children()[-1]
progress_button.set_progress(line.split()[5][:-2]) progress_button.set_progress(percentage)
return True return True
def on_start_clicked(self, button): def on_start_clicked(self, button):
...@@ -146,9 +147,11 @@ class ProgressBar(Gtk.ProgressBar): ...@@ -146,9 +147,11 @@ class ProgressBar(Gtk.ProgressBar):
Gtk.ProgressBar.__init__(self) Gtk.ProgressBar.__init__(self)
def set_progress(self, percentage): def set_progress(self, percentage):
if isinstance(percentage, int): try:
fraction = float(percentage) / 100 fraction = float(percentage) / 100
self.set_fraction(fraction) self.set_fraction(fraction)
except:
pass
class StopButton(Gtk.Button): class StopButton(Gtk.Button):
def __init__(self): def __init__(self):
......
carburetor (2.9-1) bionic; urgency=medium
* fix the bug in setting progress button (This time for real)
-- Danial Behzadi <dani.behzi@ubuntu.com> Fri, 08 Nov 2019 16:30:00 +0330
carburetor (2.8-1) bionic; urgency=medium carburetor (2.8-1) bionic; urgency=medium
* use internal gi notification * use internal gi notification
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment