added check for unsupported browsers
This commit is contained in:
parent
9bbee13d4a
commit
22a059978d
2 changed files with 28 additions and 15 deletions
|
@ -50,7 +50,7 @@ profile_observer = ProfileObserver()
|
|||
|
||||
class WorkerThread(QThread):
|
||||
text_output = pyqtSignal(str)
|
||||
sync_output = pyqtSignal(list, list, bool, bool, list, bool)
|
||||
sync_output = pyqtSignal(list, list, bool, bool, list, list)
|
||||
invoice_output = pyqtSignal(object, str)
|
||||
invoice_finished = pyqtSignal(bool)
|
||||
profiles_output = pyqtSignal(dict)
|
||||
|
@ -235,10 +235,10 @@ class WorkerThread(QThread):
|
|||
browser = ApplicationVersionController.get_all()
|
||||
all_browser_versions = [f"{browser.application_code}:{browser.version_number}" for browser in browser if browser.supported]
|
||||
all_location_codes = [f"{location.country_code}_{location.code}" for location in locations]
|
||||
self.sync_output.emit(all_location_codes, all_browser_versions, True, False, locations, False)
|
||||
self.sync_output.emit(all_location_codes, all_browser_versions, True, False, locations, browser)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
self.sync_output.emit([], False, False, [], False)
|
||||
self.sync_output.emit([], [], False, False, [], [])
|
||||
|
||||
|
||||
|
||||
|
@ -456,10 +456,10 @@ class CustomWindow(QMainWindow):
|
|||
menu_page = self.page_stack.findChild(MenuPage)
|
||||
menu_page.on_update_check_finished()
|
||||
|
||||
def update_values(self, available_locations, available_browsers, status, is_tor, locations, is_os_error):
|
||||
def update_values(self, available_locations, available_browsers, status, is_tor, locations, all_browsers):
|
||||
sync_screen = self.page_stack.findChild(SyncScreen)
|
||||
if sync_screen:
|
||||
sync_screen.update_after_sync(available_locations, available_browsers, locations)
|
||||
sync_screen.update_after_sync(available_locations, available_browsers, locations, all_browsers)
|
||||
|
||||
|
||||
|
||||
|
@ -1383,14 +1383,19 @@ class MenuPage(Page):
|
|||
else:
|
||||
new_profile['connection'] = 'just proxy'
|
||||
|
||||
|
||||
|
||||
browser = profile.application_version.application_code if hasattr(profile, 'application_version') else 'unknown'
|
||||
if isinstance(profile, SessionProfile):
|
||||
browser = profile.application_version.application_code
|
||||
else:
|
||||
browser = 'unknown'
|
||||
if browser != 'unknown':
|
||||
new_profile['browser'] = browser
|
||||
new_profile['browser_version'] = profile.application_version.version_number
|
||||
new_profile['browser_supported'] = profile.application_version.supported
|
||||
else:
|
||||
new_profile['browser'] = 'unknown browser'
|
||||
new_profile['browser_supported'] = False
|
||||
|
||||
|
||||
|
||||
resolution = profile.resolution if hasattr(profile, 'resolution') else 'None'
|
||||
new_profile['dimentions'] = resolution
|
||||
|
@ -1625,12 +1630,15 @@ class MenuPage(Page):
|
|||
# Crear QLabel con la imagen os.path.join(self.btn_path, "browser only.png") detrás del label_principal
|
||||
label_background = QLabel(self)
|
||||
label_background.setGeometry(0, 60, 410, 354) # Geometría según necesidades
|
||||
pixmap = QPixmap(os.path.join(self.btn_path, "browser only.png"))
|
||||
is_supported = profile.get('browser_supported', False)
|
||||
image_name = "browser only.png" if is_supported else "unsupported_browser_only.png"
|
||||
pixmap = QPixmap(os.path.join(self.btn_path, image_name))
|
||||
label_background.setPixmap(pixmap)
|
||||
label_background.show()
|
||||
label_background.setScaledContents(True)
|
||||
label_background.lower()
|
||||
self.additional_labels.append(label_background)
|
||||
|
||||
if protocol.lower() == "residential" and connection.lower() == "tor":
|
||||
|
||||
label_background = QLabel(self)
|
||||
|
@ -1984,13 +1992,14 @@ class ConnectionManager:
|
|||
def store_locations(self, locations):
|
||||
self._location_list = locations
|
||||
|
||||
|
||||
def store_browsers(self, browsers):
|
||||
self._browser_list = browsers
|
||||
|
||||
def get_browser_list(self):
|
||||
return self._browser_list
|
||||
|
||||
|
||||
|
||||
def get_location_list(self):
|
||||
if self.is_synced():
|
||||
location_names = [f'{location.country_code}_{location.code}' for location in self._location_list]
|
||||
|
@ -3521,7 +3530,8 @@ class ResumePage(Page):
|
|||
main_label.show()
|
||||
self.labels_creados.append(main_label)
|
||||
if profile_1.get("connection", "") == "browser-only":
|
||||
image_path = os.path.join(self.btn_path, "browser only.png")
|
||||
image_name = "browser only.png"
|
||||
image_path = os.path.join(self.btn_path, image_name)
|
||||
label_background = QLabel(self)
|
||||
label_background.setGeometry(10, 50, 535, 460)
|
||||
label_background.setPixmap(QPixmap(image_path))
|
||||
|
@ -3854,6 +3864,9 @@ class EditorPage(Page):
|
|||
self.display.setPixmap(QPixmap(os.path.join(self.btn_path, f"wireguard_{location}.png")))
|
||||
self.garaje.hide()
|
||||
if connection == "browser-only":
|
||||
is_supported = data_profile.get('browser_supported', False)
|
||||
image_name = "browser only.png" if is_supported else "unsupported_browser_only.png"
|
||||
self.brow_disp.setPixmap(QPixmap(os.path.join(self.btn_path, image_name)))
|
||||
self.brow_disp.show()
|
||||
else:
|
||||
self.brow_disp.hide()
|
||||
|
@ -5432,8 +5445,8 @@ class SyncScreen(Page):
|
|||
self.worker_thread.sync_output.connect(self.update_output)
|
||||
self.worker_thread.start()
|
||||
|
||||
def update_output(self, available_locations, available_browsers, status, is_tor, locations, is_os_error):
|
||||
if is_os_error:
|
||||
def update_output(self, available_locations, available_browsers, status, is_tor, locations, all_browsers):
|
||||
if isinstance(all_browsers, bool) and not all_browsers:
|
||||
install_page = self.page_stack.findChild(InstallSystemPackage)
|
||||
install_page.configure(package_name='tor', distro='debian', is_sync=True)
|
||||
self.page_stack.setCurrentIndex(self.page_stack.indexOf(install_page))
|
||||
|
@ -5457,11 +5470,11 @@ class SyncScreen(Page):
|
|||
menu_page.on_update_check_finished()
|
||||
|
||||
|
||||
self.update_after_sync(available_locations, available_browsers, locations)
|
||||
self.update_after_sync(available_locations, available_browsers, locations, all_browsers)
|
||||
|
||||
self.page_stack.setCurrentIndex(self.page_stack.indexOf(self.page_stack.findChild(ProtocolPage)))
|
||||
|
||||
def update_after_sync(self, available_locations, available_browsers, locations):
|
||||
def update_after_sync(self, available_locations, available_browsers, locations, all_browsers=None):
|
||||
|
||||
self.connection_manager.set_synced(True)
|
||||
|
||||
|
|
BIN
gui/resources/images/unsupported_browser_only.png
Normal file
BIN
gui/resources/images/unsupported_browser_only.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 25 KiB |
Loading…
Reference in a new issue