Services (pyzed.services)
Services raise events but draw nothing: they are the non-visual components of Pyzed Design
(the tray under the form) and work the same in a
pz.App or a script. Handlers go in on_<event>=; events raised by a background thread reach
them on the app’s thread. See the Services guide.
watcher = pz.FileWatcher("inbox", pattern="*.csv", on_created=self.import_file)watcher.start()Time and keys
Section titled “Time and keys”class TimerRaises tick (with the count) every interval milliseconds while it is running; repeat=False ticks once. Return subscriptions() from your app’s subscriptions.
Shortcut
Section titled “Shortcut”class ShortcutRaises activate when one of its keys is pressed ("ctrl-s", "Ctrl+S", several separated by commas; mod- is Cmd on macOS and Ctrl elsewhere). Call handle(combo) from on_key.
Files and programs
Section titled “Files and programs”FileWatcher
Section titled “FileWatcher”class FileWatcherWatches a folder or a file and raises created, modified and deleted (a path) and change (the changed paths), checking every interval milliseconds. start(), stop(), running.
Process
Section titled “Process”class ProcessRuns a program and raises output and error_output for every line it prints, finished with its exit code, started and failed. start(), write(), kill(), wait().
Worker
Section titled “Worker”class WorkerRuns work(value) in a background thread with run(value); report() raises progress, the result arrives in done and an exception in failed. cancel() sets cancelled.
Network
Section titled “Network”HttpRequest
Section titled “HttpRequest”class HttpRequestCalls a web address in the background: send() raises response with an HttpResponse (error statuses included) or failed when there was no answer. json= sends JSON.
HttpResponse
Section titled “HttpResponse”@dataclassclass HttpResponse(status, content=b'', headers={}, url='')A web server’s answer: status, ok, headers, content (bytes), text and json().
System
Section titled “System”Clipboard
Section titled “Clipboard”class ClipboardThe system clipboard: copy(text) and paste() return commands; with watch=True it raises change when something new is copied.
Settings
Section titled “Settings”class SettingsValues kept between runs: a dict saved as JSON in the user’s settings folder at every change, with defaults; raises change with (key, value).
FileDialog
Section titled “FileDialog”class FileDialogThe system’s file dialog: show() returns the command that opens it in mode "open", "open_many", "save" or "folder"; raises chosen or cancelled.
Notification
Section titled “Notification”class NotificationA desktop notification: show(text) shows it and returns whether it could; raises shown or failed.
TrayIcon
Section titled “TrayIcon”class TrayIconAn icon in the system tray with a tooltip and a menu (a list, or text with one item per line: - separator, [x] check, indented submenu): show() returns whether it could, hide(), checked(item); raises click, double_click (Windows), menu and failed. On Linux it is a StatusNotifierItem, without GTK.
TrayItem
Section titled “TrayItem”@dataclassclass TrayItem(text, id=None, enabled=True, checked=None, items=[])An entry of a TrayIcon menu: text, id (what menu receives), enabled, checked and items for a submenu.
Operating system (pyzed.system)
Section titled “Operating system (pyzed.system)”SystemInfo
Section titled “SystemInfo”class SystemInfoWhat the computer is: os ("Windows", "macOS", "Linux"), os_version, machine, hostname, user, home, language, cpu_count, python_version, memory_total, plus memory_available, disk_free and disk_total read when asked. env(name) reads a variable, folder("documents") finds the user’s folders. With interval above 0, start() raises update with snapshot() every so often.
Launcher
Section titled “Launcher”class LauncherOpens files, folders and links with the app the system uses for them: open(target), reveal(path) (selected in the file manager) and email(to, subject, body); raises opened or failed.
NetworkMonitor
Section titled “NetworkMonitor”class NetworkMonitorNotices when the computer goes online or offline by reaching host every interval milliseconds in the background: online, check(), start(), stop(); raises change, online and offline.
PowerMonitor
Section titled “PowerMonitor”class PowerMonitorThe battery: percent, plugged and has_battery; every interval milliseconds raises change, low (under low_level while unplugged), plugged and unplugged.