mirror of
https://github.com/onionshare/onionshare.git
synced 2024-10-01 01:35:40 -04:00
Make ReceiveMode start using Uploads
This commit is contained in:
parent
a0db6d0ee7
commit
23821ebae6
@ -87,15 +87,6 @@ class ReceiveMode(Mode):
|
|||||||
self.layout.insertWidget(0, self.receive_info)
|
self.layout.insertWidget(0, self.receive_info)
|
||||||
self.layout.insertWidget(0, self.info_widget)
|
self.layout.insertWidget(0, self.info_widget)
|
||||||
|
|
||||||
def timer_callback_custom(self):
|
|
||||||
"""
|
|
||||||
This method is called regularly on a timer while share mode is active.
|
|
||||||
"""
|
|
||||||
# Scroll to the bottom of the download progress bar log pane if a new download has been added
|
|
||||||
#if self.new_download:
|
|
||||||
# self.downloads.downloads_container.vbar.setValue(self.downloads.downloads_container.vbar.maximum())
|
|
||||||
# self.new_download = False
|
|
||||||
|
|
||||||
def get_stop_server_shutdown_timeout_text(self):
|
def get_stop_server_shutdown_timeout_text(self):
|
||||||
"""
|
"""
|
||||||
Return the string to put on the stop server button, if there's a shutdown timeout
|
Return the string to put on the stop server button, if there's a shutdown timeout
|
||||||
@ -116,9 +107,8 @@ class ReceiveMode(Mode):
|
|||||||
# Reset web counters
|
# Reset web counters
|
||||||
self.web.error404_count = 0
|
self.web.error404_count = 0
|
||||||
|
|
||||||
# Hide and reset the downloads if we have previously shared
|
# Hide and reset the uploads if we have previously shared
|
||||||
#self.downloads.reset_downloads()
|
self.reset_info_counters()
|
||||||
#self.reset_info_counters()
|
|
||||||
|
|
||||||
def start_server_step2_custom(self):
|
def start_server_step2_custom(self):
|
||||||
"""
|
"""
|
||||||
@ -141,6 +131,17 @@ class ReceiveMode(Mode):
|
|||||||
self.stop_server()
|
self.stop_server()
|
||||||
self.system_tray.showMessage(strings._('systray_close_server_title', True), strings._('systray_close_server_message', True))
|
self.system_tray.showMessage(strings._('systray_close_server_title', True), strings._('systray_close_server_message', True))
|
||||||
|
|
||||||
|
def reset_info_counters(self):
|
||||||
|
"""
|
||||||
|
Set the info counters back to zero.
|
||||||
|
"""
|
||||||
|
self.uploads_completed = 0
|
||||||
|
self.uploads_in_progress = 0
|
||||||
|
self.update_uploads_completed()
|
||||||
|
self.update_uploads_in_progress()
|
||||||
|
self.info_show_uploads.setIcon(QtGui.QIcon(self.common.get_resource_path('images/upload_window_gray.png')))
|
||||||
|
self.uploads.reset()
|
||||||
|
|
||||||
def update_uploads_completed(self):
|
def update_uploads_completed(self):
|
||||||
"""
|
"""
|
||||||
Update the 'Downloads completed' info widget.
|
Update the 'Downloads completed' info widget.
|
||||||
|
@ -21,6 +21,7 @@ from PyQt5 import QtCore, QtWidgets, QtGui
|
|||||||
|
|
||||||
from onionshare import strings
|
from onionshare import strings
|
||||||
|
|
||||||
|
|
||||||
class Uploads(QtWidgets.QScrollArea):
|
class Uploads(QtWidgets.QScrollArea):
|
||||||
"""
|
"""
|
||||||
The uploads chunk of the GUI. This lists all of the active upload
|
The uploads chunk of the GUI. This lists all of the active upload
|
||||||
@ -55,3 +56,9 @@ class Uploads(QtWidgets.QScrollArea):
|
|||||||
layout.addStretch()
|
layout.addStretch()
|
||||||
widget.setLayout(layout)
|
widget.setLayout(layout)
|
||||||
self.setWidget(widget)
|
self.setWidget(widget)
|
||||||
|
|
||||||
|
def reset(self):
|
||||||
|
"""
|
||||||
|
Reset the uploads back to zero
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
@ -23,7 +23,6 @@ from PyQt5 import QtCore, QtWidgets, QtGui
|
|||||||
from onionshare import strings
|
from onionshare import strings
|
||||||
|
|
||||||
class Download(object):
|
class Download(object):
|
||||||
|
|
||||||
def __init__(self, common, download_id, total_bytes):
|
def __init__(self, common, download_id, total_bytes):
|
||||||
self.common = common
|
self.common = common
|
||||||
|
|
||||||
@ -33,7 +32,14 @@ class Download(object):
|
|||||||
self.downloaded_bytes = 0
|
self.downloaded_bytes = 0
|
||||||
|
|
||||||
# make a new progress bar
|
# make a new progress bar
|
||||||
cssStyleData ="""
|
self.progress_bar = QtWidgets.QProgressBar()
|
||||||
|
self.progress_bar.setTextVisible(True)
|
||||||
|
self.progress_bar.setAttribute(QtCore.Qt.WA_DeleteOnClose)
|
||||||
|
self.progress_bar.setAlignment(QtCore.Qt.AlignHCenter)
|
||||||
|
self.progress_bar.setMinimum(0)
|
||||||
|
self.progress_bar.setMaximum(total_bytes)
|
||||||
|
self.progress_bar.setValue(0)
|
||||||
|
self.progress_bar.setStyleSheet("""
|
||||||
QProgressBar {
|
QProgressBar {
|
||||||
border: 1px solid #4e064f;
|
border: 1px solid #4e064f;
|
||||||
background-color: #ffffff !important;
|
background-color: #ffffff !important;
|
||||||
@ -45,15 +51,7 @@ class Download(object):
|
|||||||
QProgressBar::chunk {
|
QProgressBar::chunk {
|
||||||
background-color: #4e064f;
|
background-color: #4e064f;
|
||||||
width: 10px;
|
width: 10px;
|
||||||
}"""
|
}""")
|
||||||
self.progress_bar = QtWidgets.QProgressBar()
|
|
||||||
self.progress_bar.setTextVisible(True)
|
|
||||||
self.progress_bar.setAttribute(QtCore.Qt.WA_DeleteOnClose)
|
|
||||||
self.progress_bar.setAlignment(QtCore.Qt.AlignHCenter)
|
|
||||||
self.progress_bar.setMinimum(0)
|
|
||||||
self.progress_bar.setMaximum(total_bytes)
|
|
||||||
self.progress_bar.setValue(0)
|
|
||||||
self.progress_bar.setStyleSheet(cssStyleData)
|
|
||||||
self.progress_bar.total_bytes = total_bytes
|
self.progress_bar.total_bytes = total_bytes
|
||||||
|
|
||||||
# start at 0
|
# start at 0
|
||||||
|
Loading…
Reference in New Issue
Block a user