from gettext import gettext as _

from PyQt6 import QtCore, QtGui, QtWidgets


class Ui_PageCustomizations(object):
    def setupUi(self, PageCustomizations):
        PageCustomizations.setObjectName("PageCustomizations")
        PageCustomizations.resize(720, 600)
        self.mainLayout = QtWidgets.QVBoxLayout(PageCustomizations)
        self.mainLayout.setSpacing(12)
        self.mainLayout.setObjectName("mainLayout")
        self.label_title = QtWidgets.QLabel(parent=PageCustomizations)
        font = QtGui.QFont()
        font.setPointSize(12)
        font.setBold(True)
        self.label_title.setFont(font)
        self.label_title.setObjectName("label_title")
        self.mainLayout.addWidget(self.label_title)
        self.scope_group = QtWidgets.QGroupBox(parent=PageCustomizations)
        self.scope_group.setObjectName("scope_group")
        self.vboxlayout = QtWidgets.QVBoxLayout(self.scope_group)
        self.vboxlayout.setObjectName("vboxlayout")
        self.hboxlayout = QtWidgets.QHBoxLayout()
        self.hboxlayout.setObjectName("hboxlayout")
        self.label_scope = QtWidgets.QLabel(parent=self.scope_group)
        self.label_scope.setObjectName("label_scope")
        self.hboxlayout.addWidget(self.label_scope)
        self.scope_combo = QtWidgets.QComboBox(parent=self.scope_group)
        self.scope_combo.setObjectName("scope_combo")
        self.hboxlayout.addWidget(self.scope_combo)
        self.account_label = QtWidgets.QLabel(parent=self.scope_group)
        font = QtGui.QFont()
        font.setItalic(True)
        self.account_label.setFont(font)
        self.account_label.setObjectName("account_label")
        self.hboxlayout.addWidget(self.account_label)
        spacerItem = QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum)
        self.hboxlayout.addItem(spacerItem)
        self.vboxlayout.addLayout(self.hboxlayout)
        self.inherit_checkbox = QtWidgets.QCheckBox(parent=self.scope_group)
        self.inherit_checkbox.setObjectName("inherit_checkbox")
        self.vboxlayout.addWidget(self.inherit_checkbox)
        self.account_scope_hint_label = QtWidgets.QLabel(parent=self.scope_group)
        self.account_scope_hint_label.setWordWrap(True)
        self.account_scope_hint_label.setObjectName("account_scope_hint_label")
        self.vboxlayout.addWidget(self.account_scope_hint_label)
        self.mainLayout.addWidget(self.scope_group)
        self.feedback_label = QtWidgets.QLabel(parent=PageCustomizations)
        self.feedback_label.setWordWrap(True)
        self.feedback_label.setObjectName("feedback_label")
        self.mainLayout.addWidget(self.feedback_label)
        self.assets_panels_layout = QtWidgets.QHBoxLayout()
        self.assets_panels_layout.setSpacing(16)
        self.assets_panels_layout.setObjectName("assets_panels_layout")
        self.css_files_group = QtWidgets.QGroupBox(parent=PageCustomizations)
        self.css_files_group.setObjectName("css_files_group")
        self.css_panel_layout = QtWidgets.QVBoxLayout(self.css_files_group)
        self.css_panel_layout.setObjectName("css_panel_layout")
        self.css_enabled = QtWidgets.QCheckBox(parent=self.css_files_group)
        self.css_enabled.setObjectName("css_enabled")
        self.css_panel_layout.addWidget(self.css_enabled)
        self.css_preview_group = QtWidgets.QGroupBox(parent=self.css_files_group)
        self.css_preview_group.setObjectName("css_preview_group")
        self.css_preview_group_layout = QtWidgets.QVBoxLayout(self.css_preview_group)
        self.css_preview_group_layout.setObjectName("css_preview_group_layout")
        self.css_preview_frame = QtWidgets.QFrame(parent=self.css_preview_group)
        self.css_preview_frame.setMaximumSize(QtCore.QSize(16777215, 240))
        self.css_preview_frame.setMinimumSize(QtCore.QSize(0, 240))
        self.css_preview_frame.setFrameShape(QtWidgets.QFrame.Shape.NoFrame)
        self.css_preview_frame.setObjectName("css_preview_frame")
        self.css_preview_frame_layout = QtWidgets.QVBoxLayout(self.css_preview_frame)
        self.css_preview_frame_layout.setContentsMargins(0, 0, 0, 0)
        self.css_preview_frame_layout.setSpacing(0)
        self.css_preview_frame_layout.setObjectName("css_preview_frame_layout")
        self.css_preview_stack = QtWidgets.QStackedWidget(parent=self.css_preview_frame)
        self.css_preview_stack.setObjectName("css_preview_stack")
        self.css_preview_placeholder_page = QtWidgets.QWidget()
        self.css_preview_placeholder_page.setObjectName("css_preview_placeholder_page")
        self.css_preview_placeholder_layout = QtWidgets.QVBoxLayout(self.css_preview_placeholder_page)
        self.css_preview_placeholder_layout.setContentsMargins(12, 12, 12, 12)
        self.css_preview_placeholder_layout.setSpacing(8)
        self.css_preview_placeholder_layout.setObjectName("css_preview_placeholder_layout")
        self.css_preview_placeholder = QtWidgets.QLabel(parent=self.css_preview_placeholder_page)
        self.css_preview_placeholder.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter)
        self.css_preview_placeholder.setWordWrap(True)
        self.css_preview_placeholder.setObjectName("css_preview_placeholder")
        self.css_preview_placeholder_layout.addWidget(self.css_preview_placeholder)
        self.css_preview_placeholder_upload_button = QtWidgets.QPushButton(parent=self.css_preview_placeholder_page)
        self.css_preview_placeholder_upload_button.setVisible(False)
        self.css_preview_placeholder_upload_button.setObjectName("css_preview_placeholder_upload_button")
        self.css_preview_placeholder_layout.addWidget(self.css_preview_placeholder_upload_button, 0, QtCore.Qt.AlignmentFlag.AlignCenter)
        self.css_preview_stack.addWidget(self.css_preview_placeholder_page)
        self.css_preview_image_page = QtWidgets.QWidget()
        self.css_preview_image_page.setObjectName("css_preview_image_page")
        self.css_preview_image_layout = QtWidgets.QGridLayout(self.css_preview_image_page)
        self.css_preview_image_layout.setContentsMargins(12, 12, 12, 12)
        self.css_preview_image_layout.setSpacing(8)
        self.css_preview_image_layout.setObjectName("css_preview_image_layout")
        self.css_preview_image = QtWidgets.QLabel(parent=self.css_preview_image_page)
        self.css_preview_image.setText("")
        self.css_preview_image.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter)
        self.css_preview_image.setObjectName("css_preview_image")
        self.css_preview_image_layout.addWidget(self.css_preview_image, 0, 0, 1, 1)
        self.css_preview_replace_button = QtWidgets.QPushButton(parent=self.css_preview_image_page)
        self.css_preview_replace_button.setVisible(False)
        self.css_preview_replace_button.setObjectName("css_preview_replace_button")
        self.css_preview_image_layout.addWidget(self.css_preview_replace_button, 0, 0, 1, 1, QtCore.Qt.AlignmentFlag.AlignCenter)
        self.css_preview_stack.addWidget(self.css_preview_image_page)
        self.css_preview_frame_layout.addWidget(self.css_preview_stack)
        self.css_preview_group_layout.addWidget(self.css_preview_frame)
        self.css_panel_layout.addWidget(self.css_preview_group)
        self.css_files = QtWidgets.QTableWidget(parent=self.css_files_group)
        self.css_files.setEditTriggers(QtWidgets.QAbstractItemView.EditTrigger.NoEditTriggers)
        self.css_files.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.SingleSelection)
        self.css_files.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectionBehavior.SelectRows)
        self.css_files.setShowGrid(False)
        self.css_files.setColumnCount(2)
        self.css_files.setObjectName("css_files")
        self.css_files.setRowCount(0)
        item = QtWidgets.QTableWidgetItem()
        self.css_files.setHorizontalHeaderItem(0, item)
        item = QtWidgets.QTableWidgetItem()
        item.setTextAlignment(QtCore.Qt.AlignmentFlag.AlignLeading|QtCore.Qt.AlignmentFlag.AlignLeft|QtCore.Qt.AlignmentFlag.AlignVCenter)
        self.css_files.setHorizontalHeaderItem(1, item)
        self.css_panel_layout.addWidget(self.css_files)
        self.css_actions_row1 = QtWidgets.QHBoxLayout()
        self.css_actions_row1.setObjectName("css_actions_row1")
        self.btn_css_create = QtWidgets.QPushButton(parent=self.css_files_group)
        self.btn_css_create.setObjectName("btn_css_create")
        self.css_actions_row1.addWidget(self.btn_css_create)
        self.btn_css_edit = QtWidgets.QPushButton(parent=self.css_files_group)
        self.btn_css_edit.setObjectName("btn_css_edit")
        self.css_actions_row1.addWidget(self.btn_css_edit)
        self.btn_css_delete = QtWidgets.QPushButton(parent=self.css_files_group)
        self.btn_css_delete.setObjectName("btn_css_delete")
        self.css_actions_row1.addWidget(self.btn_css_delete)
        spacerItem1 = QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum)
        self.css_actions_row1.addItem(spacerItem1)
        self.css_panel_layout.addLayout(self.css_actions_row1)
        self.css_actions_row2 = QtWidgets.QHBoxLayout()
        self.css_actions_row2.setObjectName("css_actions_row2")
        self.btn_css_import = QtWidgets.QPushButton(parent=self.css_files_group)
        self.btn_css_import.setObjectName("btn_css_import")
        self.css_actions_row2.addWidget(self.btn_css_import)
        self.btn_css_import_url = QtWidgets.QPushButton(parent=self.css_files_group)
        self.btn_css_import_url.setObjectName("btn_css_import_url")
        self.css_actions_row2.addWidget(self.btn_css_import_url)
        self.btn_css_folder = QtWidgets.QPushButton(parent=self.css_files_group)
        self.btn_css_folder.setObjectName("btn_css_folder")
        self.css_actions_row2.addWidget(self.btn_css_folder)
        spacerItem2 = QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum)
        self.css_actions_row2.addItem(spacerItem2)
        self.css_panel_layout.addLayout(self.css_actions_row2)
        self.assets_panels_layout.addWidget(self.css_files_group)
        self.js_files_group = QtWidgets.QGroupBox(parent=PageCustomizations)
        self.js_files_group.setObjectName("js_files_group")
        self.js_panel_layout = QtWidgets.QVBoxLayout(self.js_files_group)
        self.js_panel_layout.setObjectName("js_panel_layout")
        self.js_enabled = QtWidgets.QCheckBox(parent=self.js_files_group)
        self.js_enabled.setObjectName("js_enabled")
        self.js_panel_layout.addWidget(self.js_enabled)
        self.warning_label = QtWidgets.QLabel(parent=self.js_files_group)
        self.warning_label.setWordWrap(True)
        self.warning_label.setObjectName("warning_label")
        self.js_panel_layout.addWidget(self.warning_label)
        self.js_files = QtWidgets.QTableWidget(parent=self.js_files_group)
        self.js_files.setEditTriggers(QtWidgets.QAbstractItemView.EditTrigger.NoEditTriggers)
        self.js_files.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.SingleSelection)
        self.js_files.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectionBehavior.SelectRows)
        self.js_files.setShowGrid(False)
        self.js_files.setColumnCount(2)
        self.js_files.setObjectName("js_files")
        self.js_files.setRowCount(0)
        item = QtWidgets.QTableWidgetItem()
        self.js_files.setHorizontalHeaderItem(0, item)
        item = QtWidgets.QTableWidgetItem()
        item.setTextAlignment(QtCore.Qt.AlignmentFlag.AlignLeading|QtCore.Qt.AlignmentFlag.AlignLeft|QtCore.Qt.AlignmentFlag.AlignVCenter)
        self.js_files.setHorizontalHeaderItem(1, item)
        self.js_panel_layout.addWidget(self.js_files)
        self.js_actions_row1 = QtWidgets.QHBoxLayout()
        self.js_actions_row1.setObjectName("js_actions_row1")
        self.btn_js_create = QtWidgets.QPushButton(parent=self.js_files_group)
        self.btn_js_create.setObjectName("btn_js_create")
        self.js_actions_row1.addWidget(self.btn_js_create)
        self.btn_js_edit = QtWidgets.QPushButton(parent=self.js_files_group)
        self.btn_js_edit.setObjectName("btn_js_edit")
        self.js_actions_row1.addWidget(self.btn_js_edit)
        self.btn_js_delete = QtWidgets.QPushButton(parent=self.js_files_group)
        self.btn_js_delete.setObjectName("btn_js_delete")
        self.js_actions_row1.addWidget(self.btn_js_delete)
        spacerItem3 = QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum)
        self.js_actions_row1.addItem(spacerItem3)
        self.js_panel_layout.addLayout(self.js_actions_row1)
        self.js_actions_row2 = QtWidgets.QHBoxLayout()
        self.js_actions_row2.setObjectName("js_actions_row2")
        self.btn_js_import = QtWidgets.QPushButton(parent=self.js_files_group)
        self.btn_js_import.setObjectName("btn_js_import")
        self.js_actions_row2.addWidget(self.btn_js_import)
        self.btn_js_import_url = QtWidgets.QPushButton(parent=self.js_files_group)
        self.btn_js_import_url.setObjectName("btn_js_import_url")
        self.js_actions_row2.addWidget(self.btn_js_import_url)
        self.btn_js_folder = QtWidgets.QPushButton(parent=self.js_files_group)
        self.btn_js_folder.setObjectName("btn_js_folder")
        self.js_actions_row2.addWidget(self.btn_js_folder)
        spacerItem4 = QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum)
        self.js_actions_row2.addItem(spacerItem4)
        self.js_panel_layout.addLayout(self.js_actions_row2)
        self.assets_panels_layout.addWidget(self.js_files_group)
        self.mainLayout.addLayout(self.assets_panels_layout)
        self.horizontalLayout_actions = QtWidgets.QHBoxLayout()
        self.horizontalLayout_actions.setObjectName("horizontalLayout_actions")
        spacerItem5 = QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum)
        self.horizontalLayout_actions.addItem(spacerItem5)
        self.btn_save_reload = QtWidgets.QPushButton(parent=PageCustomizations)
        self.btn_save_reload.setObjectName("btn_save_reload")
        self.horizontalLayout_actions.addWidget(self.btn_save_reload)
        self.btn_reload = QtWidgets.QPushButton(parent=PageCustomizations)
        self.btn_reload.setObjectName("btn_reload")
        self.horizontalLayout_actions.addWidget(self.btn_reload)
        self.btn_save = QtWidgets.QPushButton(parent=PageCustomizations)
        self.btn_save.setDefault(True)
        self.btn_save.setObjectName("btn_save")
        self.horizontalLayout_actions.addWidget(self.btn_save)
        self.mainLayout.addLayout(self.horizontalLayout_actions)

        self.retranslateUi(PageCustomizations)
        QtCore.QMetaObject.connectSlotsByName(PageCustomizations)

    def retranslateUi(self, PageCustomizations):
        
        self.label_title.setText(_("Customizations"))
        self.label_scope.setText(_("Account"))
        self.inherit_checkbox.setText(_("Inherit global settings"))
        self.account_scope_hint_label.setText(_("When inherit is disabled, account customizations are appended after global settings."))
        self.css_files_group.setTitle(_("CSS"))
        self.css_enabled.setText(_("Enable custom CSS"))
        self.css_preview_group.setTitle(_("CSS Preview"))
        self.css_preview_stack.setStyleSheet(_("background: palette(base);"))
        self.css_preview_placeholder.setText(_("Select a CSS file to preview."))
        self.css_preview_placeholder_upload_button.setText(_("Upload preview image"))
        self.css_preview_replace_button.setText(_("Replace preview image"))
        item = self.css_files.horizontalHeaderItem(0)
        item.setText(_("Enabled"))
        item = self.css_files.horizontalHeaderItem(1)
        item.setText(_("Filename"))
        self.btn_css_create.setText(_("Create"))
        self.btn_css_edit.setText(_("Edit"))
        self.btn_css_delete.setText(_("Delete"))
        self.btn_css_import.setText(_("Import .css"))
        self.btn_css_import_url.setText(_("Import from URL"))
        self.btn_css_folder.setText(_("Open folder"))
        self.js_files_group.setTitle(_("JavaScript"))
        self.js_enabled.setText(_("Enable custom JavaScript"))
        self.warning_label.setStyleSheet(_("color: #c77800;"))
        self.warning_label.setText(_("⚠ Custom JavaScript runs with full page privileges. Use trusted code only."))
        item = self.js_files.horizontalHeaderItem(0)
        item.setText(_("Enabled"))
        item = self.js_files.horizontalHeaderItem(1)
        item.setText(_("Filename"))
        self.btn_js_create.setText(_("Create"))
        self.btn_js_edit.setText(_("Edit"))
        self.btn_js_delete.setText(_("Delete"))
        self.btn_js_import.setText(_("Import .js"))
        self.btn_js_import_url.setText(_("Import from URL"))
        self.btn_js_folder.setText(_("Open folder"))
        self.btn_save_reload.setText(_("Save and reload"))
        self.btn_reload.setText(_("Reload"))
        self.btn_save.setText(_("Save"))


if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    PageCustomizations = QtWidgets.QWidget()
    ui = Ui_PageCustomizations()
    ui.setupUi(PageCustomizations)
    PageCustomizations.show()
    sys.exit(app.exec())
