Structures#
Structures manage the project registry, screen lifecycle, and release pipeline. Most are used
internally by the CLI and by Root/Screen.load(). Import from VIStk.Structures.
VINFO#
VINFO is the base class for Project and Screen. It locates the .VIS/ folder by
walking up the directory tree from the current working directory, and exposes path constants for
all project directories.
You do not instantiate VINFO directly. It is initialized automatically when Project() or
Root() is created.
If no .VIS/ folder exists when VINFO is initialized (i.e., running VIS new), it
creates the project structure and prompts for project name, company, and version.
Path attributes (available on ``Project`` and ``Screen``):
Attribute |
Description |
|---|---|
|
Absolute path to the project root |
|
Path to |
|
Path to |
|
Path to |
|
Path to |
|
Path to |
|
Path to |
|
Path to |
|
Path to the installed VIStk package |
|
Project name (from |
|
Project |
|
Company name (from |
|
Copyright string; defaults to |
|
Name of the default screen; |
Methods:
Method |
Description |
|---|---|
|
Undoes screen isolation — restores all screens that were temporarily set to non-releasing during a single-screen release. |
Project#
Project(VINFO) — Loads the project registry from project.json and provides screen
management. Automatically attached to Root as root.Project.
from VIStk.Structures import Project
project = Project()
Attributes:
Attribute |
Type |
Description |
|---|---|---|
|
|
All registered screens |
|
|
The currently active screen (set by |
|
|
Default icon name |
|
|
Output folder for releases |
|
|
PyInstaller hidden imports |
|
|
Copyright string from |
|
|
Filename of the Host entry-point script |
|
|
Name of the default screen; |
Methods:
Method |
Returns |
Description |
|---|---|---|
|
|
Checks if a screen with the given name is registered |
|
|
Returns the |
|
|
Returns the screen if it exists, or creates it via |
|
|
Sets |
|
|
Calls |
|
|
Unified navigation — routes through Host if running, else |
|
|
Reloads the currently active screen |
|
|
Returns |
|
|
Interactively creates a new screen (CLI use) |
|
|
Sets the default screen and persists to |
|
|
Renames a screen throughout the project; returns |
|
|
Sets any attribute in a screen’s entry with type coercion; returns |
open(name, stay_open=False)#
Preferred navigation method when a Host may be running. Routing rules:
Host running + target is tabbed — opens or focuses the tab in the Host window.
Host running + target is standalone, ``stay_open=False`` — Host spawns a subprocess; the caller should close.
Host running + target is standalone, ``stay_open=True`` — Host spawns a subprocess; caller keeps running.
No Host — falls back to
Screen.load()(os.execl), preserving standalone behaviour.
# Prefer open() over load() for portable navigation
root.Project.open("WorkOrders")
root.Project.open("Settings", stay_open=True)
Screen#
Screen(VINFO) — Represents one screen in the project. Stores metadata and provides the
load() method that switches to this screen.
Attributes:
Attribute |
Type |
Description |
|---|---|---|
|
|
Screen name |
|
|
Python script filename (e.g. |
|
|
Whether this screen is compiled to its own binary |
|
|
Icon name for this screen |
|
|
Screen description |
|
|
Screen-specific version number |
|
|
Absolute path to |
|
|
Absolute path to |
|
|
If |
|
|
If |
Methods:
Method |
Description |
|---|---|
|
Switches to this screen. Routes via IPC if a Host is running; falls back to
|
|
Asks the Host to close this screen via IPC. Returns |
|
Creates |
|
Creates |
|
Rewrites import blocks in the screen script to include all |
|
Returns all |
|
Temporarily disables release for all other screens |
|
Sends a desktop notification for this app/screen |
Host hooks#
When screen.tabbed is True, the Host imports the screen module and calls the following
functions. All hooks have default no-op stubs in the template.
Lookup priority: If modules/<screen>/m_<screen>.py exists, the Host looks for hooks
there first. The screen script is used as a fallback.
Hook |
Signature |
When called |
|---|---|---|
|
|
Once, when the tab is first opened. Build all widgets into |
|
|
Each time the tab gains focus. |
|
|
Each time the tab gains focus. |
|
|
Each time the tab loses focus or is closed. |
def setup(parent):
Label(parent, text="Hello from Tab").pack()
def configure_menu(menubar):
menubar.set_screen_items([
{"label": "Refresh", "command": refresh},
{"separator": True},
{"label": "Export", "command": export},
], label="MyScreen")
def on_focused():
start_polling()
def on_unfocused():
stop_polling()
IPC — send_to_host#
When the Host is running, any script in the same project can open a screen or send control
messages by calling send_to_host() directly.
from VIStk.Structures import send_to_host
# Open a screen in the running Host
send_to_host("MyApp", "WorkOrders")
# Send the quit signal to stop the Host
send_to_host("MyApp", "__VIS_QUIT__")
# Close a specific screen
send_to_host("MyApp", "__VIS_CLOSE__:Settings")
Parameters:
Parameter |
Type |
Description |
|---|---|---|
|
|
The project |
|
|
Screen name to open, or a reserved control message |
Returns True if the message was delivered, False if no Host port file was found or the
connection failed.
Reserved control messages:
Message |
Effect |
|---|---|
|
Gracefully shuts down the Host |
|
Asks the Host to close the named tab or Toplevel |
Screen.close() is a convenience wrapper around the __VIS_CLOSE__ message:
project = Project()
project.getScreen("Settings").close()
How it works: The Host writes its TCP port number to %TEMP%/<ProjectTitle>_vis_host.port
on startup and deletes it on shutdown. send_to_host() reads that file, connects to
127.0.0.1:<port>, and sends the message as UTF-8 text.
Version#
Version stores a semantic version number as major.minor.patch.
from VIStk.Structures import Version
v = Version("1.3.2")
print(v) # "1.3.2"
v.minor()
print(v) # "1.4.0"
Methods:
Method |
Description |
|---|---|
|
Increments major, resets minor and patch to 0 |
|
Increments minor, resets patch to 0 |
|
Increments patch |
Release#
Release(Project) — Manages the build and release pipeline. Used internally by
VIS release. You do not normally instantiate this directly.
from VIStk.Structures import Release
rel = Release(flag="beta", type="Minor")
rel.release() # compile with Nuitka, bundle assets, create installer
rel.restoreAll() # undo any screen isolation
The release pipeline uses Nuitka for compilation (not PyInstaller). The installer and uninstaller are built with PyInstaller and cached between releases.
Compilation order#
Compilations are grouped into three categories and executed in this order:
Required Packages — Shared libraries (e.g.
pywomlib,VIStk) compiled as.pydmodules intoshared/.Screens — Every tabbed screen compiled as a
.pydmodule intoScreens/. The default screen is included.Binaries — Standalone screens (
tabbed=false, release=true) compiled as.exefiles, plus the Host binary.
The Host is compiled last with --standalone --follow-imports and bundles the modules/
and Screens/ packages so that screen .pyd files can resolve their imports at runtime.
Progress is displayed on a single overwriting line:
PYWOM Release - 19 Compilations
[5/19] Screens 3/14 - WOMServant — C 12/45
If any compilation fails, the release aborts immediately with a clear error message.
No .py source files are ever included in the release — if a .pyd compilation fails,
the release fails.
Methods:
Method |
Description |
|---|---|
|
Runs the full pipeline: version bump → Nuitka compilation → asset bundling → installer assembly. Warns if no default screen is set. |
|
Compiles top-level packages from |
|
Compiles screens. |
|
Compiles the Host as a standalone Nuitka executable. |
|
Copies assets (Icons, Images, |
|
Increments the project version number in |