An application for managing inventory and stock for the SLAC National Accelerator Laboratory's LCLS division. This tool streamlines inventory tracking, integrates QR code scanning, and connects to Google Sheets for lightweight, cloud-based data storage.
-
Inventory Table View: Browse, search, and update stock information from a Google Sheet.
-
QR Code Scanning: Scan QR codes with your webcam or camera to quickly look up and manage inventory items.
-
Modular Architecture: Components are cleanly separated into controllers, utilities, and UI for easy extension.
-
Robust Logging: All application events and errors are logged for troubleshooting and auditing.
- Python 3.10 or newer
- pip (Python package manager)
- Google Cloud service account with access to Google Sheets API
-
Clone the repository:
git clone https://github.com/CalciumKing/SLAC-LCLS-Stock-Management.git cd SLAC-LCLS-Stock-Management
-
Install dependencies:
pip install -r requirements.txt
Main dependencies include:
- PyQt6
- opencv-python
- numpy
- gspread
- oauth2client
- pathlib
-
Configure Google Sheets access:
- Follow these instructions to create a Google Cloud service account and download the
gs_credentials.json
key. - Share your Google Sheet (e.g., "Stock Management Sheet") with the service account email in your credentials file.
- Place
gs_credentials.json
in theassets/
directory.
- Follow these instructions to create a Google Cloud service account and download the
-
Run the application:
python -m stock_manager
-
View Inventory:
The main screen shows a table synced with your Google Sheet. Data is read directly from the sheet. -
Scan QR Codes:
Switch to the QR Scanner tab. Hold item QR codes up to your camera to scan them. Scanned codes are logged and can be used for lookup or management. -
Navigation:
Use the sidebar to switch between screens or exit the application. -
Logging:
Most actions and errors are logged toapp.log
or your configured log destination.
SLAC-LCLS-Stock-Management/
│
├── stock_manager/ # Main application code
│ ├── app.py
│ ├── app.log
│ ├── __main__.py
│ │
│ ├── controllers/
│ │ ├── view.py
│ │ ├── scanner.py
│ │ └── abstract_controller.py
│ │
│ ├── utils/
│ │ ├── logger.py
│ │ └── database.py
│ │
│ └── ...
│
├── ui/ # Qt Designer .ui files
│ ├── main.ui
│ ├── view.ui
│ └── scanner.ui
│
├── assets/
│ ├── gs_credentials.json # Google Sheets credentials
│ │
│ ├── images/ # Images used throughout application
│ │ └── ...
│ └── ...
│
├── requirements.txt
└── README.md
- All critical operations (UI loading, database access, camera access) are wrapped in error handlers.
- Users are presented with clear messages in case of failure (e.g., camera not found, Google Sheets inaccessible).
- Detailed errors are logged for troubleshooting.
-
To use a different Google Sheet:
Change the sheet name indatabase.py
. -
To modify the UI:
Edit the.ui
files in theui/
directory using Qt Designer. -
To add new features/screens:
Extend thecontrollers/
orutils/
package as needed.
This project is licensed under the SLAC National Accelerator Laboratory License