def add_a_playlist(self):
     j = 1
     while True:            
         textOld = "我的列表%s"%j
         if textOld not in playlistsManager.get_play_list_names():
             break
         j += 1            
     text, ok = QInputDialog.getText(self, "添加列表", "请输入列表名:", QLineEdit.Normal, textOld)
     if ok:
         if text:
             if text in playlistsManager.get_play_list_names():
                 QMessageBox.critical(self, "注意!", "列表'%s'已存在!\n请重新添加!"%text)
                 return
         else:
             QMessageBox.critical(self, "注意!", "列表名不能为空!")
             return
         playlistsManager.create_a_playlist(text)
         self.playlistsTable.add_item(text)
Beispiel #2
0
 def add_a_playlist(self):
     j = 1
     while True:
         textOld = "我的列表%s" % j
         if textOld not in playlistsManager.get_play_list_names():
             break
         j += 1
     text, ok = QInputDialog.getText(self, "添加列表", "请输入列表名:",
                                     QLineEdit.Normal, textOld)
     if ok:
         if text:
             if text in playlistsManager.get_play_list_names():
                 QMessageBox.critical(self, "注意!",
                                      "列表'%s'已存在!\n请重新添加!" % text)
                 return
         else:
             QMessageBox.critical(self, "注意!", "列表名不能为空!")
             return
         playlistsManager.create_a_playlist(text)
         self.playlistsTable.add_item(text)
 def rename_a_playlist(self, index):
     name = self.playlistsTable.get_name_at(index)
     newName, ok = QInputDialog.getText(self, "重命名列表", "请输入新列表名:", QLineEdit.Normal, name)
     if ok:
         if newName and newName != name:
             if newName in playlistsManager.get_play_list_names():
                 QMessageBox.critical(self, "注意!", "列表'%s'已存在!\n请重新修改!"%newName)
             else:
                 playlistsManager.rename_a_playlist(name, newName)
                 self.playlistsTable.rename_an_item(index, newName)
                 self.playlist_renamed_signal.emit(name, newName)
Beispiel #4
0
 def rename_a_playlist(self, index):
     name = self.playlistsTable.get_name_at(index)
     newName, ok = QInputDialog.getText(self, "重命名列表", "请输入新列表名:",
                                        QLineEdit.Normal, name)
     if ok:
         if newName and newName != name:
             if newName in playlistsManager.get_play_list_names():
                 QMessageBox.critical(self, "注意!",
                                      "列表'%s'已存在!\n请重新修改!" % newName)
             else:
                 playlistsManager.rename_a_playlist(name, newName)
                 self.playlistsTable.rename_an_item(index, newName)
                 self.playlist_renamed_signal.emit(name, newName)
