def init_ui(self, top_bar_type):
        # 最小化
        self.minus.setFont(qtawesome.font('fa', 25))
        self.minus.setObjectName("minus")
        self.minus.clicked.connect(lambda: self.minus_signal.emit())

        # 最大化
        self.plus.setFont(qtawesome.font('fa', 25))
        self.plus.setObjectName("plus")

        # 关闭
        self.power_off.setFont(qtawesome.font('fa', 25))
        self.power_off.setObjectName("power_off")
        self.power_off.clicked.connect(lambda: self.power_off_signal.emit())

        self.grid.addWidget(self.minus, 0, 4)
        self.grid.addWidget(self.plus, 0, 5)
        self.grid.addWidget(self.power_off, 0, 6)
        # 处理不同风格,wide是登陆界面的风格
        if top_bar_type == "wide":
            self.grid.setColumnStretch(0, 5)
            self.grid.setColumnStretch(1, 5)
            self.grid.setColumnStretch(2, 5)
            self.grid.setColumnStretch(4, 1)
            self.grid.setColumnStretch(5, 1)
            self.grid.setColumnStretch(6, 1)
            self.grid.setRowStretch(0, 5)
            self.grid.setRowStretch(1, 5)
            self.grid.setRowStretch(2, 5)
            self.grid.setRowStretch(3, 5)
        self.grid.setSpacing(20)
        self.setLayout(self.grid)
        self.setContentsMargins(0, 0, 0, 0)
Beispiel #2
0
    def __init__(self):
        super(Window, self).__init__()
        map_window = MapWindow()

        self.takeoffland = TakeoffLandButton()
        self.armdisarm = ArmDisarmButton()
        self.goto = GotoLocationButton(map_window)
        self.flight_mode = QLabel("Flight mode: ", self)
        self.arm = QLabel("DISARM", self)
        self.altitude = QLabel("Altitude: ", self)

        self.battery_widget = QLabel(unichr(0xf079))
        self.battery_widget.setFont(qta.font('mdi', 16))
        self.battery = QLabel("Battery: ", self)

        # self.satellite_widget = qta.IconWidget()
        # satellite_icon = qta.icon('mdi.satellite-variant', scale_factor=1.1)
        # self.satellite_widget.setIcon(satellite_icon)
        self.satellite_widget = QLabel(unichr(0xf471))
        self.satellite_widget.setFont(qta.font('mdi', 16))
        self.gps_info = QLabel("GPS info: ", self)
        self.position_widget = QLabel("Pos: ", self)

        layout = QVBoxLayout(self)
        layout.addWidget(map_window)
        layout.addStretch(1)
        layout.addWidget(self.position_widget)
        layout.addStretch(1)
        layout.addWidget(self.goto)
        layout.addStretch(1)

        layout.addWidget(self.arm)
        layout.addStretch(1)
        layout.addWidget(self.flight_mode)
        layout.addStretch(1)
        layout.addWidget(self.altitude)
        layout.addStretch(1)

        hbox = QHBoxLayout()
        hbox.addWidget(self.battery_widget)
        hbox.addWidget(self.battery)
        layout.addLayout(hbox)
        layout.addStretch(1)

        hbox = QHBoxLayout()
        hbox.addWidget(self.satellite_widget)
        hbox.addWidget(self.gps_info)
        layout.addLayout(hbox)

        layout.addWidget(self.armdisarm)
        layout.addStretch(1)
        layout.addWidget(self.takeoffland)
        layout.addStretch(1)
        # self.setGeometry(100,100,150,150)
        self.setLayout(layout)
    def set_up(self):
        middle_widget = QWidget()
        self.middle_layout = QGridLayout()
        middle_widget.setLayout(self.middle_layout)
        for i in range(self.row):
            middle_icon = QLabel(chr(0xf002) + f'目录_{i}:')
            middle_icon.setFont(qtawesome.font('fa', 12))
            middle_icon.setFixedSize(50, self.height)
            middle_input = QLineEdit()
            middle_input.setFixedHeight(self.height)
            middle_input.setObjectName(f'middle_input_{i}')
            middle_btn = QPushButton("…")
            middle_btn.setFixedSize(50, self.height)
            middle_btn.setObjectName(f'middle_btn_{i}')
            middle_btn.setToolTip('点击选择文件')
            middle_btn.clicked.connect(lambda: self.open_file(middle_widget))

            self.middle_layout.addWidget(middle_icon, i, 0, 1, 1)
            self.middle_layout.addWidget(middle_input, i, 1, 1, self.row - 1)
            self.middle_layout.addWidget(middle_btn, i, self.row, 1, 1)

        middle_icon = QLabel(chr(0xf002) + f'目录_{i}:')
        middle_icon.setFont(qtawesome.font('fa', 12))
        middle_icon.setFixedSize(50, self.height)

        self.middle_time = QLineEdit()
        self.middle_time.setFixedHeight(self.height)
        self.middle_time.setObjectName(f'middle_input_{i}')

        btn = QPushButton("选择日期")
        btn.clicked.connect(self.openCalendar)

        self.cal = QCalendarWidget()
        self.cal.setGridVisible(True)  # 是否显示日期之间的网格
        self.cal.setFixedSize(250, 200)
        self.cal.hide()  # 隐藏日期控件
        self.cal.clicked[QDate].connect(
            self.showDate)  # clicked[参数],即定义showDate是传入的参数类型设置

        self.middle_layout.addWidget(middle_icon, 2, 0, 1, 1)
        self.middle_layout.addWidget(self.middle_time, 2, 1, 1, self.row - 1)
        self.middle_layout.addWidget(btn, 2, self.row, 1, 1)
        self.middle_layout.addWidget(self.cal, 3, 1, 1, 1)

        self.middle_layout.setAlignment(Qt.AlignTop)
        self._obj.mid_layout.addWidget(middle_widget, 0, 0, 1, 1)

        set_first_mode_style(middle_widget)
        return True
    def init_ui(self):
        # 设置部件
        search_icon = QLabel(chr(0xf002))
        search_icon.setFont(qtawesome.font('fa', 20))
        search_icon.setStyleSheet('''
            border: none;
            color: rgb(183, 176, 176);
            margin: 0;
            padding: 0;
        ''')
        qle = QLineEdit()
        qle.setPlaceholderText("搜索")
        qle.setClearButtonEnabled(True)
        qle.setFocusPolicy(Qt.ClickFocus)
        qle.setStyleSheet('''
            border: none;
            background: transparent;
        ''')

        # 设置布局
        gird = QGridLayout()
        gird.addWidget(search_icon, 0, 0, 1, 1)
        gird.addWidget(qle, 0, 2)

        # 应用布局
        self.setLayout(gird)

        self.setStyleSheet('''
            background: rgb(240, 240, 240);
            border-radius: 20px;
            padding: 0;
        ''')
Beispiel #5
0
 def addToolTip(self, tip: str):
     """
     Add icon for tooltip
     """
     self.setToolTip(tip)
     self.setFont(qtawesome.font('fa', 13))
     self.setText(self.text() + ' ' + chr(0xf059))
Beispiel #6
0
    def set_up(self):
        middle_widget = QWidget()
        self.middle_layout = QGridLayout()
        middle_widget.setLayout(self.middle_layout)
        for i in range(self.row):
            middle_icon = QLabel(chr(0xf002) + f'目录_{i}:')
            middle_icon.setFont(qtawesome.font('fa', 12))
            middle_icon.setFixedSize(50, self.height)
            middle_input = QLineEdit()
            middle_input.setFixedHeight(self.height)
            middle_input.setObjectName(f'middle_input_{i}')
            middle_btn = QPushButton("…")
            middle_btn.setFixedSize(50, self.height)
            middle_btn.setObjectName(f'middle_btn_{i}')
            middle_btn.setToolTip('点击选择文件')
            middle_btn.clicked.connect(lambda: self.open_file(middle_widget))

            self.middle_layout.addWidget(middle_icon, i, 0, 1, 1)
            self.middle_layout.addWidget(middle_input, i, 1, 1, self.row - 1)
            self.middle_layout.addWidget(middle_btn, i, self.row, 1, 1)

        self.middle_layout.setAlignment(Qt.AlignTop)
        self._obj.mid_layout.addWidget(middle_widget, 0, 0, 1, 1)

        set_first_mode_style(middle_widget)
        return True
 def init_ui(self, username):
     # 头像图标
     head = QLabel(chr(0xf2bd))
     head.setFont(qtawesome.font('fa', 30))
     # 用户名
     user = QLabel(username)
     self.grid.addWidget(head, 0, 0)
     self.grid.addWidget(user, 0, 2)
     self.setLayout(self.grid)
Beispiel #8
0
    def init_ui(self):
        # 用户头像,使用文字图标
        head = ClickLabel(chr(0xf2bd))
        head.setFont(qtawesome.font('fa', 50))

        # 聊天图标
        chat = ClickLabel(chr(0xf086))
        chat.setFont(qtawesome.font('fa', 30))
        chat.setObjectName("chat")

        # 设置,暂不需要,关闭
        # setting = ClickLabel(chr(0xf0ad))
        # setting.setFont(qtawesome.font("fa", 30))

        # 关于图标
        about = ClickLabel(chr(0xf129))
        about.setFont(qtawesome.font('fa', 30))
        about.clicked.connect(self.tip)

        # 关闭程序,暂不需要,关闭
        # power_off = ClickLabel(chr(0xf011))
        # power_off.setFont(qtawesome.font('fa', 30))
        # power_off.setObjectName("power_off")
        # power_off.clicked.connect(lambda: self.close_connect.emit())

        # 网格布局
        gird = QGridLayout()
        gird.addWidget(head, 0, 0, alignment=Qt.AlignCenter)
        gird.addWidget(chat, 1, 0, alignment=Qt.AlignCenter)
        # gird.addWidget(setting, 2, 0, alignment=Qt.AlignCenter)
        gird.addWidget(about, 2, 0, alignment=Qt.AlignCenter)
        # gird.addWidget(power_off, 5, 0, alignment=Qt.AlignCenter)
        gird.setSpacing(20)
        # 设置各行比例
        gird.setRowStretch(0, 10)
        gird.setRowStretch(1, 5)
        gird.setRowStretch(2, 5)
        gird.setRowStretch(3, 5)
        gird.setRowStretch(4, 70)
        gird.setRowStretch(5, 10)
        self.setLayout(gird)
Beispiel #9
0
    def createWidgets(self):
        content = QGridLayout()
        lblFile = QLabel(self.file, self)
        label = QLabel(unichr(0xf00c))
        label.setFont(qta.font('fa', 16))
        label.setStyleSheet("QLabel {color : green}")

        lblFile.setFixedWidth(550)
        lblFile.setWordWrap(True)

        content.addWidget(lblFile, 0, 0)
        content.addWidget(label, 0, 1)
        self.setLayout(content)
Beispiel #10
0
    def init_ui(self):
        self.bt_search.setFont(qtawesome.font('fa', 16))
        self.bt_search.setText(chr(0xf002) + ' ' + '搜索')
        #qtawesome用法
        #icon_close=qtawesome.icon("fa.close",color='white')
        #self.btclose.setIcon(icon_close)

        # self.setWindowFlag(QtCore.Qt.FramelessWindowHint)  # 隐藏边框
        self.setWindowOpacity(1)  # 设置窗口透明度
        self.setAttribute(QtCore.Qt.WA_TranslucentBackground)  # 设置窗口背景透明

        self.tabWidget.setTabText(0, "项目浏览")
        self.tabWidget.setTabsClosable(1)
        self.tabWidget.tabBar().setTabButton(0, QtWidgets.QTabBar.RightSide,
                                             None)
        self.tabWidget.tabCloseRequested.connect(self.mclose)
Beispiel #11
0
    def init_ui(self):
        # 头像图标
        self.head.setFont(qtawesome.font('fa', 120))
        self.head.setObjectName("head")
        # 添加部件
        self.grid.addWidget(self.head, 0, 0, 1, 1)
        self.grid.addWidget(self.input_message, 0, 2, 1, 4)
        self.grid.addWidget(self.confirm, 3, 2, 1, 1)
        self.grid.addWidget(self.register, 3, 4, 1, 1)
        # 设置间距
        self.grid.setSpacing(30)
        # 应用布局
        self.setLayout(self.grid)
        # 设置边距
        self.setContentsMargins(20, 10, 20, 10)

        # 处理信号
        self.confirm.clicked.connect(lambda: self.emit_signal("login"))
        self.register.clicked.connect(lambda: self.emit_signal("register"))
Beispiel #12
0
    def init_ui(self):
        # 表情图标
        self.expression.setFont(qtawesome.font('fa', 22))

        # 上传文件图标
        # self.upload_file.setText(chr(0xf07b))
        # self.upload_file.setFont(qtawesome.font('fa', 22))

        self.grid.addWidget(self.expression, 0, 0, alignment=Qt.AlignLeft)
        # self.grid.addWidget(self.upload_file, 0, 1, alignment=Qt.AlignLeft)

        # 设置列比例
        self.grid.setColumnStretch(0, 10)
        # self.grid.setColumnStretch(1, 10)
        self.grid.setColumnStretch(2, 100)
        self.setLayout(self.grid)

        # 处理信号
        self.expression.clicked.connect(lambda: self.expression_widget.show())
        self.expression_widget.expression_signal.connect(self.add_expression)
    def init_ui(self, **kwargs):
        # 头像图标
        head = QLabel(chr(0xf2bd))
        head.setFont(qtawesome.font('fa', 25))

        # 用户名
        name = QLabel(kwargs['name'])

        # 消息,消息不能过长,所有每35个字符后,加一个换行
        message = QLabel(
            re.sub(r"(.{35})", "\\1\n", emoji.emojize(kwargs['message'])))
        # 边距
        message.setContentsMargins(0, 0, 0, 0)
        message.setObjectName("message")

        # 对齐方式
        alignment = kwargs['alignment']
        if not alignment or alignment == "left":
            self.grid.addWidget(head, 0, 0)
            self.grid.addWidget(name, 0, 1)
            self.grid.addWidget(message, 1, 1)
            self.grid.setRowStretch(0, 5)
            self.grid.setRowStretch(1, 10)
            self.grid.setRowStretch(2, 1)
            self.grid.setColumnStretch(4, 5)
        else:
            self.grid.addWidget(head, 0, 6)
            self.grid.addWidget(name, 0, 4, 1, 1, alignment=Qt.AlignRight)
            self.grid.addWidget(message, 1, 4)
            self.grid.setColumnStretch(0, 10)
        # 间距
        self.grid.setSpacing(10)
        # 应用
        self.setLayout(self.grid)
        # 边距
        self.setContentsMargins(10, 10, 10, 10)
Beispiel #14
0
    def __init__(self, parent=None):
        super(Client, self).__init__(parent)

        self.networkSession = None
        self.blockSize = 0
        self.currentFortune = ''
        self.title = "扫码收货PC辅助程序"

        hostLabel = QLabel('IP:')
        hostLabel.setFont(qtawesome.font('fa', 14))

        portLabel = QLabel('端口:')
        portLabel.setFont(qtawesome.font('fa', 14))

        taskCodeLabel = QLabel('任务码:')
        taskCodeLabel.setFont(qtawesome.font('fa', 14))
        self.serverMsgLable = QLabel('来自服务端的消息:')
        self.serverMsgLable.setFont(qtawesome.font('fa', 14))

        self.sendMsgLabel = QLabel('将要发送的消息:')
        self.sendMsgLabel.setFont(qtawesome.font('fa', 14))

        self.hostCombo = QComboBox()
        self.hostCombo.setEditable(True)

        name = QHostInfo.localHostName()
        if name != '':
            self.hostCombo.addItem(name)

            domain = QHostInfo.localDomainName()
            if domain != '':
                self.hostCombo.addItem(name + '.' + domain)

        if name != 'localhost':
            self.hostCombo.addItem('10.286.88.124')

        ipAddressesList = QNetworkInterface.allAddresses()

        for ipAddress in ipAddressesList:
            if not ipAddress.isLoopback():
                self.hostCombo.addItem(ipAddress.toString())

        for ipAddress in ipAddressesList:
            if ipAddress.isLoopback():
                self.hostCombo.addItem(ipAddress.toString())

        self.portLineEdit = QLineEdit()
        self.portLineEdit.setValidator(QIntValidator(1, 65535, self))
        self.portLineEdit.setPlaceholderText("请输入端口")

        self.taskLineEdit = QLineEdit()
        self.taskLineEdit.setPlaceholderText("请向组长询问后输入任务码")
        self.taskLineEdit.setValidator(QIntValidator(1, 9999, self))

        self.serverLineEdit = QLineEdit()
        self.serverLineEdit.setPlaceholderText('服务器发送的消息会显示在这里')

        self.sendTextEdit = QTextEdit()
        self.sendTextEdit.setPlaceholderText('请输入先要发送给服务器的消息')

        hostLabel.setBuddy(self.hostCombo)
        portLabel.setBuddy(self.portLineEdit)
        taskCodeLabel.setBuddy(self.taskLineEdit)
        self.serverMsgLable.setBuddy(self.serverLineEdit)
        self.sendMsgLabel.setBuddy(self.sendTextEdit)

        self.statusLabel = QLabel("状态:尚未连接")
        self.statusLabel.setAutoFillBackground(True)
        self.statusLabel.setAlignment(Qt.AlignCenter)
        palette = QPalette()  # 新建一个调色板
        palette.setColor(QPalette.Window, Qt.red)  # 设置颜色
        self.statusLabel.setPalette(palette)
        self.statusLabel.setStyleSheet('''
                color:#ffffff;
                font-size:18px;
                font-weight:bold;
        ''')

        self.getFortuneButton = QPushButton("启动连接")
        self.getFortuneButton.setDefault(True)
        self.getFortuneButton.setEnabled(False)

        quitButton = QPushButton("退出")
        self.stopButton = QPushButton("中止连接")
        self.stopButton.setDefault(True)
        self.stopButton.setEnabled(False)

        buttonBox = QDialogButtonBox()
        buttonBox.addButton(self.getFortuneButton, QDialogButtonBox.ActionRole)
        buttonBox.addButton(self.stopButton, QDialogButtonBox.AcceptRole)
        buttonBox.addButton(quitButton, QDialogButtonBox.RejectRole)
        self.sendMsgbutton = QPushButton('发送消息')
        self.webSocket = QWebSocket()

        self.hostCombo.editTextChanged.connect(self.enableGetFortuneButton)
        self.portLineEdit.textChanged.connect(self.enableGetFortuneButton)
        self.taskLineEdit.textChanged.connect(self.enableGetFortuneButton)
        self.getFortuneButton.clicked.connect(self.CreateNewConn)
        self.stopButton.clicked.connect(self.stopCurrentConn)
        quitButton.clicked.connect(self.close)
        self.webSocket.connected.connect(self.websocketConnect)
        self.webSocket.disconnected.connect(self.webSocketDisconnect)
        self.webSocket.error.connect(self.displayError)
        self.webSocket.textMessageReceived.connect(
            self.webSocketMessageReceived)
        self.sendTextEdit.textChanged.connect(self.enableSendMessageButton)
        self.sendMsgbutton.clicked.connect(self.sendMsgToServer)

        mainLayout = QGridLayout()
        mainLayout.addWidget(hostLabel, 0, 0)
        mainLayout.addWidget(self.hostCombo, 0, 1)
        mainLayout.addWidget(portLabel, 1, 0)
        mainLayout.addWidget(self.portLineEdit, 1, 1)
        mainLayout.addWidget(taskCodeLabel, 2, 0)
        mainLayout.addWidget(self.taskLineEdit, 2, 1)
        mainLayout.addWidget(self.statusLabel, 3, 0, 1, 2)
        mainLayout.addWidget(buttonBox, 4, 0, 1, 2)
        mainLayout.addWidget(self.serverMsgLable, 5, 0)
        mainLayout.addWidget(self.serverLineEdit, 5, 1, 1, 1)
        mainLayout.addWidget(self.sendMsgLabel, 6, 0)
        mainLayout.addWidget(self.sendTextEdit, 6, 1)
        mainLayout.addWidget(self.sendMsgbutton, 7, 0, 1, 5)
        self.serverLineEdit.setEnabled(False)
        self.serverMsgLable.setVisible(False)
        self.serverLineEdit.setVisible(False)
        self.sendMsgLabel.setVisible(False)
        self.sendTextEdit.setVisible(False)
        self.sendMsgbutton.setEnabled(False)
        self.sendMsgbutton.setVisible(False)
        self.setLayout(mainLayout)
        mainLayout.setSpacing(10)
        self.setWindowTitle(self.title)
        self.portLineEdit.setFocus()
        manager = QNetworkConfigurationManager()
        if manager.capabilities(
        ) & QNetworkConfigurationManager.NetworkSessionRequired:
            settings = QSettings(QSettings.UserScope, 'QtProject')
            settings.beginGroup('QtNetwork')
            id = settings.value('DefaultNetworkConfiguration')
            settings.endGroup()

            config = manager.configurationFromIdentifier(id)
            if config.state() & QNetworkConfiguration.Discovered == 0:
                config = manager.defaultConfiguration()

            self.networkSession = QNetworkSession(config, self)
            self.networkSession.opened.connect(self.sessionOpened)

            self.getFortuneButton.setEnabled(False)
            self.statusLabel.setText("Opening network session.")
            self.networkSession.open()
