示例#1
0
    def setup_ui(self):
        self.setObjectName('playbackPage')

        #歌手信息页
        self.artistHeadLabel = QLabel(self)
        self.artistHeadLabel.setFixedSize(QSize(90, 90))
        self.artistHeadLabel.setScaledContents(True)
        self.artistName = NewLabel(self, True)
        self.artistName.setFixedSize(QSize(90, 30))
        self.artistGender = QLabel("性别:未知", self)
        self.artistBirthday = QLabel("生日:未知", self)
        self.artistConstellation = QLabel("星座:未知", self)
        self.artistLanguage = QLabel("语言:未知", self)
        self.artistBirthplace = QLabel("出生地:未知", self)
        self.artistDetail = MyTextEdit(self)

        #刷新歌手信息缓存按键
        self.refreshBtn = QPushButton(self)
        self.refreshBtn.setFocusPolicy(Qt.NoFocus)
        self.refreshBtn.setIcon(QIcon(IconsHub.Refresh))
        self.refreshBtn.setText('刷新')
        self.refreshBtn.setToolTip("刷新歌手信息")
        self.refreshBtn.setFixedSize(QSize(70, 30))

        vbox1 = QVBoxLayout()
        vbox1.setSpacing(10)
        vbox1.addWidget(self.artistHeadLabel)
        vbox1.addWidget(self.artistName)

        hbox1 = QHBoxLayout()
        hbox1.addWidget(self.artistGender)
        hbox1.addWidget(self.artistBirthday)

        hbox2 = QHBoxLayout()
        hbox2.addWidget(self.artistConstellation)
        hbox2.addWidget(self.artistLanguage)

        hbox3 = QHBoxLayout()
        hbox3.addWidget(self.artistBirthplace)
        hbox3.addWidget(self.refreshBtn)
        vbox2 = QVBoxLayout()
        vbox2.addLayout(hbox1)
        vbox2.addLayout(hbox2)
        vbox2.addLayout(hbox3)
        hbox4 = QHBoxLayout()
        hbox4.setSpacing(30)
        hbox4.addLayout(vbox1)
        hbox4.addLayout(vbox2)

        mainLayout = QVBoxLayout(self)
        mainLayout.addLayout(hbox4)
        mainLayout.addWidget(self.artistDetail)
    def setup_ui(self):
        self.setFixedHeight(50)
        #桌面歌词标签
        self.desktopLyric = desktop_lyric.DesktopLyric()
        self.desktopLyric.set_color(globalSettings.DesktoplyricColors)
        #3个标签
        self.artistHeadLabel = LabelButton()
        self.artistHeadLabel.setToolTip(self.tr('查看歌手信息'))
        self.artistHeadLabel.setFixedSize(QSize(42, 42))
        self.artistHeadLabel.setScaledContents(True)
        self.artistHeadLabel.setPixmap(QPixmap(IconsHub.Anonymous))

        self.musicTitleLabel = NewLabel()
        self.musicTitleLabel.setObjectName('musicTitleLabel')
        self.musicTitleLabel.setFixedSize(QSize(370, 20))
        self.musicTitleLabel.setText("Zheng-Yejian._.XYPLAYER")
        self.timeLabel = QLabel("00:00/00:00")
        self.timeLabel.setObjectName('timeLabel')
        self.timeLabel.setFixedHeight(20)
        self.timeLabel.setAlignment(Qt.AlignRight and Qt.AlignVCenter)

        #五个基本按键
        self.playmodeButton = QToolButton(clicked=self.change_playmode)
        self.playmodeButton.setFocusPolicy(Qt.NoFocus)

        self.playmodeButton.setIcon(QIcon(IconsHub.PlaymodeRandom))
        self.playmodeButton.setIconSize(QSize(25, 25))
        self.playmodeButton.setToolTip('随机播放')

        self.favoriteButton = QToolButton(clicked=self.mark_as_favorite)
        self.favoriteButton.setFocusPolicy(Qt.NoFocus)
        self.favoriteButton.setToolTip('收藏')
        self.favoriteButton.setIcon(QIcon(IconsHub.Favorites))
        self.favoriteButton.setIconSize(QSize(20, 20))

        self.previousButton = QToolButton()
        self.previousButton.setFocusPolicy(Qt.NoFocus)
        self.previousButton.setIconSize(QSize(40, 40))
        self.previousButton.setShortcut(QKeySequence("Ctrl + Left"))
        self.previousButton.setDefaultAction(self.previousAction)

        self.playButton = QToolButton()
        self.playButton.setFocusPolicy(Qt.NoFocus)
        self.playButton.setIconSize(QSize(40, 40))
        self.playButton.setShortcut(QKeySequence("Ctrl + Down"))
        self.playButton.setDefaultAction(self.playAction)

        self.nextButton = QToolButton()
        self.nextButton.setFocusPolicy(Qt.NoFocus)
        self.nextButton.setIconSize(QSize(40, 40))
        self.nextButton.setFocusPolicy(Qt.NoFocus)
        self.nextButton.setShortcut(QKeySequence("Ctrl + Right"))
        self.nextButton.setDefaultAction(self.nextAction)

        self.desktopLyricButton = QToolButton(clicked=self.show_desktop_lyric)
        self.desktopLyricButton.setToolTip(self.tr("桌面歌词"))
        self.desktopLyricButton.setFocusPolicy(Qt.NoFocus)
        self.desktopLyricButton.setIcon(QIcon(IconsHub.DesktopLyric))
        self.desktopLyricButton.setIconSize(QSize(25, 25))

        self.seekSlider = QSlider(Qt.Horizontal)
        self.seekSlider.setObjectName('seekSlider')
        self.seekSlider.setFixedHeight(20)
        self.seekSlider.setFocusPolicy(Qt.NoFocus)
        self.seekSlider.setRange(0, 0)

        hbox1 = QHBoxLayout()
        hbox1.addWidget(self.favoriteButton)
        hbox1.addWidget(self.musicTitleLabel)
        hbox1.addStretch()
        hbox1.addWidget(self.timeLabel)
        vbox1 = QVBoxLayout()
        vbox1.addLayout(hbox1)
        vbox1.setSpacing(5)
        vbox1.addWidget(self.seekSlider)

        mainLayout = QHBoxLayout(self)
        mainLayout.setContentsMargins(2, 0, 0, 0)
        mainLayout.addWidget(self.artistHeadLabel)
        mainLayout.addWidget(self.previousButton)
        mainLayout.addWidget(self.playButton)
        mainLayout.addWidget(self.nextButton)
        mainLayout.addLayout(vbox1)
        mainLayout.addWidget(self.playmodeButton)
        mainLayout.addWidget(self.desktopLyricButton)
