mirror of
https://github.com/codex-storage/deluge.git
synced 2025-02-26 10:05:19 +00:00
PiecesBar
Now, either show the pieces bar or the progress bar, not both.
This commit is contained in:
parent
28def22625
commit
b3492b07a1
@ -74,6 +74,7 @@ class StatusTab(Tab):
|
||||
# Get the labels we need to update.
|
||||
# widgetname, modifier function, status keys
|
||||
self.glade = glade = component.get("MainWindow").main_glade
|
||||
self.progressbar = component.get("MainWindow").main_glade.get_widget("progressbar")
|
||||
|
||||
self._name = "Status"
|
||||
self._child_widget = glade.get_widget("status_tab")
|
||||
@ -161,12 +162,12 @@ class StatusTab(Tab):
|
||||
widget[0].set_text(txt)
|
||||
|
||||
# Do the progress bar because it's a special case (not a label)
|
||||
w = component.get("MainWindow").main_glade.get_widget("progressbar")
|
||||
fraction = status["progress"] / 100
|
||||
if w.get_fraction() != fraction:
|
||||
w.set_fraction(fraction)
|
||||
if self.config['show_piecesbar']:
|
||||
self.piecesbar.update_from_status(status)
|
||||
else:
|
||||
fraction = status["progress"] / 100
|
||||
if self.progressbar.get_fraction() != fraction:
|
||||
self.progressbar.set_fraction(fraction)
|
||||
|
||||
def on_show_pieces_bar_config_changed(self, key, show):
|
||||
self.show_pieces_bar(show)
|
||||
@ -175,19 +176,23 @@ class StatusTab(Tab):
|
||||
if hasattr(self, 'piecesbar'):
|
||||
if show:
|
||||
self.piecesbar.show()
|
||||
self.progressbar.hide()
|
||||
else:
|
||||
self.piecesbar.hide()
|
||||
self.progressbar.show()
|
||||
else:
|
||||
if show:
|
||||
self.piecesbar = PiecesBar()
|
||||
self.glade.get_widget("status_progress_vbox").pack_start(
|
||||
self.piecesbar, False, False, 5
|
||||
)
|
||||
self.progressbar.hide()
|
||||
|
||||
def clear(self):
|
||||
for widget in self.label_widgets:
|
||||
widget[0].set_text("")
|
||||
|
||||
component.get("MainWindow").main_glade.get_widget("progressbar").set_fraction(0.0)
|
||||
if self.config['show_piecesbar']:
|
||||
self.piecesbar.clear()
|
||||
else:
|
||||
self.progressbar.set_fraction(0.0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user