Add Sound Module
This commit is contained in:
32
main.py
32
main.py
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user