示例#3
0
 def setup_ui(self):
     self.setWindowTitle('歌曲信息')
     label1 = QLabel('歌手:')
     label2 = QLabel('曲名:')
     label3 = QLabel('专辑:')
     label4 = QLabel('路径:')
     label4.setFixedWidth(40)
     self.artistEdit = QLineEdit()
     self.musicEdit = QLineEdit()
     self.albumEdit = QLineEdit()
     self.timeLabel = QLabel('时长: 00:00')
     self.sizeLabel = QLabel('大小: 0.00 MB')
     self.pathLabel = NewLabel()
     self.playlistInfoLabel = QLabel('位置: 默认列表  ( 1 / 100 )')
     self.countInfoLabel = QLabel('播放次数: n次')
     self.addTimeLabel = QLabel('添加时间: 2015年12月30日')
     self.modifyTimeLabel = QLabel('修改时间: 2015年12月31日')
     self.favorInfoLabel = QLabel('收藏情况: 未收藏')
     self.traceInfoLabel = QLabel('歌曲来源: 本地添加')
     self.nearPlaylistLabel = QLabel('最近播放位置: 默认列表')
     self.nearPlayedDateLabel = QLabel('最近播放时间: 2016年1月1日')
     self.applyButton = QPushButton('应用', clicked=self.apply)
     self.applyButton.setFocusPolicy(Qt.NoFocus)
     self.cancelButton = QPushButton('取消', clicked=self.cancel)
     self.cancelButton.setFocusPolicy(Qt.NoFocus)
     self.refreshButton = QPushButton('刷新',
                                      clicked=self.refresh_infos_on_page)
     self.refreshButton.setFocusPolicy(Qt.NoFocus)
     self.importlyricButton = QPushButton('导入歌词', clicked=self.import_lyric)
     self.importlyricButton.setFocusPolicy(Qt.NoFocus)
     hbox0 = QHBoxLayout()
     hbox0.addWidget(label4)
     hbox0.addWidget(self.pathLabel)
     hbox1 = QHBoxLayout()
     hbox1.addWidget(label1)
     hbox1.addWidget(self.artistEdit)
     hbox2 = QHBoxLayout()
     hbox2.addWidget(label2)
     hbox2.addWidget(self.musicEdit)
     hbox3 = QHBoxLayout()
     hbox3.addWidget(label3)
     hbox3.addWidget(self.albumEdit)
     hbox4 = QHBoxLayout()
     hbox4.addWidget(self.importlyricButton)
     hbox4.addStretch()
     hbox4.addWidget(self.applyButton)
     hbox4.addWidget(self.cancelButton)
     hbox4.addWidget(self.refreshButton)
     hbox5 = QHBoxLayout()
     hbox5.addWidget(self.timeLabel)
     hbox5.addWidget(self.sizeLabel)
     hbox5.addWidget(self.traceInfoLabel)
     hbox6 = QHBoxLayout()
     hbox6.setContentsMargins(0, 0, 20, 0)
     hbox6.addWidget(self.playlistInfoLabel)
     hbox6.addStretch()
     hbox6.addWidget(self.favorInfoLabel)
     mainLayout = QVBoxLayout(self)
     mainLayout.setSpacing(10)
     mainLayout.addLayout(hbox0)
     mainLayout.addLayout(hbox6)
     mainLayout.addLayout(hbox1)
     mainLayout.addLayout(hbox2)
     mainLayout.addLayout(hbox3)
     mainLayout.addLayout(hbox5)
     mainLayout.addWidget(self.countInfoLabel)
     mainLayout.addWidget(self.nearPlaylistLabel)
     mainLayout.addWidget(self.nearPlayedDateLabel)
     mainLayout.addWidget(self.addTimeLabel)
     mainLayout.addWidget(self.modifyTimeLabel)
     mainLayout.addLayout(hbox4)