[GTKUI] Rearrange items in the UI tabs

* Move Private label to Trackers Tab.
 * Move Owner to Options Tab with a future plan for a dropdown box
   to change ownership.
 * Put the torrent status message into the progress bar.
 * Remove duplicate Shared label in Details Tab.
 * Details Tab allow more horizontal room for long folder paths
   and fix horizontal scrolling.
This commit is contained in:
Calum Lind 2016-10-27 22:18:52 +01:00
parent fef160e7a7
commit b5afe90764
6 changed files with 233 additions and 303 deletions

View File

@ -29,11 +29,6 @@ def fdate_or_dash(value):
return "-"
def str_yes_no(value):
"""Return Yes or No to bool value"""
return _("Yes") if value else _("No")
class DetailsTab(Tab):
def __init__(self):
Tab.__init__(self)
@ -51,12 +46,9 @@ class DetailsTab(Tab):
(builder.get_object("summary_num_files"), str, ("num_files",)),
(builder.get_object("summary_completed"), fdate_or_dash, ("completed_time",)),
(builder.get_object("summary_date_added"), fdate, ("time_added",)),
(builder.get_object("summary_private"), str_yes_no, ("private",)),
(builder.get_object("summary_torrent_path"), None, ("download_location",)),
(builder.get_object("summary_hash"), str, ("hash",)),
(builder.get_object("summary_comments"), str, ("comment",)),
(builder.get_object("summary_owner"), str, ("owner",)),
(builder.get_object("summary_shared"), str_yes_no, ("shared",)),
(builder.get_object("summary_pieces"), fpieces_num_size, ("num_pieces", "piece_length")),
]

View File

