コード例 #1
0
ファイル: datacontext.py プロジェクト: jmuelbert/jmbde-python
 def __init__(self) -> None:
     """The class initializer."""
     self.database: QSqlDatabase = QSqlDatabase()
     self.dbType: str = "sqlite"
     self.database_name: str = ""
     self.database_hostname: str = ""
     self.database_port: int = 0
     self.database_user_name: str = ""
     self.database_password: str = ""
     self.log = Logger().create_log()
     self.log.info("jmbde: init datacontext")
コード例 #2
0
import re
import sys

from PySide2.QtCore import QSize, Qt
from PySide2.QtSql import QSqlDatabase, QSqlTableModel
from PySide2.QtWidgets import (
    QApplication,
    QLineEdit,
    QMainWindow,
    QTableView,
    QVBoxLayout,
    QWidget,
)

db = QSqlDatabase("QSQLITE")
db.setDatabaseName("chinook.sqlite")
db.open()


class MainWindow(QMainWindow):
    def __init__(self):
        super().__init__()

        container = QWidget()
        layout = QVBoxLayout()

        self.search = QLineEdit()
        self.search.textChanged.connect(self.update_filter)
        self.table = QTableView()

        layout.addWidget(self.search)
コード例 #3
0
        for series in series_list:
            series[6] = image_count[series[2]]

        #print(study_list)
        #print(series_list)

        return study_list, series_list


if __name__ == "__main__":

    #Set up the application window
    app = QGuiApplication(sys.argv)

    #Expose the list to the Qml code
    m_Database = QSqlDatabase()
    m_Database = QSqlDatabase.addDatabase("QSQLITE")
    m_Database.setDatabaseName("C:\dev\Work\python\SQLTest\o3.db")

    # Don't know why it is not working with (.mde file?, ...)
    #    m_Database = QSqlDatabase.addDatabase("QODBC");
    #    m_Database.setDatabaseName("DRIVER={Microsoft Access Driver (*.mdb)}; FIL={MS Access}; DBQ=C:\\OnDemand3DApp\\Users\\Common\\MasterDB\\lucion.mde;")

    if (not m_Database.open()):
        qDebug("ERROR")
    else:
        qDebug("DB Opened")

    my_StudyModel = myStudyModel()
    my_SeriesModel = studySeriesModel()
    my_StudyModel.selectRow.connect(my_SeriesModel.refreshUID)