Beispiel #15
0
    def init_ui(self):
        self.setFixedSize(960, 700)
        self.main_widget = QtWidgets.QWidget()  # 创建窗口主部件
        self.main_layout = QtWidgets.QGridLayout()  # 创建主部件的网格布局
        self.main_widget.setLayout(self.main_layout)  # 设置窗口主部件布局为网格布局

        self.left_widget = QtWidgets.QWidget()  # 创建左侧部件
        self.left_widget.setObjectName('left_widget')
        self.left_layout = QtWidgets.QGridLayout()  # 创建左侧部件的网格布局层
        self.left_widget.setLayout(self.left_layout)  # 设置左侧部件布局为网格

        self.right_widget = QtWidgets.QWidget()  # 创建右侧部件
        self.right_widget.setObjectName('right_widget')
        self.right_layout = QtWidgets.QGridLayout()
        self.right_widget.setLayout(self.right_layout)  # 设置右侧部件布局为网格

        self.main_layout.addWidget(self.left_widget, 0, 0, 12,
                                   2)  # 左侧部件在第0行第0列,占8行3列
        self.main_layout.addWidget(self.right_widget, 0, 2, 12,
                                   10)  # 右侧部件在第0行第3列,占8行9列
        self.setCentralWidget(self.main_widget)  # 设置窗口主部件
        '''d1'''
        self.left_close = QtWidgets.QPushButton("")  # 关闭按钮
        self.left_visit = QtWidgets.QPushButton("")  # 空白按钮
        self.left_mini = QtWidgets.QPushButton("")  # 最小化按钮

        self.left_label_1 = QtWidgets.QPushButton("每日推荐")
        self.left_label_1.setObjectName('left_label')
        self.left_label_2 = QtWidgets.QPushButton("我的音乐")
        self.left_label_2.setObjectName('left_label')
        self.left_label_3 = QtWidgets.QPushButton("联系与帮助")
        self.left_label_3.setObjectName('left_label')

        self.left_button_1 = QtWidgets.QPushButton(
            qtawesome.icon('fa.music', color='white'), "华语流行")
        self.left_button_1.setObjectName('left_button')
        self.left_button_2 = QtWidgets.QPushButton(
            qtawesome.icon('fa.sellsy', color='white'), "在线FM")
        self.left_button_2.setObjectName('left_button')
        self.left_button_3 = QtWidgets.QPushButton(
            qtawesome.icon('fa.film', color='white'), "热门MV")
        self.left_button_3.setObjectName('left_button')
        self.left_button_4 = QtWidgets.QPushButton(
            qtawesome.icon('fa.home', color='white'), "本地音乐")
        self.left_button_4.setObjectName('left_button')
        self.left_button_5 = QtWidgets.QPushButton(
            qtawesome.icon('fa.download', color='white'), "下载管理")
        self.left_button_5.setObjectName('left_button')
        self.left_button_6 = QtWidgets.QPushButton(
            qtawesome.icon('fa.heart', color='white'), "我的收藏")
        self.left_button_6.setObjectName('left_button')
        self.left_button_7 = QtWidgets.QPushButton(
            qtawesome.icon('fa.comment', color='white'), "反馈建议")
        self.left_button_7.setObjectName('left_button')
        self.left_button_8 = QtWidgets.QPushButton(
            qtawesome.icon('fa.star', color='white'), "关注我们")
        self.left_button_8.setObjectName('left_button')
        self.left_button_9 = QtWidgets.QPushButton(
            qtawesome.icon('fa.question', color='white'), "遇到问题")
        self.left_button_9.setObjectName('left_button')
        self.left_xxx = QtWidgets.QPushButton(" ")

        self.left_layout.addWidget(self.left_mini, 0, 0, 1, 1)
        self.left_layout.addWidget(self.left_close, 0, 2, 1, 1)
        self.left_layout.addWidget(self.left_visit, 0, 1, 1, 1)
        self.left_layout.addWidget(self.left_label_1, 1, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_1, 2, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_2, 3, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_3, 4, 0, 1, 3)
        self.left_layout.addWidget(self.left_label_2, 5, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_4, 6, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_5, 7, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_6, 8, 0, 1, 3)
        self.left_layout.addWidget(self.left_label_3, 9, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_7, 10, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_8, 11, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_9, 12, 0, 1, 3)

        self.left_widget = QtWidgets.QWidget()
        self.left_widget.setObjectName('left_widget')
        self.left_layout = QtWidgets.QGridLayout()
        self.left_widget.setLayout(self.left_layout)

        self.right_widget = QtWidgets.QWidget()
        self.right_widget.setObjectName('right_widget')
        self.right_layout = QtWidgets.QGridLayout()
        self.right_widget.setLayout(self.right_layout)

        self.main_layout.addWidget(self.left_widget, 0, 0, 12, 2)
        self.main_layout.addWidget(self.right_widget, 0, 2, 12, 10)
        self.setCentralWidget(self.main_widget)

        self.right_bar = QtWidgets.QWidget()
        self.right_bar_layout = QtWidgets.QGridLayout()
        self.right_bar.setLayout(self.right_bar_layout)
        self.search_icon = QtWidgets.QLabel(chr(0xf002) + '' + '搜索')
        self.search_icon.setFont(qtawesome.font('fa', 16))
        self.right_bar_widget_search_input = QtWidgets.QLineEdit()
        self.right_bar_widget_search_input.setPlaceholderText("输入歌手或者")

        self.right_bar_layout.addWidget(self.search_icon, 0, 0, 1, 1)
        self.right_bar_layout.addWidget(self.right_bar_widget_search_input, 0,
                                        1, 1, 8)
        self.right_layout.addWidget(self.right_bar, 0, 0, 1, 9)

        self.right_recommend_label = QtWidgets.QLabel("今日推荐")
        self.right_recommend_label.setObjectName('right_lable')

        self.right_recommend_widget = QtWidgets.QWidget()  # 推荐封面部件
        self.right_recommend_layout = QtWidgets.QGridLayout()  # 推荐封面网格布局
        self.right_recommend_widget.setLayout(self.right_recommend_layout)

        self.recommend_button_1 = QtWidgets.QToolButton()
        self.recommend_button_1.setText("可馨HANM")  # 设置按钮文本
        self.recommend_button_1.setIcon(QtGui.QIcon('./p1.jpg'))  # 设置按钮图标
        self.recommend_button_1.setIconSize(QtCore.QSize(100, 100))  # 设置图标大小
        self.recommend_button_1.setToolButtonStyle(
            QtCore.Qt.ToolButtonTextUnderIcon)  # 设置按钮形式为上图下文

        self.right_recommend_layout.addWidget(self.recommend_button_1, 0, 0)

        self.right_layout.addWidget(self.right_recommend_label, 1, 0, 1, 9)
        self.right_layout.addWidget(self.right_recommend_widget, 2, 0, 2, 9)
        '''self.button_1 = QtWidgets.QToolButton()
Beispiel #16
0
    def init_ui(self):
        self.setFixedSize(960,700)
        self.main_widget = QtWidgets.QWidget()  # 创建窗口主部件
        self.main_layout = QtWidgets.QGridLayout()  # 创建主部件的网格布局
        self.main_widget.setLayout(self.main_layout)  # 设置窗口主部件布局为网格布局

        self.left_widget = QtWidgets.QWidget()  # 创建左侧部件
        self.left_widget.setObjectName('left_widget')
        self.left_layout = QtWidgets.QGridLayout()  # 创建左侧部件的网格布局层
        self.left_widget.setLayout(self.left_layout) # 设置左侧部件布局为网格

        self.right_widget = QtWidgets.QWidget() # 创建右侧部件
        self.right_widget.setObjectName('right_widget')
        self.right_layout = QtWidgets.QGridLayout()
        self.right_widget.setLayout(self.right_layout) # 设置右侧部件布局为网格

        self.main_layout.addWidget(self.left_widget,0,0,12,2) # 左侧部件在第0行第0列,占8行3列
        self.main_layout.addWidget(self.right_widget,0,2,12,10) # 右侧部件在第0行第3列,占8行9列
        self.setCentralWidget(self.main_widget) # 设置窗口主部件

        self.left_close = QtWidgets.QPushButton("") # 关闭按钮
        self.left_visit = QtWidgets.QPushButton("") # 空白按钮
        self.left_mini = QtWidgets.QPushButton("")  # 最小化按钮

        self.left_label_1 = QtWidgets.QPushButton("每日推荐")
        self.left_label_1.setObjectName('left_label')
        self.left_label_2 = QtWidgets.QPushButton("我的音乐")
        self.left_label_2.setObjectName('left_label')
        self.left_label_3 = QtWidgets.QPushButton("联系与帮助")
        self.left_label_3.setObjectName('left_label')

        self.left_button_1 = QtWidgets.QPushButton(qtawesome.icon('fa.music',color='white'),"华语流行")
        self.left_button_1.setObjectName('left_button')
        self.left_button_2 = QtWidgets.QPushButton(qtawesome.icon('fa.sellsy',color='white'),"在线FM")
        self.left_button_2.setObjectName('left_button')
        self.left_button_3 = QtWidgets.QPushButton(qtawesome.icon('fa.film',color='white'),"热门MV")
        self.left_button_3.setObjectName('left_button')
        self.left_button_4 = QtWidgets.QPushButton(qtawesome.icon('fa.home',color='white'),"本地音乐")
        self.left_button_4.setObjectName('left_button')
        self.left_button_5 = QtWidgets.QPushButton(qtawesome.icon('fa.download',color='white'),"下载管理")
        self.left_button_5.setObjectName('left_button')
        self.left_button_6 = QtWidgets.QPushButton(qtawesome.icon('fa.heart',color='white'),"我的收藏")
        self.left_button_6.setObjectName('left_button')
        self.left_button_7 = QtWidgets.QPushButton(qtawesome.icon('fa.comment',color='white'),"反馈建议")
        self.left_button_7.setObjectName('left_button')
        self.left_button_8 = QtWidgets.QPushButton(qtawesome.icon('fa.star',color='white'),"关注我们")
        self.left_button_8.setObjectName('left_button')
        self.left_button_9 = QtWidgets.QPushButton(qtawesome.icon('fa.question',color='white'),"遇到问题")
        self.left_button_9.setObjectName('left_button')
        self.left_xxx = QtWidgets.QPushButton(" ")

        self.left_layout.addWidget(self.left_mini, 0, 0,1,1)
        self.left_layout.addWidget(self.left_close, 0, 2,1,1)
        self.left_layout.addWidget(self.left_visit, 0, 1, 1, 1)
        self.left_layout.addWidget(self.left_label_1,1,0,1,3)
        self.left_layout.addWidget(self.left_button_1, 2, 0,1,3)
        self.left_layout.addWidget(self.left_button_2, 3, 0,1,3)
        self.left_layout.addWidget(self.left_button_3, 4, 0,1,3)
        self.left_layout.addWidget(self.left_label_2, 5, 0,1,3)
        self.left_layout.addWidget(self.left_button_4, 6, 0,1,3)
        self.left_layout.addWidget(self.left_button_5, 7, 0,1,3)
        self.left_layout.addWidget(self.left_button_6, 8, 0,1,3)
        self.left_layout.addWidget(self.left_label_3, 9, 0,1,3)
        self.left_layout.addWidget(self.left_button_7, 10, 0,1,3)
        self.left_layout.addWidget(self.left_button_8, 11, 0,1,3)
        self.left_layout.addWidget(self.left_button_9, 12, 0, 1, 3)

        self.right_bar_widget = QtWidgets.QWidget() # 右侧顶部搜索框部件
        self.right_bar_layout = QtWidgets.QGridLayout() # 右侧顶部搜索框网格布局
        self.right_bar_widget.setLayout(self.right_bar_layout)
        self.search_icon = QtWidgets.QLabel(chr(0xf002) + ' '+'搜索  ')
        self.search_icon.setFont(qtawesome.font('fa', 16))
        self.right_bar_widget_search_input = QtWidgets.QLineEdit()
        self.right_bar_widget_search_input.setPlaceholderText("输入歌手、歌曲或用户,回车进行搜索")

        self.right_bar_layout.addWidget(self.search_icon,0,0,1,1)
        self.right_bar_layout.addWidget(self.right_bar_widget_search_input,0,1,1,8)

        self.right_layout.addWidget(self.right_bar_widget, 0, 0, 1, 9)

        self.right_recommend_label = QtWidgets.QLabel("今日推荐")
        self.right_recommend_label.setObjectName('right_lable')

        self.right_recommend_widget = QtWidgets.QWidget() # 推荐封面部件
        self.right_recommend_layout = QtWidgets.QGridLayout() # 推荐封面网格布局
        self.right_recommend_widget.setLayout(self.right_recommend_layout)

        self.recommend_button_1 = QtWidgets.QToolButton()
        self.recommend_button_1.setText("可馨HANM") # 设置按钮文本
        self.recommend_button_1.setIcon(QtGui.QIcon('./r1.jpg')) # 设置按钮图标
        self.recommend_button_1.setIconSize(QtCore.QSize(100,100)) # 设置图标大小
        self.recommend_button_1.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon) # 设置按钮形式为上图下文

        self.recommend_button_2 = QtWidgets.QToolButton()
        self.recommend_button_2.setText("那首歌")
        self.recommend_button_2.setIcon(QtGui.QIcon('./r2.jpg'))
        self.recommend_button_2.setIconSize(QtCore.QSize(100, 100))
        self.recommend_button_2.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon)

        self.recommend_button_3 = QtWidgets.QToolButton()
        self.recommend_button_3.setText("伟大的渺小")
        self.recommend_button_3.setIcon(QtGui.QIcon('./r3.jpg'))
        self.recommend_button_3.setIconSize(QtCore.QSize(100, 100))
        self.recommend_button_3.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon)

        self.recommend_button_4 = QtWidgets.QToolButton()
        self.recommend_button_4.setText("荣耀征战")
        self.recommend_button_4.setIcon(QtGui.QIcon('./r4.jpg'))
        self.recommend_button_4.setIconSize(QtCore.QSize(100, 100))
        self.recommend_button_4.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon)

        self.recommend_button_5 = QtWidgets.QToolButton()
        self.recommend_button_5.setText("猎场合辑")
        self.recommend_button_5.setIcon(QtGui.QIcon('./r5.jpg'))
        self.recommend_button_5.setIconSize(QtCore.QSize(100, 100))
        self.recommend_button_5.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon)

        self.right_recommend_layout.addWidget(self.recommend_button_1,0,0)
        self.right_recommend_layout.addWidget(self.recommend_button_2,0,1)
        self.right_recommend_layout.addWidget(self.recommend_button_3, 0, 2)
        self.right_recommend_layout.addWidget(self.recommend_button_4, 0, 3)
        self.right_recommend_layout.addWidget(self.recommend_button_5, 0, 4)

        self.right_layout.addWidget(self.right_recommend_label, 1, 0, 1, 9)
        self.right_layout.addWidget(self.right_recommend_widget, 2, 0, 2, 9)

        self.right_newsong_lable = QtWidgets.QLabel("最新歌曲")
        self.right_newsong_lable.setObjectName('right_lable')

        self.right_playlist_lable = QtWidgets.QLabel("热门歌单")
        self.right_playlist_lable.setObjectName('right_lable')

        self.right_newsong_widget = QtWidgets.QWidget()  # 最新歌曲部件
        self.right_newsong_layout = QtWidgets.QGridLayout() # 最新歌曲部件网格布局
        self.right_newsong_widget.setLayout(self.right_newsong_layout)

        self.newsong_button_1 = QtWidgets.QPushButton("夜机      陈慧娴      永远的朋友      03::29")
        self.newsong_button_2 = QtWidgets.QPushButton("夜机      陈慧娴      永远的朋友      03::29")
        self.newsong_button_3 = QtWidgets.QPushButton("夜机      陈慧娴      永远的朋友      03::29")
        self.newsong_button_4 = QtWidgets.QPushButton("夜机      陈慧娴      永远的朋友      03::29")
        self.newsong_button_5 = QtWidgets.QPushButton("夜机      陈慧娴      永远的朋友      03::29")
        self.newsong_button_6 = QtWidgets.QPushButton("夜机      陈慧娴      永远的朋友      03::29")
        self.right_newsong_layout.addWidget(self.newsong_button_1,0,1,)
        self.right_newsong_layout.addWidget(self.newsong_button_2, 1, 1, )
        self.right_newsong_layout.addWidget(self.newsong_button_3, 2, 1, )
        self.right_newsong_layout.addWidget(self.newsong_button_4, 3, 1, )
        self.right_newsong_layout.addWidget(self.newsong_button_5, 4, 1, )
        self.right_newsong_layout.addWidget(self.newsong_button_6, 5, 1, )

        self.right_playlist_widget = QtWidgets.QWidget() # 播放歌单部件
        self.right_playlist_layout = QtWidgets.QGridLayout() # 播放歌单网格布局
        self.right_playlist_widget.setLayout(self.right_playlist_layout)

        self.playlist_button_1 = QtWidgets.QToolButton()
        self.playlist_button_1.setText("无法释怀的整天循环音乐…")
        self.playlist_button_1.setIcon(QtGui.QIcon('./p1.jpg'))
        self.playlist_button_1.setIconSize(QtCore.QSize(100, 100))
        self.playlist_button_1.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon)

        self.playlist_button_2 = QtWidgets.QToolButton()
        self.playlist_button_2.setText("不需要歌词,也可以打动你的心")
        self.playlist_button_2.setIcon(QtGui.QIcon('./p2.jpg'))
        self.playlist_button_2.setIconSize(QtCore.QSize(100, 100))
        self.playlist_button_2.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon)

        self.playlist_button_3 = QtWidgets.QToolButton()
        self.playlist_button_3.setText("那些你熟悉又不知道名字…")
        self.playlist_button_3.setIcon(QtGui.QIcon('./p3.jpg'))
        self.playlist_button_3.setIconSize(QtCore.QSize(100, 100))
        self.playlist_button_3.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon)

        self.playlist_button_4 = QtWidgets.QToolButton()
        self.playlist_button_4.setText("那些只听前奏就中毒的英文歌")
        self.playlist_button_4.setIcon(QtGui.QIcon('./p4.jpg'))
        self.playlist_button_4.setIconSize(QtCore.QSize(100, 100))
        self.playlist_button_4.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon)

        self.right_playlist_layout.addWidget(self.playlist_button_1,0,0)
        self.right_playlist_layout.addWidget(self.playlist_button_2, 0, 1)
        self.right_playlist_layout.addWidget(self.playlist_button_3, 1, 0)
        self.right_playlist_layout.addWidget(self.playlist_button_4, 1, 1)

        self.right_layout.addWidget(self.right_newsong_lable, 4, 0, 1, 5)
        self.right_layout.addWidget(self.right_playlist_lable, 4, 5, 1, 4)
        self.right_layout.addWidget(self.right_newsong_widget, 5, 0, 1, 5)
        self.right_layout.addWidget(self.right_playlist_widget, 5, 5, 1, 4)

        self.right_process_bar = QtWidgets.QProgressBar()  # 播放进度部件
        self.right_process_bar.setValue(49)
        self.right_process_bar.setFixedHeight(3)  # 设置进度条高度
        self.right_process_bar.setTextVisible(False)  # 不显示进度条文字

        self.right_playconsole_widget = QtWidgets.QWidget()  # 播放控制部件
        self.right_playconsole_layout = QtWidgets.QGridLayout()  # 播放控制部件网格布局层
        self.right_playconsole_widget.setLayout(self.right_playconsole_layout)

        self.console_button_1 = QtWidgets.QPushButton(qtawesome.icon('fa.backward', color='#F76677'), "")
        self.console_button_2 = QtWidgets.QPushButton(qtawesome.icon('fa.forward', color='#F76677'), "")
        self.console_button_3 = QtWidgets.QPushButton(qtawesome.icon('fa.pause', color='#F76677', font=18), "")
        self.console_button_3.setIconSize(QtCore.QSize(30, 30))

        self.right_playconsole_layout.addWidget(self.console_button_1, 0, 0)
        self.right_playconsole_layout.addWidget(self.console_button_2, 0, 2)
        self.right_playconsole_layout.addWidget(self.console_button_3, 0, 1)
        self.right_playconsole_layout.setAlignment(QtCore.Qt.AlignCenter)  # 设置布局内部件居中显示

        self.right_layout.addWidget(self.right_process_bar, 9, 0, 1, 9)
        self.right_layout.addWidget(self.right_playconsole_widget, 10, 0, 1, 9)

        self.left_close.setFixedSize(15,15) # 设置关闭按钮的大小
        self.left_visit.setFixedSize(15, 15)  # 设置按钮大小
        self.left_mini.setFixedSize(15, 15) # 设置最小化按钮大小

        self.left_close.setStyleSheet('''QPushButton{background:#F76677;border-radius:5px;}QPushButton:hover{background:red;}''')
        self.left_visit.setStyleSheet('''QPushButton{background:#F7D674;border-radius:5px;}QPushButton:hover{background:yellow;}''')
        self.left_mini.setStyleSheet('''QPushButton{background:#6DDF6D;border-radius:5px;}QPushButton:hover{background:green;}''')

        self.left_widget.setStyleSheet('''
            QPushButton{border:none;color:white;}
            QPushButton#left_label{
                border:none;
                border-bottom:1px solid white;
                font-size:18px;
                font-weight:700;
                font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
            }
            QPushButton#left_button:hover{border-left:4px solid red;font-weight:700;}
        ''')

        self.right_bar_widget_search_input.setStyleSheet(
        '''QLineEdit{
                border:1px solid gray;
                width:300px;
                border-radius:10px;
                padding:2px 4px;
        }''')

        self.right_widget.setStyleSheet('''
            QWidget#right_widget{
                color:#232C51;
                background:white;
                border-top:1px solid darkGray;
                border-bottom:1px solid darkGray;
                border-right:1px solid darkGray;
                border-top-right-radius:10px;
                border-bottom-right-radius:10px;
            }
            QLabel#right_lable{
                border:none;
                font-size:16px;
                font-weight:700;
                font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
            }
        ''')

        self.right_recommend_widget.setStyleSheet(
            '''
                QToolButton{border:none;}
                QToolButton:hover{border-bottom:2px solid #F76677;}
            ''')
        self.right_playlist_widget.setStyleSheet(
            '''
                QToolButton{border:none;}
                QToolButton:hover{border-bottom:2px solid #F76677;}
            ''')

        self.right_newsong_widget.setStyleSheet('''
            QPushButton{
                border:none;
                color:gray;
                font-size:12px;
                height:40px;
                padding-left:5px;
                padding-right:10px;
                text-align:left;
            }
            QPushButton:hover{
                color:black;
                border:1px solid #F3F3F5;
                border-radius:10px;
                background:LightGray;
            }
        ''')

        self.right_process_bar.setStyleSheet('''
            QProgressBar::chunk {
                background-color: #F76677;
            }
        ''')

        self.right_playconsole_widget.setStyleSheet('''
            QPushButton{
                border:none;
            }
        ''')

        self.setWindowOpacity(0.9) # 设置窗口透明度
        self.setAttribute(QtCore.Qt.WA_TranslucentBackground) # 设置窗口背景透明
        # palette = QtGui.QPalette()
        # palette.setColor(palette.Background, QtGui.QColor(0,0,0))
        # self.setPalette(palette)

        self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTopHint) # 隐藏边框

        self.left_widget.setStyleSheet('''
            QWidget#left_widget{
                background:gray;
                border-top:1px solid white;
                border-bottom:1px solid white;
                border-left:1px solid white;
                border-top-left-radius:10px;
                border-bottom-left-radius:10px;
            }
        ''')
        
        self.main_layout.setSpacing(0)
