Compare commits
5 Commits
88425198ed
...
8588eda3ce
Author | SHA1 | Date | |
---|---|---|---|
8588eda3ce | |||
87893febac | |||
48cfa5fee6 | |||
46e67e1edf | |||
4d7151b513 |
11
README.md
11
README.md
@ -26,3 +26,14 @@ In addition to these criteria, there are the following extras:
|
||||
- All test cases are in `PDF` format
|
||||
- 1 Test case is for running the app including importing database structure
|
||||
- 2 Test cases are for testing the app itself and all possible errors and edge cases and configurability
|
||||
|
||||
|
||||
## Solution
|
||||
My solution will use the following tech stack:
|
||||
1. **Python** language
|
||||
2. **MySQL** for database
|
||||
3. **PySide6** for user interface made in Qt
|
||||
4. **SqlAlchemy** for database management
|
||||
5. **`python-dotenv`** for configurability
|
||||
|
||||
The problem in question will be demonstrated on a library application
|
BIN
db/Model.mwb
Normal file
BIN
db/Model.mwb
Normal file
Binary file not shown.
11
requirements.txt
Normal file
11
requirements.txt
Normal file
@ -0,0 +1,11 @@
|
||||
greenlet==3.1.1
|
||||
mypy==1.14.1
|
||||
mypy-extensions==1.0.0
|
||||
PySide6==6.8.1
|
||||
PySide6_Addons==6.8.1
|
||||
PySide6_Essentials==6.8.1
|
||||
python-dotenv==1.0.1
|
||||
shiboken2==5.13.2
|
||||
shiboken6==6.8.1
|
||||
sqlalchemy-stubs==0.4
|
||||
typing_extensions==4.12.2
|
0
src/__init__.py
Normal file
0
src/__init__.py
Normal file
14
src/app.py
Normal file
14
src/app.py
Normal file
@ -0,0 +1,14 @@
|
||||
import sys
|
||||
from PySide6.QtGui import QGuiApplication
|
||||
from PySide6.QtQml import QQmlApplicationEngine
|
||||
|
||||
if __name__ == "__main__":
|
||||
app = QGuiApplication(sys.argv)
|
||||
engine = QQmlApplicationEngine()
|
||||
engine.addImportPath(sys.path[0])
|
||||
engine.loadFromModule("ui", "Main")
|
||||
if not engine.rootObjects():
|
||||
sys.exit(-1)
|
||||
exit_code = app.exec()
|
||||
del engine
|
||||
sys.exit(exit_code)
|
0
src/models/__init__.py
Normal file
0
src/models/__init__.py
Normal file
12
src/models/author.py
Normal file
12
src/models/author.py
Normal file
@ -0,0 +1,12 @@
|
||||
from sqlalchemy import Column, Integer, VARCHAR
|
||||
from sqlalchemy.orm import relationship
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
|
||||
Base = declarative_base()
|
||||
|
||||
class Author(Base):
|
||||
__tablename__ = "author"
|
||||
|
||||
id = Column(Integer, primary_key=True)
|
||||
first_name = Column(VARCHAR(length=50))
|
||||
last_name = Column(VARCHAR(length=50))
|
32
src/ui/Main.qml
Normal file
32
src/ui/Main.qml
Normal file
@ -0,0 +1,32 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
|
||||
Window {
|
||||
width: 300
|
||||
height: 200
|
||||
visible: true
|
||||
title: "Hello World"
|
||||
|
||||
readonly property list<string> texts: ["Hallo Welt", "Hei maailma", "Hola Mundo", "Привет мир"]
|
||||
|
||||
function setText() {
|
||||
var i = Math.round(Math.random() * 3);
|
||||
text.text = texts[i];
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
|
||||
Text {
|
||||
id: text
|
||||
text: "Hello World"
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
}
|
||||
Button {
|
||||
text: "Click me"
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
onClicked: setText()
|
||||
}
|
||||
}
|
||||
}
|
2
src/ui/qmldir
Normal file
2
src/ui/qmldir
Normal file
@ -0,0 +1,2 @@
|
||||
module Example
|
||||
Main 254.0 Main.qml
|
Loading…
x
Reference in New Issue
Block a user