v2: Restructure, redesign UI, fix bugs, remove committed databases - #1
Open
Jenks00 wants to merge 4 commits into
Open
v2: Restructure, redesign UI, fix bugs, remove committed databases#1Jenks00 wants to merge 4 commits into
Jenks00 wants to merge 4 commits into
Conversation
Split the single Student_management_system.py file into main.py plus app/database.py, login_window.py, dashboard.py, theme.py, export.py, and validators.py. The database and its tables are now created at runtime via CREATE TABLE IF NOT EXISTS instead of committing .db files. Passwords are now stored as SHA-256 hashes instead of plaintext.
test_database.py covers auth, CRUD, role-scoped queries, search, and validators against a throwaway sqlite file. test_gui.py drives the real Tkinter widgets end to end (login, add/update/delete, search, sort, export, theme toggle, role restrictions) to catch UI-level bugs that unit tests on the data layer alone would miss.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This is a full production-readiness pass and UI redesign of the Student Management System, done entirely on this branch so
mainis untouched and easy to compare against or revert to.Student_management_system.pyfile is split intomain.py(entry point) plus a smallapp/package:database.py(SQLite access layer),login_window.py,dashboard.py,theme.py(ttk styling),export.py(CSV/PDF), andvalidators.py(input validation). No functional behavior changed except the bug fixes below..dbfiles (app.db,login.db,sms.db,student.db,students.db,users.db). Onlyapp.dbwas ever actually opened by the code (DB_FILE = "app.db"); the rest were dead leftovers. The database and its tables are now created automatically at runtime (CREATE TABLE IF NOT EXISTS, already present in the original code and preserved) and*.dbis gitignored.ttk.Treeviewstringifies PythonNoneto the literal text"None"when values are inserted. For a student with no linked login (usernameisNULL), selecting that row and then saving any edit would write the string"None"back into theusernamecolumn — and sinceusernameisUNIQUE, a second such edit would fail with aUNIQUE/FOREIGN KEYconstraint error. Fixed by sanitizingNoneto""when populating the table.hashlib, stdlib) instead of being stored and compared as plaintext.ttk.Styletheme (light + dark palettes), a resizable grid layout (the old layout used fixed-pixelplace()coordinates and a fixed window size), a striped/sortablettk.Treeviewdata table with a scrollbar, consistent button styling by intent (primary/success/danger/warning/accent/secondary), and better spacing throughout.reportlab, which is not part of the standard library. This wasn't previously documented anywhere.requirements.txtnow lists it, and the README calls out that everything else is pure stdlib. Ifreportlabisn't installed, PDF export shows a clear message instead of crashing; everything else still works.tests/:test_database.py(22 checks against a throwaway sqlite file: auth, CRUD, role-scoped queries, search, validators) andtest_gui.py(21 checks that drive the actual Tk widgets end-to-end — login, add/update/delete, search, sort, export, theme toggle, role restrictions — against a live Tk root). Both pass.LICENSE(MIT) and rewroteREADME.mdwith features, tech stack, setup instructions, test instructions, and a PyInstaller packaging note.How this was verified
Given the headless/CI-like constraints of the environment this was developed in (no real interactive desktop), verification was layered:
python -m py_compileon every module — no syntax errors.tests/test_database.py— 22 automated checks against the real data-access layer (throwaway sqlite file).tests/test_gui.py— 21 automated checks that construct the actualLoginWindowandDashboardwidget trees on a liveTk()root and drive their real callback methods (not mocks), pumping the event loop withroot.update(). This is what caught theNone-stringification bug above.Test plan
python main.py, log in withadmin/admin123reportlabfirst for PDF)python tests/test_database.pyandpython tests/test_gui.pyboth report all checks passing