Beispiel #1
0
    def __init__(self, app):
        super().__init__(parent=None)
        self._app = app

        self._left_con = LeftCon(self)  #: left container
        self._left_con_scrollarea = ScrollArea(self._app)
        self._left_con_scrollarea.setWidget(self._left_con)
        self._right_con = RightCon(self)
        self._left_layout = QVBoxLayout(self._left_con)
        self._left_h1_layout = QHBoxLayout()
        self._left_h2_layout = QHBoxLayout()
        self._right_layout = QVBoxLayout(self._right_con)

        self.header_label = HeaderLabel()
        self.lyric_header = HeaderLabel('<h3>歌词:</h3>')
        self.comments_header = HeaderLabel('<h2>热门评论</h2>')
        self.lyric_label = LyricLabel()
        self.play_btn = TextButton('播放')
        self.cover_label = CoverLabelV2(app=app)
        self.album_info_label = SongAlbumLabel(app)
        self.comments_view = CommentListView()

        self._lyric_scrollarea = ScrollArea(self._app)
        self._lyric_scrollarea.setWidget(self.lyric_label)
        self.lyric_label.setSizePolicy(QSizePolicy.Preferred,
                                       QSizePolicy.Expanding)

        self.header_label.setTextFormat(Qt.RichText)
        self.cover_label.setSizePolicy(QSizePolicy.Preferred,
                                       QSizePolicy.Preferred)

        self._layout = QHBoxLayout(self)
        self._setup_ui()
Beispiel #2
0
class ListViewContainer(QFrame):
    btn_text_hide = '△'
    btn_text_show = '▼'

    def __init__(self, label, view, parent=None):
        super().__init__(parent)

        self._label = label
        self._view = view
        self._toggle_btn = TextButton(self.btn_text_hide, self)

        self._layout = QVBoxLayout(self)
        self._layout.setContentsMargins(0, 0, 0, 0)
        self._layout.setSpacing(0)
        self._h_layout = QHBoxLayout()
        label.setFixedHeight(25)
        self._h_layout.addWidget(label)
        self._h_layout.addStretch(0)
        self._h_layout.addWidget(self._toggle_btn)
        self._h_layout.addSpacing(10)
        self._layout.addLayout(self._h_layout)
        self._layout.addWidget(view)
        self._layout.addStretch(0)
        # XXX: 本意是让 ListViewContainer 下方不要出现多余的空间
        self.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Maximum)

        self._toggle_btn.clicked.connect(self.toggle_view)

    def toggle_view(self):
        if self._view.isVisible():
            self.hide_view()
        else:
            self.show_view()

    def show_view(self):
        self._toggle_btn.setText(self.btn_text_hide)
        self._view.show()

    def hide_view(self):
        self._toggle_btn.setText(self.btn_text_show)
        self._view.hide()
Beispiel #3
0
    def __init__(self, label, view, parent=None):
        super().__init__(parent)

        self._label = label
        self._view = view
        self._toggle_btn = TextButton(self.btn_text_hide, self)

        self._layout = QVBoxLayout(self)
        self._layout.setContentsMargins(0, 0, 0, 0)
        self._layout.setSpacing(0)
        self._h_layout = QHBoxLayout()
        label.setFixedHeight(25)
        self._h_layout.addWidget(label)
        self._h_layout.addStretch(0)
        self._h_layout.addWidget(self._toggle_btn)
        self._h_layout.addSpacing(10)
        self._layout.addLayout(self._h_layout)
        self._layout.addWidget(view)
        self._layout.addStretch(0)
        # XXX: 本意是让 ListViewContainer 下方不要出现多余的空间
        self.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Maximum)

        self._toggle_btn.clicked.connect(self.toggle_view)
Beispiel #4
0
    def __init__(self):
        super().__init__(parent=None)

        self.header_title = HeaderLabel()
        self.header_playlist_list = HeaderLabel()
        self.header_daily_rec = HeaderLabel()
        self.playlist_list_view = _PlaylistListView(img_min_width=100)
        self.daily_rec_btn = TextButton('查看每日推荐')

        self.header_title.setText('<h1>发现音乐</h1>')
        self.header_playlist_list.setText('<h2>个性化推荐</h2>')
        self.header_daily_rec.setText('<h2>每日推荐</h2>')

        self._daily_rec_layout = QHBoxLayout()
        self._layout = QVBoxLayout(self)
        self._setup_ui()