Beispiel #17
0
    def init_ui(self):
        self.setFixedSize(960, 700)
        self.main_widget = QtWidgets.QWidget()  # 创建窗口主部件
        self.main_layout = QtWidgets.QGridLayout()  # 创建主部件的网格布局
        self.main_widget.setLayout(self.main_layout)  # 设置窗口主部件布局为网格布局

        self.left_widget = QtWidgets.QWidget()  # 创建左侧部件
        self.left_widget.setObjectName('left_widget')
        self.left_layout = QtWidgets.QGridLayout()  # 创建左侧部件的网格布局层
        self.left_widget.setLayout(self.left_layout)  # 设置左侧部件布局为网格

        self.right_widget = QtWidgets.QWidget()  # 创建右侧部件
        self.right_widget.setObjectName('right_widget')
        self.right_layout = QtWidgets.QGridLayout()
        self.right_widget.setLayout(self.right_layout)  # 设置右侧部件布局为网格

        #控件名,行,列,占用行数,占用列数,对齐方式
        self.main_layout.addWidget(self.left_widget, 0, 0, 12,
                                   2)  # 左侧部件在第0行第0列,占8行3列
        self.main_layout.addWidget(self.right_widget, 0, 2, 12,
                                   10)  # 右侧部件在第0行第3列,占8行9列
        self.setCentralWidget(self.main_widget)  # 设置窗口主部件

        self.left_close = QtWidgets.QPushButton("关闭")  # 关闭按钮
        self.left_visit = QtWidgets.QPushButton("")  # 空白按钮
        self.left_mini = QtWidgets.QPushButton("最小化")  # 最小化按钮

        self.left_label_1 = QtWidgets.QPushButton("每日推荐")
        self.left_label_1.setObjectName('left_label')
        self.left_label_2 = QtWidgets.QPushButton("我的音乐")
        self.left_label_2.setObjectName('left_label')
        self.left_label_3 = QtWidgets.QPushButton("联系与帮助")
        self.left_label_3.setObjectName('left_label')

        self.left_button_1 = QtWidgets.QPushButton(
            qtawesome.icon('fa.music', color='white'), "华语流行")
        self.left_button_1.setObjectName('left_button')
        self.left_button_2 = QtWidgets.QPushButton(
            qtawesome.icon('fa.sellsy', color='white'), "在线FM")
        self.left_button_2.setObjectName('left_button')
        self.left_button_3 = QtWidgets.QPushButton(
            qtawesome.icon('fa.film', color='white'), "热门MV")
        self.left_button_3.setObjectName('left_button')
        self.left_button_4 = QtWidgets.QPushButton(
            qtawesome.icon('fa.home', color='white'), "本地音乐")
        self.left_button_4.setObjectName('left_button')
        self.left_button_5 = QtWidgets.QPushButton(
            qtawesome.icon('fa.download', color='white'), "下载管理")
        self.left_button_5.setObjectName('left_button')
        self.left_button_6 = QtWidgets.QPushButton(
            qtawesome.icon('fa.heart', color='white'), "我的收藏")
        self.left_button_6.setObjectName('left_button')
        self.left_button_7 = QtWidgets.QPushButton(
            qtawesome.icon('fa.comment', color='white'), "反馈建议")
        self.left_button_7.setObjectName('left_button')
        self.left_button_8 = QtWidgets.QPushButton(
            qtawesome.icon('fa.star', color='white'), "关注我们")
        self.left_button_8.setObjectName('left_button')
        self.left_button_9 = QtWidgets.QPushButton(
            qtawesome.icon('fa.question', color='white'), "遇到问题")
        self.left_button_9.setObjectName('left_button')
        self.left_xxx = QtWidgets.QPushButton(" ")

        self.left_layout.addWidget(self.left_mini, 0, 0, 1, 1)
        self.left_layout.addWidget(self.left_close, 0, 2, 1, 1)
        self.left_layout.addWidget(self.left_visit, 0, 1, 1, 1)
        self.left_layout.addWidget(self.left_label_1, 1, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_1, 2, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_2, 3, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_3, 4, 0, 1, 3)
        self.left_layout.addWidget(self.left_label_2, 5, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_4, 6, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_5, 7, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_6, 8, 0, 1, 3)
        self.left_layout.addWidget(self.left_label_3, 9, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_7, 10, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_8, 11, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_9, 12, 0, 1, 3)

        self.right_bar_widget = QtWidgets.QWidget()  # 右侧顶部搜索框部件
        self.right_bar_layout = QtWidgets.QGridLayout()  # 右侧顶部搜索框网格布局
        self.right_bar_widget.setLayout(self.right_bar_layout)
        self.search_icon = QtWidgets.QLabel(chr(0xf002) + ' ' + '搜索  ')
        self.search_icon.setFont(qtawesome.font('fa', 16))
        self.right_bar_widget_search_input = QtWidgets.QLineEdit()
        self.right_bar_widget_search_input.setPlaceholderText(
            "输入歌手、歌曲或用户,回车进行搜索")

        self.right_bar_layout.addWidget(self.search_icon, 0, 0, 1, 1)
        self.right_bar_layout.addWidget(self.right_bar_widget_search_input, 0,
                                        1, 1, 8)

        self.right_layout.addWidget(self.right_bar_widget, 0, 0, 1, 9)

        self.right_recommend_label = QtWidgets.QLabel("今日推荐")
        self.right_recommend_label.setObjectName('right_lable')

        self.right_recommend_widget = QtWidgets.QWidget()  # 推荐封面部件
        self.right_recommend_layout = QtWidgets.QGridLayout()  # 推荐封面网格布局
        self.right_recommend_widget.setLayout(self.right_recommend_layout)

        self.recommend_button_1 = QtWidgets.QToolButton()
        self.recommend_button_1.setText("可馨HANM")  # 设置按钮文本
        self.recommend_button_1.setIcon(QtGui.QIcon('./r1.jpg'))  # 设置按钮图标
        self.recommend_button_1.setIconSize(QtCore.QSize(100, 100))  # 设置图标大小
        self.recommend_button_1.setToolButtonStyle(
            QtCore.Qt.ToolButtonTextUnderIcon)  # 设置按钮形式为上图下文

        self.recommend_button_2 = QtWidgets.QToolButton()
        self.recommend_button_2.setText("那首歌")
        self.recommend_button_2.setIcon(QtGui.QIcon('./r2.jpg'))
        self.recommend_button_2.setIconSize(QtCore.QSize(100, 100))
        self.recommend_button_2.setToolButtonStyle(
            QtCore.Qt.ToolButtonTextUnderIcon)

        self.recommend_button_3 = QtWidgets.QToolButton()
        self.recommend_button_3.setText("伟大的渺小")
        self.recommend_button_3.setIcon(QtGui.QIcon('./r3.jpg'))
        self.recommend_button_3.setIconSize(QtCore.QSize(100, 100))
        self.recommend_button_3.setToolButtonStyle(
            QtCore.Qt.ToolButtonTextUnderIcon)

        self.recommend_button_4 = QtWidgets.QToolButton()
        self.recommend_button_4.setText("荣耀征战")
        self.recommend_button_4.setIcon(QtGui.QIcon('./r4.jpg'))
        self.recommend_button_4.setIconSize(QtCore.QSize(100, 100))
        self.recommend_button_4.setToolButtonStyle(
            QtCore.Qt.ToolButtonTextUnderIcon)

        self.recommend_button_5 = QtWidgets.QToolButton()
        self.recommend_button_5.setText("猎场合辑")
        self.recommend_button_5.setIcon(QtGui.QIcon('./r5.jpg'))
        self.recommend_button_5.setIconSize(QtCore.QSize(100, 100))
        self.recommend_button_5.setToolButtonStyle(
            QtCore.Qt.ToolButtonTextUnderIcon)

        self.right_recommend_layout.addWidget(self.recommend_button_1, 0, 0)
        self.right_recommend_layout.addWidget(self.recommend_button_2, 0, 1)
        self.right_recommend_layout.addWidget(self.recommend_button_3, 0, 2)
        self.right_recommend_layout.addWidget(self.recommend_button_4, 0, 3)
        self.right_recommend_layout.addWidget(self.recommend_button_5, 0, 4)

        self.right_layout.addWidget(self.right_recommend_label, 1, 0, 1, 9)
        self.right_layout.addWidget(self.right_recommend_widget, 2, 0, 2, 9)

        self.right_newsong_lable = QtWidgets.QLabel("最新歌曲")
        self.right_newsong_lable.setObjectName('right_lable')

        self.right_playlist_lable = QtWidgets.QLabel("热门歌单")
        self.right_playlist_lable.setObjectName('right_lable')

        self.right_newsong_widget = QtWidgets.QWidget()  # 最新歌曲部件
        self.right_newsong_layout = QtWidgets.QGridLayout()  # 最新歌曲部件网格布局
        self.right_newsong_widget.setLayout(self.right_newsong_layout)

        self.newsong_button_1 = QtWidgets.QPushButton(
            "夜机      陈慧娴      永远的朋友      03::29")
        self.newsong_button_2 = QtWidgets.QPushButton(
            "夜机      陈慧娴      永远的朋友      03::29")
        self.newsong_button_3 = QtWidgets.QPushButton(
            "夜机      陈慧娴      永远的朋友      03::29")
        self.newsong_button_4 = QtWidgets.QPushButton(
            "夜机      陈慧娴      永远的朋友      03::29")
        self.newsong_button_5 = QtWidgets.QPushButton(
            "夜机      陈慧娴      永远的朋友      03::29")
        self.newsong_button_6 = QtWidgets.QPushButton(
            "夜机      陈慧娴      永远的朋友      03::29")
        self.right_newsong_layout.addWidget(
            self.newsong_button_1,
            0,
            1,
        )
        self.right_newsong_layout.addWidget(
            self.newsong_button_2,
            1,
            1,
        )
        self.right_newsong_layout.addWidget(
            self.newsong_button_3,
            2,
            1,
        )
        self.right_newsong_layout.addWidget(
            self.newsong_button_4,
            3,
            1,
        )
        self.right_newsong_layout.addWidget(
            self.newsong_button_5,
            4,
            1,
        )
        self.right_newsong_layout.addWidget(
            self.newsong_button_6,
            5,
            1,
        )

        self.right_playlist_widget = QtWidgets.QWidget()  # 播放歌单部件
        self.right_playlist_layout = QtWidgets.QGridLayout()  # 播放歌单网格布局
        self.right_playlist_widget.setLayout(self.right_playlist_layout)

        self.playlist_button_1 = QtWidgets.QToolButton()
        self.playlist_button_1.setText("无法释怀的整天循环音乐…")
        self.playlist_button_1.setIcon(QtGui.QIcon('./p1.jpg'))
        self.playlist_button_1.setIconSize(QtCore.QSize(100, 100))
        self.playlist_button_1.setToolButtonStyle(
            QtCore.Qt.ToolButtonTextUnderIcon)

        self.playlist_button_2 = QtWidgets.QToolButton()
        self.playlist_button_2.setText("不需要歌词,也可以打动你的心")
        self.playlist_button_2.setIcon(QtGui.QIcon('./p2.jpg'))
        self.playlist_button_2.setIconSize(QtCore.QSize(100, 100))
        self.playlist_button_2.setToolButtonStyle(
            QtCore.Qt.ToolButtonTextUnderIcon)

        self.playlist_button_3 = QtWidgets.QToolButton()
        self.playlist_button_3.setText("那些你熟悉又不知道名字…")
        self.playlist_button_3.setIcon(QtGui.QIcon('./p3.jpg'))
        self.playlist_button_3.setIconSize(QtCore.QSize(100, 100))
        self.playlist_button_3.setToolButtonStyle(
            QtCore.Qt.ToolButtonTextUnderIcon)

        self.playlist_button_4 = QtWidgets.QToolButton()
        self.playlist_button_4.setText("那些只听前奏就中毒的英文歌")
        self.playlist_button_4.setIcon(QtGui.QIcon('./p4.jpg'))
        self.playlist_button_4.setIconSize(QtCore.QSize(100, 100))
        self.playlist_button_4.setToolButtonStyle(
            QtCore.Qt.ToolButtonTextUnderIcon)

        self.right_playlist_layout.addWidget(self.playlist_button_1, 0, 0)
        self.right_playlist_layout.addWidget(self.playlist_button_2, 0, 1)
        self.right_playlist_layout.addWidget(self.playlist_button_3, 1, 0)
        self.right_playlist_layout.addWidget(self.playlist_button_4, 1, 1)

        self.right_layout.addWidget(self.right_newsong_lable, 4, 0, 1, 5)
        self.right_layout.addWidget(self.right_playlist_lable, 4, 5, 1, 4)
        self.right_layout.addWidget(self.right_newsong_widget, 5, 0, 1, 5)
        self.right_layout.addWidget(self.right_playlist_widget, 5, 5, 1, 4)
        #
        self.right_process_bar = QtWidgets.QProgressBar()  # 播放进度部件
        self.right_process_bar.setValue(49)
        self.right_process_bar.setFixedHeight(3)  # 设置进度条高度
        self.right_process_bar.setTextVisible(False)  # 不显示进度条文字

        self.right_playconsole_widget = QtWidgets.QWidget()  # 播放控制部件
        self.right_playconsole_layout = QtWidgets.QGridLayout()  # 播放控制部件网格布局层
        self.right_playconsole_widget.setLayout(self.right_playconsole_layout)

        self.console_button_1 = QtWidgets.QPushButton(
            qtawesome.icon('fa.backward', color='#F76677'), "")
        self.console_button_2 = QtWidgets.QPushButton(
            qtawesome.icon('fa.forward', color='#F76677'), "")
        self.console_button_3 = QtWidgets.QPushButton(
            qtawesome.icon('fa.pause', color='#F76677', font=18), "")
        self.console_button_3.setIconSize(QtCore.QSize(30, 30))

        self.right_playconsole_layout.addWidget(self.console_button_1, 0, 0)
        self.right_playconsole_layout.addWidget(self.console_button_2, 0, 2)
        self.right_playconsole_layout.addWidget(self.console_button_3, 0, 1)
        self.right_playconsole_layout.setAlignment(
            QtCore.Qt.AlignCenter)  # 设置布局内部件居中显示

        self.right_layout.addWidget(self.right_process_bar, 9, 0, 1, 9)
        self.right_layout.addWidget(self.right_playconsole_widget, 10, 0, 1, 9)
        #
        self.left_close.setFixedSize(15, 15)  # 设置关闭按钮的大小
        self.left_visit.setFixedSize(15, 15)  # 设置按钮大小
        self.left_mini.setFixedSize(15, 15)  # 设置最小化按钮大小

        self.left_close.setStyleSheet(
            '''QPushButton{background:#F76677;border-radius:5px;}QPushButton:hover{background:red;}'''
        )
        self.left_visit.setStyleSheet(
            '''QPushButton{background:#F7D674;border-radius:5px;}QPushButton:hover{background:yellow;}'''
        )
        self.left_mini.setStyleSheet(
            '''QPushButton{background:#6DDF6D;border-radius:5px;}QPushButton:hover{background:green;}'''
        )