@ -60,7 +60,7 @@
<object class="GtkAlignment" id="alignment43">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="top_padding">5</property>
<property name="top_padding">10</property>
<property name="bottom_padding">2</property>
<property name="left_padding">10</property>
<property name="right_padding">10</property>
@ -69,54 +69,6 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">5</property>
<child>
<object class="GtkHBox" id="hbox3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkAlignment" id="alignment10">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="right_padding">5</property>
<child>
<object class="GtkLabel" id="label_status">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="ypad">1</property>
<property name="label" translatable="yes">Status:</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="summary_torrent_status">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="selectable">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkVBox" id="status_progress_vbox">
<property name="visible">True</property>
@ -129,8 +81,8 @@
<property name="pulse_step">0.10000000149</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
@ -141,7 +93,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
<property name="position">0</property>
</packing>
</child>
<child>
@ -330,21 +282,6 @@
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkAlignment" id="alignment4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="right_padding">5</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_last_seen_complete">
<property name="visible">True</property>
@ -660,11 +597,14 @@
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
<property name="position">1</property>
</packing>
</child>
</object>
@ -704,7 +644,7 @@
<property name="can_focus">False</property>
<property name="yalign">0</property>
<property name="yscale">0</property>
<property name="top_padding">5</property>
<property name="top_padding">10</property>
<property name="bottom_padding">2</property>
<property name="left_padding">10</property>
<property name="right_padding">15</property>
@ -712,7 +652,7 @@
<object class="GtkTable" id="table_details">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="n_rows">7</property>
<property name="n_rows">6</property>
<property name="n_columns">5</property>
<property name="column_spacing">10</property>
<property name="row_spacing">5</property>
@ -733,42 +673,6 @@
<property name="y_options">GTK_EXPAND</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_owner">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Owner:</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkLabel" id="summary_owner">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="wrap_mode">char</property>
<property name="selectable">True</property>
</object>
<packing>
<property name="left_attach">4</property>
<property name="right_attach">5</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_comments">
<property name="visible">True</property>
@ -780,8 +684,8 @@
</attributes>
</object>
<packing>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
@ -798,8 +702,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">5</property>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="y_options"></property>
</packing>
</child>
@ -811,8 +715,8 @@
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">6</property>
<property name="top_attach">2</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_SHRINK</property>
</packing>
</child>
@ -842,8 +746,8 @@
</attributes>
</object>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
@ -858,8 +762,9 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
@ -874,8 +779,8 @@
</attributes>
</object>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
@ -890,17 +795,18 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_private">
<object class="GtkLabel" id="label_completed">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Private:</property>
<property name="label" translatable="yes">Completed:</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
@ -915,12 +821,10 @@
</packing>
</child>
<child>
<object class="GtkLabel" id="summary_private">
<object class="GtkLabel" id="summary_completed">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="wrap_mode">char</property>
<property name="selectable">True</property>
</object>
<packing>
<property name="left_attach">4</property>
@ -932,28 +836,80 @@
</packing>
</child>
<child>
<object class="GtkLabel" id="label_hash">
<object class="GtkLabel" id="label_date_added">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Hash:</property>
<property name="label" translatable="yes">Added:</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_path">
<object class="GtkLabel" id="summary_date_added">
<property name="width_request">100</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Download Folder:</property>
</object>
<packing>
<property name="left_attach">4</property>
<property name="right_attach">5</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_SHRINK | GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_pieces">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Pieces:</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkLabel" id="summary_pieces">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">4</property>
<property name="right_attach">5</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_SHRINK | GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_hash">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Hash:</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
@ -973,13 +929,29 @@
<property name="wrap">True</property>
<property name="wrap_mode">char</property>
<property name="selectable">True</property>
<property name="ellipsize">end</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_path">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Download Folder:</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
@ -995,146 +967,9 @@
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_pieces">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Pieces:</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkLabel" id="summary_pieces">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_SHRINK | GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_completed">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Completed:</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkLabel" id="summary_completed">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">4</property>
<property name="right_attach">5</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_date_added">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Added:</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkLabel" id="summary_date_added">
<property name="width_request">100</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">4</property>
<property name="right_attach">5</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_SHRINK | GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_shared">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Shared:</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkLabel" id="summary_shared">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="wrap_mode">char</property>
<property name="selectable">True</property>
</object>
<packing>
<property name="left_attach">4</property>
<property name="right_attach">5</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
@ -1405,7 +1240,11 @@
<object class="GtkLabel" id="label13">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">KiB/s</property>
<property name="label" translatable="yes">K/s</property>
<property name="ellipsize">start</property>
<attributes>
<attribute name="scale" value="0.90000000000000002"/>
</attributes>
</object>
<packing>
<property name="left_attach">2</property>
@ -1418,7 +1257,10 @@
<object class="GtkLabel" id="label14">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">KiB/s</property>
<property name="label" translatable="yes">K/s</property>
<attributes>
<attribute name="scale" value="0.90000000000000002"/>
</attributes>
</object>
<packing>
<property name="left_attach">2</property>
@ -1503,6 +1345,48 @@
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkLabel" id="label_owner">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Owner:</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="summary_owner">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="wrap_mode">char</property>
<property name="selectable">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">10</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="chk_shared">
<property name="label" translatable="yes">Shared</property>
@ -1516,7 +1400,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
<property name="position">1</property>
</packing>
</child>
<child>
@ -1532,7 +1416,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
<property name="position">2</property>
</packing>
</child>
<child>
@ -1548,7 +1432,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
<property name="position">3</property>
</packing>
</child>
<child>
@ -1564,7 +1448,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">3</property>
<property name="position">4</property>
</packing>
</child>
<child>
@ -1578,7 +1462,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
<property name="position">5</property>
</packing>
</child>
</object>
@ -1776,7 +1660,7 @@
<object class="GtkTable" id="table2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="n_rows">5</property>
<property name="n_rows">6</property>
<property name="n_columns">2</property>
<property name="column_spacing">10</property>
<property name="row_spacing">5</property>
@ -1908,8 +1792,8 @@
</object>
<packing>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
@ -1942,6 +1826,40 @@
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_private">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Private Torrent:</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkLabel" id="summary_private">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="wrap_mode">char</property>
<property name="selectable">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
</object>
</child>
</object>

View File

@ -38,6 +38,7 @@ class OptionsTab(Tab):
self.entry_move_completed = builder.get_object("entry_move_completed")
self.chk_shared = builder.get_object("chk_shared")
self.button_apply = builder.get_object("button_apply")
self.summary_owner = builder.get_object("summary_owner")
self.move_completed_hbox = builder.get_object("hbox_move_completed_path_chooser")
self.move_completed_path_chooser = PathChooser("move_completed_paths_list")
@ -55,7 +56,8 @@ class OptionsTab(Tab):
"on_chk_stop_at_ratio_toggled": self._on_chk_stop_at_ratio_toggled,
"on_chk_toggled": self._on_chk_toggled,
"on_spin_value_changed": self._on_spin_value_changed,
"on_move_completed_file_set": self._on_move_completed_file_set
"on_move_completed_file_set": self._on_move_completed_file_set,
"on_button_owner_clicked": self._on_button_owner_clicked,
})
self.spin_max_download.connect("key-press-event", self._on_key_press_event)
@ -100,7 +102,8 @@ class OptionsTab(Tab):
"sequential_download",
"move_on_completed",
"move_on_completed_path",
"shared"
"shared",
"owner"
]).addCallback(self._on_get_torrent_status)
self.prev_torrent_id = torrent_id
@ -142,6 +145,8 @@ class OptionsTab(Tab):
cursor_end=False, default_text=True)
if status["shared"] != self.prev_status["shared"]:
self.chk_shared.set_active(status["shared"])
if status["owner"] != self.prev_status["owner"]:
self.summary_owner.set_text(status["owner"])
if status["storage_mode"] == "compact":
self.chk_prioritize_first_last.set_sensitive(False)
@ -241,3 +246,7 @@ class OptionsTab(Tab):
def _on_path_chooser_text_changed_event(self, widget, path):
self.button_apply.set_sensitive(True)
def _on_button_owner_clicked(self, button):
pass

