Python module for quick building minimalistic interface for database.
Just clone or download...
pip3 install -r requirements.txt
from MiniDbHelper.MiniDbHelper import MiniDbHelper, Layout
from PySide6.QtWidgets import QApplication
import sys
app = QApplication(sys.argv)
window = MiniDbHelper("Sells",
Layout(title="Primary",
fields={"id" : "int", "summ": "int", "priority": "short"},
initial_data=["1", "2", "3", "4", "5", "6"]),
Layout(title="Notes",
initial_data=["1", "2", "3", "0"],
fields={"Name": "", "Checked": "bool"}))
window.show()
sys.exit(app.exec())data = {"Field Name": "type", "Another Field": "type"} #Dictionary- "str" -> (QLineEdit)
- "int" -> (QDoubleSpinBox) -> STORED AS FLOAT
- "unsigned" -> (QDoubleSpinBox) -> STORED AS FLOAT
- "bool" -> (QCheckBox)
- not specified -> "str" -> (QLineEdit)
Optional methods to check/process data when user clicks add/delete button
def on_add(vals: list) -> list:
new vals = edit(vals)
return new_valsDefault: no action
Optional method to control user input
def validator(vals: list) -> str:
if some_error:
return "Error text" #Show error text to user
return "~OK" #Just continueDefault: just checks if all input fields are not empty.
- vals - list of values of its native type (according to supported types):
[123.0, "String", True, -32.43]
- Окно должно быть готово к использованию сразу после создания экземпляра класса;
- Хранить словари элементов чтобы можно было обращаться к ключевым позициям для их модификации или независимого получения данных;
- Полностью адаптивный интерфейс. Либо через QDockWidget либо через разделители для изменения размелов;
- Импорт/Экспорт данных CSV/Excel/...;
- Возможность скрывать поля ввода для пользователя.