Beispiel #18
0
    def init_ui(self):
        self.setFixedSize(1500, 1000) #长*宽
        self.main_widget = QtWidgets.QWidget()  # 创建窗口主部件
        self.main_layout = QtWidgets.QGridLayout()  # 创建主部件的网格布局
        self.main_widget.setLayout(self.main_layout)  # 设置窗口主部件布局为网格布局

        self.left_widget = QtWidgets.QWidget()  # 创建左侧部件
        self.left_widget.setObjectName('left_widget')
        self.left_layout = QtWidgets.QGridLayout()  # 创建左侧部件的网格布局层
        self.left_widget.setLayout(self.left_layout)  # 设置左侧部件布局为网格

        self.right_widget = QtWidgets.QWidget()  # 创建右侧部件
        self.right_widget.setObjectName('right_widget')
        self.right_layout = QtWidgets.QGridLayout()
        self.right_widget.setLayout(self.right_layout)  # 设置右侧部件布局为网格

        self.main_layout.addWidget(self.left_widget, 0, 0, 12, 2)  # 左侧部件在第0行第0列,占8行3列
        self.main_layout.addWidget(self.right_widget, 0, 2, 12, 10)  # 右侧部件在第0行第3列,占8行9列
        self.setCentralWidget(self.main_widget)  # 设置窗口主部件

        self.left_close = QtWidgets.QPushButton("")  # 关闭按钮
        self.left_visit = QtWidgets.QPushButton("")  # 空白按钮
        self.left_mini = QtWidgets.QPushButton("")  # 最小化按钮

        self.left_label_1 = QtWidgets.QPushButton("财务模块")
        self.left_label_1.setObjectName('left_label')
        self.left_label_2 = QtWidgets.QPushButton("报表模块")
        self.left_label_2.setObjectName('left_label')
        self.left_label_3 = QtWidgets.QPushButton("其它功能")
        self.left_label_3.setObjectName('left_label')

        self.left_button_1 = QtWidgets.QPushButton(qtawesome.icon('fa.sellsy', color='white'), "可供记账模板")
        self.left_button_1.setObjectName('left_button')
        self.left_button_2 = QtWidgets.QPushButton(qtawesome.icon('fa.sellsy', color='white'), "可供资产登记")
        self.left_button_2.setObjectName('left_button')
        self.left_button_3 = QtWidgets.QPushButton(qtawesome.icon('fa.sellsy', color='white'), "待补充")
        self.left_button_3.setObjectName('left_button')
        self.left_button_4 = QtWidgets.QPushButton(qtawesome.icon('fa.home', color='white'), "审核报表")
        self.left_button_4.setObjectName('left_button')
        self.left_button_5 = QtWidgets.QPushButton(qtawesome.icon('fa.home', color='white'), "统计报表")
        self.left_button_5.setObjectName('left_button')
        self.left_button_6 = QtWidgets.QPushButton(qtawesome.icon('fa.home', color='white'), "待补充")
        self.left_button_6.setObjectName('left_button')
        self.left_button_7 = QtWidgets.QPushButton(qtawesome.icon('fa.comment', color='white'), "反馈建议")
        self.left_button_7.setObjectName('left_button')
        self.left_button_8 = QtWidgets.QPushButton(qtawesome.icon('fa.star', color='white'), "关注我们")
        self.left_button_8.setObjectName('left_button')
        self.left_button_9 = QtWidgets.QPushButton(qtawesome.icon('fa.question', color='white'), "遇到问题")
        self.left_button_9.setObjectName('left_button')
        self.left_xxx = QtWidgets.QPushButton(" ")

        self.left_layout.addWidget(self.left_mini, 0, 0, 1, 1)
        self.left_layout.addWidget(self.left_close, 0, 2, 1, 1)
        self.left_layout.addWidget(self.left_visit, 0, 1, 1, 1)
        self.left_layout.addWidget(self.left_label_1, 1, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_1, 2, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_2, 3, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_3, 4, 0, 1, 3)
        self.left_layout.addWidget(self.left_label_2, 5, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_4, 6, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_5, 7, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_6, 8, 0, 1, 3)
        self.left_layout.addWidget(self.left_label_3, 9, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_7, 10, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_8, 11, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_9, 12, 0, 1, 3)

        self.right_bar_widget = QtWidgets.QWidget()  # 右侧顶部搜索框部件
        self.right_bar_layout = QtWidgets.QGridLayout()  # 右侧顶部搜索框网格布局
        self.right_bar_widget.setLayout(self.right_bar_layout)
        self.search_icon = QtWidgets.QLabel(chr(0xf002) + ' ' + '搜索  ')
        self.search_icon.setFont(qtawesome.font('fa', 16))
        self.right_bar_widget_search_input = QtWidgets.QLineEdit()
        self.right_bar_widget_search_input.setPlaceholderText("输入路径、文件名或文件类型,回车进行搜索")

        self.right_bar_layout.addWidget(self.search_icon, 0, 0, 1, 1)
        self.right_bar_layout.addWidget(self.right_bar_widget_search_input, 0, 1, 1, 8)

        self.right_layout.addWidget(self.right_bar_widget, 0, 0, 1, 9)

        self.right_recommend_label = QtWidgets.QLabel("逻辑处理")
        self.right_recommend_label.setObjectName('right_lable')

        self.right_recommend_widget = QtWidgets.QWidget()  # 推荐封面部件
        self.right_recommend_layout = QtWidgets.QGridLayout()  # 推荐封面网格布局
        self.right_recommend_widget.setLayout(self.right_recommend_layout)

        self.recommend_button_1 = QtWidgets.QToolButton()
        self.recommend_button_1.setText("可供出售账户每月估值表1")  # 设置按钮文本
        self.recommend_button_1.setIcon(QtGui.QIcon('./r1.jpg'))  # 设置按钮图标
        self.recommend_button_1.setIconSize(QtCore.QSize(100, 100))  # 设置图标大小
        self.recommend_button_1.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon)  # 设置按钮形式为上图下文

        # self.recommend_button_2 = QtWidgets.QToolButton()
        # self.recommend_button_2.setText("可供出售账户每月估值表2")
        # self.recommend_button_2.setIcon(QtGui.QIcon('./r2.jpg'))
        # self.recommend_button_2.setIconSize(QtCore.QSize(100, 100))
        # self.recommend_button_2.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon)
        #
        # self.recommend_button_3 = QtWidgets.QToolButton()
        # self.recommend_button_3.setText("可供出售账户每月估值表3")
        # self.recommend_button_3.setIcon(QtGui.QIcon('./r3.jpg'))
        # self.recommend_button_3.setIconSize(QtCore.QSize(100, 100))
        # self.recommend_button_3.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon)
        #
        # self.recommend_button_4 = QtWidgets.QToolButton()
        # self.recommend_button_4.setText("可供出售账户每月估值表4")
        # self.recommend_button_4.setIcon(QtGui.QIcon('./r4.jpg'))
        # self.recommend_button_4.setIconSize(QtCore.QSize(100, 100))
        # self.recommend_button_4.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon)
        #
        # self.recommend_button_5 = QtWidgets.QToolButton()
        # self.recommend_button_5.setText("可供出售账户每月估值表5")
        # self.recommend_button_5.setIcon(QtGui.QIcon('./r5.jpg'))
        # self.recommend_button_5.setIconSize(QtCore.QSize(100, 100))
        # self.recommend_button_5.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon)

        self.right_recommend_layout.addWidget(self.recommend_button_1, 0, 0)
        # self.right_recommend_layout.addWidget(self.recommend_button_2, 0, 1)
        # self.right_recommend_layout.addWidget(self.recommend_button_3, 0, 2)
        # self.right_recommend_layout.addWidget(self.recommend_button_4, 0, 3)
        # self.right_recommend_layout.addWidget(self.recommend_button_5, 0, 4)

        self.right_layout.addWidget(self.right_recommend_label, 1, 0, 1, 9)
        #self.right_layout.addWidget(self.right_recommend_widget, 2, 0, 2, 9)

        self.right_newsong_lable = QtWidgets.QLabel("最新歌曲")
        self.right_newsong_lable.setObjectName('right_lable')

        self.right_playlist_lable = QtWidgets.QLabel("热门歌单")
        self.right_playlist_lable.setObjectName('right_lable')

        # self.right_newsong_widget = QtWidgets.QWidget()  # 最新歌曲部件
        # self.right_newsong_layout = QtWidgets.QGridLayout()  # 最新歌曲部件网格布局
        # self.right_newsong_widget.setLayout(self.right_newsong_layout)

        # self.newsong_button_1 = QtWidgets.QPushButton("夜机      陈慧娴      永远的朋友      03::29")
        # self.newsong_button_2 = QtWidgets.QPushButton("夜机      陈慧娴      永远的朋友      03::29")
        # self.newsong_button_3 = QtWidgets.QPushButton("夜机      陈慧娴      永远的朋友      03::29")
        # self.newsong_button_4 = QtWidgets.QPushButton("夜机      陈慧娴      永远的朋友      03::29")
        # self.newsong_button_5 = QtWidgets.QPushButton("夜机      陈慧娴      永远的朋友      03::29")
        # self.newsong_button_6 = QtWidgets.QPushButton("夜机      陈慧娴      永远的朋友      03::29")
        # self.right_newsong_layout.addWidget(self.newsong_button_1, 0, 1, )
        # self.right_newsong_layout.addWidget(self.newsong_button_2, 1, 1, )
        # self.right_newsong_layout.addWidget(self.newsong_button_3, 2, 1, )
        # self.right_newsong_layout.addWidget(self.newsong_button_4, 3, 1, )
        # self.right_newsong_layout.addWidget(self.newsong_button_5, 4, 1, )
        # self.right_newsong_layout.addWidget(self.newsong_button_6, 5, 1, )

        # self.right_playlist_widget = QtWidgets.QWidget()  # 播放歌单部件
        # self.right_playlist_layout = QtWidgets.QGridLayout()  # 播放歌单网格布局
        # self.right_playlist_widget.setLayout(self.right_playlist_layout)
        #
        # self.playlist_button_1 = QtWidgets.QToolButton()
        # self.playlist_button_1.setText("无法释怀的整天循环音乐…")
        # self.playlist_button_1.setIcon(QtGui.QIcon('./p1.jpg'))
        # self.playlist_button_1.setIconSize(QtCore.QSize(100, 100))
        # self.playlist_button_1.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon)
        #
        # self.playlist_button_2 = QtWidgets.QToolButton()
        # self.playlist_button_2.setText("不需要歌词,也可以打动你的心")
        # self.playlist_button_2.setIcon(QtGui.QIcon('./p2.jpg'))
        # self.playlist_button_2.setIconSize(QtCore.QSize(100, 100))
        # self.playlist_button_2.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon)
        #
        # self.playlist_button_3 = QtWidgets.QToolButton()
        # self.playlist_button_3.setText("那些你熟悉又不知道名字…")
        # self.playlist_button_3.setIcon(QtGui.QIcon('./p3.jpg'))
        # self.playlist_button_3.setIconSize(QtCore.QSize(100, 100))
        # self.playlist_button_3.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon)
        #
        # self.playlist_button_4 = QtWidgets.QToolButton()
        # self.playlist_button_4.setText("那些只听前奏就中毒的英文歌")
        # self.playlist_button_4.setIcon(QtGui.QIcon('./p4.jpg'))
        # self.playlist_button_4.setIconSize(QtCore.QSize(100, 100))
        # self.playlist_button_4.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon)
        #
        # self.right_playlist_layout.addWidget(self.playlist_button_1, 0, 0)
        # self.right_playlist_layout.addWidget(self.playlist_button_2, 0, 1)
        # self.right_playlist_layout.addWidget(self.playlist_button_3, 1, 0)
        # self.right_playlist_layout.addWidget(self.playlist_button_4, 1, 1)
        #
        # self.right_layout.addWidget(self.right_newsong_lable, 4, 0, 1, 5)
        # self.right_layout.addWidget(self.right_playlist_lable, 4, 5, 1, 4)
        # self.right_layout.addWidget(self.right_newsong_widget, 5, 0, 1, 5)
        # self.right_layout.addWidget(self.right_playlist_widget, 5, 5, 1, 4)
        #
        # self.right_process_bar = QtWidgets.QProgressBar()  # 播放进度部件
        # self.right_process_bar.setValue(49)
        # self.right_process_bar.setFixedHeight(3)  # 设置进度条高度
        # self.right_process_bar.setTextVisible(False)  # 不显示进度条文字
        #
        # self.right_playconsole_widget = QtWidgets.QWidget()  # 播放控制部件
        # self.right_playconsole_layout = QtWidgets.QGridLayout()  # 播放控制部件网格布局层
        # self.right_playconsole_widget.setLayout(self.right_playconsole_layout)

        # self.console_button_1 = QtWidgets.QPushButton(qtawesome.icon('fa.backward', color='#F76677'), "")
        # self.console_button_2 = QtWidgets.QPushButton(qtawesome.icon('fa.forward', color='#F76677'), "")
        # self.console_button_3 = QtWidgets.QPushButton(qtawesome.icon('fa.pause', color='#F76677', font=18), "")
        # self.console_button_3.setIconSize(QtCore.QSize(30, 30))
        #
        # self.right_playconsole_layout.addWidget(self.console_button_1, 0, 0)
        # self.right_playconsole_layout.addWidget(self.console_button_2, 0, 2)
        # self.right_playconsole_layout.addWidget(self.console_button_3, 0, 1)
        # self.right_playconsole_layout.setAlignment(QtCore.Qt.AlignCenter)  # 设置布局内部件居中显示

        # self.right_layout.addWidget(self.right_process_bar, 9, 0, 1, 9)
        # self.right_layout.addWidget(self.right_playconsole_widget, 10, 0, 1, 9)

        self.left_close.setFixedSize(15, 15)  # 设置关闭按钮的大小
        self.left_visit.setFixedSize(15, 15)  # 设置按钮大小
        self.left_mini.setFixedSize(15, 15)  # 设置最小化按钮大小

        self.left_close.setStyleSheet(
            '''QPushButton{background:#F76677;border-radius:5px;}QPushButton:hover{background:red;}''')
        self.left_visit.setStyleSheet(
            '''QPushButton{background:#F7D674;border-radius:5px;}QPushButton:hover{background:yellow;}''')
        self.left_mini.setStyleSheet(
            '''QPushButton{background:#6DDF6D;border-radius:5px;}QPushButtoTn:hover{background:green;}''')

        self.left_widget.setStyleSheet('''
            QWidget#left_widget{
                background:gray;
                border-top:1px solid white;
                border-bottom:1px solid white;
                border-left:1px solid white;
                border-top-left-radius:10px;
                border-bottom-left-radius:10px;
            }
            
            QPushButton{border:none;color:white;}
            
            QPushButton#left_label{
                border:none;
                border-bottom:1px solid white;
                font-size:30px;
                font-weight:700;
                font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
            }
            QPushButton#left_button:hover{border-left:4px solid red;font-weight:700;}
        ''')

        self.right_bar_widget_search_input.setStyleSheet('''
            QLineEdit{
                    border:1px solid gray;
                    width:300px;
                    border-radius:10px;
                    padding:2px 4px;
            }
        ''')

        self.right_widget.setStyleSheet('''
            QWidget#right_widget{
                color:#232C51;
                background:white;
                border-top:1px solid darkGray;
                border-bottom:1px solid darkGray;
                border-right:1px solid darkGray;
                border-top-right-radius:10px;
                border-bottom-right-radius:10px;
            }
            QLabel#right_lable{
                border:none;
                font-size:16px;
                font-weight:700;
                font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
            }
        ''')

        self.right_recommend_widget.setStyleSheet(
            '''
                QToolButton{border:none;}
                QToolButton:hover{border-bottom:2px solid #F76677;}
            ''')
        # self.right_playlist_widget.setStyleSheet(
        #     '''
        #         QToolButton{border:none;}
        #         QToolButton:hover{border-bottom:2px solid #F76677;}
        #     ''')

        # self.right_newsong_widget.setStyleSheet('''
        #     QPushButton{
        #         border:none;
        #         color:gray;
        #         font-size:12px;
        #         height:40px;
        #         padding-left:5px;
        #         padding-right:10px;
        #         text-align:left;
        #     }
        #     QPushButton:hover{
        #         color:black;
        #         border:1px solid #F3F3F5;
        #         border-radius:10px;
        #         background:LightGray;
        #     }
        # ''')

        # self.right_process_bar.setStyleSheet('''
        #     QProgressBar::chunk {
        #         background-color: #F76677;
        #     }
        # ''')

        # self.right_playconsole_widget.setStyleSheet('''
        #     QPushButton{
        #         border:none;
        #     }
        # ''')

        self.setWindowOpacity(1)  # 设置窗口透明度
        self.setAttribute(QtCore.Qt.WA_TranslucentBackground)  # 设置窗口背景透明
        self.setWindowFlag(QtCore.Qt.FramelessWindowHint)

        self.main_layout.setSpacing(0)#去掉间隔线
    def init_ui(self):
        self.setFixedSize(960,700)
        self.main_widget = QtWidgets.QWidget()  # 创建窗口主部件
        self.main_layout = QtWidgets.QGridLayout()  # 创建主部件的网格布局
        self.main_widget.setLayout(self.main_layout)  # 设置窗口主部件布局为网格布局
 
        self.left_widget = QtWidgets.QWidget()  # 创建左侧部件
        self.left_widget.setObjectName('left_widget')
        self.left_layout = QtWidgets.QGridLayout()  # 创建左侧部件的网格布局层
        self.left_widget.setLayout(self.left_layout) # 设置左侧部件布局为网格
 
        self.right_widget = QtWidgets.QWidget() # 创建右侧部件
        self.right_widget.setObjectName('right_widget')
        self.right_layout = QtWidgets.QGridLayout()
        self.right_widget.setLayout(self.right_layout) # 设置右侧部件布局为网格
 
        self.main_layout.addWidget(self.left_widget,0,0,12,2) # 左侧部件在第0行第0列,占8行3列
        self.main_layout.addWidget(self.right_widget,0,2,12,10) # 右侧部件在第0行第3列,占8行9列
        self.setCentralWidget(self.main_widget) # 设置窗口主部件
        
        self.left_ocr = QtWidgets.QPushButton("识别") # 关闭按钮
        self.left_close = QtWidgets.QPushButton("") # 空白按钮
        self.left_mini = QtWidgets.QPushButton("")  # 最小化按钮

        self.left_button_1 = QtWidgets.QPushButton(qtawesome.icon('fa.music',color='white'),"文本行识别")
        self.left_button_1.setObjectName('left_button')
        self.left_button_2 = QtWidgets.QPushButton(qtawesome.icon('fa.sellsy',color='white'),"单词识别")
        self.left_button_2.setObjectName('left_button')
        
        self.left_button_1.clicked.connect(self.line_ocr)
        self.left_button_2.clicked.connect(self.word_ocr)
        self.left_ocr.clicked.connect(self.do_ocr)
        self.left_layout.addWidget(self.left_mini, 0, 0,1,1)
        self.left_layout.addWidget(self.left_ocr, 0, 2,1,1)
        self.left_layout.addWidget(self.left_close, 0, 1, 1, 1)
        self.left_layout.addWidget(self.left_button_1, 1, 0,1,3)
        self.left_layout.addWidget(self.left_button_2, 2, 0,1,3)
        
        self.right_bar_widget = QtWidgets.QWidget() # 右侧顶部搜索框部件
        self.right_bar_layout = QtWidgets.QGridLayout() # 右侧顶部搜索框网格布局
        self.right_bar_widget.setLayout(self.right_bar_layout)
        
        self.search_icon = QtWidgets.QPushButton(chr(0xf002) + ' '+'选择图片')
        self.search_icon.setFont(qtawesome.font('fa', 16))
        self.right_bar_widget_search_input = QtWidgets.QLineEdit()
#         self.right_bar_widget_search_input.setReadOnly(True)
        self.right_bar_widget_search_input.setPlaceholderText("图片路径")

        self.search_icon.clicked.connect(self.slot_btn_chooseFile)
        self.right_bar_layout.addWidget(self.search_icon,0,0,1,1)
        self.right_bar_layout.addWidget(self.right_bar_widget_search_input,0,1,1,8)

        self.right_layout.addWidget(self.right_bar_widget, 0, 0, 1, 9)
        
        self.right_picture_label = QtWidgets.QLabel("选取图片")
        self.right_picture_label.setObjectName('right_picture')
        self.right_picture = QtWidgets.QLabel("")
#         self.right_picture.setFixedSize(300, 200)
        self.right_result_label = QtWidgets.QLabel("识别结果")
        self.right_result_label.setObjectName('right_label')
        self.right_result = QtWidgets.QLabel("")

        
        self.right_layout.addWidget(self.right_picture_label, 1, 0, 1, 9)
        self.right_layout.addWidget(self.right_result_label, 3, 0, 1, 9)
        self.right_layout.addWidget(self.right_picture, 2, 0, 1, 9)
        self.right_layout.addWidget(self.right_result, 4, 0, 1, 9)
Beispiel #20
0
    def init_ui(self):
        self.setWindowIcon(QIcon('./img/index.ico'))
        self.setWindowTitle("工具")
        # self.setFixedSize(960, 700)
        self.resize(960, 700)
        # self._center()
        self.main_widget = QWidget()  # 创建窗口主部件
        self.main_layout = QGridLayout()  # 创建主部件的网格布局
        self.main_widget.setLayout(self.main_layout)  # 设置窗口主部件布局为网格布局

        # 创建上侧部件
        self.up_widget = QWidget()
        self.up_widget.setObjectName('up_widget')
        self.up_widget.setFixedHeight(80)
        self.up_layout = QGridLayout()
        self.up_widget.setLayout(self.up_layout)
        # 创建滚动条
        self.slide = QScrollBar(True)
        self.slide.setObjectName('slide_roll_bar')
        self.slide.setMaximum(self.column)
        self.slide.setMinimum(self.num)
        self.slide.valueChanged.connect(self._value_change)

        # 创建中侧部件
        self.mid_widget = QWidget()
        self.mid_widget.setObjectName('mid_widget')
        self.mid_layout = QGridLayout()
        self.mid_widget.setLayout(self.mid_layout)

        # 创建下侧部件
        self.down_widget = QWidget()
        self.down_widget.setObjectName('down_widget')
        self.down_layout = QGridLayout()
        self.down_widget.setLayout(self.down_layout)

        self.main_layout.addWidget(self.up_widget, 0, 0, 1, self.column)
        self.main_layout.addWidget(self.slide, 1, 0, 1, self.column)
        self.main_layout.addWidget(self.mid_widget, 2, 2, 1, self.column - 2)
        self.main_layout.addWidget(self.down_widget, 3, self.column - 1,
                                   self.row, 1)
        self.setCentralWidget(self.main_widget)

        # 创建头部(head)
        self.head_widget = QWidget()
        self.head_layout = QGridLayout()
        self.head_widget.setLayout(self.head_layout)

        self.load_model_ico(
            0, self.num) if self.num < self.column else self.load_model_ico(
                0, self.column)

        self.up_layout.addWidget(self.head_widget, 0, 0, 0, 0)

        # 创建中部(middle)
        self.middle_widget = QWidget()
        self.middle_layout = QGridLayout()
        self.middle_widget.setLayout(self.middle_layout)

        for i in range(self.row):
            self.middle_icon = QLabel(chr(0xf002) + f'目录_{i}:')
            self.middle_icon.setFont(qtawesome.font('fa', 12))
            self.middle_input = QLineEdit()
            # self.middle_input.setPlaceholderText("请选择文件...")
            self.middle_input.setObjectName(f'middle_input_{i}')
            self.middle_btn = QPushButton(
                qtawesome.icon('fa.film', color='green'), "选择文件")
            self.middle_btn.setObjectName(f'middle_btn_{i}')
            self.middle_btn.clicked.connect(self.open_dir)

            self.middle_layout.addWidget(self.middle_icon, i, 0, 1, 1)
            self.middle_layout.addWidget(self.middle_input, i, 1, 1,
                                         self.row - 1)
            self.middle_layout.addWidget(self.middle_btn, i, self.row, 1, 1)

        self.mid_layout.addWidget(self.middle_widget, 0, 0, 1, 1)

        # 创建尾部
        self.tail_widget = QWidget()
        self.tail_layout = QGridLayout()
        self.tail_widget.setLayout(self.tail_layout)

        self.tail_btn = QPushButton(
            qtawesome.icon('fa.download', color='green'), "运行")
        self.tail_layout.addWidget(self.tail_btn, 0, 9, 1, 1)
        self.down_layout.addWidget(self.tail_widget, 0, 0, 0, 0)
        self.set_style()

        self.main_layout.setSpacing(0)
Beispiel #21
0
 def __init__(self, icon):
     Button.__init__(self, "playback")
     self.setText(icon)
     self.setFont(qta.font('fa', 12))
Beispiel #22
0
    def __init__(self):
        super(AwesomeExample, self).__init__()

        # Get icons by name.
        fa_icon = qta.icon('fa.flag')
        fa_button = QtWidgets.QPushButton(fa_icon, 'Font Awesome!')

        asl_icon = qta.icon('ei.asl')
        elusive_button = QtWidgets.QPushButton(asl_icon, 'Elusive Icons!')

        # Styling
        styling_icon = qta.icon('fa.music',
                                active='fa.legal',
                                color='blue',
                                color_active='orange')
        music_button = QtWidgets.QPushButton(styling_icon, 'Styling')

        # Toggle
        toggle_icon = qta.icon('fa.home',
                               selected='fa.legal',
                               color_off='black',
                               color_off_active='blue',
                               color_on='orange',
                               color_on_active='yellow')
        toggle_button = QtWidgets.QPushButton(toggle_icon, 'Toggle')
        toggle_button.setCheckable(True)

        # Render a label with this font
        label = QtWidgets.QLabel(unichr(0xf19c) + ' ' + 'Label')
        label.setFont(qta.font('fa', 16))

        # Stack icons
        camera_ban = qta.icon('fa.camera',
                              'fa.ban',
                              options=[{
                                  'scale_factor': 0.5,
                                  'active': 'fa.legal'
                              }, {
                                  'color': 'red',
                                  'opacity': 0.7
                              }])
        stack_button = QtWidgets.QPushButton(camera_ban, 'Stack')
        stack_button.setIconSize(QtCore.QSize(32, 32))

        # Spin icons
        spin_button = QtWidgets.QPushButton(' Spinning icon')
        spin_icon = qta.icon('fa.spinner',
                             color='red',
                             animation=qta.Spin(spin_button))
        spin_button.setIcon(spin_icon)

        # Pulse icons
        pulse_button = QtWidgets.QPushButton(' Pulsing icon')
        pulse_icon = qta.icon('fa.spinner',
                              color='green',
                              animation=qta.Pulse(pulse_button))
        pulse_button.setIcon(pulse_icon)

        # Stacked spin icons
        stack_spin_button = QtWidgets.QPushButton('Stack spin')
        options = [{
            'scale_factor': 0.4,
            'animation': qta.Spin(stack_spin_button)
        }, {
            'color': 'blue'
        }]
        stack_spin_icon = qta.icon('ei.asl', 'fa.square-o', options=options)
        stack_spin_button.setIcon(stack_spin_icon)
        stack_spin_button.setIconSize(QtCore.QSize(32, 32))

        # Stack and offset icons
        saveall = qta.icon('fa.save',
                           'fa.save',
                           options=[{
                               'scale_factor': 0.8,
                               'offset': (0.2, 0.2),
                               'color': 'gray'
                           }, {
                               'scale_factor': 0.8
                           }])
        saveall_button = QtWidgets.QPushButton(saveall, 'Stack, offset')

        # Layout
        vbox = QtWidgets.QVBoxLayout()
        widgets = [
            fa_button, elusive_button, music_button, toggle_button,
            stack_button, saveall_button, spin_button, pulse_button,
            stack_spin_button, label
        ]

        for w in widgets:
            vbox.addWidget(w)

        self.setLayout(vbox)
        self.setWindowTitle('Awesome')
        self.show()
