mirror of
https://github.com/onionshare/onionshare.git
synced 2024-12-28 16:59:35 -05:00
Make OnionShareGui use the proper web object
This commit is contained in:
parent
9e9f65572b
commit
ff55d7df75
@ -52,7 +52,6 @@ class OnionShareGui(QtWidgets.QMainWindow):
|
|||||||
self.local_only = local_only
|
self.local_only = local_only
|
||||||
|
|
||||||
self.mode = self.MODE_SHARE
|
self.mode = self.MODE_SHARE
|
||||||
self.web = None
|
|
||||||
|
|
||||||
self.setWindowTitle('OnionShare')
|
self.setWindowTitle('OnionShare')
|
||||||
self.setWindowIcon(QtGui.QIcon(self.common.get_resource_path('images/logo.png')))
|
self.setWindowIcon(QtGui.QIcon(self.common.get_resource_path('images/logo.png')))
|
||||||
@ -374,36 +373,40 @@ class OnionShareGui(QtWidgets.QMainWindow):
|
|||||||
|
|
||||||
self.share_mode.handle_tor_broke()
|
self.share_mode.handle_tor_broke()
|
||||||
|
|
||||||
# If we have a web object, process events from it
|
# Process events from the web object
|
||||||
if self.web:
|
if self.mode == self.MODE_SHARE:
|
||||||
events = []
|
web = self.share_mode.web
|
||||||
|
else:
|
||||||
|
web = self.receive_mode.web
|
||||||
|
|
||||||
done = False
|
events = []
|
||||||
while not done:
|
|
||||||
try:
|
|
||||||
r = self.web.q.get(False)
|
|
||||||
events.append(r)
|
|
||||||
except queue.Empty:
|
|
||||||
done = True
|
|
||||||
|
|
||||||
for event in events:
|
done = False
|
||||||
if event["type"] == Web.REQUEST_LOAD:
|
while not done:
|
||||||
self.share_mode.handle_request_load(event)
|
try:
|
||||||
|
r = web.q.get(False)
|
||||||
|
events.append(r)
|
||||||
|
except queue.Empty:
|
||||||
|
done = True
|
||||||
|
|
||||||
elif event["type"] == Web.REQUEST_DOWNLOAD:
|
for event in events:
|
||||||
self.share_mode.handle_request_download(event)
|
if event["type"] == Web.REQUEST_LOAD:
|
||||||
|
self.share_mode.handle_request_load(event)
|
||||||
|
|
||||||
elif event["type"] == Web.REQUEST_RATE_LIMIT:
|
elif event["type"] == Web.REQUEST_DOWNLOAD:
|
||||||
self.share_mode.handle_request_rate_limit(event)
|
self.share_mode.handle_request_download(event)
|
||||||
|
|
||||||
elif event["type"] == Web.REQUEST_PROGRESS:
|
elif event["type"] == Web.REQUEST_RATE_LIMIT:
|
||||||
self.share_mode.handle_request_progress(event)
|
self.share_mode.handle_request_rate_limit(event)
|
||||||
|
|
||||||
elif event["type"] == Web.REQUEST_CANCELED:
|
elif event["type"] == Web.REQUEST_PROGRESS:
|
||||||
self.share_mode.handle_request_canceled(event)
|
self.share_mode.handle_request_progress(event)
|
||||||
|
|
||||||
elif event["path"] != '/favicon.ico':
|
elif event["type"] == Web.REQUEST_CANCELED:
|
||||||
self.status_bar.showMessage('[#{0:d}] {1:s}: {2:s}'.format(self.web.error404_count, strings._('other_page_loaded', True), event["path"]))
|
self.share_mode.handle_request_canceled(event)
|
||||||
|
|
||||||
|
elif event["path"] != '/favicon.ico':
|
||||||
|
self.status_bar.showMessage('[#{0:d}] {1:s}: {2:s}'.format(web.error404_count, strings._('other_page_loaded', True), event["path"]))
|
||||||
|
|
||||||
if self.mode == self.MODE_SHARE:
|
if self.mode == self.MODE_SHARE:
|
||||||
self.share_mode.timer_callback()
|
self.share_mode.timer_callback()
|
||||||
|
Loading…
Reference in New Issue
Block a user