Beispiel #5
0
    def setup_ui(self):
        self.setObjectName('managePage')
        self.setFixedHeight(520)
        self.settingsFrame = settings_frame.SettingsFrame()
        self.aboutPage = about_page.AboutPage()
        self.updatePanel = update_panel.UpdatePanel()
        self.exitmodePanel = exitmode_panel.ExitmodePanel()
        self.lyricText = MyLyricText()

        self.playlistWidget = PlaylistWidget()
        self.playlistWidget.setFixedHeight(435)
        self.playlistWidget.set_playlist_names(
            playlistsManager.get_play_list_names())
        self.playlistWidget.set_playlist_use_name(Configures.PlaylistDefault)

        self.playlistTableUnfold = PlaylistsTableUnfold(self.playlistWidget)
        self.playlistTableUnfold.hide()
        self.playlistsTable = PlaylistsTable()
        for i, tableName in enumerate(playlistsManager.get_play_list_names()):
            self.playlistsTable.add_item(tableName)
        self.playlistsTable.selectRow(1)

        plWidgets = QWidget()
        hbox = QHBoxLayout(plWidgets)
        hbox.setContentsMargins(0, 0, 0, 0)
        hbox.addWidget(self.playlistsTable)
        hbox.addWidget(self.playlistTableUnfold)

        #搜索页面
        self.searchFrame = search_page.SearchFrame()
        #下载页面
        self.downloadPage = download_page.DownloadPage()

        #歌手信息
        self.artistInfoPage = artist_info_page.ArtistInfoPage()

        #歌曲信息
        self.songInfoPage = song_info_page.SongInfoPage()

        #中间的stackedWidget
        self.stackedWidget = QStackedWidget()
        self.stackedWidget.setObjectName('stackleft')
        self.stackedWidget.setFixedWidth(270)
        self.stackedWidget.addWidget(plWidgets)
        self.stackedWidget.addWidget(self.downloadPage)
        self.stackedWidget.addWidget(self.exitmodePanel)
        self.stackedWidget.addWidget(self.updatePanel)

        self.muteButton = QToolButton(clicked=self.mute_clicked)
        self.muteButton.setFocusPolicy(Qt.NoFocus)
        self.muteButton.setIcon(QIcon(IconsHub.Volume))
        self.muteButton.setIconSize(QSize(25, 25))
        self.volumeSlider = QSlider(Qt.Vertical,
                                    valueChanged=self.changeVolume)
        self.volumeSlider.setObjectName('volumeSlider')
        self.volumeSlider.setFocusPolicy(Qt.NoFocus)
        self.volumeSlider.setFixedHeight(120)
        self.volumeSlider.setRange(0, 100)
        self.volumeSlider.setValue(globalSettings.Volume)
        self.toolBar = QToolBar()
        self.toolBar.setIconSize(QSize(36, 36))
        self.toolBar.setObjectName('toolBar')
        self.toolBar.setOrientation(Qt.Vertical)
        self.toolBar.addAction(QIcon(IconsHub.Musics), self.tr('musics'))
        self.toolBar.addAction(QIcon(IconsHub.Download), self.tr('download'))
        self.toolBar.addAction(QIcon(IconsHub.Exitmode), self.tr('exitmode'))
        self.toolBar.addAction(QIcon(IconsHub.Update), self.tr('update'))
        volumeLayout = QVBoxLayout()
        volumeLayout.setContentsMargins(6, 0, 0, 0)
        volumeLayout.addWidget(self.volumeSlider)
        volumeLayout.addWidget(self.muteButton)
        toolsLayout = QVBoxLayout()
        toolsLayout.setContentsMargins(0, 0, 0, 0)
        toolsLayout.addWidget(self.toolBar)
        toolsLayout.addLayout(volumeLayout)

        functionsLayout = QHBoxLayout()
        functionsLayout.setSpacing(0)
        functionsLayout.setContentsMargins(0, 0, 0, 0)
        functionsLayout.addLayout(toolsLayout)
        functionsLayout.addWidget(self.stackedWidget)

        self.windowsStack = QStackedWidget()  #歌词、搜索、关于等合用的一个堆栈
        self.windowsStack.setFixedWidth(600)
        self.windowsStack.addWidget(self.lyricText)
        self.windowsStack.addWidget(self.settingsFrame)
        self.windowsStack.addWidget(self.aboutPage)
        self.windowsStack.addWidget(self.searchFrame)
        self.windowsStack.addWidget(self.artistInfoPage)
        self.windowsStack.addWidget(self.songInfoPage)

        mainLayout = QHBoxLayout(self)
        mainLayout.setContentsMargins(0, 0, 0, 0)
        mainLayout.addLayout(functionsLayout)
        mainLayout.addWidget(self.windowsStack)
Beispiel #6
0
 def select_current_playlist_on_table(self):
     if not self.playlistsTable.isHidden():
         self.playlistsTable.selectRow(
             playlistsManager.get_play_list_names().index(
                 self.playlistWidget.get_playing_list_name()))
    def setup_ui(self):
        self.setObjectName('managePage')
        self.setFixedHeight(520)
        self.settingsFrame = settings_frame.SettingsFrame()
        self.aboutPage = about_page.AboutPage()
        self.updatePanel = update_panel.UpdatePanel()
        self.exitmodePanel = exitmode_panel.ExitmodePanel()
        self.lyricText = MyLyricText()

        self.playlistWidget = PlaylistWidget()
        self.playlistWidget.setFixedHeight(435)
        self.playlistWidget.set_playlist_names(playlistsManager.get_play_list_names())
        self.playlistWidget.set_playlist_use_name(Configures.PlaylistDefault)
        
        self.playlistTableUnfold = PlaylistsTableUnfold(self.playlistWidget)
        self.playlistTableUnfold.hide()
        self.playlistsTable = PlaylistsTable()
        for i, tableName in enumerate(playlistsManager.get_play_list_names()):
            self.playlistsTable.add_item(tableName)  
        self.playlistsTable.selectRow(1)
        
        plWidgets = QWidget()
        hbox = QHBoxLayout(plWidgets)
        hbox.setContentsMargins(0, 0, 0, 0)
        hbox.addWidget(self.playlistsTable)
        hbox.addWidget(self.playlistTableUnfold)
        