Beispiel #23
0
    def init_ui(self):
        self.setFixedSize(960, 700)

        self.main_widget = QtWidgets.QWidget()  # 创建窗口主部件
        self.main_layout = QtWidgets.QGridLayout()  # 创建主部件的网格布局
        self.main_widget.setLayout(self.main_layout)  # 设置窗口主部件布局为网格布局

        self.left_widget = QtWidgets.QWidget()  # 创建左侧部件
        self.left_widget.setObjectName('left_widget')
        self.left_layout = QtWidgets.QGridLayout()  # 创建左侧部件的网格布局层
        self.left_widget.setLayout(self.left_layout)  # 设置左侧部件布局为网格

        self.right_widget = QtWidgets.QWidget()  # 创建右侧部件
        self.right_widget.setObjectName('right_widget')
        self.right_layout = QtWidgets.QGridLayout()
        self.right_widget.setLayout(self.right_layout)  # 设置右侧部件布局为网格

        self.main_layout.addWidget(self.left_widget, 0, 0, 12,
                                   2)  # 左侧部件在第0行第0列,占8行3列
        self.main_layout.addWidget(self.right_widget, 0, 2, 12,
                                   10)  # 右侧部件在第0行第3列,占8行9列

        self.left_close = QtWidgets.QPushButton("", self)  # 关闭按钮
        self.left_visit = QtWidgets.QPushButton("", self)  # 最大化按钮
        self.left_mini = QtWidgets.QPushButton("", self)  # 最小化按钮
        self.left_close.setToolTip('关闭')

        self.left_visit.setToolTip('最大化')
        self.left_visit.clicked.connect(
            self.pushButton_show_max_normal)  # 点击按钮之后最大化窗口

        self.left_mini.setToolTip('最小化')
        self.left_close.clicked.connect(self.close)  # 点击按钮之后关闭窗口
        self.left_mini.clicked.connect(self.showMinimized)  # 点击按钮之后最小化窗口

        self.left_label_1 = QtWidgets.QPushButton("配音助手")
        self.left_label_1.setObjectName('left_label')
        self.left_label_2 = QtWidgets.QPushButton("联系与帮助")
        self.left_label_2.setObjectName('left_label')

        self.left_button_1 = QtWidgets.QPushButton(
            qtawesome.icon('fa.cog', color='white'), "语音合成")
        self.left_button_1.setObjectName('left_button')
        self.left_button_1.clicked.connect(self.push_button_compose_clicked)
        self.left_button_2 = QtWidgets.QPushButton(
            qtawesome.icon('fa.hand-o-right', color='white'), "使用说明")
        self.left_button_2.setObjectName('left_button')
        self.left_button_2.clicked.connect(self.push_button_shuoming_clicked)
        self.left_button_3 = QtWidgets.QPushButton(
            qtawesome.icon('fa.download', color='white'), "下载管理")
        self.left_button_3.setObjectName('left_button')
        self.left_button_3.clicked.connect(self.push_button_xiazai_clicked)
        self.left_button_4 = QtWidgets.QPushButton(
            qtawesome.icon('fa.comment', color='white'), "反馈建议")
        self.left_button_4.setObjectName('left_button')
        self.left_button_4.clicked.connect(self.push_button_fankui_clicked)
        self.left_button_5 = QtWidgets.QPushButton(
            qtawesome.icon('fa.star', color='white'), "关于我们")
        self.left_button_5.setObjectName('left_button')
        self.left_button_5.clicked.connect(self.push_button_guanyu_clicked)
        self.left_button_6 = QtWidgets.QPushButton(
            qtawesome.icon('fa.question', color='white'), "遇到问题")
        self.left_button_6.setObjectName('left_button')
        self.left_button_6.clicked.connect(self.push_button_wenti_clicked)
        self.left_xxx = QtWidgets.QPushButton(" ")

        self.left_layout.addWidget(self.left_mini, 0, 0, 1, 1)
        self.left_layout.addWidget(self.left_visit, 0, 1, 1, 1)
        self.left_layout.addWidget(self.left_close, 0, 2, 1, 1)
        self.left_layout.addWidget(self.left_label_1, 1, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_1, 2, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_2, 3, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_3, 4, 0, 1, 3)
        self.left_layout.addWidget(self.left_label_2, 5, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_4, 6, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_5, 7, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_6, 8, 0, 1, 3)

        self.right_arg_label = QtWidgets.QLabel("参数设置")
        self.right_arg_label.setObjectName('right_lable')
        self.right_layout.addWidget(self.right_arg_label, 0, 0, 1, 9)

        # 第一行appkey和token
        self.right_arg1_widget = QtWidgets.QWidget()  # 第一行参数部件
        self.right_arg1_layout = QtWidgets.QGridLayout()  # 第一行参数网格布局
        self.right_arg1_widget.setLayout(self.right_arg1_layout)
        self.right_arg11_widget = QtWidgets.QWidget()  # 第一行第一个参数部件
        self.right_arg11_layout = QtWidgets.QGridLayout()  # 第一行第一个参数网格布局
        self.right_arg11_widget.setLayout(self.right_arg11_layout)
        self.right_arg12_widget = QtWidgets.QWidget()  # 第一行第二个参数部件
        self.right_arg12_layout = QtWidgets.QGridLayout()  # 第一行第二个参数网格布局
        self.right_arg12_widget.setLayout(self.right_arg12_layout)

        self.appkey_icon = QtWidgets.QLabel('appkey')
        self.appkey_icon.setFont(qtawesome.font('fa', 16))
        self.right_bar_widget_appkey_input = QtWidgets.QLineEdit()
        self.right_bar_widget_appkey_input.setPlaceholderText("输入appkey")

        self.token_icon = QtWidgets.QLabel('token')
        self.token_icon.setFont(qtawesome.font('fa', 16))
        self.right_bar_widget_token_input = QtWidgets.QLineEdit()
        self.right_bar_widget_token_input.setPlaceholderText("输入token")

        self.right_arg11_layout.addWidget(self.appkey_icon, 1, 0, 1, 1)
        self.right_arg11_layout.addWidget(self.right_bar_widget_appkey_input,
                                          1, 1, 1, 3)
        self.right_arg12_layout.addWidget(self.token_icon, 1, 4, 1, 1)
        self.right_arg12_layout.addWidget(self.right_bar_widget_token_input, 1,
                                          5, 1, 3)
        self.right_arg1_layout.addWidget(self.right_arg11_widget, 1, 0, 1, 4)
        self.right_arg1_layout.addWidget(self.right_arg12_widget, 1, 4, 1, 4)

        self.right_layout.addWidget(self.right_arg1_widget, 1, 0, 1, 6)

        # 第二行输入文本text
        self.right_arg2_widget = QtWidgets.QWidget()  # 第二行参数部件
        self.right_arg2_layout = QtWidgets.QGridLayout()  # 第二行参数网格布局
        self.right_arg2_widget.setLayout(self.right_arg2_layout)

        self.text_icon = QtWidgets.QLabel('输入文本')
        self.text_icon.setFont(qtawesome.font('fa', 14))
        self.right_bar_widget_text_input = QtWidgets.QTextEdit()
        self.right_bar_widget_text_input.setPlaceholderText("输入格式请看“使用说明”")

        self.right_arg2_layout.addWidget(self.text_icon, 2, 0, 1, 1)
        self.right_arg2_layout.addWidget(self.right_bar_widget_text_input, 2,
                                         1, 1, 8)
        self.right_layout.addWidget(self.right_arg2_widget, 2, 0, 1, 9)

        # 第三行speech_rate和volume
        self.right_arg3_widget = QtWidgets.QWidget()
        self.right_arg3_layout = QtWidgets.QGridLayout()
        self.right_arg3_widget.setLayout(self.right_arg3_layout)
        self.right_arg31_widget = QtWidgets.QWidget()
        self.right_arg31_layout = QtWidgets.QGridLayout()
        self.right_arg31_widget.setLayout(self.right_arg31_layout)
        self.right_arg32_widget = QtWidgets.QWidget()
        self.right_arg32_layout = QtWidgets.QGridLayout()
        self.right_arg32_widget.setLayout(self.right_arg32_layout)
        self.right_arg33_widget = QtWidgets.QWidget()
        self.right_arg33_layout = QtWidgets.QGridLayout()
        self.right_arg33_widget.setLayout(self.right_arg33_layout)

        self.speech_rate_icon = QtWidgets.QLabel('语音速率')
        self.speech_rate_icon.setFont(qtawesome.font('fa', 16))
        self.right_bar_widget_speech_rate_input = QtWidgets.QLineEdit()
        self.right_bar_widget_speech_rate_input.setPlaceholderText(
            "-500-500(-100中)")
        self.right_bar_widget_speech_rate_input.setText('-100')

        self.format_icon = QtWidgets.QLabel('音频格式')
        self.format_icon.setFont(qtawesome.font('fa', 16))
        self.right_bar_widget_format_input = QtWidgets.QComboBox(self)
        self.right_bar_widget_format_input.addItems(['mp3', 'wav', 'pcm'])

        self.right_bar_widget_format_input.currentIndexChanged[str].connect(
            self.print_value)  # 条目发生改变,发射信号,传递条目内容
        # self.right_bar_widget_format_input.currentIndexChanged[int].connect(self.print_value)  # 条目发生改变,发射信号,传递条目索引

        self.volume_icon = QtWidgets.QLabel('    音量')
        self.volume_icon.setFont(qtawesome.font('fa', 16))
        self.right_bar_widget_volume_input = QtWidgets.QLineEdit()
        self.right_bar_widget_volume_input.setPlaceholderText("0-100(建议100)")
        self.right_bar_widget_volume_input.setText('100')

        self.right_arg31_layout.addWidget(self.speech_rate_icon, 3, 0, 1, 1)
        self.right_arg31_layout.addWidget(
            self.right_bar_widget_speech_rate_input, 3, 1, 1, 2)
        self.right_arg32_layout.addWidget(self.format_icon, 3, 3, 1, 1)
        self.right_arg32_layout.addWidget(self.right_bar_widget_format_input,
                                          3, 4, 1, 2)
        self.right_arg33_layout.addWidget(self.volume_icon, 3, 6, 1, 1)
        self.right_arg33_layout.addWidget(self.right_bar_widget_volume_input,
                                          3, 7, 1, 3)
        self.right_arg3_layout.addWidget(self.right_arg31_widget, 3, 0, 1, 3)
        self.right_arg3_layout.addWidget(self.right_arg32_widget, 3, 3, 1, 3)
        self.right_arg3_layout.addWidget(self.right_arg33_widget, 3, 6, 1, 3)
        self.right_layout.addWidget(self.right_arg3_widget, 3, 0, 1, 9)

        # 第四行voice和audio
        self.right_arg4_widget = QtWidgets.QWidget()
        self.right_arg4_layout = QtWidgets.QGridLayout()
        self.right_arg4_widget.setLayout(self.right_arg4_layout)
        self.right_arg41_widget = QtWidgets.QWidget()
        self.right_arg41_layout = QtWidgets.QGridLayout()
        self.right_arg41_widget.setLayout(self.right_arg41_layout)
        self.right_arg42_widget = QtWidgets.QWidget()
        self.right_arg42_layout = QtWidgets.QGridLayout()
        self.right_arg42_widget.setLayout(self.right_arg42_layout)

        self.voice_icon = QtWidgets.QLabel('音色')
        self.voice_icon.setFont(qtawesome.font('fa', 16))
        self.right_bar_widget_voice_input = QtWidgets.QComboBox(self)
        self.right_bar_widget_voice_input.addItems([
            '小云', '小刚', '若兮', '思琪', '思佳', '思诚', '艾夏', '艾琪', '艾佳', '艾诚', '艾达',
            '宁儿', '瑞琳', '思悦', '艾雅', '艾美', '艾雨', '艾悦', '艾婧', '小美', '艾娜', '伊娜',
            '思婧', '思彤', '小北', '艾彤', '艾薇', '艾宝', '姗姗', '小玥', 'Lydia', '艾硕',
            '青青', '翠姐', '小泽', '艾媛(商用)', '艾颖(商用)', '艾祥(商用)', '艾墨(商用)', '艾晔(商用)',
            '艾婷(商用)', '艾凡(商用)'
        ])
        self.test_voice_button = QtWidgets.QPushButton('配音试听')
        self.test_voice_button.setFont(qtawesome.font('fa', 16))
        self.test_voice_button.clicked.connect(self.open_test_voice_url)
        self.compose_voice_button = QtWidgets.QPushButton('音频合成')
        self.compose_voice_button.setFont(qtawesome.font('fa', 16))
        self.compose_voice_button.clicked.connect(self.start_compose)
        self.right_bar_widget_voice_input.currentIndexChanged[str].connect(
            self.print_value)  # 条目发生改变,发射信号,传递条目内容
        # self.right_bar_widget_voice_input.currentIndexChanged[int].connect(self.print_value)  # 条目发生改变,发射信号,传递条目索引

        self.right_arg41_layout.addWidget(self.voice_icon, 4, 0, 1, 1)
        self.right_arg41_layout.addWidget(self.right_bar_widget_voice_input, 4,
                                          1, 1, 2)
        self.right_arg42_layout.addWidget(self.test_voice_button, 4, 3, 1, 2)
        self.right_arg42_layout.addWidget(self.compose_voice_button, 4, 5, 1,
                                          2)
        self.right_arg4_layout.addWidget(self.right_arg41_widget, 4, 0, 1, 3)
        self.right_arg4_layout.addWidget(self.right_arg42_widget, 4, 3, 1, 9)
        self.right_layout.addWidget(self.right_arg4_widget, 4, 0, 1, 9)

        self.left_close.setFixedSize(15, 15)  # 设置关闭按钮的大小
        self.left_visit.setFixedSize(15, 15)  # 设置按钮大小
        self.left_mini.setFixedSize(15, 15)  # 设置最小化按钮大小

        # 说明
        self.right_widget_shuoming = QtWidgets.QWidget()  # 创建右侧部件
        self.right_widget_shuoming.setObjectName('right_widget_shuoming')
        self.right_layout_shuoming = QtWidgets.QGridLayout()
        self.right_widget_shuoming.setLayout(
            self.right_layout_shuoming)  # 设置右侧部件布局为网格
        self.right_widget_shuoming.setVisible(False)

        self.main_layout.addWidget(self.right_widget_shuoming, 0, 2, 12,
                                   10)  # 右侧部件在第0行第3列,占8行9列
        self.shuoming_text = QtWidgets.QLabel(
            '1、打开网址:<a href="https://zhuanlan.zhihu.com/p/123930042" style="color:blue">https://zhuanlan.zhihu.com/p/123930042</a><br>'
            '2、按照文章中提示注册登录阿里云,获得智能语音交互的appkey和token(会过期)<br>'
            '3、在语音合成中,输入相应的参数,即可进行语音合成,进行配音<br>'
            '4、输入文本中目前支持中文进行配音,且必须有句号等标点符号,<br>      本程序利用句号“。”才进行分割,所以请按规范输入文本<br>'
            '5、音色选择可以在点击配音试听,到阿里云官网选择你需要的配音音色<br>'
            '6、语音合成的速度:300字符以内(10秒),800字符(25秒左右),请耐心等待<br>'
            '7、免费音色当前语音合成并发数为2(免费版最大并发数),普通使用者足够<br>'
            '8、合成音频在当前目录audioFiles中,文件名称为"日期.mp3"<br>'
            '9、根据字符长度讲每段字符数限制在300内进行合成,若有800字,则可能生成3个音频文件<br>'
            '9、目录下会生成日志文件:“日志.log”<br>'
            '10、目录下生成音频合成信息文件:“voice_data.json”,记录上次合成信息<br>'
            '11、商用音色(已备注)请查看更新文章,请开通后使用,未开通则不能使用,<br>文学类音色为长文本语音合成特有音色,且为商用,使用须向阿里云缴费!'
        )
        self.shuoming_text.setObjectName('shuoming_text_lable')
        self.shuoming_text.setTextInteractionFlags(Qt.TextBrowserInteraction)
        self.shuoming_text.setOpenExternalLinks(True)
        self.right_layout_shuoming.addWidget(self.shuoming_text, 0, 0, 12, 10)

        self.right_widget_xiazai = QtWidgets.QWidget()  # 创建右侧部件
        self.right_widget_xiazai.setObjectName('right_widget_xiazai')
        self.right_layout_xiazai = QtWidgets.QGridLayout()
        self.right_widget_xiazai.setLayout(
            self.right_layout_xiazai)  # 设置右侧部件布局为网格
        self.right_widget_xiazai.setVisible(False)

        self.main_layout.addWidget(self.right_widget_xiazai, 0, 2, 12,
                                   10)  # 右侧部件在第0行第3列,占8行9列
        self.xiazai_button = QtWidgets.QPushButton('打开下载文件夹')
        self.xiazai_button.setFont(qtawesome.font('fa', 16))
        self.xiazai_button.clicked.connect(self.open_xaizai_file)
        self.right_layout_xiazai.addWidget(self.xiazai_button, 0, 0, 12, 10)

        self.right_widget_fankui = QtWidgets.QWidget()  # 创建右侧部件
        self.right_widget_fankui.setObjectName('right_widget_fankui')
        self.right_layout_fankui = QtWidgets.QGridLayout()
        self.right_widget_fankui.setLayout(
            self.right_layout_fankui)  # 设置右侧部件布局为网格
        self.right_widget_fankui.setVisible(False)

        self.main_layout.addWidget(self.right_widget_fankui, 0, 2, 12,
                                   10)  # 右侧部件在第0行第3列,占8行9列
        self.fankui_text = QtWidgets.QLabel(
            '1、发送邮件至 : [email protected] <br>' + '2、发送邮件至 : [email protected]<br>' +
            '3、知乎 @NH4L私信 : <a href="https://www.zhihu.com/people/NH4L/posts" style="color:blue">https://www.zhihu.com/people/NH4L</a><br>'
            +
            '4、CSDN @NH4L博客私信 : <a href="https://blog.csdn.net/LeeGe666" style="color:blue">https://blog.csdn.net/LeeGe666</a><br>'
        )
        self.fankui_text.setObjectName('fankui_text_lable')
        self.fankui_text.setTextInteractionFlags(Qt.TextBrowserInteraction)
        self.fankui_text.setOpenExternalLinks(True)
        self.right_layout_fankui.addWidget(self.fankui_text, 0, 0, 12, 10)

        self.right_widget_guanyu = QtWidgets.QWidget()  # 创建右侧部件
        self.right_widget_guanyu.setObjectName('right_widget_guanyu')
        self.right_layout_guanyu = QtWidgets.QGridLayout()
        self.right_widget_guanyu.setLayout(
            self.right_layout_guanyu)  # 设置右侧部件布局为网格
        self.right_widget_guanyu.setVisible(False)

        self.main_layout.addWidget(self.right_widget_guanyu, 0, 2, 12,
                                   10)  # 右侧部件在第0行第3列,占8行9列
        self.guanyu_text = QtWidgets.QLabel(
            '1、本人是一位大学生, 计算机科学与技术专业,<br>     对软件开发,机器学习,大数据有较大兴趣;<br>'
            '2、如需和我交流 +qq:2283373978<br>'
            '                           +微信:nh4lan<br>'
            '3、本软件调用阿里云免费语音合成接口,利用阿里云的API薅羊毛,<br>      不读取用户任何信息,请放心使用<br>'
            '4、本软件完全开源 github @NH4L  <a href="https://github.com/NH4L/voiceAssistant" style="color:blue">https://github.com/NH4L/voiceAssistant</a> <br>'
            '5、我的CSDN博客 @NH4L <a href="https://blog.csdn.net/LeeGe666" style="color:blue">https://blog.csdn.net/LeeGe666</a> <br>'
            '                           @Copyright NH4L All Rights Reserved')
        self.guanyu_text.setObjectName('guanyu_text_lable')
        self.guanyu_text.setTextInteractionFlags(Qt.TextBrowserInteraction)
        self.guanyu_text.setOpenExternalLinks(True)
        self.right_layout_guanyu.addWidget(self.guanyu_text, 0, 0, 12, 10)

        self.right_widget_wenti = QtWidgets.QWidget()  # 创建右侧部件
        self.right_widget_wenti.setObjectName('right_widget_wenti')
        self.right_layout_wenti = QtWidgets.QGridLayout()
        self.right_widget_wenti.setLayout(
            self.right_layout_wenti)  # 设置右侧部件布局为网格
        self.right_widget_wenti.setVisible(False)

        self.main_layout.addWidget(self.right_widget_wenti, 0, 2, 12,
                                   10)  # 右侧部件在第0行第3列,占8行9列
        self.wenti_text = QtWidgets.QLabel(
            '1、有问题联系   +qq:2283373978<br>'
            '                          +微信:nh4lan<br>'
            '2、知乎私信 @NH4L <a href="https://www.zhihu.com/people/NH4L/posts" style="color:blue">https://www.zhihu.com/people/NH4L</a> <br>'
            '3、CSDN博客私信 @NH4L <a href="https://blog.csdn.net/LeeGe666" style="color:blue">https://blog.csdn.net/LeeGe666</a> <br>'
        )
        self.wenti_text.setObjectName('wenti_text_lable')
        self.wenti_text.setTextInteractionFlags(Qt.TextBrowserInteraction)
        self.wenti_text.setOpenExternalLinks(True)
        self.right_layout_wenti.addWidget(self.wenti_text, 0, 0, 12, 10)

        self.setCentralWidget(self.main_widget)  # 设置窗口主部件

        self.get_last_voice_info()

        self.left_close.setStyleSheet(
            '''QPushButton{background:#F76677 url(./assets/exit.png) no-repeat;border-radius:5px;}QPushButton:hover{background:red url(./assets/exit.png);}'''
        )
        self.left_visit.setStyleSheet(
            '''QPushButton{background:#F7D674 url(./assets/max.png) no-repeat;border-radius:5px;}QPushButton:hover{background:yellow  url(./assets/max.png);}'''
        )
        self.left_mini.setStyleSheet(
            '''QPushButton{background:#6DDF6D url(./assets/min.png) no-repeat;border-radius:5px;}QPushButton:hover{background:green  url(./assets/min.png);}'''
        )

        self.left_widget.setStyleSheet('''
          QPushButton{border:none;color:white;}
          QPushButton#left_label{
            border:none;
            border-bottom:1px solid white;
            font-size:18px;
            font-weight:700;
            font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
          }
          QPushButton#left_button:hover{border-left:4px solid red;font-weight:700;}
        ''')

        self.right_widget.setStyleSheet('''
          QWidget#right_widget{
            color:#232C51;
            background:white;
            border-top:1px solid darkGray;
            border-bottom:1px solid darkGray;
            border-right:1px solid darkGray;
            border-top-right-radius:10px;
            border-bottom-right-radius:10px;
          }
          QLabel#right_lable{
            border:none;
            font-size:16px;
            font-weight:700;
            font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
          }
        ''')
        self.right_widget_shuoming.setStyleSheet('''
                  QWidget#right_widget_shuoming{
                    color:#232C51;
                    background:white;
                    border-top:1px solid darkGray;
                    border-bottom:1px solid darkGray;
                    border-right:1px solid darkGray;
                    border-top-right-radius:10px;
                    border-bottom-right-radius:10px;
                  }
                  QLabel#shuoming_text_lable{
                    border:none;
                    font-size:16px;
                    font-weight:700;
                    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
                  }
                ''')
        self.right_widget_fankui.setStyleSheet('''
                          QWidget#right_widget_fankui{
                            color:#232C51;
                            background:white;
                            border-top:1px solid darkGray;
                            border-bottom:1px solid darkGray;
                            border-right:1px solid darkGray;
                            border-top-right-radius:10px;
                            border-bottom-right-radius:10px;
                          }
                          QLabel#fankui_text_lable{
                            border:none;
                            font-size:16px;
                            font-weight:700;
                            font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
                          }
                        ''')
        self.right_widget_guanyu.setStyleSheet('''
                                  QWidget#right_widget_guanyu{
                                    color:#232C51;
                                    background:white;
                                    border-top:1px solid darkGray;
                                    border-bottom:1px solid darkGray;
                                    border-right:1px solid darkGray;
                                    border-top-right-radius:10px;
                                    border-bottom-right-radius:10px;
                                  }
                                  QLabel#guanyu_text_lable{
                                    border:none;
                                    font-size:16px;
                                    font-weight:700;
                                    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
                                  }
                                ''')
        self.right_widget_wenti.setStyleSheet('''
                                          QWidget#right_widget_wenti{
                                            color:#232C51;
                                            background:white;
                                            border-top:1px solid darkGray;
                                            border-bottom:1px solid darkGray;
                                            border-right:1px solid darkGray;
                                            border-top-right-radius:10px;
                                            border-bottom-right-radius:10px;
                                          }
                                          QLabel#wenti_text_lable{
                                            border:none;
                                            font-size:16px;
                                            font-weight:700;
                                            font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
                                          }
                                        ''')
        self.right_widget_xiazai.setStyleSheet('''
                          QWidget#right_widget_xiazai{
                            color:#232C51;
                            background:white;
                            border-top:1px solid darkGray;
                            border-bottom:1px solid darkGray;
                            border-right:1px solid darkGray;
                            border-top-right-radius:10px;
                            border-bottom-right-radius:10px;
                          }
                        ''')

        self.right_bar_widget_appkey_input.setStyleSheet('''QLineEdit{
                border:1px solid gray;
                width:75px;
                border-radius:10px;
                padding:2px 4px;
            }''')
        self.right_bar_widget_token_input.setStyleSheet('''QLineEdit{
                border:1px solid gray;
                width:75px;
                border-radius:10px;
                padding:2px 4px;
            }''')
        self.right_bar_widget_speech_rate_input.setStyleSheet('''QLineEdit{
                border:1px solid gray;
                width:75px;
                border-radius:10px;
                padding:2px 4px;
            }''')
        self.right_bar_widget_volume_input.setStyleSheet('''QLineEdit{
                border:1px solid gray;
                width:75px;
                border-radius:10px;
                padding:2px 4px;
            }''')

        self.test_voice_button.setStyleSheet('''QPushButton{
                    background:#1C86EE;border-radius:6px;
                    min-height: 25px; 
                    min-width: 100px;  
                    max-width: 100px; 
                    max-height: 25px;
            }QPushButton:hover{background:#436EEE;}''')
        self.xiazai_button.setStyleSheet('''QPushButton{
                    background:#1C86EE;border-radius:6px;
                    min-height: 50px; 
                    min-width: 400px;  
                    max-width: 400px; 
                    max-height: 50px;
            }QPushButton:hover{background:#436EEE;}''')
        self.compose_voice_button.setStyleSheet('''QPushButton{
                    background:#1C86EE;border-radius:6px;
                    min-height: 25px; 
                    min-width: 100px;  
                    max-width: 100px; 
                    max-height: 25px;
                    font-weight:bold;
            }QPushButton:hover{background:#436EEE;}''')
        self.right_bar_widget_text_input.setStyleSheet('''QTextEdit{
                border:1px solid gray;
                width:300px;
                border-radius:10px;
                padding:2px 4px;
            }''')
        self.right_bar_widget_format_input.setStyleSheet('''QComboBox{
                border:1px solid gray;
                width:75px;
                border-radius:10px;
                padding:2px 4px;
            }''')
        self.right_bar_widget_voice_input.setStyleSheet('''QComboBox{
                border:1px solid gray;
                width:75px;
                border-radius:10px;
                padding:2px 4px;
            }''')

        self.setWindowOpacity(0.9)  # 设置窗口透明度
        self.setAttribute(QtCore.Qt.WA_TranslucentBackground)  # 设置窗口背景透明

        self.setWindowFlag(QtCore.Qt.FramelessWindowHint)  # 隐藏边框

        self.main_widget.setStyleSheet('''
            QWidget#left_widget{
            background:gray;
            border-top:1px solid white;
            border-bottom:1px solid white;
            border-left:1px solid white;
            border-top-left-radius:10px;
            border-bottom-left-radius:10px;
            }
            ''')

        self.main_layout.setSpacing(0)