View File

@ -17,6 +17,7 @@ import pango
import pangocairo
from cairo import FORMAT_ARGB32, Context, ImageSurface
import deluge.ui.gtkui.status_tab
from deluge.configmanager import ConfigManager
log = logging.getLogger(__name__)
@ -46,6 +47,7 @@ class PiecesBar(gtk.DrawingArea):
self.__pieces = self.__old_pieces = ()
self.__num_pieces = self.__old_num_pieces = None
self.__text = self.__old_text = ""
self.__message = self.__old_message = ""
self.__fraction = self.__old_fraction = 0.0
self.__state = self.__old_state = None
self.__progress_overlay = self.__text_overlay = self.__pieces_overlay = None
@ -165,17 +167,11 @@ class PiecesBar(gtk.DrawingArea):
pl.set_font_description(self.__text_font)
pl.set_width(-1) # No text wrapping
text = ""
if self.__text:
text += self.__text
text = self.__text
else:
if self.__state:
text += _(self.__state) + " "
if self.__fraction == 1.0:
fraction_format = "%d%%"
else:
fraction_format = "%.2f%%"
text += fraction_format % (self.__fraction * 100)
text = deluge.ui.gtkui.status_tab.fpcnt(self.__fraction, self.__state, self.__message)
log.trace("PiecesBar text %r", text)
pl.set_text(text)
plsize = pl.get_size()
@ -208,6 +204,13 @@ class PiecesBar(gtk.DrawingArea):
self.__old_text = self.__text
self.__text = text
def get_status_message(self):
return self.__text
def set_status_message(self, message):
self.__old_message = self.__message
self.__message = message
def set_pieces(self, pieces, num_pieces):
self.__old_pieces = self.__pieces
self.__pieces = pieces
@ -234,6 +237,7 @@ class PiecesBar(gtk.DrawingArea):
return
self.set_pieces(status['pieces'], status['num_pieces'])
self.set_status_message(status['message'])
self.update()
def clear(self):

View File

@ -28,10 +28,12 @@ def fratio(value):
return ("%.3f" % value).rstrip('0').rstrip('.') if value > 0 else ""
def fpcnt(value, state):
def fpcnt(value, state, message):
textstr = _(state)
if state not in ("Error", "Seeding") and value < 100:
textstr = ('%s %.2f' % (textstr, value)).rstrip('0').rstrip('.') + '%'
elif state == "Error":
textstr = _("%s: %s") % (textstr, message)
return textstr
@ -100,11 +102,10 @@ class StatusTab(Tab):
(builder.get_object("summary_active_time"), ftime_or_dash, ("active_time",)),
(builder.get_object("summary_seed_time"), ftime_or_dash, ("seeding_time",)),
(builder.get_object("summary_seed_rank"), fseed_rank_or_dash, ("seed_rank", "seeding_time")),
(builder.get_object("progressbar"), fpcnt, ("progress", "state")),
(builder.get_object("progressbar"), fpcnt, ("progress", "state", "message")),
(builder.get_object("summary_last_seen_complete"), fdate_or_never, ("last_seen_complete",)),
(builder.get_object("summary_last_active"), flast_active, ("time_since_download",
"time_since_upload")),
(builder.get_object("summary_torrent_status"), str, ("message",)),
]
self.status_keys = [status for widget in self.label_widgets for status in widget[2]]

View File

@ -26,6 +26,11 @@ def ftranslate(text):
return text
def str_yes_no(value):
"""Return Yes or No to bool value"""
return _("Yes") if value else _("No")
class TrackersTab(Tab):
def __init__(self):
Tab.__init__(self)
@ -42,6 +47,7 @@ class TrackersTab(Tab):
(builder.get_object("summary_tracker"), None, ("tracker_host",)),
(builder.get_object("summary_tracker_status"), ftranslate, ("tracker_status",)),
(builder.get_object("summary_tracker_total"), fcount, ("trackers",)),
(builder.get_object("summary_private"), str_yes_no, ("private",)),
]
self.status_keys = [status for widget in self.label_widgets for status in widget[2]]