Add Sound Module

This commit is contained in:
Christopher T. Johnson
2023-12-19 10:01:09 -05:00
parent 11726900f7
commit bb5287743c
7 changed files with 177 additions and 99 deletions

32
main.py
View File

@@ -1,15 +1,9 @@
#!/usr/bin/env python3
#
# TODO:
# Record all words examined
#
# Add definition to definition
# Follow definition links
# Print subset of words, limit to words from this session's paragraphs
# plus defined during session
# Add Note per session
# Add book import dialog
# Add person create/edit dialog
# Reading scroll with speed control
# Move controls out of reading window.
# Ability to edit text with updates to word-section links
@@ -24,7 +18,14 @@ import sys
from datetime import datetime, timedelta
from typing import cast
from PyQt6.QtCore import QModelIndex, Qt, QTimer, pyqtSignal, pyqtSlot
from PyQt6.QtCore import (
QModelIndex,
QResource,
Qt,
QTimer,
pyqtSignal,
pyqtSlot,
)
from PyQt6.QtGui import (
QAction,
QFont,
@@ -59,10 +60,21 @@ def query_error(query: QSqlQuery) -> None:
class MainWindow(QMainWindow, Ui_MainWindow):
playAlert = pyqtSignal()
playSound = pyqtSignal(str)
def __init__(self) -> None:
super(MainWindow, self).__init__()
self.setupUi(self)
# model = ModelOverride()
#
# Setup resources
#
if not QResource.registerResource(
os.path.join(os.path.dirname(__file__), "ui/resources.rcc"), "/"
):
raise Exception("Unable to register resources.rcc")
self.soundOff = SoundOff()
model = QSqlQueryModel()
query = QSqlQuery("SELECT * FROM people ORDER BY name")
model.setQuery(query)
@@ -86,6 +98,8 @@ class MainWindow(QMainWindow, Ui_MainWindow):
) # Y
self.peopleView.doubleClicked.connect(self.editPerson) # Y
self.peopleView.clicked.connect(self.selectedPerson) # Y
self.playAlert.connect(self.soundOff.alert)
self.playSound.connect(self.soundOff.playSound)
self.show()
return
@@ -156,7 +170,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.session.show()
self.session.raise_()
self.setPerson.emit(person_id)
self.dlg = EditDialog(self.session, person_id)
self.dlg = EditDialog(self, self.session, person_id)
self.dlg.show()
self.dlg.raise_()
return