Beispiel #24
0
    def init_ui(self):
        self.setFixedSize(960, 700)
        self.main_widget = QtWidgets.QWidget()  # 创建窗口主部件
        self.main_layout = QtWidgets.QGridLayout()  # 创建主部件的网格布局
        self.main_widget.setLayout(self.main_layout)  # 设置窗口主部件布局为网格布局

        self.left_widget = QtWidgets.QWidget()  # 创建左侧部件
        self.left_widget.setObjectName('left_widget')
        self.left_layout = QtWidgets.QGridLayout()  # 创建左侧部件的网格布局层
        self.left_widget.setLayout(self.left_layout)  # 设置左侧部件布局为网格

        self.right_widget = QtWidgets.QWidget()  # 创建右侧部件
        self.right_widget.setObjectName('right_widget')
        self.right_layout = QtWidgets.QGridLayout()
        self.right_widget.setLayout(self.right_layout)  # 设置右侧部件布局为网格

        self.main_layout.addWidget(self.left_widget, 0, 0, 12,
                                   2)  # 左侧部件在第0行第0列,占8行3列
        self.main_layout.addWidget(self.right_widget, 0, 2, 12,
                                   10)  # 右侧部件在第0行第3列,占8行9列
        self.setCentralWidget(self.main_widget)  # 设置窗口主部件
        self.left_close = QtWidgets.QPushButton("")  # 关闭按钮
        self.left_visit = QtWidgets.QPushButton("")  # 空白按钮
        self.left_mini = QtWidgets.QPushButton("")  # 最小化按钮

        self.left_label_1 = QtWidgets.QPushButton("每日推荐")
        self.left_label_1.setObjectName('left_label')
        self.left_label_2 = QtWidgets.QPushButton("我的音乐")
        self.left_label_2.setObjectName('left_label')
        self.left_label_3 = QtWidgets.QPushButton("联系与帮助")
        self.left_label_3.setObjectName('left_label')

        self.left_button_1 = QtWidgets.QPushButton(
            qtawesome.icon('fa.music', color='white'), "华语流行")
        self.left_button_1.setObjectName('left_button')
        self.left_button_2 = QtWidgets.QPushButton(
            qtawesome.icon('fa.sellsy', color='white'), "在线FM")
        self.left_button_2.setObjectName('left_button')
        self.left_button_3 = QtWidgets.QPushButton(
            qtawesome.icon('fa.film', color='white'), "热门MV")
        self.left_button_3.setObjectName('left_button')
        self.left_button_4 = QtWidgets.QPushButton(
            qtawesome.icon('fa.home', color='white'), "本地音乐")
        self.left_button_4.setObjectName('left_button')
        self.left_button_5 = QtWidgets.QPushButton(
            qtawesome.icon('fa.download', color='white'), "下载管理")
        self.left_button_5.setObjectName('left_button')
        self.left_button_6 = QtWidgets.QPushButton(
            qtawesome.icon('fa.heart', color='white'), "我的收藏")
        self.left_button_6.setObjectName('left_button')
        self.left_button_7 = QtWidgets.QPushButton(
            qtawesome.icon('fa.comment', color='white'), "反馈建议")
        self.left_button_7.setObjectName('left_button')
        self.left_button_8 = QtWidgets.QPushButton(
            qtawesome.icon('fa.star', color='white'), "关注我们")
        self.left_button_8.setObjectName('left_button')
        self.left_button_9 = QtWidgets.QPushButton(
            qtawesome.icon('fa.question', color='white'), "遇到问题")
        self.left_button_9.setObjectName('left_button')
        self.left_xxx = QtWidgets.QPushButton(" ")
        self.left_layout.addWidget(self.left_mini, 0, 0, 1, 1)
        self.left_layout.addWidget(self.left_close, 0, 2, 1, 1)
        self.left_layout.addWidget(self.left_visit, 0, 1, 1, 1)
        self.left_layout.addWidget(self.left_label_1, 1, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_1, 2, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_2, 3, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_3, 4, 0, 1, 3)
        self.left_layout.addWidget(self.left_label_2, 5, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_4, 6, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_5, 7, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_6, 8, 0, 1, 3)
        self.left_layout.addWidget(self.left_label_3, 9, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_7, 10, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_8, 11, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_9, 12, 0, 1, 3)
        self.right_bar_widget = QtWidgets.QWidget()  # 右侧顶部搜索框部件
        self.right_bar_layout = QtWidgets.QGridLayout()  # 右侧顶部搜索框网格布局
        self.right_bar_widget.setLayout(self.right_bar_layout)
        self.search_icon = QtWidgets.QLabel(chr(0xf005) + ' ' + '搜索  ')
        self.search_icon.setFont(qtawesome.font('fa', 16))
        self.right_bar_widget_search_input = QtWidgets.QLineEdit()
        self.right_bar_widget_search_input.setPlaceholderText(
            "输入歌手、歌曲或用户,回车进行搜索")

        self.right_bar_layout.addWidget(self.search_icon, 0, 0, 1, 1)
        self.right_bar_layout.addWidget(self.right_bar_widget_search_input, 0,
                                        1, 1, 8)

        self.right_layout.addWidget(self.right_bar_widget, 0, 0, 1, 9)
Beispiel #25
0
    def initUI(self):
        self.setWindowTitle("数据库列表")
        self.resize(1000, 800)
        self.setObjectName('win')

        self.setWindowIcon(QtGui.QIcon('images/tubiao.ico'))

        self.db = pymysql.connect(
            host='127.0.0.1',
            port=3306,
            user='******',
            password='******',
            db='videos',
            charset='utf8',
        )
        self.cur = self.db.cursor()
        self.cur.execute("select name,url,mark,action from video")
        self.data = self.cur.fetchall()

        self.col_lst = [tup[0] for tup in self.cur.description]
        row = len(self.data)
        vol = len(self.data[0])

        self.MyTable = QTableWidget(row, vol)
        font = QtGui.QFont('微软雅黑', 10)

        self.MyTable.horizontalHeader().setFont(font)
        self.MyTable.setHorizontalHeaderLabels(self.col_lst)
        self.MyTable.verticalHeader().setVisible(False)
        self.MyTable.setFrameShape(QFrame.NoFrame)
        self.MyTable.horizontalHeader().setSectionResizeMode(
            QHeaderView.Stretch)
        self.MyTable.horizontalHeader().setStyleSheet(
            'QHeaderView::section{background:skyblue}')

        for i in range(row):
            for j in range(vol):
                temp_data = self.data[i][j]
                data1 = QTableWidgetItem(str(temp_data))  # 转换后可插入表格
                self.MyTable.setItem(i, j, data1)

        #编辑按钮
        self.search_icon = QtWidgets.QLabel(chr(0xf002) + ' ' + '搜索  ')
        self.search_icon.setFont(qtawesome.font('fa', 16))
        self.qle = QLineEdit()
        self.qle.setPlaceholderText("输入视频名称、动作数字标签或动作名称,QUERY键进行搜索")
        buttonBox = QDialogButtonBox()
        #增删查改四个按钮
        self.addButton = buttonBox.addButton("&ADD",
                                             QDialogButtonBox.ActionRole)
        self.okButton = buttonBox.addButton("&OK", QDialogButtonBox.ActionRole)
        self.deleteButton = buttonBox.addButton("&DELETE",
                                                QDialogButtonBox.ActionRole)
        self.inquireButton = buttonBox.addButton("&QUERY",
                                                 QDialogButtonBox.ActionRole)
        #按钮的颜色优化
        self.addButton.setStyleSheet(
            '''QPushButton{background:#F76677;border-radius:5px;}QPushButton:hover{
        background:red;}''')
        self.okButton.setStyleSheet(
            '''QPushButton{background:#F7D674;border-radius:5px;}QPushButton:hover{
        background:yellow;}''')
        self.deleteButton.setStyleSheet(
            '''QPushButton{background:#6DDF6D;border-radius:5px;}QPushButton:hover{
        background:green;}''')
        self.inquireButton.setStyleSheet(
            '''QPushButton{background:#CC6699;border-radius:5px;}QPushButton:hover{
        background:blue;}''')
        self.qle.setStyleSheet('''QLineEdit{
                    border:1px solid gray;
                    width:300px;
                    border-radius:10px;
                    padding:2px 4px;
            }''')

        #设置按钮内字体样式
        self.addButton.setFont(font)
        self.okButton.setFont(font)
        self.deleteButton.setFont(font)
        self.inquireButton.setFont(font)

        #网格布局
        self.net_widget = QtWidgets.QWidget()
        self.net_layout = QtWidgets.QGridLayout()  #搜索部件的布局
        self.net_widget.setLayout(self.net_layout)
        self.net_layout.addWidget(self.search_icon, 0, 0, 1, 1)
        self.net_layout.addWidget(self.qle, 0, 1, 1, 8)

        #垂直布局
        layout = QVBoxLayout()
        layout.addWidget(self.net_widget)
        #layout.addWidget(self.search_icon)
        #layout.addWidget(self.qle)
        layout.addWidget(buttonBox)
        layout.addWidget(self.MyTable)
        self.setLayout(layout)

        #qss进行布局优化
        self.setStyleSheet("#win{background-color: white}")  #设置背景为白色
        self.setWindowOpacity(0.9)  #设置透明度
        #self.setAttribute(QtCore.Qt.WA_TranslucentBackground)  # 设置窗口背景透明
        self.setWindowFlag(QtCore.Qt.FramelessWindowHint)  # 隐藏边框
        layout.setSpacing(0)
        self.setStyleSheet('''
        #win{
            background:white;
            border-top:1px solid white;
            border-bottom:1px solid white;
            border-left:1px solid white;
            border-top-left-radius:10px;
            border-bottom-left-radius:10px;
        }
        ''')
Beispiel #26
0
    def __init__(self):
        super().__init__()

        # Label for supported fonts
        supported_fonts_label = QtWidgets.QLabel('Supported fonts (prefix)')
        supported_fonts_label.setAlignment(QtCore.Qt.AlignCenter)

        # Get FontAwesome 5.x icons by name in various styles by name
        fa5_icon = qta.icon('fa5.flag')
        fa5_button = QtWidgets.QPushButton(fa5_icon,
                                           'Font Awesome regular (fa5)')

        fa5s_icon = qta.icon('fa5s.flag')
        fa5s_button = QtWidgets.QPushButton(fa5s_icon,
                                            'Font Awesome solid (fa5s)')

        fa5b_icon = qta.icon('fa5b.github')
        fa5b_button = QtWidgets.QPushButton(fa5b_icon,
                                            'Font Awesome brands (fa5b)')

        # Get Elusive icons by name
        asl_icon = qta.icon('ei.asl')
        elusive_button = QtWidgets.QPushButton(asl_icon, 'Elusive Icons (ei)')

        # Get Material Design icons by name
        apn_icon = qta.icon('mdi6.access-point-network')
        mdi6_button = QtWidgets.QPushButton(apn_icon,
                                            'Material Design (mdi, mdi6)')

        # Get Phosphor by name
        mic_icon = qta.icon('ph.microphone-fill')
        ph_button = QtWidgets.QPushButton(mic_icon, 'Phosphor Icons (ph)')

        # Get Remix Icon by name
        truck_icon = qta.icon('ri.truck-fill')
        ri_button = QtWidgets.QPushButton(truck_icon, 'Remix Icons (ri)')

        # Get Microsoft's Codicons by name
        squirrel_icon = qta.icon('msc.squirrel')
        msc_button = QtWidgets.QPushButton(squirrel_icon, 'Codicons (msc)')

        # Label for style options and animations
        styles_label = QtWidgets.QLabel('Styles')
        styles_label.setAlignment(QtCore.Qt.AlignCenter)

        # Rotated
        rot_icon = qta.icon('mdi.access-point-network', rotated=45)
        rot_button = QtWidgets.QPushButton(rot_icon, 'Rotated Icons')

        # Horizontal flip
        hflip_icon = qta.icon('mdi.account-alert', hflip=True)
        hflip_button = QtWidgets.QPushButton(hflip_icon,
                                             'Horizontally Flipped Icons')

        # Vertical flip
        vflip_icon = qta.icon('mdi.account-alert', vflip=True)
        vflip_button = QtWidgets.QPushButton(vflip_icon,
                                             'Vertically Flipped Icons')

        # Styling
        styling_icon = qta.icon('fa5s.music',
                                active='fa5s.balance-scale',
                                color='blue',
                                color_active='orange')
        music_button = QtWidgets.QPushButton(styling_icon, 'Changing colors')

        # Setting an alpha of 165 to the color of this icon. Alpha must be a number
        # between 0 and 255.
        icon_with_alpha = qta.icon('mdi.heart', color=('red', 120))
        heart_button = QtWidgets.QPushButton(icon_with_alpha, 'Setting alpha')

        # Toggle
        toggle_icon = qta.icon('fa5s.home',
                               selected='fa5s.balance-scale',
                               color_off='black',
                               color_off_active='blue',
                               color_on='orange',
                               color_on_active='yellow')
        toggle_button = QtWidgets.QPushButton(toggle_icon, 'Toggle')
        toggle_button.setCheckable(True)

        iconwidget = qta.IconWidget()
        spin_icon = qta.icon('mdi.loading',
                             color='red',
                             animation=qta.Spin(iconwidget))
        iconwidget.setIcon(spin_icon)
        iconwidget.setIconSize(QtCore.QSize(32, 32))
        iconwidgetholder = QtWidgets.QWidget()
        lo = QtWidgets.QHBoxLayout()
        lo.addWidget(iconwidget)
        lo.addWidget(QtWidgets.QLabel('IconWidget'))
        iconwidgetholder.setLayout(lo)
        iconwidget2 = qta.IconWidget('mdi.web', color='blue')

        # Stack icons
        camera_ban = qta.icon('fa5s.camera',
                              'fa5s.ban',
                              options=[{
                                  'scale_factor': 0.5,
                                  'active': 'fa5s.balance-scale'
                              }, {
                                  'color': 'red',
                                  'opacity': 0.7
                              }])
        stack_button = QtWidgets.QPushButton(camera_ban, 'Stack')
        stack_button.setIconSize(QtCore.QSize(32, 32))

        # Stack and offset icons
        saveall = qta.icon('fa5.save',
                           'fa5.save',
                           options=[{
                               'scale_factor': 0.8,
                               'offset': (0.2, 0.2),
                               'color': 'gray'
                           }, {
                               'scale_factor': 0.8
                           }])
        saveall_button = QtWidgets.QPushButton(saveall, 'Stack, offset')

        # Spin icons
        spin_button = QtWidgets.QPushButton(' Spinning icon')
        spin_icon = qta.icon('fa5s.spinner',
                             color='red',
                             animation=qta.Spin(spin_button))
        spin_button.setIcon(spin_icon)

        # Pulse icons
        pulse_button = QtWidgets.QPushButton(' Pulsing icon')
        pulse_icon = qta.icon('fa5s.spinner',
                              color='green',
                              animation=qta.Pulse(pulse_button))
        pulse_button.setIcon(pulse_icon)

        # Stacked spin icons
        stack_spin_button = QtWidgets.QPushButton('Stack spin')
        options = [{
            'scale_factor': 0.4,
            'animation': qta.Spin(stack_spin_button)
        }, {
            'color': 'blue'
        }]
        stack_spin_icon = qta.icon('ei.asl', 'fa5.square', options=options)
        stack_spin_button.setIcon(stack_spin_icon)
        stack_spin_button.setIconSize(QtCore.QSize(32, 32))

        # Render a label with this font
        label = QtWidgets.QLabel(chr(0xf19c) + ' ' + 'Label')
        label.setFont(qta.font('fa', 16))

        # Layout
        grid = QtWidgets.QGridLayout()
        fonts_widgets = [
            supported_fonts_label,
            fa5_button,
            fa5s_button,
            fa5b_button,
            elusive_button,
            mdi6_button,
            ph_button,
            ri_button,
            msc_button,
        ]
        styled_widgets = [
            styles_label, music_button, heart_button, rot_button, hflip_button,
            vflip_button, toggle_button
        ]
        animated_widgets = [
            spin_button,
            pulse_button,
            stack_button,
            saveall_button,
            stack_spin_button,
        ]
        other_widgets = [label, iconwidgetholder, iconwidget2]

        for idx, w in enumerate(fonts_widgets):
            grid.addWidget(w, idx, 0)

        for idx, w in enumerate(styled_widgets):
            grid.addWidget(w, idx, 1)

        for idx, w in enumerate(animated_widgets):
            grid.addWidget(w, idx + len(styled_widgets), 1)

        for idx, w in enumerate(other_widgets):
            grid.addWidget(w,
                           idx + len(styled_widgets) + len(animated_widgets),
                           1)

        self.setLayout(grid)
        self.setWindowTitle('Awesome')
        self.setMinimumWidth(520)
        self.show()
