Oxoria API Reference
7 modules · Complete method reference
Modules
opencv_convert
cv_img, and writes the processed result back to the canvas.| Step | Description |
|---|---|
| 1 | Retrieves all selected items via CanvasAPI().get_selected() |
| 2 | Converts each item's base_pixmap to QImage.Format_RGBA8888 |
| 3 | Casts the image data to a np.ndarray of shape (H, W, 4) |
| 4 | Injects it into the decorated function as the cv_img keyword argument |
| 5 | Converts the returned np.ndarray back to QPixmap |
| 6 | Writes the result back via CanvasAPI().set_pixmap() |
cv_img: np.ndarray = None and must return a np.ndarray of shape (H, W, 4) in RGBA format. The decorator iterates over all selected items independently. No value is returned from the wrapper.CvProcessAPI
@opencv_convert and @classmethod.Converts the selected image(s) to grayscale (black & white).
| Argument | Description |
|---|---|
| cv_img | Injected automatically by @opencv_convert; do not pass manually |
| Returns | |
|---|---|
| np.ndarray | RGBA image converted from grayscale |
cv2.COLOR_BGRA2GRAY then cv2.COLOR_GRAY2RGBA for round-trip conversion.Returns the image unchanged. Intended to restore a previously processed image to its original state.
| Returns | |
|---|---|
| np.ndarray | Original RGBA image as-is |
base_pixmap holding the original data.Applies colored non-local means denoising to the selected image(s).
| Returns | |
|---|---|
| np.ndarray | Denoised RGBA image |
cv2.fastNlMeansDenoisingColored with fixed parameters (h=10, hColor=10, templateWindowSize=7, searchWindowSize=21). These are not currently configurable.Executes an arbitrary OpenCV expression string and applies the result to the selected image(s).
| Argument | Description |
|---|---|
| cv2_cmd | A Python expression string; has access to cv2, np, and cv_img in its execution context |
| cv_img | Injected automatically by @opencv_convert |
| Returns | |
|---|---|
| np.ndarray | Result of the evaluated expression |
eval() to execute the expression. Only pass trusted, validated strings. Never expose this to untrusted user input, as it can execute arbitrary code.CanvasAPI
Serializes the current canvas scene into a dictionary suitable for JSON export.
| Returns | |
|---|---|
| dict | Keys are item pointers; values contain size_h, size_w, pos_x, pos_y |
ImageItem instances are included. Returns early if UI_Var.MAIN_CANVAS is None.Serializes and saves the current canvas to a .oxoria JSON file.
| Argument | Description |
|---|---|
| saving_path | Absolute or relative path to write the file |
GBVar.OPENED_FILE upon completion.Loads a .oxoria project file and restores all image items to the canvas.
| Argument | Description |
|---|---|
| opening_path | Path to the .oxoria file |
.oxoria, or cannot be parsed. Only items whose pointers exist in the current resource profile are restored. Updates GBVar.OPENED_FILE.Opens an image file and places it onto the canvas.
| Argument | Description |
|---|---|
| img_path | Path to the image file |
Removes all items from the canvas scene and resets GBVar.OPENED_FILE.
save_file() before invoking if preservation is needed.Packages the current canvas and its associated image resources into an .oxoarchive file.
| Argument | Description |
|---|---|
| archive_path | Destination path for the archive |
temp_export/ under GBVar.DATA_DIR, builds a zip archive, then renames it to .oxoarchive. The temp directory is removed after archiving. Only resources referenced by the current canvas are included.Removes a list of ImageItem instances from the canvas scene.
| Argument | Description |
|---|---|
| items_to_delete | List of items to remove |
Returns a list of currently selected items on the canvas.
| Returns | |
|---|---|
| list[ImageItem] | Currently selected scene items |
Groups all currently selected items into a single QGraphicsItemGroup.
Returns whether any item is currently selected on the canvas.
| Returns | |
|---|---|
| bool | True if at least one item is selected |
Resets the canvas view transform, centers on the origin, and applies a default zoom scale of 0.15.
Replaces the pixmap of an ImageItem on the canvas, updating both base_pixmap and the displayed scaled version.
| Argument | Description |
|---|---|
| pixmap | New QPixmap to assign |
| image_item | The target canvas item |
AppAPI
Launches the screen capture monitor as a background process, if not already running.
psutil before launching to prevent duplicate instances. The monitor script path is resolved relative to the module's location.Opens a new Oxoria application window as an independent subprocess.
__main__.py in the application root directory. Prints an error to stdout if the entry script is not found.Quits the main Qt application.
GBVar.MAIN_APP.quit(). Does nothing if MAIN_APP is None.Retrieves a slice of the global command execution history stack.
| Argument | Description |
|---|---|
| output_length | Number of commands to return from the end of the stack. Pass -1 (default) to return the entire stack; pass a positive integer to return only the last N commands |
| Returns | |
|---|---|
| list[str] | List of command strings; empty list if the command stack is empty or output_length is invalid |
output_length exceeds the actual stack size, the entire stack is returned. The stack is accessed via GBVar.COMMAND_STACK.Registers a custom shortcut by storing a command string mapped to a shortcut alphabet key.
| Argument | Description |
|---|---|
| cmd | The command string to execute when the shortcut is triggered |
| shortcut_alphabet | A single character or key name to use as the shortcut trigger |
config/app_config.json, updates the "mycommand" section with the new shortcut mapping, and writes the updated config back to disk. Creates the "mycommand" dictionary if it does not exist.Retrieves the command string associated with a registered custom shortcut.
| Argument | Description |
|---|---|
| shortcut_alphabet | The shortcut key to look up |
| Returns | |
|---|---|
| str | The command string for the given shortcut; empty string "" if the shortcut does not exist or the "mycommand" section is not found |
config/app_config.json. Returns an empty string rather than raising an error if the shortcut is not found.Returns the absolute path to the application data directory.
| Returns | |
|---|---|
| str | Path to the data directory, typically containing resources_lib/, profiles/, and other application data |
GBVar.DATA_DIR. This is a convenience accessor for the global data directory.Returns the absolute path to the parent directory of the data directory (the root application folder).
| Returns | |
|---|---|
| str | Path to the application root folder, one level above the data directory |
Path.resolve().parent. Useful for locating configuration files and other app-level resources.Returns a reference to the global GBVar class object.
| Returns | |
|---|---|
| GBVar | The GBVar class itself, providing access to all global application variables |
MAIN_APP, COMMAND_STACK, DATA_DIR, etc.ResourcesAPI
| Argument | Description |
|---|---|
| data_path | Override for the data directory; defaults to GBVar.DATA_DIR |
Darwin), sets OMP_NUM_THREADS=1 to avoid OpenMP conflicts.Copies an image file into the local resource library directory.
| Argument | Description |
|---|---|
| original_path | Source file path |
| new_path | Destination filename (relative to resources_lib/) |
Checks whether an image (by hash or path) already exists in the resource library.
| Argument | Description |
|---|---|
| img_hash | Precomputed hash; if None, computed from img_path |
| img_path | Image file path; used to compute hash if img_hash is None |
| tolerance | Similarity tolerance for fuzzy matching; 0 = exact match (default: 0) |
| Returns | |
|---|---|
| tuple | (hash_value, exists_flag); both None if neither argument is provided |
Returns the full resource profile dictionary from resources_profile.json.
| Returns | |
|---|---|
| dict | All resource entries; empty dict if the profile file does not exist |
Constructs a profile dictionary for a new resource (does not write to disk).
| Argument | Description |
|---|---|
| img_path | Path to the image |
| name | Display name; defaults to the filename stem |
| memo | Free-text memo; defaults to "" |
| tags | List of tag strings; defaults to [] |
| make_clone_path | If True, stores only the filename (not the full path) in the profile (default: True) |
| Returns | |
|---|---|
| dict | Profile with keys path, name, memo, tags |
Writes or updates a single resource entry in resources_profile.json.
| Argument | Description |
|---|---|
| pointer | Unique hash identifier for the resource |
| profile | Profile data; must contain a "path" key |
| merge | If True, merges with the existing profile instead of replacing (default: False) |
| Returns | |
|---|---|
| bool | True on success; False if "path" is missing from profile |
Imports an image into the resource library: adds its hash, writes its profile, and optionally copies the file.
| Argument | Description |
|---|---|
| img_hash | Precomputed hash; computed from img_path if None |
| img_path | Source image path |
| profile | Resource profile dictionary |
| skip_existencce_check | If True, skips duplicate detection (default: True) |
| tolerance | Hash similarity tolerance for duplicate check (default: 0) |
| make_clone | If True, copies the file into the repository (default: True) |
| Returns | |
|---|---|
| bool | True on success; False if the resource already exists (when check is enabled) or if both hash and path are None |
skip_existencce_check contains a typo (existencce). Use it as-is in your code.Resolves a resource pointer (hash) to its absolute file path.
| Returns | |
|---|---|
| str | None | Absolute path string, or None if not found |
Finds the resource pointer associated with a stored relative path.
| Returns | |
|---|---|
| str | None | Pointer string, or None if not found |
Looks up the relative path for a resource by its display name.
| Returns | |
|---|---|
| str | None | Relative path string, or None if not found |
Returns all resource pointers that have the specified tag.
| Returns | |
|---|---|
| list[str] | List of matching pointer strings |
Returns all resource pointers matching the specified category.
| Returns | |
|---|---|
| list[str] | List of matching pointer strings |
pass. Not yet available.Updates the memo field of a resource profile in place.
| Argument | Description |
|---|---|
| pointer | Resource hash |
| memo_text | New memo content |
Appends or removes tags from a resource's profile.
| Argument | Description |
|---|---|
| pointer | Resource hash |
| tags | Tags to add or remove |
| mode | "append" adds new tags (deduplicates); "remove" removes specified tags (default: "append") |
pointer is not in the current profile or if mode is unrecognized.SearchAPI
Initializes UseVector, SearchBase, and FaissIndexBase internally.
Adds a keyword to the FAISS vector index and the in-memory search base.
| Argument | Description |
|---|---|
| kw | Keyword string to index |
Searches for the most semantically similar keywords to the query using the FAISS index.
| Argument | Description |
|---|---|
| kw | Query keyword |
| return_num | Maximum number of results to return (default: 3) |
| Returns | |
|---|---|
| list[str] | List of matching keyword strings; may be shorter than return_num if the search base is small |
0.65; results below this threshold are excluded.Performs semantic search and maps the results back to resource pointers.
| Argument | Description |
|---|---|
| kw | Query keyword |
| return_num | Number of results to return (default: 3) |
| Returns | |
|---|---|
| list[str | None] | List of length return_num; positions without a matching pointer contain None |
"memo" field of each resource profile.Searches for resources by fuzzy string matching on display names using difflib.
| Argument | Description |
|---|---|
| kw | Query string |
| return_num | Maximum number of results (default: 3) |
| cutoff | Minimum similarity score [0.0, 1.0]; results below this are discarded (default: 0.5) |
| Returns | |
|---|---|
| list[str] | List of resource pointer strings matching the name query |
cutoff parameter is accepted in the signature, but the internal difflib.get_close_matches call hardcodes cutoff=0.5, so the passed value is ignored.