def updateTimes (self, tick): elapsed= tick/1000 # ms to s song= self.appModel.collaggr.songForIndex (self.modelIndex.row ()) length= int (song.length) remaining= elapsed-length # print "tick! %d [%d] / %d / %d" % (elapsed, tick, length, remaining) self.ui.elapsedTime.setText (utils.secondsToTime (elapsed)) self.ui.remainingTime.setText (utils.secondsToTime (remaining))
def formatSeconds (self, seconds): """convert length from seconds to mm:ss""" if seconds is not None: return utils.secondsToTime (float (seconds)) else: return "???"