QTimer added, TOD clock updating
This commit is contained in:
parent
aeda0880dd
commit
31cf7ca3e6
@ -14,6 +14,7 @@ class Config(object):
|
|||||||
MAIL_USE_TLS = os.environ.get('MAIL_USE_TLS') is not None
|
MAIL_USE_TLS = os.environ.get('MAIL_USE_TLS') is not None
|
||||||
MYSQL_CONNECT = "mysql+mysqldb://songdb:songdb@localhost/songdb"
|
MYSQL_CONNECT = "mysql+mysqldb://songdb:songdb@localhost/songdb"
|
||||||
ROOT = "/home/kae/music"
|
ROOT = "/home/kae/music"
|
||||||
|
TIMER_MS = 500
|
||||||
|
|
||||||
|
|
||||||
config = Config
|
config = Config
|
||||||
|
|||||||
@ -4,9 +4,10 @@ import os
|
|||||||
import vlc
|
import vlc
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
from datetime import datetime
|
||||||
from log import DEBUG, ERROR
|
from log import DEBUG, ERROR
|
||||||
|
|
||||||
from PyQt5.QtCore import Qt
|
from PyQt5.QtCore import Qt, QTimer
|
||||||
from PyQt5.QtWidgets import QApplication, QDialog, QMainWindow
|
from PyQt5.QtWidgets import QApplication, QDialog, QMainWindow
|
||||||
from PyQt5.QtWidgets import QTableWidgetItem, QFileDialog, QListWidgetItem
|
from PyQt5.QtWidgets import QTableWidgetItem, QFileDialog, QListWidgetItem
|
||||||
from threading import Timer
|
from threading import Timer
|
||||||
@ -124,6 +125,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
|
self.timer = QTimer()
|
||||||
self.connectSignalsSlots()
|
self.connectSignalsSlots()
|
||||||
self.music = Music()
|
self.music = Music()
|
||||||
|
|
||||||
@ -143,6 +145,8 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
if record.f_int is not None:
|
if record.f_int is not None:
|
||||||
self.playlist.setColumnWidth(column, record.f_int)
|
self.playlist.setColumnWidth(column, record.f_int)
|
||||||
|
|
||||||
|
self.timer.start(Config.TIMER_MS)
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
for column in range(self.playlist.columnCount()):
|
for column in range(self.playlist.columnCount()):
|
||||||
name = f"playlist_col_{str(column)}_width"
|
name = f"playlist_col_{str(column)}_width"
|
||||||
@ -172,6 +176,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
self.actionPlay_selected.triggered.connect(self.play_next)
|
self.actionPlay_selected.triggered.connect(self.play_next)
|
||||||
self.actionPlay_next.triggered.connect(self.play_next)
|
self.actionPlay_next.triggered.connect(self.play_next)
|
||||||
self.playlist.itemSelectionChanged.connect(self.set_next)
|
self.playlist.itemSelectionChanged.connect(self.set_next)
|
||||||
|
self.timer.timeout.connect(self.tick)
|
||||||
|
|
||||||
def selectFromDatabase(self):
|
def selectFromDatabase(self):
|
||||||
dlg = DbDialog(self)
|
dlg = DbDialog(self)
|
||||||
@ -214,6 +219,11 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
if self.music.set_next_track(track_id) != track_id:
|
if self.music.set_next_track(track_id) != track_id:
|
||||||
ERROR("Can't set next track")
|
ERROR("Can't set next track")
|
||||||
|
|
||||||
|
def tick(self):
|
||||||
|
self.current_time.setText(
|
||||||
|
datetime.strftime(datetime.now(), "%H:%M:%S")
|
||||||
|
)
|
||||||
|
|
||||||
def add_to_playlist(self, track):
|
def add_to_playlist(self, track):
|
||||||
"""
|
"""
|
||||||
Add track to playlist
|
Add track to playlist
|
||||||
|
|||||||
@ -37,9 +37,9 @@ Playlist management
|
|||||||
Wikipedia for song title
|
Wikipedia for song title
|
||||||
Song facts for song title
|
Song facts for song title
|
||||||
Display
|
Display
|
||||||
Remember window size
|
✓ Remember window size
|
||||||
Remember dialog size
|
✓ Remember dialog size
|
||||||
Remember playlist column sizes
|
✓ Remember playlist column sizes
|
||||||
Top: previous, current, next track
|
Top: previous, current, next track
|
||||||
Misc
|
Misc
|
||||||
Logging
|
Logging
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user