Skip to content

Commit

Permalink
Refactor REST API and GUI for download details
Browse files Browse the repository at this point in the history
- Remove 'total_upload', 'total_payload_upload', 'total_download', and 'total_payload_download' fields from the REST API response in `downloads_endpoint.py`
- Remove corresponding labels and values from the GUI in `mainwindow.ui` and `downloadsdetailstabwidget.py`

These changes simplify the code by removing unnecessary fields and labels related to upload and download totals.
  • Loading branch information
drew2a committed Jan 29, 2024
1 parent d3aa116 commit dbc502b
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -237,13 +237,8 @@ def get_files_info_json_paged(download: Download, view_start: Path, view_size: i
'eta': Integer,
'num_peers': Integer,
'num_seeds': Integer,
'total_upload': Integer,
'total_payload_upload': Integer,
'all_time_upload': Integer,
'total_payload_download': Integer,
'total_download': Integer,
'all_time_download': Integer,
'session_ratio': Float,
'all_time_ratio': Float,
'files': String,
'trackers': String,
Expand Down Expand Up @@ -332,13 +327,8 @@ async def get_downloads(self, request):
"num_seeds": num_seeds,
"num_connected_peers": num_connected_peers,
"num_connected_seeds": num_connected_seeds,
"total_upload": state.total_upload,
"total_payload_upload": state.total_payload_upload,
"all_time_upload": state.all_time_upload,
"total_download": state.total_download,
"total_payload_download": state.total_payload_download,
"all_time_download": state.all_time_download,
"session_ratio": state.get_session_ratio(),
"all_time_ratio": state.get_all_time_ratio(),
"trackers": tracker_info,
"hops": download.config.get_hops(),
Expand Down
34 changes: 0 additions & 34 deletions src/tribler/gui/qt_resources/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -3493,40 +3493,6 @@ margin-right: 10px;</string>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="session_ratio_label">
<property name="styleSheet">
<string notr="true">font-weight: bold;</string>
</property>
<property name="text">
<string>Session ratio</string>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QLabel" name="download_detail_session_ratio_label">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel" name="session_total">
<property name="styleSheet">
<string notr="true">font-weight: bold;</string>
</property>
<property name="text">
<string>Session total</string>
</property>
</widget>
</item>
<item row="10" column="1">
<widget class="QLabel" name="download_detail_session_total_label">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="11" column="0">
<widget class="QLabel" name="label_26">
<property name="styleSheet">
Expand Down
11 changes: 0 additions & 11 deletions src/tribler/gui/widgets/downloadsdetailstabwidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,23 +171,12 @@ def update_pages(self, new_download=False):
)
self.window().download_detail_infohash_label.setText(self.current_download['infohash'])
self.window().download_detail_destination_label.setText(self.current_download["destination"])
total_upload = format_size(self.current_download['total_upload'])
total_payload_upload = format_size(self.current_download['total_payload_upload'])
all_time_upload = format_size(self.current_download['all_time_upload'])
all_time_download = format_size(self.current_download['all_time_download'])
total_download = format_size(self.current_download['total_download'])
total_payload_download = format_size(self.current_download['total_payload_download'])
session_ratio = self.current_download['session_ratio']
all_time_ratio = self.current_download['all_time_ratio']
self.window().download_detail_ratio_label.setText(
f"{all_time_ratio:.3f}, upload: {all_time_upload}, download: {all_time_download}"
)
self.window().download_detail_session_ratio_label.setText(
f"{session_ratio:.3f}, upload: {total_payload_upload}, download: {total_payload_download}"
)
self.window().download_detail_session_total_label.setText(
f"Upload: {total_upload}, download: {total_download}"
)

self.window().download_detail_availability_label.setText(f"{self.current_download['availability']:.2f}")

Expand Down

0 comments on commit dbc502b

Please sign in to comment.