Beispiel #27
0
    def init_ui(self):
        self.setFixedSize(1024, 600)
        self.main_widget = QtWidgets.QWidget()  # 创建窗口主部件
        self.main_layout = QtWidgets.QGridLayout()  # 创建主部件的网格布局
        self.main_widget.setLayout(self.main_layout)  # 设置窗口主部件布局为网格布局

        self.left_widget = QtWidgets.QWidget()  # 创建左侧部件
        self.left_widget.setObjectName('left_widget')
        self.left_layout = QtWidgets.QGridLayout()  # 创建左侧部件的网格布局层
        self.left_widget.setLayout(self.left_layout)  # 设置左侧部件布局为网格

        self.right_widget = QtWidgets.QWidget()  # 创建右侧部件
        self.right_widget.setObjectName('right_widget')
        self.right_layout = QtWidgets.QGridLayout()
        self.right_widget.setLayout(self.right_layout)  # 设置右侧部件布局为网格

        self.main_layout.addWidget(self.left_widget, 0, 0, 12, 2)  # 左侧部件在第0行第0列,占12行2列
        self.main_layout.addWidget(self.right_widget, 0, 2, 12, 10)  # 右侧部件在第0行第3列,占12行10列
        self.setCentralWidget(self.main_widget)  # 设置窗口主部件

        # self.left_close = QtWidgets.QPushButton("") # 关闭按钮
        self.left_close = QtWidgets.QPushButton(qtawesome.icon('fa.times', color='white'), "")
        # self.left_visit = QtWidgets.QPushButton("") # 空白按钮
        self.left_visit = QtWidgets.QPushButton(qtawesome.icon('fa.gamepad', color='white'), "")
        # self.left_mini = QtWidgets.QPushButton("")  # 最小化按钮
        self.left_mini = QtWidgets.QPushButton(qtawesome.icon('fa.film', color='white'), "")
        self.left_close.clicked.connect(self.close_window)  # 关联

        self.left_label_1 = QtWidgets.QPushButton("每日推荐")
        self.left_label_1.setObjectName('left_label')
        self.left_label_2 = QtWidgets.QPushButton("我的音乐")
        self.left_label_2.setObjectName('left_label')
        self.left_label_3 = QtWidgets.QPushButton("联系与帮助")
        self.left_label_3.setObjectName('left_label')

        self.left_button_1 = QtWidgets.QPushButton(qtawesome.icon('fa.music', color='white'), "华语流行")
        self.left_button_1.setObjectName('left_button')
        self.left_button_2 = QtWidgets.QPushButton(qtawesome.icon('fa.sellsy', color='white'), "在线FM")
        self.left_button_2.setObjectName('left_button')
        self.left_button_3 = QtWidgets.QPushButton(qtawesome.icon('fa.film', color='white'), "热门MV")
        self.left_button_3.setObjectName('left_button')
        self.left_button_4 = QtWidgets.QPushButton(qtawesome.icon('fa.home', color='white'), "本地音乐")
        self.left_button_4.setObjectName('left_button')
        self.left_button_5 = QtWidgets.QPushButton(qtawesome.icon('fa.download', color='white'), "下载管理")
        self.left_button_5.setObjectName('left_button')
        self.left_button_6 = QtWidgets.QPushButton(qtawesome.icon('fa.heart', color='white'), "我的收藏")
        self.left_button_6.setObjectName('left_button')
        self.left_button_7 = QtWidgets.QPushButton(qtawesome.icon('fa.comment', color='white'), "反馈建议")
        self.left_button_7.setObjectName('left_button')
        self.left_button_8 = QtWidgets.QPushButton(qtawesome.icon('fa.star', color='white'), "关注我们")
        self.left_button_8.setObjectName('left_button')
        self.left_button_9 = QtWidgets.QPushButton(qtawesome.icon('fa.question', color='white'), "遇到问题")
        self.left_button_9.setObjectName('left_button')
        self.left_xxx = QtWidgets.QPushButton(" ")

        self.left_layout.addWidget(self.left_mini, 0, 0, 1, 1)
        self.left_layout.addWidget(self.left_close, 0, 2, 1, 1)
        self.left_layout.addWidget(self.left_visit, 0, 1, 1, 1)

        self.left_layout.addWidget(self.left_label_1, 1, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_1, 2, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_2, 3, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_3, 4, 0, 1, 3)
        self.left_layout.addWidget(self.left_label_2, 5, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_4, 6, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_5, 7, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_6, 8, 0, 1, 3)
        self.left_layout.addWidget(self.left_label_3, 9, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_7, 10, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_8, 11, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_9, 12, 0, 1, 3)

        self.right_bar_widget = QtWidgets.QWidget()  # 右侧顶部搜索框部件
        self.right_bar_layout = QtWidgets.QGridLayout()  # 右侧顶部搜索框网格布局
        self.right_bar_widget.setLayout(self.right_bar_layout)
        self.search_icon = QtWidgets.QLabel(chr(0xf002) + ' ' + '搜索  ')
        self.search_icon.setFont(qtawesome.font('fa', 16))
        self.right_bar_widget_search_input = QtWidgets.QLineEdit()
        self.right_bar_widget_search_input.setPlaceholderText("输入歌手、歌曲或用户,回车进行搜索")

        self.right_bar_layout.addWidget(self.search_icon, 0, 0, 1, 1)
        self.right_bar_layout.addWidget(self.right_bar_widget_search_input, 0, 1, 1, 8)

        self.right_layout.addWidget(self.right_bar_widget, 0, 0, 1, 9)

        self.right_recommend_label = QtWidgets.QLabel("今日推荐")
        self.right_recommend_label.setObjectName('right_lable')

        self.right_recommend_widget = QtWidgets.QWidget()  # 推荐封面部件
        self.right_recommend_layout = QtWidgets.QGridLayout()  # 推荐封面网格布局
        self.right_recommend_widget.setLayout(self.right_recommend_layout)

        self.recommend_button_1 = QtWidgets.QToolButton()
        self.recommend_button_1.setText("个性电台")  # 设置按钮文本
        self.recommend_button_1.setIcon(QtGui.QIcon('./r1.jpg'))  # 设置按钮图标
        self.recommend_button_1.setIconSize(QtCore.QSize(100, 100))  # 设置图标大小
        self.recommend_button_1.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon)  # 设置按钮形式为上图下文

        self.recommend_button_2 = QtWidgets.QToolButton()
        self.recommend_button_2.setText("跑步者")
        self.recommend_button_2.setIcon(QtGui.QIcon('./r2.jpg'))
        self.recommend_button_2.setIconSize(QtCore.QSize(100, 100))
        self.recommend_button_2.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon)

        self.recommend_button_3 = QtWidgets.QToolButton()
        self.recommend_button_3.setText("睡前")
        self.recommend_button_3.setIcon(QtGui.QIcon('./r3.jpg'))
        self.recommend_button_3.setIconSize(QtCore.QSize(100, 100))
        self.recommend_button_3.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon)

        self.recommend_button_4 = QtWidgets.QToolButton()
        self.recommend_button_4.setText("随心听")
        self.recommend_button_4.setIcon(QtGui.QIcon('./r4.jpg'))
        self.recommend_button_4.setIconSize(QtCore.QSize(100, 100))
        self.recommend_button_4.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon)

        self.recommend_button_5 = QtWidgets.QToolButton()
        self.recommend_button_5.setText("经典日漫")
        self.recommend_button_5.setIcon(QtGui.QIcon('./01.jpg'))
        self.recommend_button_5.setIconSize(QtCore.QSize(100, 100))
        self.recommend_button_5.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon)

        self.right_recommend_layout.addWidget(self.recommend_button_1, 0, 0)
        self.right_recommend_layout.addWidget(self.recommend_button_2, 0, 1)
        self.right_recommend_layout.addWidget(self.recommend_button_3, 0, 2)
        self.right_recommend_layout.addWidget(self.recommend_button_4, 0, 3)
        self.right_recommend_layout.addWidget(self.recommend_button_5, 0, 4)

        self.right_layout.addWidget(self.right_recommend_label, 1, 0, 1, 9)
        self.right_layout.addWidget(self.right_recommend_widget, 2, 0, 2, 9)

        self.right_newsong_lable = QtWidgets.QLabel("最新歌曲")
        self.right_newsong_lable.setObjectName('right_lable')

        self.right_playlist_lable = QtWidgets.QLabel("热门歌单")
        self.right_playlist_lable.setObjectName('right_lable')

        self.right_newsong_widget = QtWidgets.QWidget()  # 最新歌曲部件
        self.right_newsong_layout = QtWidgets.QGridLayout()  # 最新歌曲部件网格布局
        self.right_newsong_widget.setLayout(self.right_newsong_layout)

        self.newsong_button_1 = QtWidgets.QPushButton(
            "Bohemian Rhapsody    Queen           Bohemian Rhapsody         05::54")
        self.newsong_button_2 = QtWidgets.QPushButton(
            "Dance Monkey         Tones and I     The Kids Are Coming       03::29")
        self.newsong_button_3 = QtWidgets.QPushButton(
            "Girls Like You       Maroon 5        Red Pill Blues            03::55")
        self.newsong_button_4 = QtWidgets.QPushButton(
            "Cheap Thrills        Sia             Cheap Thrills             03::31")
        self.newsong_button_5 = QtWidgets.QPushButton(
            "Государственный гимн СССР                                  03::29")
        self.newsong_button_6 = QtWidgets.QPushButton("リブート                ミワ              reboot               04::02")

        self.right_newsong_layout.addWidget(self.newsong_button_1, 0, 1, )
        self.right_newsong_layout.addWidget(self.newsong_button_2, 1, 1, )
        self.right_newsong_layout.addWidget(self.newsong_button_3, 2, 1, )
        self.right_newsong_layout.addWidget(self.newsong_button_4, 3, 1, )
        self.right_newsong_layout.addWidget(self.newsong_button_5, 4, 1, )
        self.right_newsong_layout.addWidget(self.newsong_button_6, 5, 1, )
        self.right_playlist_widget = QtWidgets.QWidget()  # 播放歌单部件
        self.right_playlist_layout = QtWidgets.QGridLayout()  # 播放歌单网格布局
        self.right_playlist_widget.setLayout(self.right_playlist_layout)

        self.playlist_button_1 = QtWidgets.QToolButton()
        self.playlist_button_1.setText("助眠白噪音:调整...")
        self.playlist_button_1.setIcon(QtGui.QIcon('./p1.jpg'))
        self.playlist_button_1.setIconSize(QtCore.QSize(100, 100))
        self.playlist_button_1.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon)

        self.playlist_button_2 = QtWidgets.QToolButton()
        self.playlist_button_2.setText("当代古典乐:走进...")
        self.playlist_button_2.setIcon(QtGui.QIcon('./p2.jpg'))
        self.playlist_button_2.setIconSize(QtCore.QSize(100, 100))
        self.playlist_button_2.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon)

        self.playlist_button_3 = QtWidgets.QToolButton()
        self.playlist_button_3.setText("沉静如海 : 被复古...")
        self.playlist_button_3.setIcon(QtGui.QIcon('./p3.jpg'))
        self.playlist_button_3.setIconSize(QtCore.QSize(100, 100))
        self.playlist_button_3.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon)

        self.playlist_button_4 = QtWidgets.QToolButton()
        self.playlist_button_4.setText("歌慌必备 : 打破感...")
        self.playlist_button_4.setIcon(QtGui.QIcon('./p4.jpg'))
        self.playlist_button_4.setIconSize(QtCore.QSize(100, 100))
        self.playlist_button_4.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon)

        self.right_playlist_layout.addWidget(self.playlist_button_1, 0, 0)
        self.right_playlist_layout.addWidget(self.playlist_button_2, 0, 1)
        self.right_playlist_layout.addWidget(self.playlist_button_3, 1, 0)
        self.right_playlist_layout.addWidget(self.playlist_button_4, 1, 1)

        self.right_layout.addWidget(self.right_newsong_lable, 4, 0, 1, 5)
        self.right_layout.addWidget(self.right_playlist_lable, 4, 5, 1, 4)
        self.right_layout.addWidget(self.right_newsong_widget, 5, 0, 1, 5)
        self.right_layout.addWidget(self.right_playlist_widget, 5, 5, 1, 4)

        self.right_process_bar = QtWidgets.QProgressBar()  # 播放进度部件
        self.right_process_bar.setValue(49)
        self.right_process_bar.setFixedHeight(3)  # 设置进度条高度
        self.right_process_bar.setTextVisible(False)  # 不显示进度条文字

        self.right_playconsole_widget = QtWidgets.QWidget()  # 播放控制部件
        self.right_playconsole_layout = QtWidgets.QGridLayout()  # 播放控制部件网格布局层
        self.right_playconsole_widget.setLayout(self.right_playconsole_layout)

        self.console_button_1 = QtWidgets.QPushButton(qtawesome.icon('fa.backward', color='#F76677'), "")
        self.console_button_2 = QtWidgets.QPushButton(qtawesome.icon('fa.forward', color='#F76677'), "")
        self.console_button_3 = QtWidgets.QPushButton(qtawesome.icon('fa.pause', color='#F76677', font=18), "")
        self.console_button_3.setIconSize(QtCore.QSize(30, 30))

        self.right_playconsole_layout.addWidget(self.console_button_1, 0, 0)
        self.right_playconsole_layout.addWidget(self.console_button_2, 0, 2)
        self.right_playconsole_layout.addWidget(self.console_button_3, 0, 1)
        self.right_playconsole_layout.setAlignment(QtCore.Qt.AlignCenter)  # 设置布局内部件居中显示

        self.right_layout.addWidget(self.right_process_bar, 9, 0, 1, 9)
        self.right_layout.addWidget(self.right_playconsole_widget, 10, 0, 1, 9)

        self.left_close.setFixedSize(16, 16)  # 设置关闭按钮的大小
        self.left_visit.setFixedSize(16, 16)  # 设置按钮大小
        self.left_mini.setFixedSize(16, 16)  # 设置最小化按钮大小

        self.left_close.setStyleSheet(
            '''QPushButton{background:#F76677;border-radius:5px;}QPushButton:hover{background:red;}''')
        self.left_visit.setStyleSheet(
            '''QPushButton{background:#F7D674;border-radius:5px;}QPushButton:hover{background:yellow;}''')
        self.left_mini.setStyleSheet(
            '''QPushButton{background:#6DDF6D;border-radius:5px;}QPushButton:hover{background:green;}''')

        self.left_widget.setStyleSheet('''
            QPushButton{border:none;color:white;}
            QPushButton#left_label{
                border:none;
                border-bottom:1px solid white;
                font-size:18px;
                font-weight:700;
                font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
            }
            QPushButton#left_button:hover{border-left:4px solid red;font-weight:700;}
            QWidget#left_widget{
            background:gray;
            border-top:1px solid white;
            border-bottom:1px solid white;
            border-left:1px solid white;
            border-top-left-radius:10px;
            border-bottom-left-radius:10px;
        }
        ''')

        self.right_bar_widget_search_input.setStyleSheet(
            '''QLineEdit{
                    border:1px solid gray;
                    width:300px;
                    border-radius:10px;
                    padding:2px 4px;
            }''')

        self.right_widget.setStyleSheet('''
            QWidget#right_widget{
                color:#232C51;
                background:white;
                border-top:1px solid darkGray;
                border-bottom:1px solid darkGray;
                border-right:1px solid darkGray;
                border-top-right-radius:10px;
                border-bottom-right-radius:10px;
            }
            QLabel#right_lable{
                border:none;
                font-size:16px;
                font-weight:700;
                font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
            }
        ''')
        self.right_recommend_widget.setStyleSheet(
            '''
                QToolButton{border:none;}
                QToolButton:hover{border-bottom:2px solid #F76677;}
            ''')
        self.right_playlist_widget.setStyleSheet(
            '''
                QToolButton{border:none;}
                QToolButton:hover{border-bottom:2px solid #F76677;}
            ''')
        self.right_newsong_widget.setStyleSheet('''
            QPushButton{
                border:none;
                color:gray;
                font-size:12px;
                height:40px;
                padding-left:5px;
                padding-right:10px;
                text-align:left;
            }
            QPushButton:hover{
                color:black;
                border:1px solid #F3F3F5;
                border-radius:10px;
                background:LightGray;
            }
        ''')
        self.right_process_bar.setStyleSheet('''
            QProgressBar::chunk {
                background-color: #F76677;
            }
        ''')

        self.right_playconsole_widget.setStyleSheet('''
            QPushButton{
                border:none;
            }
        ''')

        self.setWindowOpacity(0.9)  # 设置窗口透明度
        self.setAttribute(QtCore.Qt.WA_TranslucentBackground)  # 设置窗口背景透明
        self.setWindowFlags(QtCore.Qt.FramelessWindowHint)  # 隐藏边框

        self.main_layout.setSpacing(0)
