AcademySoftwareFoundation / AcademySoftwareFoundation/OpenCue
[cuegui/pycue] Allow creating new departments from the UI / Python API
- Dominant language
- Python
- Stars
- 957
- Forks
- 259
- Avg merge
- 3d 6h
- Merged PRs (30d)
- 16
Description
**Is your feature request related to a problem? Please describe.**
Departments cannot currently be created from CueGUI or from pycue. The only entry point is the gRPC `DepartmentInterface.AddDepartmentName` method, which is not wrapped in pycue and is not exposed by any CueGUI action.
The closest existing mechanism is `Group.setDepartment(name)` — per `proto/src/department.proto:18-22`, the backend will auto-create a department when a previously-unseen name is assigned to a group. However:
- `cuegui/cuegui/GroupDialog.py:42-74` populates the department dropdown from `opencue.api.getDepartmentNames()` — i.e., only whitelisted names. The combo box is not editable, so users cannot type a new name.
- Even if it were editable, `AddDepartmentName` would still need to be called first to register the name on the backend's allowed list.
Net result: departments can only be created out-of-band (direct gRPC call or DB edit). There is no end-to-end supported workflow for administrators using the standard tools.
**Describe the solution you'd like**
1. **pycue** — wrap the missing `DepartmentInterface` methods, either in a new `pycue/opencue/wrappers/department.py` or extending `pycue/opencue/api.py`:
- `createDepartment(name)` → `AddDepartmentName`
- `deleteDepartment(name)` → `RemoveDepartmentName`
2. **CueGUI** — add an admin-facing way to create departments. Two viable shapes:
- A small "Manage Departments" dialog that lists existing departments, lets an admin add a new one, and optionally remove unused ones.
- Or, a "+" affordance next to the department combo box in `GroupDialog` that prompts for a new name and registers it before assigning.
3. As part of the same change, fix `Show.getDepartments()` (filed separately as bug #2399) so the existing `TasksDialog` becomes usable — the department admin UX would otherwise be hard to test end-to-end.
**Describe alternatives you've considered**
- Making the `GroupDialog` department combo editable and auto-creating on submit. Simpler UX, but creation becomes a side effect of group editing rather than an explicit admin action, and the underlying pycue wrapper is still needed.
- Wrapping only the pycue API and letting operators script department creation. Lower implementation effort, but leaves CueGUI users unable to self-serve and leaves the "no UI for it" gap unaddressed.
**Additional context**
- Backend gRPC methods already exist: `AddDepartmentName`, `RemoveDepartmentName`, `GetDepartmentNames` (see `proto/src/department.proto` and `proto/opencue_proto/department_pb2_grpc.py`). The work is purely on the pycue + CueGUI side.
- Related bug: `Show.getDepartments()` wrapper missing — #2399 (originally #1042).
- Repo state: master @ `e504bc98`.
Contributor guide
Research direction
Start with proto/src/department.proto and the existing DepartmentInterface methods, then inspect cuegui/cuegui/GroupDialog.py:42-74 and the pycue API or proposed department wrapper. Verify the CueGUI and Python API flows against the existing department-name operations, including the related Show.getDepartments() issue #2399. Done means administrators can create departments through pycue and CueGUI, assign them to groups, and optionally remove unused names.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100