예제 #1
0
 def refresh_tracks(self, arr):
     self.track_map = {}
     self.ui.TrackTable.setRowCount(len(arr))
     for row in range(len(arr)):
         track = DBTrackItem(arr[row], row)
         self.ui.TrackTable.setItem(row, 0, QTableWidgetItem(track.title))
         self.ui.TrackTable.setItem(row, 1, QTableWidgetItem(track.artist))
         self.ui.TrackTable.setItem(row, 2, QTableWidgetItem(track.album))
         if track.length != None:
             self.ui.TrackTable.setItem(
                 row, 3, QTableWidgetItem(util.min_to_string(track.length)))
         self.ui.TrackTable.setItem(
             row, 4, QTableWidgetItem(str(track.track_number)))
         self.ui.TrackTable.setItem(row, 5,
                                    QTableWidgetItem(track.filename))
         self.ui.TrackTable.setItem(row, 6, QTableWidgetItem(track.path))
         self.ui.TrackTable.setItem(
             row, 7,
             QTableWidgetItem(util.filesize_to_string(track.filesize)))
         self.ui.TrackTable.item(row, 0).track = track
         self.controls.color_item(self.ui.TrackTable.item(row, 0))
     for r in range(self.ui.TrackTable.rowCount()):
         for c in range(self.ui.TrackTable.columnCount()):
             item = self.ui.TrackTable.item(r, c)
             if item != None:
                 item.setFlags(item.flags() & ~Qt.ItemIsEditable)
     self.controls.chose_tracks()
예제 #2
0
 def play(self):
     if len(self.playlist) > 0:
         track = self.playlist[self.curplaying].track
         if self.check_if_exists(track.path):
             self.mainwin.ui.PlayPause.setIcon(QIcon("../assets/img/appbar.control.pause.png"))
             self.color()
             self.player.timer.reset()
             self.mainwin.ui.TrackName.setText(track.title)
             self.mainwin.ui.TrackLength.setText(util.min_to_string(track.length))
             self.player.play(track, self.play_next, 0)
         else:
             dialog = FileMissingDialog(self.mainwin, track.path, self.remove_track, self.ignore_track)
             dialog.exec()
             self.stop()
예제 #3
0
 def play(self):
     if len(self.playlist) > 0:
         track = self.playlist[self.curplaying].track
         if self.check_if_exists(track.path):
             self.mainwin.ui.PlayPause.setIcon(
                 QIcon('../assets/img/appbar.control.pause.png'))
             self.color()
             self.player.timer.reset()
             self.mainwin.ui.TrackName.setText(track.title)
             self.mainwin.ui.TrackLength.setText(
                 util.min_to_string(track.length))
             self.player.play(track, self.play_next, 0)
         else:
             dialog = FileMissingDialog(self.mainwin, track.path,
                                        self.remove_track,
                                        self.ignore_track)
             dialog.exec()
             self.stop()
예제 #4
0
 def update(self):
     # Run refresh from main thread to avoid threading issues
     if self.mainwin.do_refresh:
         self.mainwin.refresh_lists(self.mainwin.db_t, self.mainwin.db_a, self.mainwin.db_alb)
         self.mainwin.do_refresh = False
     # Elapsed label
     if len(self.playlist) > 0:
         self.mainwin.ui.ElapsedTime.setText(util.min_to_string(self.player.timer.elapsed))
     # Volume code
     volume = self.mainwin.ui.VolumeSlider.value() / 100.0
     if len(self.playlist) > 0 and self.player.volume != volume:
         self.player.set_volume(volume)
     # Animate track progress slider
     if len(self.playlist) > 0:
         track = self.playlist[self.curplaying].track
         self.mainwin.ui.TrackSlider.setValue(
             float(self.player.timer.elapsed) * float(self.mainwin.ui.TrackSlider.maximum()) / float(track.length)
         )
     # Update player
     self.player.update()
예제 #5
0
 def refresh_tracks(self, arr):
     self.track_map = {}
     self.ui.TrackTable.setRowCount(len(arr))
     for row in range(len(arr)):
         track = DBTrackItem(arr[row], row)
         self.ui.TrackTable.setItem(row, 0, QTableWidgetItem(track.title))
         self.ui.TrackTable.setItem(row, 1, QTableWidgetItem(track.artist))
         self.ui.TrackTable.setItem(row, 2, QTableWidgetItem(track.album))
         if track.length != None:
             self.ui.TrackTable.setItem(row, 3, QTableWidgetItem(util.min_to_string(track.length)))
         self.ui.TrackTable.setItem(row, 4, QTableWidgetItem(str(track.track_number)))
         self.ui.TrackTable.setItem(row, 5, QTableWidgetItem(track.filename))
         self.ui.TrackTable.setItem(row, 6, QTableWidgetItem(track.path))
         self.ui.TrackTable.setItem(row, 7, QTableWidgetItem(util.filesize_to_string(track.filesize)))
         self.ui.TrackTable.item(row, 0).track = track;
         self.controls.color_item(self.ui.TrackTable.item(row, 0))
     for r in range(self.ui.TrackTable.rowCount()):
         for c in range(self.ui.TrackTable.columnCount()):
             item = self.ui.TrackTable.item(r, c)
             if item != None:
                 item.setFlags(item.flags() & ~Qt.ItemIsEditable)
     self.controls.chose_tracks()
예제 #6
0
 def update(self):
     # Run refresh from main thread to avoid threading issues
     if self.mainwin.do_refresh:
         self.mainwin.refresh_lists(self.mainwin.db_t, self.mainwin.db_a,
                                    self.mainwin.db_alb)
         self.mainwin.do_refresh = False
     # Elapsed label
     if len(self.playlist) > 0:
         self.mainwin.ui.ElapsedTime.setText(
             util.min_to_string(self.player.timer.elapsed))
     # Volume code
     volume = self.mainwin.ui.VolumeSlider.value() / 100.0
     if len(self.playlist) > 0 and self.player.volume != volume:
         self.player.set_volume(volume)
     # Animate track progress slider
     if len(self.playlist) > 0:
         track = self.playlist[self.curplaying].track
         self.mainwin.ui.TrackSlider.setValue(
             float(self.player.timer.elapsed) *
             float(self.mainwin.ui.TrackSlider.maximum()) /
             float(track.length))
     # Update player
     self.player.update()