Updated payment page / hidetor graphics / minor error fixes

This commit is contained in:
Your Name 2025-05-05 00:53:01 +01:00
parent 22245d7542
commit 9b3b824dce

View file

@ -298,14 +298,18 @@ class CustomWindow(QMainWindow):
Qt.WindowType.Window
)
font_id = QFontDatabase.addApplicationFont('gui/resources/fonts/retro-gaming.ttf')
current_dir = os.path.dirname(os.path.abspath(__file__))
font_path = os.path.join(current_dir, 'resources', 'fonts')
retro_gaming_path = os.path.join(font_path, 'retro-gaming.ttf')
font_id = QFontDatabase.addApplicationFont(retro_gaming_path)
font_family = QFontDatabase.applicationFontFamilies(font_id)[0]
app_font = QFont(font_family)
app_font.setPointSize(10)
QApplication.setFont(app_font)
self.open_sans_family = None
open_sans_path = 'gui/resources/fonts/open-sans.ttf'
open_sans_path = os.path.join(font_path, 'open-sans.ttf')
if os.path.exists(open_sans_path):
open_sans_id = QFontDatabase.addApplicationFont(open_sans_path)
if open_sans_id != -1:
@ -1293,10 +1297,8 @@ class MenuPage(Page):
if protocol == 'wireguard':
new_profile['protocol'] = 'wireguard'
elif location in self.connection_manager.get_non_residential_proxy_list():
new_profile['protocol'] = 'hidetor'
else:
new_profile['protocol'] = 'residential'
new_profile['protocol'] = 'hidetor'
connection_type = 'browser-only' if isinstance(profile, SessionProfile) else 'system-wide'
@ -1441,7 +1443,7 @@ class MenuPage(Page):
def get_icon_path(self, label_name, value, connection_type):
if label_name == 'protocol':
if connection_type == 'tor':
return os.path.join(self.btn_path, "toricon_mini.png") if value['location'] in self.connection_manager.get_non_residential_proxy_list() else os.path.join(self.btn_path, "residential tor_mini.png")
return os.path.join(self.btn_path, "toricon_mini.png")
elif connection_type == 'just proxy':
return os.path.join(self.btn_path, "just proxy_mini.png")
@ -1874,8 +1876,6 @@ class ConnectionManager:
'ch': 'Europe/Zurich'
}
self._location_list = []
self.wireguard_locations = ['Moldova', 'The Netherlands', 'US (Ohio)', 'US (Seattle)', 'Iceland', 'Malaysia']
self.non_resident_proxy_locations = ['Moldova', 'The Netherlands', 'US (Ohio)', 'US (Seattle)', 'Iceland']
def get_profile_button_objects(self, profile_id):
return self.profile_button_objects.get(profile_id, None)
@ -1921,13 +1921,12 @@ class ConnectionManager:
def get_location_list(self):
if self.is_synced():
location_names = [location.country_name for location in self._location_list]
location_names = [f'{location.country_code}_{location.code}' for location in self._location_list]
return location_names
else:
return self.wireguard_locations
return []
def get_non_residential_proxy_list(self):
return self.non_resident_proxy_locations
def set_is_profile_being_enabled(self, profile_id: int, status: bool):
self._is_profile_being_enabled[profile_id] = status
@ -2855,9 +2854,11 @@ class ResidentialPage(Page):
def set_connection_choice(self, connection_choice):
self.connection_choice = connection_choice
pass
def show_residential(self, icon_name,page_class):
self.connection_choice = icon_name
self.selected_page_class = page_class
if icon_name == "tor":
@ -3045,12 +3046,10 @@ class LocationPage(Page):
button.setChecked(False)
def create_interface_elements(self, available_locations):
print(available_locations)
self.buttonGroup = QButtonGroup(self)
self.buttons = []
for j, (object_type, icon_name, geometry) in enumerate(available_locations):
print(object_type, icon_name, geometry)
boton = object_type(self)
boton.setGeometry(*geometry)
boton.setIconSize(boton.size())
@ -3430,10 +3429,9 @@ class ResumePage(Page):
self.labels_creados.append(parent_label)
if connection_exists:
if profile_1.get("connection", "") == "system-wide":
image_path = os.path.join(self.btn_path, f"{profile_1.get('protocol', '')} {profile_1.get('location', '')}.png")
image_path = os.path.join(self.btn_path, f"wireguard_{profile_1.get('location', '')}.png")
main_label = QLabel(self)
main_label.setGeometry(10, 130, 500, 375)
main_label.setPixmap(QPixmap(image_path))
@ -3443,15 +3441,7 @@ class ResumePage(Page):
if profile_1.get("connection", "") == "just proxy":
image_path = os.path.join(self.btn_path, "browser only.png")
label_background = QLabel(self)
label_background.setGeometry(10, 50, 535, 460)
label_background.setPixmap(QPixmap(image_path))
label_background.setScaledContents(True)
label_background.show()
label_background.lower()
self.labels_creados.append(label_background)
image_path = os.path.join(self.btn_path, f"{profile_1.get('country_garaje', '')} garaje.png")
image_path = os.path.join(self.btn_path, f"icon_{profile_1.get('location', '')}.png")
main_label = QLabel(self)
main_label.setGeometry(10, 105, 530, 398)
main_label.setPixmap(QPixmap(image_path))
@ -3459,32 +3449,13 @@ class ResumePage(Page):
main_label.show()
self.labels_creados.append(main_label)
if profile_1.get("connection", "") == "tor":
if profile_1.get("protocol", "") == "hidetor":
location = profile_1.get("location", "")
image_path = f'btn/hdtor_{location}.png'
else:
image_path = os.path.join(self.btn_path, "browser only.png")
label_background = QLabel(self)
label_background.setGeometry(10, 50, 535, 460)
label_background.setPixmap(QPixmap(image_path))
label_background.setScaledContents(True)
label_background.show()
label_background.lower()
self.labels_creados.append(label_background)
image_path = os.path.join(self.btn_path, f"{profile_1.get('country_garaje', '')} garaje.png")
image_path = os.path.join(self.btn_path, f"hdtor_{profile_1.get('location', '')}.png")
main_label = QLabel(self)
main_label.setGeometry(10, 105, 530, 398)
main_label.setPixmap(QPixmap(image_path))
main_label.setScaledContents(True)
main_label.show()
self.labels_creados.append(main_label)
image_path =os.path.join(self.btn_path, "tor 86x130.png")
tor_label = QLabel(self)
tor_label.setGeometry(450, 380, 86, 130)
tor_label.setPixmap(QPixmap(image_path))
tor_label.setScaledContents(True)
tor_label.show()
self.labels_creados.append(tor_label)
self.labels_creados.append(main_label)
if profile_1.get("connection", "") == "browser-only":
image_path = os.path.join(self.btn_path, "browser only.png")
label_background = QLabel(self)
@ -3494,7 +3465,7 @@ class ResumePage(Page):
label_background.show()
label_background.lower()
self.labels_creados.append(label_background)
image_path = os.path.join(self.btn_path, f"{profile_1.get('protocol', '')} {profile_1.get('location', '')}.png")
image_path = os.path.join(self.btn_path, f"wireguard_{profile_1.get('location', '')}.png")
main_label = QLabel(self)
main_label.setGeometry(10, 130, 500, 375)
main_label.setPixmap(QPixmap(image_path))
@ -3502,8 +3473,7 @@ class ResumePage(Page):
main_label.show()
self.labels_creados.append(main_label)
else:
image_path = os.path.join(self.btn_path, f"{profile_1.get('protocol', '')} {profile_1.get('location', '')}.png")
image_path = os.path.join(self.btn_path, f"icon_{profile_1.get('location', '')}.png")
main_label = QLabel(self)
main_label.setGeometry(10, 130, 500, 375)
main_label.setPixmap(QPixmap(image_path))
@ -3775,7 +3745,7 @@ class EditorPage(Page):
self.process_and_show_labels(data_profile, {
"protocol": ['residential', 'wireguard', 'hidetor'],
"connection": ['tor', 'just proxy'],
"location": self.connection_manager.get_non_residential_proxy_list(),
"location": self.connection_manager.get_location_list(),
"browser": ['brave 1.63.165','brave 1.70.123', 'firefox 123.0', 'firefox 131.0.2', 'chromium 122.0.6261.94-1', 'chromium 129.0.6668.89-1', 'librewolf 125.0.2-1', 'librewolf 130.0.1-1', 'firefox 128.0.2', 'brave 1.71.121'],
"dimentions": ['800x600', '1024x760', '1152x1080', '1280x1024', '1920x1080']
}, selected_profile_str)
@ -3790,7 +3760,7 @@ class EditorPage(Page):
}, selected_profile_str)
except Exception as e:
print(f'An error occurred: {e}')
print(f'An error occurred in verificate: {e}')
def process_and_show_labels(self, data_profile, parameters, selected_profile_str):
protocol = data_profile.get('protocol', "")
@ -3799,7 +3769,6 @@ class EditorPage(Page):
country_garaje = location
name = data_profile.get('name', "")
self.name.setText(name)
if protocol=="hidetor":
if connection == "just proxy":
self.display.setPixmap(QPixmap(os.path.join(self.btn_path, f"icon_{location}.png")))
@ -3813,12 +3782,11 @@ class EditorPage(Page):
self.garaje.hide()
self.brow_disp.hide()
if protocol=="wireguard":
self.display.setGeometry(0, 60, 540, 405)
self.display.show()
self.display.setPixmap(QPixmap(os.path.join(self.btn_path, f"{protocol} {location}.png")))
self.display.setPixmap(QPixmap(os.path.join(self.btn_path, f"wireguard_{location}.png")))
self.garaje.hide()
if connection == "browser-only":
self.brow_disp.show()
@ -5015,6 +4983,7 @@ class PaymentPage(Page):
def invoice_update_text_output(self, text):
self.update_status.update_status(text)
self.text_fields[3].setText(text)
self.text_fields[3].setStyleSheet('font-size: 15px;')
if 'No compatible' in text:
for line in self.text_fields:
@ -5074,6 +5043,19 @@ class PaymentPage(Page):
width = self.text_fields[2].width()
elided_text = metrics.elidedText(text, QtCore.Qt.TextElideMode.ElideMiddle, width)
self.text_fields[2].setText(elided_text)
elif i == 1:
text = str(dict_value)
self.text_fields[i].setProperty("fullText", text)
self.text_fields[i].setText(text)
font_size = 14
if len(text) > 9:
font_size = 15
if len(text) > 13:
font_size = 10
if len(text) > 16:
font_size = 8
self.text_fields[i].setStyleSheet(f"font-size: {font_size}px; font-weight: bold;")
else:
self.text_fields[i].setProperty("fullText", str(dict_value))
self.text_fields[i].setText(str(dict_value))
@ -5634,7 +5616,6 @@ class SyncScreen(Page):
self.heading_label.setGeometry(15, 80, 750, 120)
font_style = "font-size: 34px; font-weight: bold; color: white;"
if self.custom_window.open_sans_family:
print('open sans found')
font_style += f" font-family: '{self.custom_window.open_sans_family}';"
self.heading_label.setStyleSheet(font_style)