Skip to content

FireChickenProductivity/PowerFace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

Power Face

Simple Talon Voice extension for graphical interfaces. Under construction but with a stable API.

Goals

  • Easy to use
  • Simple core (relatively few lines of code)
  • Convenience features (automatic pagination, word wrapping)
  • Voice interactable
  • Mouse interactable
  • Basic Components (text area, buttons, rows, columns)
  • Simple layouts (vertical, horizontal)
  • Canvases are movable with voice commands
  • Settings for customizing appearance (component sizes, colors)
  • More Layout Options
  • Ability to drag canvases with mouse
  • Input components (text input, integer, float, boolean)
  • Keyboard interactable
  • Make prettier

Alternatives

talon-ui-elements offers more sophisticated Talon User Interface support.

Public API

Actions

You can create a simple vertical interface with the actions.user.power_face_create_vertical(name: str, components: list, top: list = [], bottom: list = []) action.

name is the name associated with the interface's canvas, which disambiguates it from other interfaces. This should ideally be speakable to allow voice commands to interact with the canvas.

components is a list of python built-in types used to construct an interface. A string denotes a text area. A tuple with a string and a callable denotes a button with label text based on the string and calls the callable when used. ... denotes a vertical line. A sublist of components denotes horizontally aligned components.

Example:

from talon import Module, actions

mod = Module()

@mod.action_class
class Actions:
	def power_face_create_demo_canvas():
		"""Shows a demonstration power face canvas"""
		actions.user.power_face_create_vertical(
			"demo",
			[
				"This Is a Power Face Demo",
				...,
				[("Left Button", lambda: print("Left Button Clicked"))
				, ("Right Button", lambda: print("Right Button Clicked"))],
				"This is a multiline text area\nNote that Power Face provides word wrap as well. This is a single text area, so all of its text will get shown on the same page."
			]
		)

With default settings, the example produces the following

image

top and bottom respectively are optional lists for specifying components that Power Face should always try to put at the top or bottom of every page.

Calling this action with the same canvas name will update the existing canvas.

actions.user.power_face_hide_canvas(name: str) hides the specified canvas by name.

actions.user.power_face_hide_active_canvas() hides the currently active canvas.

actions.user.power_face_hide_all_canvases() hides all Power Face canvases.

actions.user.power_face_get_active_canvas_name() -> Optional[str] returns the name of the active canvas if present.

actions.user.power_face_get_canvas_rectangle(name: str) -> Rectangle returns the rectangle of the specified canvas.

actions.user.power_face_move_canvas(name: str, rectangle: Rectangle) moves the specified canvas to the area given by the rectangle.

actions.user.power_face_move_canvas_by_upper_left(name: str, new_x: int, new_y: int) moves the specified canvas by setting its upper-left corner to the given coordinates.

actions.user.power_face_rectangle(left: int, right: int, top: int, bottom: int) -> Rectangle creates a Power Face rectangle.

Settings

See src/settings.py for available settings. Behavior is undefined if you change these while a canvas is active. Power Face does not prevent you from making poor setting choices that degrade interface quality or break things.

Commands

Global commands documented with comments can be found in src/commands.talon.

Some highlights:

pow hide: hides the active canvas.

pow click {user.power_face_interactable_component_name}: if a component has a unique name, this allows clicking that component by name. Behavior is undefined when used with a component with a non-unique name.

pow <number>: interactive components are automatically given parenthesized id numbers. This command clicks the component with the given number.

pow move here {user.power_face_canvas_name}: moves the specified canvas to the cursor.

src/extra_features

This directory contains non-core functionality. Each subdirectory can be removed without breaking anything outside it.

Positioning

Provides commands for moving canvases. See src/extra_features/positioning/README.md for details.

About

Simple Talon Voice extension for graphical interfaces. Still under construction but with a stable API.

Resources

License

Stars

Watchers

Forks