# -*- coding: utf-8 -*-from PySide6.QtCore import Qt, QSize, Signalfrom PySide6.QtWidgets import QDialog, QLabelfrom PySide6.QtGui import QGuiApplicationfrom icon import MenuIcon, LogoIconfrom style import LabelStyle, WidgetStyle, ButtonStylefrom ui_feedback import Ui_FeedbackWindowimport os# show feedback information of the applicationclass FeedbackWindow(QDialog):theme_signal = Signal(str)def __init__(self, parent=None, theme=None):super().__init__(parent)self.theme = themeself.clipboard = QGuiApplication.clipboard()self.is_moving = Noneself.start_point = Noneself.window_point = Noneself.ui = Ui_FeedbackWindow()self.ui.setupUi(self)self.init_window()self.init_menu()self.init_content()def init_window(self):self.ui.lbl_logo.setMinimumSize(QSize(24, 24))self.ui.lbl_logo.setMaximumSize(QSize(24, 24))self.ui.lbl_logo.setPixmap(LogoIcon.get_pixmap())self.ui.lbl_logo.setScaledContents(True)self.ui.lbl_logo.setText('')self.ui.lbl_title.setStyleSheet(LabelStyle.get_title())self.ui.wid_main.setContentsMargins(16, 8, 4, 16)self.ui.wid_main.setStyleSheet(WidgetStyle.get_border('wid_main'))self.setWindowFlags(Qt.Dialog | Qt.FramelessWindowHint)def init_menu(self):self.ui.btn_close.setFlat(True)self.ui.btn_close.setIcon(MenuIcon.get_close())self.ui.btn_close.setIconSize(QSize(24, 24))self.ui.btn_close.setText('')self.ui.btn_close.setStyleSheet(ButtonStyle.get_close())self.ui.btn_close.clicked.connect(self.on_exit)def init_content(self):self.ui.layout_body.setAlignment(Qt.AlignCenter)self.ui.layout_body.addStretch()for i in range(4):label = QLabel()label.setFixedHeight(6)self.ui.layout_body.addWidget(label, 1)label = QLabel()label.setText(FeedbackWindow.tr('info_qq'))label.setToolTip(FeedbackWindow.tr('tip_copy_data'))label.setStyleSheet('font-size: 16px')label.mousePressEvent = self.on_copy_dataself.ui.layout_body.addWidget(label, 1)label = QLabel()label.setText(FeedbackWindow.tr('info_email'))label.setToolTip(FeedbackWindow.tr('tip_copy_data'))label.setStyleSheet('font-size: 16px')label.mousePressEvent = self.on_copy_dataself.ui.layout_body.addWidget(label, 1)for i in range(4):label = QLabel()label.setFixedHeight(6)self.ui.layout_body.addWidget(label, 1)@staticmethoddef get_license_folder():return os.path.join(os.getcwd(), "license")def on_exit(self):self.close()# set clipboard textdef on_copy_data(self, e):if e.button() == Qt.LeftButton:widget = self.childAt(e.scenePosition().toPoint())text = widget.text()data = text.split(':')[1]self.clipboard.setText(data.strip())# process mouse event when dragging the windowdef mousePressEvent(self, e):if e.button() == Qt.LeftButton:self.is_moving = Trueself.start_point = e.globalPosition().toPoint()self.window_point = self.frameGeometry().topLeft()def mouseMoveEvent(self, e):if self.is_moving:pos = e.globalPosition().toPoint() - self.start_pointself.move(self.window_point + pos)def mouseReleaseEvent(self, e):self.is_moving = False
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。