mirror of
https://github.com/onionshare/onionshare.git
synced 2025-07-28 00:55:40 -04:00
Fix UpdateChecker and UpdateThread to work with refactor, now it pops up an update reminder
This commit is contained in:
parent
26ef0863dc
commit
f72d5872f7
3 changed files with 43 additions and 22 deletions
|
@ -17,7 +17,7 @@ GNU General Public License for more details.
|
|||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""
|
||||
import os, platform, threading, time
|
||||
import os, threading, time
|
||||
from PyQt5 import QtCore, QtWidgets, QtGui
|
||||
|
||||
from onionshare import strings, common, web
|
||||
|
@ -59,17 +59,6 @@ class OnionShareGui(QtWidgets.QMainWindow):
|
|||
self.settings = Settings()
|
||||
self.settings.load()
|
||||
|
||||
# Check for updates in a new thread, if enabled
|
||||
system = platform.system()
|
||||
if system == 'Windows' or system == 'Darwin':
|
||||
if self.settings.get('use_autoupdate'):
|
||||
def update_available(update_url, installed_version, latest_version):
|
||||
Alert(strings._("update_available", True).format(update_url, installed_version, latest_version))
|
||||
|
||||
t = UpdateThread(self.onion)
|
||||
t.update_available.connect(update_available)
|
||||
t.start()
|
||||
|
||||
# File selection
|
||||
self.file_selection = FileSelection()
|
||||
if filenames:
|
||||
|
@ -151,6 +140,9 @@ class OnionShareGui(QtWidgets.QMainWindow):
|
|||
tor_con.open_settings.connect(self._tor_connection_open_settings)
|
||||
tor_con.start()
|
||||
|
||||
# After connecting to Tor, check for updates
|
||||
self.check_for_updates()
|
||||
|
||||
def _tor_connection_canceled(self):
|
||||
"""
|
||||
If the user cancels before Tor finishes connecting, ask if they want to
|
||||
|
@ -312,6 +304,20 @@ class OnionShareGui(QtWidgets.QMainWindow):
|
|||
|
||||
self.set_server_active(False)
|
||||
|
||||
def check_for_updates(self):
|
||||
"""
|
||||
Check for updates in a new thread, if enabled.
|
||||
"""
|
||||
system = common.get_platform()
|
||||
if system == 'Windows' or system == 'Darwin':
|
||||
if self.settings.get('use_autoupdate'):
|
||||
def update_available(update_url, installed_version, latest_version):
|
||||
Alert(strings._("update_available", True).format(update_url, installed_version, latest_version))
|
||||
|
||||
self.update_thread = UpdateThread(self.onion)
|
||||
self.update_thread.update_available.connect(update_available)
|
||||
self.update_thread.start()
|
||||
|
||||
@staticmethod
|
||||
def _compute_total_size(filenames):
|
||||
total_size = 0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue