diff --git a/BlocksScreen/lib/panels/networkWindow.py b/BlocksScreen/lib/panels/networkWindow.py index f9636a82..4090f95d 100644 --- a/BlocksScreen/lib/panels/networkWindow.py +++ b/BlocksScreen/lib/panels/networkWindow.py @@ -10,6 +10,8 @@ from lib.utils.list_button import ListCustomButton from PyQt6 import QtCore, QtGui, QtWidgets +from lib.qrcode_gen import generate_wifi_qrcode + logger = logging.getLogger("logs/BlocksScreen.log") @@ -249,17 +251,8 @@ def __init__(self, parent: typing.Optional[QtWidgets.QWidget], /) -> None: self.panel.hotspot_password_input_field.setPlaceholderText( "Defaults to: 123456789" ) - self.panel.hotspot_change_confirm.clicked.connect( - lambda: self.setCurrentIndex(self.indexOf(self.panel.main_network_page)) - ) + self.panel.hotspot_change_confirm.clicked.connect(self.hotspot_activate_clicked) - self.panel.hotspot_password_input_field.setHidden(True) - self.panel.hotspot_password_view_button.pressed.connect( - partial(self.panel.hotspot_password_input_field.setHidden, False) - ) - self.panel.hotspot_password_view_button.released.connect( - partial(self.panel.hotspot_password_input_field.setHidden, True) - ) self.panel.hotspot_name_input_field.setText( str(self.sdbus_network.get_hotspot_ssid()) ) @@ -290,16 +283,7 @@ def __init__(self, parent: typing.Optional[QtWidgets.QWidget], /) -> None: QtGui.QPixmap(":/ui/media/btn_icons/see.svg") ) ) - self.panel.hotspot_password_view_button.released.connect( - lambda: self.panel.hotspot_password_view_button.setPixmap( - QtGui.QPixmap(":/ui/media/btn_icons/unsee.svg") - ) - ) - self.panel.hotspot_password_view_button.pressed.connect( - lambda: self.panel.hotspot_password_view_button.setPixmap( - QtGui.QPixmap(":/ui/media/btn_icons/see.svg") - ) - ) + self.generate_qrcode() self.panel.add_network_password_field.setCursor( QtCore.Qt.CursorShape.BlankCursor @@ -387,8 +371,27 @@ def saved_wifi_option_selected(self): self.sdbus_network.connect_network( self.panel.saved_connection_network_name.text() ) + self.panel.hotspot_change_confirm.setEnabled(True) + self.info_box_load(True) + def hotspot_activate_clicked(self): + if self.panel.hotspot_change_confirm.text() == "Save": + self.panel.hotspot_change_confirm.setText("Activate") + + self.panel.wifi_button.toggle_button.state = ( + self.panel.wifi_button.toggle_button.State.OFF + ) + self.panel.hotspot_button.toggle_button.state = ( + self.panel.hotspot_button.toggle_button.State.ON + ) + self.setCurrentIndex(self.indexOf(self.panel.main_network_page)) + + self.panel.hotspot_button.toggle_button.stateChange.emit( + self.panel.hotspot_button.toggle_button.state + ) + self.panel.hotspot_change_confirm.setEnabled(False) + def on_show_keyboard(self, panel: QtWidgets.QWidget, field: QtWidgets.QLineEdit): """Handle keyboard show""" self.previousPanel = panel @@ -404,8 +407,39 @@ def on_qwerty_value_selected(self, value: str): """Handle keyboard value input""" self.setCurrentIndex(self.indexOf(self.previousPanel)) if hasattr(self, "currentField") and self.currentField: + if ( + self.currentField == self.panel.hotspot_name_input_field + or self.currentField == self.panel.hotspot_password_input_field + ): + if ( + self.panel.hotspot_button.toggle_button.state + == self.panel.hotspot_button.toggle_button.State.ON + ): + self.panel.hotspot_change_confirm.setEnabled(True) + + self.panel.hotspot_change_confirm.setText("Save") + self.generate_qrcode() self.currentField.setText(value) + def generate_qrcode(self): + if ( + self.panel.hotspot_button.toggle_button.state + == self.panel.hotspot_button.toggle_button.State.ON + ): + self.panel.qrcode_img.setText("") + self.panel.qrcode_img.setPixmap( + QtGui.QPixmap.fromImage( + generate_wifi_qrcode( + self.panel.hotspot_name_input_field.text(), + self.panel.hotspot_password_input_field.text(), + "WPA", + ) + ) + ) + else: + self.panel.qrcode_img.clearPixmap() + self.panel.qrcode_img.setText("Hotspot not active") + def info_box_load(self, toggle: bool = False) -> None: """ Shows or hides the loading screen. @@ -494,6 +528,7 @@ def on_toggle_state(self, new_state) -> None: except Exception as e: logger.error(f"error when turning ON wifi on_toggle_state:{e}") + self.panel.hotspot_change_confirm.setEnabled(True) elif sender_button is hotspot_btn: if is_sender_now_on: @@ -519,13 +554,15 @@ def on_toggle_state(self, new_state) -> None: self.sdbus_network.connect_network( self.panel.hotspot_name_input_field.text() ) - + self.panel.hotspot_change_confirm.setEnabled(False) + self.generate_qrcode() self.info_box_load(False) if ( hotspot_btn.state == hotspot_btn.State.OFF and wifi_btn.state == wifi_btn.State.OFF ): self.evaluate_network_state() + self.panel.hotspot_change_confirm.setEnabled(True) else: self.info_box_load(True) diff --git a/BlocksScreen/lib/panels/widgets/probeHelperPage.py b/BlocksScreen/lib/panels/widgets/probeHelperPage.py index a105037b..94fd7c42 100644 --- a/BlocksScreen/lib/panels/widgets/probeHelperPage.py +++ b/BlocksScreen/lib/panels/widgets/probeHelperPage.py @@ -1,7 +1,4 @@ import typing - -from lib.panels.widgets.basePopup import BasePopup -from lib.panels.widgets.loadWidget import LoadingOverlayWidget from lib.panels.widgets.optionCardWidget import OptionCard from lib.utils.blocks_button import BlocksCustomButton from lib.utils.blocks_label import BlocksLabel @@ -10,7 +7,6 @@ from PyQt6 import QtCore, QtGui, QtWidgets - class ProbeHelper(QtWidgets.QWidget): request_back: typing.ClassVar[QtCore.pyqtSignal] = QtCore.pyqtSignal( name="request_back" diff --git a/BlocksScreen/lib/qrcode_gen.py b/BlocksScreen/lib/qrcode_gen.py index 1901cef1..3b393328 100644 --- a/BlocksScreen/lib/qrcode_gen.py +++ b/BlocksScreen/lib/qrcode_gen.py @@ -26,7 +26,5 @@ def make_qrcode(data) -> ImageQt.ImageQt: def generate_wifi_qrcode( ssid: str, password: str, auth_type: str, hidden: bool = False ) -> ImageQt.ImageQt: - wifi_data = ( - f"WIFI:T:{auth_type};S:{ssid};P:{password};{'H:true;' if hidden else ''};" - ) + wifi_data = f"WIFI:T:{auth_type};S:{ssid};P:{password};H:{str(hidden).lower()};;" return make_qrcode(wifi_data) diff --git a/BlocksScreen/lib/ui/wifiConnectivityWindow.ui b/BlocksScreen/lib/ui/wifiConnectivityWindow.ui index 871ba2dd..3231c65c 100644 --- a/BlocksScreen/lib/ui/wifiConnectivityWindow.ui +++ b/BlocksScreen/lib/ui/wifiConnectivityWindow.ui @@ -18,14 +18,14 @@ - 0 - 400 + 800 + 480 - 16777215 - 575 + 800 + 480 @@ -40,7 +40,7 @@ - 4 + 5 @@ -2018,7 +2018,7 @@ Password - + 100 @@ -2058,7 +2058,7 @@ Password - + 100 @@ -2101,7 +2101,7 @@ Password - + 100 @@ -2157,7 +2157,7 @@ Password - + @@ -2178,6 +2178,12 @@ Password + + + 16777215 + 60 + + @@ -2289,42 +2295,22 @@ Password - - - 5 - - - 5 - - - - - Qt::Vertical - - - QSizePolicy::Minimum - - - - 20 - 50 - - - - + - + - + 0 0 - - - 70 - 80 - + + + 15 + + + + color:white QFrame::StyledPanel @@ -2332,192 +2318,40 @@ Password QFrame::Raised - - - - 0 - 10 - 776 - 61 - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 150 - 16777215 - - - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - - - 120 - 120 - 120 - - - - - - - 120 - 120 - 120 - - - - - - - - - Momcake - 10 - - - - Hotspot Name: - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - 500 - 40 - - - - - 500 - 60 - - - - - 12 - - - - QLineEdit::Password - - - - - - - Qt::Horizontal - - - QSizePolicy::Minimum - - - - 60 - 20 - - - - - - + + + + + + 325 + 325 + + + + + 325 + 325 + + + + + 15 + + + + + + + + - - - Qt::Vertical - - - QSizePolicy::Minimum - - - - 773 - 128 - - - - - - - - - 0 - 0 - - - + + - 0 - 80 + 350 + 16777215 @@ -2526,557 +2360,676 @@ Password QFrame::Raised - - - - 0 - 10 - 776 - 62 - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 150 - 16777215 - - - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 127 - 127 - 127 - - - - - - - 170 - 170 - 170 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 127 - 127 - 127 - - - - - - - 170 - 170 - 170 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 127 - 127 - 127 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 127 - 127 - 127 - - - - - - - 170 - 170 - 170 - - - - - - - 127 - 127 - 127 - - - - - - - 255 - 255 - 255 - - - - - - - 127 - 127 - 127 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - Momcake - 10 - - - - Hotspot Password: - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - 500 - 40 - - - - - 500 - 60 - - - - - 12 - - - - QLineEdit::Password - - - - - - - - 60 - 60 - - - - - 60 - 60 - - - - View - - - true - - - back_btn - - - icon - - - :/ui/media/btn_icons/unsee.svg - - - - - - - - - - - - 200 - 80 - - - - - 250 - 100 - - - - - 18 - 75 - true - - - - Save - - - :/ui/media/btn_icons/save.svg - + + + + + + 0 + 0 + + + + + 173 + 0 + + + + + 16777215 + 16777215 + + + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 120 + 120 + 120 + + + + + + + 120 + 120 + 120 + + + + + + + + + Momcake + 15 + + + + Hotspot Name: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 300 + 40 + + + + + 300 + 60 + + + + + 12 + + + + QLineEdit::Password + + + + + + + + 0 + 0 + + + + + 173 + 0 + + + + + 16777215 + 16777215 + + + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 127 + 127 + 127 + + + + + + + 170 + 170 + 170 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 127 + 127 + 127 + + + + + + + 170 + 170 + 170 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 127 + 127 + 127 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 127 + 127 + 127 + + + + + + + 170 + 170 + 170 + + + + + + + 127 + 127 + 127 + + + + + + + 255 + 255 + 255 + + + + + + + 127 + 127 + 127 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + Momcake + 15 + + + + Hotspot Password: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 300 + 40 + + + + + 300 + 60 + + + + + 12 + + + + QLineEdit::Password + + + + + + + Qt::Vertical + + + QSizePolicy::Minimum + + + + 20 + 40 + + + + + + + + + 250 + 80 + + + + + 250 + 100 + + + + + 18 + 75 + true + + + + Activate + + + :/dialog/media/btn_icons/yes.svg + + + + + + + Qt::Vertical + + + QSizePolicy::Minimum + + + + 20 + 20 + + + + + @@ -3117,9 +3070,14 @@ Password
lib.panels.widgets.loadWidget
- GroupButton + BlocksCustomCheckButton QPushButton -
lib.utils.group_button
+
lib.utils.check_button
+
+ + BlocksLabel + QLabel +
lib.utils.blocks_label
diff --git a/BlocksScreen/lib/ui/wifiConnectivityWindow_ui.py b/BlocksScreen/lib/ui/wifiConnectivityWindow_ui.py index e66053a9..0cae2bc4 100644 --- a/BlocksScreen/lib/ui/wifiConnectivityWindow_ui.py +++ b/BlocksScreen/lib/ui/wifiConnectivityWindow_ui.py @@ -1,6 +1,6 @@ # Form implementation generated from reading ui file '/home/levi/BlocksScreen/BlocksScreen/lib/ui/wifiConnectivityWindow.ui' # -# Created by: PyQt6 UI code generator 6.7.1 +# Created by: PyQt6 UI code generator 6.10.0 # # WARNING: Any manual changes made to this file will be lost when pyuic6 is # run again. Do not edit this file unless you know what you are doing. @@ -18,8 +18,8 @@ def setupUi(self, wifi_stacked_page): sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(wifi_stacked_page.sizePolicy().hasHeightForWidth()) wifi_stacked_page.setSizePolicy(sizePolicy) - wifi_stacked_page.setMinimumSize(QtCore.QSize(0, 400)) - wifi_stacked_page.setMaximumSize(QtCore.QSize(16777215, 575)) + wifi_stacked_page.setMinimumSize(QtCore.QSize(800, 480)) + wifi_stacked_page.setMaximumSize(QtCore.QSize(800, 480)) wifi_stacked_page.setStyleSheet("#wifi_stacked_page{\n" " \n" " \n" @@ -823,13 +823,14 @@ def setupUi(self, wifi_stacked_page): wifi_stacked_page.addWidget(self.saved_details_page) self.hotspot_page = QtWidgets.QWidget() self.hotspot_page.setObjectName("hotspot_page") - self.verticalLayout_12 = QtWidgets.QVBoxLayout(self.hotspot_page) - self.verticalLayout_12.setObjectName("verticalLayout_12") + self.verticalLayout_7 = QtWidgets.QVBoxLayout(self.hotspot_page) + self.verticalLayout_7.setObjectName("verticalLayout_7") self.hospot_page_header_layout = QtWidgets.QHBoxLayout() self.hospot_page_header_layout.setObjectName("hospot_page_header_layout") spacerItem9 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Minimum) self.hospot_page_header_layout.addItem(spacerItem9) self.hotspot_header_title = QtWidgets.QLabel(parent=self.hotspot_page) + self.hotspot_header_title.setMaximumSize(QtCore.QSize(16777215, 60)) palette = QtGui.QPalette() brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.BrushStyle.SolidPattern) @@ -863,36 +864,49 @@ def setupUi(self, wifi_stacked_page): self.hotspot_back_button.setProperty("icon_pixmap", QtGui.QPixmap(":/ui/media/btn_icons/back.svg")) self.hotspot_back_button.setObjectName("hotspot_back_button") self.hospot_page_header_layout.addWidget(self.hotspot_back_button) - self.verticalLayout_12.addLayout(self.hospot_page_header_layout) - self.hotspot_page_content_layout = QtWidgets.QVBoxLayout() - self.hotspot_page_content_layout.setContentsMargins(-1, 5, -1, 5) - self.hotspot_page_content_layout.setObjectName("hotspot_page_content_layout") - spacerItem10 = QtWidgets.QSpacerItem(20, 50, QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Minimum) - self.hotspot_page_content_layout.addItem(spacerItem10) - self.frame_6 = BlocksCustomFrame(parent=self.hotspot_page) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding) + self.verticalLayout_7.addLayout(self.hospot_page_header_layout) + self.horizontalLayout_3 = QtWidgets.QHBoxLayout() + self.horizontalLayout_3.setObjectName("horizontalLayout_3") + self.frame_4 = BlocksCustomFrame(parent=self.hotspot_page) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Preferred, QtWidgets.QSizePolicy.Policy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.frame_6.sizePolicy().hasHeightForWidth()) - self.frame_6.setSizePolicy(sizePolicy) - self.frame_6.setMinimumSize(QtCore.QSize(70, 80)) - self.frame_6.setFrameShape(QtWidgets.QFrame.Shape.StyledPanel) - self.frame_6.setFrameShadow(QtWidgets.QFrame.Shadow.Raised) - self.frame_6.setObjectName("frame_6") - self.layoutWidget_6 = QtWidgets.QWidget(parent=self.frame_6) - self.layoutWidget_6.setGeometry(QtCore.QRect(0, 10, 776, 61)) - self.layoutWidget_6.setObjectName("layoutWidget_6") - self.horizontalLayout_11 = QtWidgets.QHBoxLayout(self.layoutWidget_6) - self.horizontalLayout_11.setContentsMargins(0, 0, 0, 0) + sizePolicy.setHeightForWidth(self.frame_4.sizePolicy().hasHeightForWidth()) + self.frame_4.setSizePolicy(sizePolicy) + font = QtGui.QFont() + font.setPointSize(15) + self.frame_4.setFont(font) + self.frame_4.setStyleSheet("color:white") + self.frame_4.setFrameShape(QtWidgets.QFrame.Shape.StyledPanel) + self.frame_4.setFrameShadow(QtWidgets.QFrame.Shadow.Raised) + self.frame_4.setObjectName("frame_4") + self.horizontalLayout_11 = QtWidgets.QHBoxLayout(self.frame_4) self.horizontalLayout_11.setObjectName("horizontalLayout_11") - self.hotspot_info_name_label = QtWidgets.QLabel(parent=self.layoutWidget_6) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Preferred, QtWidgets.QSizePolicy.Policy.Maximum) + self.qrcode_img = BlocksLabel(parent=self.frame_4) + self.qrcode_img.setMinimumSize(QtCore.QSize(325, 325)) + self.qrcode_img.setMaximumSize(QtCore.QSize(325, 325)) + font = QtGui.QFont() + font.setPointSize(15) + self.qrcode_img.setFont(font) + self.qrcode_img.setText("") + self.qrcode_img.setObjectName("qrcode_img") + self.horizontalLayout_11.addWidget(self.qrcode_img) + self.horizontalLayout_3.addWidget(self.frame_4) + self.frame_3 = BlocksCustomFrame(parent=self.hotspot_page) + self.frame_3.setMaximumSize(QtCore.QSize(350, 16777215)) + self.frame_3.setFrameShape(QtWidgets.QFrame.Shape.StyledPanel) + self.frame_3.setFrameShadow(QtWidgets.QFrame.Shadow.Raised) + self.frame_3.setObjectName("frame_3") + self.verticalLayout = QtWidgets.QVBoxLayout(self.frame_3) + self.verticalLayout.setObjectName("verticalLayout") + self.hotspot_info_name_label = QtWidgets.QLabel(parent=self.frame_3) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Maximum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.hotspot_info_name_label.sizePolicy().hasHeightForWidth()) self.hotspot_info_name_label.setSizePolicy(sizePolicy) - self.hotspot_info_name_label.setMinimumSize(QtCore.QSize(0, 0)) - self.hotspot_info_name_label.setMaximumSize(QtCore.QSize(150, 16777215)) + self.hotspot_info_name_label.setMinimumSize(QtCore.QSize(173, 0)) + self.hotspot_info_name_label.setMaximumSize(QtCore.QSize(16777215, 16777215)) palette = QtGui.QPalette() brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.BrushStyle.SolidPattern) @@ -915,54 +929,33 @@ def setupUi(self, wifi_stacked_page): self.hotspot_info_name_label.setPalette(palette) font = QtGui.QFont() font.setFamily("Momcake") - font.setPointSize(10) + font.setPointSize(15) self.hotspot_info_name_label.setFont(font) - self.hotspot_info_name_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) + self.hotspot_info_name_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignLeading|QtCore.Qt.AlignmentFlag.AlignLeft|QtCore.Qt.AlignmentFlag.AlignVCenter) self.hotspot_info_name_label.setObjectName("hotspot_info_name_label") - self.horizontalLayout_11.addWidget(self.hotspot_info_name_label) - self.hotspot_name_input_field = BlocksCustomLinEdit(parent=self.layoutWidget_6) + self.verticalLayout.addWidget(self.hotspot_info_name_label, 0, QtCore.Qt.AlignmentFlag.AlignBottom) + self.hotspot_name_input_field = BlocksCustomLinEdit(parent=self.frame_3) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.MinimumExpanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.hotspot_name_input_field.sizePolicy().hasHeightForWidth()) self.hotspot_name_input_field.setSizePolicy(sizePolicy) - self.hotspot_name_input_field.setMinimumSize(QtCore.QSize(500, 40)) - self.hotspot_name_input_field.setMaximumSize(QtCore.QSize(500, 60)) + self.hotspot_name_input_field.setMinimumSize(QtCore.QSize(300, 40)) + self.hotspot_name_input_field.setMaximumSize(QtCore.QSize(300, 60)) font = QtGui.QFont() font.setPointSize(12) self.hotspot_name_input_field.setFont(font) self.hotspot_name_input_field.setEchoMode(QtWidgets.QLineEdit.EchoMode.Password) self.hotspot_name_input_field.setObjectName("hotspot_name_input_field") - self.horizontalLayout_11.addWidget(self.hotspot_name_input_field, 0, QtCore.Qt.AlignmentFlag.AlignHCenter) - spacerItem11 = QtWidgets.QSpacerItem(60, 20, QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Minimum) - self.horizontalLayout_11.addItem(spacerItem11) - self.hotspot_page_content_layout.addWidget(self.frame_6) - spacerItem12 = QtWidgets.QSpacerItem(773, 128, QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Minimum) - self.hotspot_page_content_layout.addItem(spacerItem12) - self.frame_7 = BlocksCustomFrame(parent=self.hotspot_page) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.frame_7.sizePolicy().hasHeightForWidth()) - self.frame_7.setSizePolicy(sizePolicy) - self.frame_7.setMinimumSize(QtCore.QSize(0, 80)) - self.frame_7.setFrameShape(QtWidgets.QFrame.Shape.StyledPanel) - self.frame_7.setFrameShadow(QtWidgets.QFrame.Shadow.Raised) - self.frame_7.setObjectName("frame_7") - self.layoutWidget_7 = QtWidgets.QWidget(parent=self.frame_7) - self.layoutWidget_7.setGeometry(QtCore.QRect(0, 10, 776, 62)) - self.layoutWidget_7.setObjectName("layoutWidget_7") - self.horizontalLayout_12 = QtWidgets.QHBoxLayout(self.layoutWidget_7) - self.horizontalLayout_12.setContentsMargins(0, 0, 0, 0) - self.horizontalLayout_12.setObjectName("horizontalLayout_12") - self.hotspot_info_password_label = QtWidgets.QLabel(parent=self.layoutWidget_7) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Preferred, QtWidgets.QSizePolicy.Policy.Maximum) + self.verticalLayout.addWidget(self.hotspot_name_input_field, 0, QtCore.Qt.AlignmentFlag.AlignHCenter) + self.hotspot_info_password_label = QtWidgets.QLabel(parent=self.frame_3) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Maximum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.hotspot_info_password_label.sizePolicy().hasHeightForWidth()) self.hotspot_info_password_label.setSizePolicy(sizePolicy) - self.hotspot_info_password_label.setMinimumSize(QtCore.QSize(0, 0)) - self.hotspot_info_password_label.setMaximumSize(QtCore.QSize(150, 16777215)) + self.hotspot_info_password_label.setMinimumSize(QtCore.QSize(173, 0)) + self.hotspot_info_password_label.setMaximumSize(QtCore.QSize(16777215, 16777215)) palette = QtGui.QPalette() brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush.setStyle(QtCore.Qt.BrushStyle.SolidPattern) @@ -1102,49 +1095,46 @@ def setupUi(self, wifi_stacked_page): self.hotspot_info_password_label.setPalette(palette) font = QtGui.QFont() font.setFamily("Momcake") - font.setPointSize(10) + font.setPointSize(15) self.hotspot_info_password_label.setFont(font) - self.hotspot_info_password_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) + self.hotspot_info_password_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignLeading|QtCore.Qt.AlignmentFlag.AlignLeft|QtCore.Qt.AlignmentFlag.AlignVCenter) self.hotspot_info_password_label.setObjectName("hotspot_info_password_label") - self.horizontalLayout_12.addWidget(self.hotspot_info_password_label) - self.hotspot_password_input_field = BlocksCustomLinEdit(parent=self.layoutWidget_7) + self.verticalLayout.addWidget(self.hotspot_info_password_label, 0, QtCore.Qt.AlignmentFlag.AlignBottom) + self.hotspot_password_input_field = BlocksCustomLinEdit(parent=self.frame_3) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.MinimumExpanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.hotspot_password_input_field.sizePolicy().hasHeightForWidth()) self.hotspot_password_input_field.setSizePolicy(sizePolicy) - self.hotspot_password_input_field.setMinimumSize(QtCore.QSize(500, 40)) - self.hotspot_password_input_field.setMaximumSize(QtCore.QSize(500, 60)) + self.hotspot_password_input_field.setMinimumSize(QtCore.QSize(300, 40)) + self.hotspot_password_input_field.setMaximumSize(QtCore.QSize(300, 60)) font = QtGui.QFont() font.setPointSize(12) self.hotspot_password_input_field.setFont(font) self.hotspot_password_input_field.setEchoMode(QtWidgets.QLineEdit.EchoMode.Password) self.hotspot_password_input_field.setObjectName("hotspot_password_input_field") - self.horizontalLayout_12.addWidget(self.hotspot_password_input_field, 0, QtCore.Qt.AlignmentFlag.AlignHCenter) - self.hotspot_password_view_button = IconButton(parent=self.layoutWidget_7) - self.hotspot_password_view_button.setMinimumSize(QtCore.QSize(60, 60)) - self.hotspot_password_view_button.setMaximumSize(QtCore.QSize(60, 60)) - self.hotspot_password_view_button.setFlat(True) - self.hotspot_password_view_button.setProperty("icon_pixmap", QtGui.QPixmap(":/ui/media/btn_icons/unsee.svg")) - self.hotspot_password_view_button.setObjectName("hotspot_password_view_button") - self.horizontalLayout_12.addWidget(self.hotspot_password_view_button) - self.hotspot_page_content_layout.addWidget(self.frame_7) - self.hotspot_change_confirm = BlocksCustomButton(parent=self.hotspot_page) - self.hotspot_change_confirm.setMinimumSize(QtCore.QSize(200, 80)) + self.verticalLayout.addWidget(self.hotspot_password_input_field, 0, QtCore.Qt.AlignmentFlag.AlignHCenter) + spacerItem10 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Minimum) + self.verticalLayout.addItem(spacerItem10) + self.hotspot_change_confirm = BlocksCustomButton(parent=self.frame_3) + self.hotspot_change_confirm.setMinimumSize(QtCore.QSize(250, 80)) self.hotspot_change_confirm.setMaximumSize(QtCore.QSize(250, 100)) font = QtGui.QFont() font.setPointSize(18) font.setBold(True) font.setWeight(75) self.hotspot_change_confirm.setFont(font) - self.hotspot_change_confirm.setProperty("icon_pixmap", QtGui.QPixmap(":/ui/media/btn_icons/save.svg")) + self.hotspot_change_confirm.setProperty("icon_pixmap", QtGui.QPixmap(":/dialog/media/btn_icons/yes.svg")) self.hotspot_change_confirm.setObjectName("hotspot_change_confirm") - self.hotspot_page_content_layout.addWidget(self.hotspot_change_confirm, 0, QtCore.Qt.AlignmentFlag.AlignHCenter|QtCore.Qt.AlignmentFlag.AlignVCenter) - self.verticalLayout_12.addLayout(self.hotspot_page_content_layout) + self.verticalLayout.addWidget(self.hotspot_change_confirm, 0, QtCore.Qt.AlignmentFlag.AlignHCenter) + spacerItem11 = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Minimum) + self.verticalLayout.addItem(spacerItem11) + self.horizontalLayout_3.addWidget(self.frame_3) + self.verticalLayout_7.addLayout(self.horizontalLayout_3) wifi_stacked_page.addWidget(self.hotspot_page) self.retranslateUi(wifi_stacked_page) - wifi_stacked_page.setCurrentIndex(4) + wifi_stacked_page.setCurrentIndex(5) QtCore.QMetaObject.connectSlotsByName(wifi_stacked_page) def retranslateUi(self, wifi_stacked_page): @@ -1218,13 +1208,11 @@ def retranslateUi(self, wifi_stacked_page): self.hotspot_back_button.setProperty("button_type", _translate("wifi_stacked_page", "icon")) self.hotspot_info_name_label.setText(_translate("wifi_stacked_page", "Hotspot Name: ")) self.hotspot_info_password_label.setText(_translate("wifi_stacked_page", "Hotspot Password:")) - self.hotspot_password_view_button.setText(_translate("wifi_stacked_page", "View")) - self.hotspot_password_view_button.setProperty("class", _translate("wifi_stacked_page", "back_btn")) - self.hotspot_password_view_button.setProperty("button_type", _translate("wifi_stacked_page", "icon")) - self.hotspot_change_confirm.setText(_translate("wifi_stacked_page", "Save")) + self.hotspot_change_confirm.setText(_translate("wifi_stacked_page", "Activate")) from lib.panels.widgets.loadWidget import LoadingOverlayWidget from lib.utils.blocks_button import BlocksCustomButton from lib.utils.blocks_frame import BlocksCustomFrame +from lib.utils.blocks_label import BlocksLabel from lib.utils.blocks_linedit import BlocksCustomLinEdit from lib.utils.blocks_togglebutton import NetworkWidgetbuttons from lib.utils.check_button import BlocksCustomCheckButton diff --git a/BlocksScreen/lib/utils/blocks_label.py b/BlocksScreen/lib/utils/blocks_label.py index 1aaa173e..99721a04 100644 --- a/BlocksScreen/lib/utils/blocks_label.py +++ b/BlocksScreen/lib/utils/blocks_label.py @@ -60,6 +60,11 @@ def setPixmap(self, a0: QtGui.QPixmap) -> None: self.icon_pixmap = a0 self.update() + def clearPixmap(self) -> None: + """Clear widget pixmap""" + self.icon_pixmap = QtGui.QPixmap() + self.repaint() + def setText(self, text: str) -> None: """Set widget text""" self._text = text diff --git a/scripts/requirements.txt b/scripts/requirements.txt index 9dfdbd57..8440506e 100644 --- a/scripts/requirements.txt +++ b/scripts/requirements.txt @@ -12,4 +12,5 @@ sdbus==0.14.1 sdbus-networkmanager==2.0.0 typing==3.7.4.3 websocket-client==1.9.0 -qrcode==8.2 \ No newline at end of file +qrcode==8.2 +pillow==12.1.0 \ No newline at end of file