Beispiel #28
0
    def init_ui(self):
        self.setFixedSize(980, 610)
        self.main_widget = QWidget()  # 创建窗口主部件
        self.setWindowIcon(QIcon("/etc/v2rayL/images/logo.ico"))
        self.main_layout = QGridLayout()  # 创建主部件的网格布局
        self.main_widget.setLayout(self.main_layout)  # 设置窗口主部件布局为网格布局

        self.left_widget = QWidget()  # 创建左侧部件
        self.left_widget.setObjectName('left_widget')
        self.left_layout = QGridLayout()  # 创建左侧部件的网格布局层
        self.left_widget.setLayout(self.left_layout)  # 设置左侧部件布局为网格
        self.right_widget = QWidget()  # 创建右上侧部件
        self.right_widget.setObjectName('right_widget')
        self.right_layout = QGridLayout()
        self.right_widget.setLayout(self.right_layout)  # 设置右侧部件布局为网格

        self.right_down_widget = QWidget()  # 创建右下侧部件
        self.right_down_widget.setObjectName('right_down_widget')
        self.right_down_layout = QGridLayout()
        self.right_down_widget.setLayout(self.right_down_layout)  # 设置右侧部件布局为网格

        self.right_up_widget = QWidget()  # 创建右上侧部件
        self.right_up_widget.setObjectName('right_up_widget')
        self.right_up_layout = QGridLayout()
        self.right_up_widget.setLayout(self.right_up_layout)  # 设置右侧部件布局为网格

        self.right_down_widget = QWidget()  # 创建右下侧部件
        self.right_down_widget.setObjectName('right_down_widget')
        self.right_down_layout = QGridLayout()
        self.right_down_widget.setLayout(self.right_down_layout)  # 设置右侧部件布局为网格

        self.main_layout.addWidget(self.left_widget, 0, 0, 12, 2)  # 左侧部件在第0行第0列,占8行3列
        # self.main_layout.addWidget(self.right_up_widget, 0, 2, 2, 10)  # 左侧部件在第0行第0列,占8行3列
        self.main_layout.addWidget(self.right_widget, 0, 2, 12, 10)  # 右侧部件在第0行第3列,占8行9列
        self.setCentralWidget(self.main_widget)  # 设置窗口主部件

        self.right_layout.addWidget(self.right_up_widget, 0, 0, 1, 9)
        self.right_layout.addWidget(self.right_down_widget, 1, 0, 8, 9)
        self.left_close = QPushButton("")  # 关闭按钮
        self.left_mini = QPushButton("")  # 最小化按钮

        self.left_connect_label = QPushButton("连接")
        self.left_connect_label.setObjectName('left_label')
        self.left_settings_label = QPushButton("设置")
        self.left_settings_label.setObjectName('left_label')
        self.left_help__label = QPushButton("帮助")
        self.left_help__label.setObjectName('left_label')

        self.left_button_1 = QPushButton(qtawesome.icon('fa.plug', color='black'), "可用连接")
        self.left_button_1.setObjectName('left_button')
        self.left_button_3 = QPushButton(qtawesome.icon('fa.tachometer', color='black'), "配置订阅")
        self.left_button_3.setObjectName('left_button')
        self.left_button_4 = QPushButton(qtawesome.icon('fa.info-circle', color='black'), "版本说明")
        self.left_button_4.setObjectName('left_button')
        self.left_button_5 = QPushButton(qtawesome.icon('fa.cog', color='black'), "系统设置")
        self.left_button_5.setObjectName('left_button')


        self.left_layout.addWidget(self.left_mini, 0, 1, 1, 3)
        self.left_layout.addWidget(self.left_close, 0, 2, 1, 2)
        self.left_layout.addWidget(self.left_connect_label, 2, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_1, 3, 0, 1, 3)
        self.left_layout.addWidget(self.left_settings_label, 5, 0, 1, 3)
        # self.left_layout.addWidget(self.left_button_2, 6, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_3, 6, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_5, 7, 0, 1, 3)
        self.left_layout.addWidget(self.left_help__label, 9, 0, 1, 3)
        self.left_layout.addWidget(self.left_button_4, 10, 0, 1, 3)


        self.right_bar_widget = QWidget()  # 右侧顶部logo部件
        self.right_bar_layout = QGridLayout()  # 右侧顶部logo网格布局
        self.right_bar_widget.setLayout(self.right_bar_layout)
        self.v2rayL_icon = QLabel()
        self.v2rayL_icon.setPixmap(QPixmap("/etc/v2rayL/images/logo.ico"))
        self.v2rayL_label = QLabel('V2rayL')
        self.v2rayL_label.setFont(qtawesome.font('fa', 24))

        self.right_bar_layout.addWidget(self.v2rayL_icon, 0, 0, 1, 4, Qt.AlignRight)
        self.right_bar_layout.addWidget(self.v2rayL_label, 0, 4, 1, 5, Qt.AlignLeft)

        self.right_up_layout.addWidget(self.right_bar_widget, 0, 0, 1, 9)
        # self.right_layout.addWidget(self.right_one_widget, 1, 0, 8, 9)

        # 顶部三个按钮Qss
        self.left_close.setFixedSize(15, 15)  # 设置关闭按钮的大小
        self.left_mini.setFixedSize(15, 15)  # 设置最小化按钮大小
        self.left_close.setStyleSheet(
            '''QPushButton{background:#F76677;border-radius:7px;}
            QPushButton:hover{background:red;}''')
        self.left_mini.setStyleSheet(
            '''QPushButton{background:#6DDF6D;border-radius:7px;}
            QPushButton:hover{background:green;}''')

        # 左部Qss
        self.left_widget.setStyleSheet('''
            QPushButton{border:none;color:white;}
            QPushButton#left_label{
                border:none;
                border-bottom:1px solid white;
                font-size:18px;
                font-weight:700;
                font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
            }
            QPushButton#left_button:hover{border-left:4px solid red;font-weight:700;}
            QWidget#left_widget{
                background:#708090;
                border-top:1px solid white;
                border-bottom:1px solid white;
                border-left:1px solid white;
                border-top-left-radius:10px;
                border-bottom-left-radius:10px;
                }
        ''')

        # 右部Qss
        self.right_widget.setStyleSheet('''
            QWidget#right_widget{
                color:#232C51;
                background:white;
                border-top:1px solid darkGray;
                border-bottom:1px solid darkGray;
                border-right:1px solid darkGray;
                border-top-right-radius:10px;
                border-bottom-right-radius:10px;
            }
            QLabel#right_lable{
                border:none;
                font-size:16px;
                font-weight:700;
                font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
            }
        ''')

        self.right_up_widget.setStyleSheet('''
            QWidget#right_up_widget{
                border-bottom: 2px solid darkGray;
            }
        ''')



        self.setWindowOpacity(0.95)  # 设置窗口透明度
        self.setAttribute(Qt.WA_TranslucentBackground)  # 设置窗口背景透明
        self.setWindowFlag(Qt.FramelessWindowHint)  # 隐藏边框
        self.main_layout.setSpacing(0)

        self.config_setting_widget = QWidget()
        self.system_setting_widget = QWidget()
        self.help_widget = QWidget()
        self.first_widget = QWidget()

        # 配置页面
        self.config_setting_ui = Ui_Setting1_Form()
        self.config_setting_ui.setupUi(self.config_setting_widget)
        self.right_down_layout.addWidget(self.config_setting_widget)

        # 系统设置页面
        self.system_setting_ui = Ui_SystemSettings()
        self.system_setting_ui.setupUi(self.system_setting_widget)
        self.right_down_layout.addWidget(self.system_setting_widget)

        # 版本说明页面
        self.help_ui = Ui_HelpUi()
        self.help_ui.setupUi(self.help_widget)
        self.right_down_layout.addWidget(self.help_widget)

        # 主页连接页面
        self.first_ui = Ui_FirstPage()
        self.first_ui.setupUi(self.first_widget)
        self.right_down_layout.addWidget(self.first_widget)

        # 分享配置窗口
        self.share_ui = QDialog()
        self.share_child_ui = Ui_Share_Dialog()
        self.share_child_ui.setupUi(self.share_ui)

        # 二维码分享配置窗口
        self.qr_ui = QDialog()
        self.qr_child_ui = Ui_Qr_Dialog()
        self.qr_child_ui.setupUi(self.qr_ui)

        self.current_page = self.first_widget
        self.config_setting_widget.hide()
        self.system_setting_widget.hide()
        self.help_widget.hide()

        self.left_mini.clicked.connect(self.on_left_mini_clicked)
        self.left_close.clicked.connect(self.on_left_close_clicked)
        self.left_button_1.clicked.connect(self.change_to_firstPage)
        self.left_button_3.clicked.connect(self.change_to_configSetting)
        self.left_button_4.clicked.connect(self.change_to_Help)
        self.left_button_5.clicked.connect(self.change_to_systemSetting)
    def init_ui(self):
        self.setFixedSize(960,700)
        self.main_widget = QtWidgets.QWidget()  # 创建窗口主部件
        self.main_layout = QtWidgets.QGridLayout()  # 创建主部件的网格布局
        self.main_widget.setLayout(self.main_layout)  # 设置窗口主部件布局为网格布局
        self.setWindowOpacity(0.9)  # 设置窗口透明度
        self.setAttribute(QtCore.Qt.WA_TranslucentBackground)  # 设置窗口背景透明
        self.setWindowFlag(QtCore.Qt.FramelessWindowHint)  # 隐藏边框
        self.main_layout.setSpacing(0)
        self.left_widget = QtWidgets.QWidget()  # 创建左侧部件
        self.left_widget.setObjectName('left_widget')
        self.frame = QFrame(self)
        self.left_layout = QtWidgets.QGridLayout(self.frame)  # 创建左侧部件的网格布局层
        self.left_widget.setLayout(self.left_layout) # 设置左侧部件布局为网格
        self.main_widget.setStyleSheet('''
            QWidget#left_widget{
            background:gray;
            border-top:1px solid white;
            border-bottom:1px solid white;
            border-left:1px solid white;
            border-top-left-radius:10px;
            border-bottom-left-radius:10px;
            }
            ''')

        self.right_widget = QtWidgets.QWidget() # 创建右侧部件
        self.right_widget.setObjectName('right_widget')
        self.right_layout = QtWidgets.QGridLayout()
        self.right_widget.setLayout(self.right_layout) # 设置右侧部件布局为网格



        self.main_layout.addWidget(self.left_widget,0,0,12,2) # 左侧部件在第0行第0列,占8行3列
        self.main_layout.addWidget(self.right_widget,0,2,12,10) # 右侧部件在第0行第3列,占8行9列
        self.setCentralWidget(self.main_widget) # 设置窗口主部件
        
        self.left_close = QtWidgets.QPushButton("")  # 关闭按钮
        self.left_close.clicked.connect(self.close)
        self.left_visit = QtWidgets.QPushButton("") # 空白按钮
        self.left_visit.clicked.connect(self.showMaximized)
        self.left_mini = QtWidgets.QPushButton("")  # 最小化按钮
        self.left_mini.clicked.connect(self.showMinimized)
        self.left_close.setStyleSheet(
            '''QPushButton{background:#F76677;border-radius:5px;}QPushButton:hover{background:red;}''')
        self.left_visit.setStyleSheet(
            '''QPushButton{background:#F7D674;border-radius:5px;}QPushButton:hover{background:yellow;}''')
        self.left_mini.setStyleSheet(
            '''QPushButton{background:#6DDF6D;border-radius:5px;}QPushButton:hover{background:green;}''')
        self.left_widget.setStyleSheet('''
            QPushButton{border:none;color:white;}
            QPushButton#left_label{
                border:none;
                border-bottom:1px solid blue;
                font-size:18px;
                font-weight:700;
                font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
            }
            QPushButton#left_button:hover{border-left:4px solid red;font-weight:700;}
        ''')
        self.left_label_1 = QtWidgets.QPushButton("国内疫情")
        self.left_label_1.setObjectName('left_label')
        self.left_label_2 = QtWidgets.QPushButton("全球疫情")
        self.left_label_2.setObjectName('left_label')
        self.left_label_3 = QtWidgets.QPushButton("联系与帮助")
        self.left_label_3.setObjectName('left_label')
        self.left_button_1 = QtWidgets.QPushButton(qtawesome.icon('fa.area-chart',color='white'),"死亡/新增确诊")
        self.left_button_1.setObjectName('left_button')
        self.left_button_1.clicked.connect(self.btn1_clicked)
        self.left_button_2 = QtWidgets.QPushButton(qtawesome.icon('fa.pie-chart',color='white'),"江西疫情情况")
        self.left_button_2.setObjectName('left_button')
        self.left_button_2.clicked.connect(self.btn2_clicked)
        self.left_button_3 = QtWidgets.QPushButton(
            qtawesome.icon('fa.line-chart', color='white'), "治愈/死亡率")
        self.left_button_3.setObjectName('left_button')
        self.left_button_3.clicked.connect(self.btn3_clicked)
        self.left_button_4 = QtWidgets.QPushButton(
            qtawesome.icon('fa.bar-chart', color='white'), "确诊国家排名")
        self.left_button_4.setObjectName('left_button')
        self.left_button_4.clicked.connect(self.btn4_clicked)
        self.left_button_5 = QtWidgets.QPushButton(
            qtawesome.icon('fa.line-chart', color='white'), "治愈/死亡率")
        self.left_button_5.setObjectName('left_button')
        self.left_button_5.clicked.connect(self.btn5_clicked)
        self.left_button_6 = QtWidgets.QPushButton(
            qtawesome.icon('fa.area-chart', color='white'), "死亡/新增确诊")
        self.left_button_6.setObjectName('left_button')
        self.left_button_6.clicked.connect(self.btn6_clicked)
        self.left_button_7 = QtWidgets.QPushButton(
            qtawesome.icon('fa.comment', color='white'), "反馈建议")
        self.left_button_7.setObjectName('left_button')
        self.left_button_7.clicked.connect(self.btn7_clicked)
        self.left_button_8 = QtWidgets.QPushButton(
            qtawesome.icon('fa.info-circle', color='white'), "数据来源")
        self.left_button_8.setObjectName('left_button')
        self.left_button_8.clicked.connect(self.btn8_clicked)
        self.left_button_9 = QtWidgets.QPushButton(
            qtawesome.icon('fa.question', color='white'), "遇到问题")
        self.left_button_9.setObjectName('left_button')
        self.left_button_9.clicked.connect(self.btn9_clicked)
        self.left_xxx = QtWidgets.QPushButton(" ")
        self.left_layout.addWidget(self.left_mini, 0,0,1,1)
        self.left_layout.addWidget(self.left_close, 0, 2,1,1)
        self.left_layout.addWidget(self.left_visit, 0, 1, 1, 1)
        self.left_layout.addWidget(self.left_label_1,1,0,1,3)
        self.left_layout.addWidget(self.left_button_1, 2, 0,1,3)
        self.left_layout.addWidget(self.left_button_2, 3, 0,1,3)
        self.left_layout.addWidget(self.left_button_3, 4, 0,1,3)
        self.left_layout.addWidget(self.left_label_2, 5, 0,1,3)
        self.left_layout.addWidget(self.left_button_4, 6, 0,1,3)
        self.left_layout.addWidget(self.left_button_5, 7, 0,1,3)
        self.left_layout.addWidget(self.left_button_6, 8, 0,1,3)
        self.left_layout.addWidget(self.left_label_3, 9, 0,1,3)
        self.left_layout.addWidget(self.left_button_7, 10, 0,1,3)
        self.left_layout.addWidget(self.left_button_8, 11, 0,1,3)
        self.left_layout.addWidget(self.left_button_9, 12, 0, 1, 3)
        self.left_close.setFixedSize(15, 15)  # 设置关闭按钮的大小
        self.left_visit.setFixedSize(15, 15)  # 设置按钮大小
        self.left_mini.setFixedSize(15, 15)  # 设置最小化按钮大小

        
        self.right_playlist_widget = QtWidgets.QWidget()  # 部件
        self.right_playlist_layout = QtWidgets.QGridLayout()  # 网格布局
        self.right_playlist_widget.setLayout(self.right_playlist_layout)


        self.right_bar_widget = QtWidgets.QWidget()  # 右侧顶部搜索框部件
        self.right_bar_layout = QtWidgets.QGridLayout()  # 右侧顶部搜索框网格布局
        self.right_bar_widget.setLayout(self.right_bar_layout)
        self.right_widget.setStyleSheet('''
    QWidget#right_widget{
        color:#232C51;
        background:white;
        border-top:1px solid darkGray;
        border-bottom:1px solid darkGray;
        border-right:1px solid darkGray;
        border-top-right-radius:10px;
        border-bottom-right-radius:10px;
    }
    QLabel#right_lable{
        border:none;
        font-size:16px;
        font-weight:700;
        font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    }
''')
        self.search_icon = QtWidgets.QLabel(chr(0xf002) + ' ' + '搜索  ')
        self.search_icon.setFont(qtawesome.font('fa', 16))
        self.search_icon.setObjectName('right_button')
        self.right_bar_widget_search_input = QtWidgets.QLineEdit()
        self.right_bar_widget_search_input.setPlaceholderText("输入你想要查询的国家的英文名,回车以查询该国家的情况")
        self.right_bar_widget_search_input.returnPressed.connect(self.lineEdit_function)

        self.right_bar_layout.addWidget(self.search_icon, 0, 0, 1, 1)
        self.right_bar_layout.addWidget(self.right_bar_widget_search_input, 0, 1, 1, 8)
        self.right_label_2 = QtWidgets.QLabel("                             中国目前死亡率:"+str(total_death_percentage)+"%"+"\n\n                             中国总确诊人数:"+str(data.Cases.sum())+"人"+"\n\n                             中国总死亡人数:"+str(data.Deaths.sum())+"人"+"\n\n\n\n2019新型冠状病毒,2020年1月12日被世界卫生组织命名为2019-nCoV ,2020年2月11日被国际病毒分类委员\n会命名为SARS-CoV-2 。美国《科学》杂志网站12日报道说,国际病毒分类学委员会冠状病毒研究小组主席约\n翰·齐布尔表示,他们是根据基因测序等方面的分类学研究提出这个名称,“这一名称与SARS疾病之间没有关\n联”。钟南山院士9日在接受媒体采访时也曾表示,新型冠状病毒与SARS冠状病毒是同一类,但不是同一种。\n   冠状病毒是一个大型病毒家族,已知可引起感冒以及中东呼吸综合征[MERS]和严重急性呼吸综合征[SARS]\n等较严重疾病.新型冠状病毒是以前从未在人体中发现的冠状病毒新毒株。2019年12月以来,湖北省武汉市持续\n开展流感及相关疾病监测,发现多起病毒性肺炎病例,均诊断为病毒性肺炎/肺部感染人感染了冠状病毒后常见\n体征有呼吸道症状:发热;咳嗽;气促和呼吸困难等.在较严重病例中,感染可导致肺炎;严重急性呼吸综合征;肾\n衰竭;甚至死亡.目前对于新型冠状病毒所致疾病没有特异治疗方法。但许多症状是可以处理的,因此需根据患\n者临床情况进行治疗。此外,对感染者的辅助护理可能非常有效。做好自我保护包括;保持基本的手部和呼吸\n道卫生,坚持安全饮食习惯,并尽可能避免与任何表现出有呼吸道疾病症状(如咳嗽和打喷嚏等)的人密切接触。\n\n    疫情爆发至今已经有四个多月的时间了,越来越多的人们投入到这场战‘疫’之中,他们奋斗在抵抗新冠\n病毒的第一防线,甚至为之奉献生命。\n  在这个严峻的时期,我以数据分析为主,基于大数据分析以可视化方式实时动态展现疫情发展,预测疫情为\n科学决策提供支持。")
        self.right_label_2.setObjectName('right_label')
        self.right_layout.addWidget(self.right_label_2, 1, 0, 1, 3)
        self.right_layout.addWidget(self.right_bar_widget, 0, 0, 1, 9)
        self.right_bar_widget_search_input.setStyleSheet(
            '''QLineEdit{
                    border:1px solid gray;
                    width:300px;
                    border-radius:10px;
                    padding:2px 4px;
            }''')

        self.right_bar_widget_search_input.text()
Beispiel #30
0
    def __init__(self):
        super(AwesomeExample, self).__init__()

        # Get icons by name.
        fa_icon = qta.icon('fa.flag')
        fa_button = QtGui.QPushButton(fa_icon, 'Font Awesome!')

        asl_icon = qta.icon('ei.asl')
        elusive_button = QtGui.QPushButton(asl_icon, 'Elusive Icons!')

        # Styling
        styling_icon = qta.icon('fa.music',
                                active='fa.legal',
                                color='blue',
                                color_active='orange')
        music_button = QtGui.QPushButton(styling_icon, 'Styling')

        # Render a label with this font
        label = QtGui.QLabel(unichr(0xf19c) + ' ' + 'Label')
        label.setFont(qta.font('fa', 16))

        # Stack icons
        camera_ban = qta.icon('fa.camera', 'fa.ban',
                              options=[{'scale_factor': 0.5,
                                        'active': 'fa.legal'},
                                       {'color': 'red', 'opacity': 0.7}])
        stack_button = QtGui.QPushButton(camera_ban, 'Stack')
        stack_button.setIconSize(QtCore.QSize(32, 32))

        # Spin icons
        spin_button = QtGui.QPushButton(' Spinning icon')
        spin_icon = qta.icon('fa.spinner', color='red',
                             animation=qta.Spin(spin_button))
        spin_button.setIcon(spin_icon)

        # Pulse icons
        pulse_button = QtGui.QPushButton(' Pulsing icon')
        pulse_icon = qta.icon('fa.spinner', color='green',
                              animation=qta.Pulse(pulse_button))
        pulse_button.setIcon(pulse_icon)

        # Stacked spin icons
        stack_spin_button = QtGui.QPushButton('Stack spin')
        options = [{'scale_factor': 0.4,
                    'animation': qta.Spin(stack_spin_button)},
                   {'color': 'blue'}]
        stack_spin_icon = qta.icon('ei.asl', 'fa.square-o',
                                   options=options)
        stack_spin_button.setIcon(stack_spin_icon)
        stack_spin_button.setIconSize(QtCore.QSize(32, 32))
        # Stack and offset icons
        saveall = qta.icon('fa.save', 'fa.save',
                           options=[{'scale_factor': 0.8,
                                     'offset': (0.2, 0.2),
                                     'color': 'gray'},
                                    {'scale_factor': 0.8}])
        saveall_button = QtGui.QPushButton(saveall, 'Stack, offset')

        # Layout
        vbox = QtGui.QVBoxLayout()
        widgets = [fa_button, elusive_button, music_button, stack_button,
                   saveall_button, spin_button, pulse_button,
                   stack_spin_button, label]
        for w in widgets:
            vbox.addWidget(w)

        self.setLayout(vbox)
        self.setWindowTitle('Awesome')
        self.show()
Beispiel #31
0
    def set_controls(self, task_name: str):
        """Generates the labels and controls that appear in the controls area."""

        # Clear the current toolbar:
        self.toolbar.clear()
        # Clear the current task panel:
        self.clear_layout(self.taskLayout)
        # Clear the current controls:
        self.clear_layout(self.controlsLayout)
        # Enable the refresh menu action in the View menu:
        self.refreshAct.setDisabled(False)
        # Load our task from global config:
        task = self.config["tasks"][task_name]
        # Make the toolbar items:
        if "label" in task:
            label_text = task["label"]
        else:
            label_text = task_name
        taskLabel = QLabel(
            chr(0xF10D5) + " " + "<strong>Task: </strong>" + label_text)
        taskLabel.setFont(qta.font("fa", 26))

        self.toolbar.addWidget(taskLabel)
        toolbarSpacer = QWidget(self)  # right-aligns the refresh button
        toolbarSpacer.setSizePolicy(QSizePolicy.Expanding,
                                    QSizePolicy.Preferred)
        refreshButton = QAction(qta.icon("mdi.refresh"), "Refresh", self)
        refreshButton.setStatusTip("Refresh the controls.")
        refreshButton.triggered.connect(self.load_config)
        self.toolbar.addWidget(toolbarSpacer)
        self.toolbar.addAction(refreshButton)
        # Make the task info panel:
        if "description" in task:
            taskLabel.setToolTip(task["description"])
            taskDescription = QWidget()
            taskDescription.setSizePolicy(QSizePolicy.Maximum,
                                          QSizePolicy.Expanding)
            descriptionLayout = QVBoxLayout()
            descriptionLayout.setAlignment(Qt.AlignTop)
            descriptionLabel = QLabel(task["description"])
            descriptionLabel.setWordWrap(True)
            descriptionHeading = QLabel(
                chr(0xF0EA7) + " " + "<strong>Description: </strong>")
            descriptionHeading.setFont(qta.font("fa", 26))
            descriptionLayout.addWidget(descriptionHeading)
            descriptionLayout.addWidget(descriptionLabel)
            taskDescription.setLayout(descriptionLayout)
            self.taskLayout.addWidget(taskDescription, 6)
        if "sessions" in task:
            taskSessions = QWidget()
            sessionLayout = QVBoxLayout()
            sessionLayout.setAlignment(Qt.AlignTop)
            sessionsHeading = QLabel(
                chr(0xF0ED8) + " " + "<strong>Sessions: </strong>")
            sessionsHeading.setFont(qta.font("fa", 26))
            sessionLayout.addWidget(sessionsHeading)
            for k, v in task["sessions"].items():
                sessionLayout.addWidget(QLabel(v))
            taskSessions.setLayout(sessionLayout)
            self.taskLayout.addWidget(taskSessions, 6)
        else:
            spacer = QWidget(self)
            spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
            self.taskLayout.addWidget(spacer, 6)
        # Refresh the task info panel layout:
        self.task_panel.setLayout(self.taskLayout)
        # Make controls for this task:
        task["key"] = task_name  # Insert task id key to the task dict
        # Construct on/off button controls for each board in our task:
        for key, board in task["boards"].items():
            self.controlsLayout.addWidget(OnOffWidget(board, task))
        self.controls.setLayout(self.controlsLayout)
Beispiel #32
0
    def init_ui(self):
        self.setFixedSize(550, 325)
        self.main_widget = QtWidgets.QWidget()  # 创建窗口主部件
        self.main_layout = QtWidgets.QGridLayout()  # 创建主部件的网格布局
        self.main_widget.setLayout(self.main_layout)  # 设置窗口主部件布局为网格布局

        self.left_widget = QtWidgets.QWidget()  # 创建左侧部件
        self.left_widget.setObjectName('left_widget')
        self.left_layout = QtWidgets.QGridLayout()  # 创建左侧部件的网格布局层
        self.left_widget.setLayout(self.left_layout)  # 设置左侧部件布局为网格
        self.left_widget.setStyleSheet('''
            QPushButton{border:none;color:white;}
            QPushButton#left_label{
                border:none;
                border-bottom:1px solid white;
                font-size:18px;
                font-weight:700;
                font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
            }
            QPushButton#left_button:hover{border-left:4px solid red;font-weight:700;}
        ''')

        self.right_widget = QtWidgets.QWidget()  # 创建右侧部件
        self.right_widget.setObjectName('right_widget')
        self.right_layout = QtWidgets.QGridLayout()
        self.right_widget.setLayout(self.right_layout)  # 设置右侧部件布局为网格
        self.right_bar_widget = QtWidgets.QWidget()  # 右侧顶部搜索框部件
        self.right_bar_layout = QtWidgets.QGridLayout()  # 右侧顶部搜索框网格布局

        self.right_bar_widget.setLayout(self.right_bar_layout)
        self.search_icon = QtWidgets.QLabel(chr(0xf002) + ' ' + '搜索  ')
        self.search_icon.setFont(qtawesome.font('fa', 16))
        self.right_bar_widget_search_input = QtWidgets.QLineEdit("")
        self.right_bar_widget_search_input.setPlaceholderText(
            "输入歌手、歌曲或用户,回车进行搜索")
        self.right_bar_layout.addWidget(self.search_icon, 0, 0, 1, 1)
        self.right_bar_layout.addWidget(self.right_bar_widget_search_input, 0,
                                        1, 1, 8)
        self.right_layout.addWidget(self.right_bar_widget, 0, 0, 1, 9)
        self.right_bar_widget_search_input.returnPressed.connect(
            self.Get_song_name)

        self.right_bar_widget_search_input.setStyleSheet('''QLineEdit{
                    border:1px solid gray;
                    width:300px;
                    border-radius:10px;
                    padding:2px 4px;
            }''')
        self.right_widget.setStyleSheet('''
            QWidget#right_widget{
                color:#232C51;
                background:white;
                border-top:1px solid darkGray;
                border-bottom:1px solid darkGray;
                border-right:1px solid darkGray;
                border-top-right-radius:10px;
                border-bottom-right-radius:10px;
            }
            QLabel#right_lable{
                border:none;
                font-size:16px;
                font-weight:700;
                font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
            }
        ''')

        # icon = QtGui.QIcon()
        # icon.addPixmap(QtGui.QPixmap("ico/瓜板.ico"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        # self.setWindowIcon(icon)
        # self.setToolTip("")

        self.main_layout.addWidget(self.left_widget, 0, 0, 12,
                                   2)  # 左侧部件在第0行第0列,占8行3列
        self.main_layout.addWidget(self.right_widget, 0, 2, 12,
                                   10)  # 右侧部件在第0行第3列,占8行9列
        self.setCentralWidget(self.main_widget)  # 设置窗口主部件

        self.left_close = QtWidgets.QPushButton("")  # 关闭按钮
        self.left_visit = QtWidgets.QPushButton("")  # 空白按钮
        self.left_mini = QtWidgets.QPushButton("")  # 最小化按钮

        self.left_close.setFixedSize(15, 15)  # 设置关闭按钮的大小
        self.left_visit.setFixedSize(15, 15)  # 设置按钮大小
        self.left_mini.setFixedSize(15, 15)  # 设置最小化按钮大小

        self.left_layout.addWidget(self.left_mini, 0, 0, 1, 1)  # 放置最小化按钮
        self.left_layout.addWidget(self.left_close, 0, 2, 1, 1)  # 放置关闭按钮
        self.left_layout.addWidget(self.left_visit, 0, 1, 1, 1)  # 放置空白按钮

        self.left_close.setStyleSheet(
            '''QPushButton{background:#F76677;border-radius:5px;}QPushButton:hover{background:red;}'''
        )
        self.left_visit.setStyleSheet(
            '''QPushButton{background:#F7D674;border-radius:5px;}QPushButton:hover{background:yellow;}'''
        )
        self.left_mini.setStyleSheet(
            '''QPushButton{background:#6DDF6D;border-radius:5px;}QPushButton:hover{background:green;}'''
        )

        self.left_close.clicked.connect(self.left_close_event)  # 添加关闭功能

        self.setWindowFlag(QtCore.Qt.FramelessWindowHint)  # 隐藏边框
        self.setWindowOpacity(0.95)  # 设置窗口透明度
        # self.setAttribute(QtCore.Qt.WA_TranslucentBackground)  # 设置窗口背景透明
        self.main_layout.setSpacing(0)