#搜索页面
        self.searchFrame = search_page.SearchFrame()
#下载页面
        self.downloadPage = download_page.DownloadPage()

#歌手信息
        self.artistInfoPage = artist_info_page.ArtistInfoPage()

#歌曲信息
        self.songInfoPage = song_info_page.SongInfoPage()

#中间的stackedWidget
        self.stackedWidget = QStackedWidget()
        self.stackedWidget.setObjectName('stackleft')
        self.stackedWidget.setFixedWidth(270)
        self.stackedWidget.addWidget(plWidgets)
        self.stackedWidget.addWidget(self.downloadPage)
        self.stackedWidget.addWidget(self.exitmodePanel)
        self.stackedWidget.addWidget(self.updatePanel)
    
        self.muteButton = QToolButton(clicked=self.mute_clicked)
        self.muteButton.setFocusPolicy(Qt.NoFocus)
        self.muteButton.setIcon(QIcon(IconsHub.Volume))
        self.muteButton.setIconSize(QSize(25, 25))
        self.volumeSlider = QSlider(Qt.Vertical, valueChanged=self.changeVolume)
        self.volumeSlider.setObjectName('volumeSlider')
        self.volumeSlider.setFocusPolicy(Qt.NoFocus)
        self.volumeSlider.setFixedHeight(120)
        self.volumeSlider.setRange(0, 100)
        self.volumeSlider.setValue(globalSettings.Volume)
        self.toolBar = QToolBar()
        self.toolBar.setIconSize(QSize(36, 36))
        self.toolBar.setObjectName('toolBar')
        self.toolBar.setOrientation(Qt.Vertical)
        self.toolBar.addAction(QIcon(IconsHub.Musics), self.tr('musics'))
        self.toolBar.addAction(QIcon(IconsHub.Download), self.tr('download'))
        self.toolBar.addAction(QIcon(IconsHub.Exitmode), self.tr('exitmode'))
        self.toolBar.addAction(QIcon(IconsHub.Update), self.tr('update'))
        volumeLayout = QVBoxLayout()
        volumeLayout.setContentsMargins(6, 0, 0, 0)
        volumeLayout.addWidget(self.volumeSlider)
        volumeLayout.addWidget(self.muteButton)
        toolsLayout = QVBoxLayout()
        toolsLayout.setContentsMargins(0, 0, 0, 0)
        toolsLayout.addWidget(self.toolBar)
        toolsLayout.addLayout(volumeLayout)

        functionsLayout = QHBoxLayout()
        functionsLayout.setSpacing(0)
        functionsLayout.setContentsMargins(0, 0, 0, 0)
        functionsLayout.addLayout(toolsLayout)
        functionsLayout.addWidget(self.stackedWidget)
        
        self.windowsStack = QStackedWidget()    #歌词、搜索、关于等合用的一个堆栈
        self.windowsStack.setFixedWidth(600)
        self.windowsStack.addWidget(self.lyricText)
        self.windowsStack.addWidget(self.settingsFrame)
        self.windowsStack.addWidget(self.aboutPage)
        self.windowsStack.addWidget(self.searchFrame)
        self.windowsStack.addWidget(self.artistInfoPage)
        self.windowsStack.addWidget(self.songInfoPage)
        
        mainLayout = QHBoxLayout(self)
        mainLayout.setContentsMargins(0, 0, 0, 0)
        mainLayout.addLayout(functionsLayout)
        mainLayout.addWidget(self.windowsStack)
 def select_current_playlist_on_table(self):
     if not self.playlistsTable.isHidden():
         self.playlistsTable.selectRow(playlistsManager.get_play_list_names().index(self.playlistWidget.get_playing_list_name()))