mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-03 06:58:42 +00:00
PiecesBar
Now, either show the pieces bar or the progress bar, not both.
This commit is contained in:
parent
28def22625
commit
b3492b07a1
1 changed files with 10 additions and 5 deletions
|
@ -74,6 +74,7 @@ class StatusTab(Tab):
|
||||||
# Get the labels we need to update.
|
# Get the labels we need to update.
|
||||||
# widgetname, modifier function, status keys
|
# widgetname, modifier function, status keys
|
||||||
self.glade = glade = component.get("MainWindow").main_glade
|
self.glade = glade = component.get("MainWindow").main_glade
|
||||||
|
self.progressbar = component.get("MainWindow").main_glade.get_widget("progressbar")
|
||||||
|
|
||||||
self._name = "Status"
|
self._name = "Status"
|
||||||
self._child_widget = glade.get_widget("status_tab")
|
self._child_widget = glade.get_widget("status_tab")
|
||||||
|
@ -161,12 +162,12 @@ class StatusTab(Tab):
|
||||||
widget[0].set_text(txt)
|
widget[0].set_text(txt)
|
||||||
|
|
||||||
# Do the progress bar because it's a special case (not a label)
|
# 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']:
|
if self.config['show_piecesbar']:
|
||||||
self.piecesbar.update_from_status(status)
|
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):
|
def on_show_pieces_bar_config_changed(self, key, show):
|
||||||
self.show_pieces_bar(show)
|
self.show_pieces_bar(show)
|
||||||
|
@ -175,19 +176,23 @@ class StatusTab(Tab):
|
||||||
if hasattr(self, 'piecesbar'):
|
if hasattr(self, 'piecesbar'):
|
||||||
if show:
|
if show:
|
||||||
self.piecesbar.show()
|
self.piecesbar.show()
|
||||||
|
self.progressbar.hide()
|
||||||
else:
|
else:
|
||||||
self.piecesbar.hide()
|
self.piecesbar.hide()
|
||||||
|
self.progressbar.show()
|
||||||
else:
|
else:
|
||||||
if show:
|
if show:
|
||||||
self.piecesbar = PiecesBar()
|
self.piecesbar = PiecesBar()
|
||||||
self.glade.get_widget("status_progress_vbox").pack_start(
|
self.glade.get_widget("status_progress_vbox").pack_start(
|
||||||
self.piecesbar, False, False, 5
|
self.piecesbar, False, False, 5
|
||||||
)
|
)
|
||||||
|
self.progressbar.hide()
|
||||||
|
|
||||||
def clear(self):
|
def clear(self):
|
||||||
for widget in self.label_widgets:
|
for widget in self.label_widgets:
|
||||||
widget[0].set_text("")
|
widget[0].set_text("")
|
||||||
|
|
||||||
component.get("MainWindow").main_glade.get_widget("progressbar").set_fraction(0.0)
|
|
||||||
if self.config['show_piecesbar']:
|
if self.config['show_piecesbar']:
|
||||||
self.piecesbar.clear()
|
self.piecesbar.clear()
|
||||||
|
else:
|
||||||
|
self.progressbar.set_fraction(0.0)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue