textual_wrapper.wrapper
Wrappers.
textual_wrapper.wrapper.gtk
Provides access to MainWindow, Terminal, WrapperGtk, and WrapperWindow,
or their Unity Launcher counterparts in unity if supported by the current desktop environment.
textual_wrapper.wrapper.gtk.base
GTK wrapper (base implementation).
Classes:
The main window, containing the terminal widget. |
|
Terminal widget for displaying a Textual app. |
|
|
A GTK3-based wrapper around a terminal app. |
|
Standalone terminal wrapper for the app. |
-
class
MainWindow[source] Bases:
ScrolledWindowThe main window, containing the terminal widget.
Methods:
add_widget(widget)Add a widget to the window.
-
class
Terminal[source] Bases:
TerminalTerminal widget for displaying a Textual app.
Attributes:
Colour to use for the terminal background.
Methods:
Returns the background colour for text which does not have a specific background colour assigned.
Hide the blinking cursor by setting its foreground colour to the background colour.
new()Create the terminal widget.
set_color_background(background)Sets the background colour for text which does not have a specific background colour assigned.
spawn_app(arguments, working_directory[, ...])Launch the app in the terminal.
-
property
background_colour Colour to use for the terminal background.
- Return type
RGBA
-
get_color_background()[source] Returns the background colour for text which does not have a specific background colour assigned.
New in version 0.4.0.
- Return type
RGBA
-
hide_cursor()[source] Hide the blinking cursor by setting its foreground colour to the background colour.
New in version 0.4.0.
-
set_color_background(background)[source] Sets the background colour for text which does not have a specific background colour assigned.
Only has effect when no background image is set and when the terminal is not transparent.
- Parameters
background (
RGBA) – The new background colour
New in version 0.4.0.
-
spawn_app(arguments, working_directory, callback=None)[source] Launch the app in the terminal.
- Parameters
arguments (
list[str]) – The app executable and any arguments to pass to it.working_directory (
str) – Directory to execute the application in.callback (
Optional[Callable[Terminal,int,Any,None]]) – Function to call when the app has launched, which is passed the terminal, the child process id, and any errors. DefaultNone.
-
property
-
class
WrapperGtk(name, arguments, icon=None, launcher_options=<factory>, menu_options=<factory>, wrapper_window_cls=<class 'WrapperWindow'>)[source] Bases:
WrapperA GTK3-based wrapper around a terminal app.
Methods:
run([working_directory])Launch the wrapper.
Classes:
The GTK wrapper window itself.
-
wrapper_window_cls The GTK wrapper window itself.
alias of
WrapperWindow
-
-
class
WrapperWindow(wrapper)[source] Bases:
WindowStandalone terminal wrapper for the app.
Displays the app in a libVTE terminal window, like gnome-terminal but without the standard terminal functionality. Closes when the app exits.
- Parameters
wrapper (
Wrapper)
Methods:
create_menu_options(menu_options)Create the menubar options.
on_child_exited(terminal, status)Handler for the process running in the terminal exiting.
on_menuitem_clicked(item)Handler for menu buttons being clicked.
run(arguments, working_directory)Show the wrapper window and launch the Textual app.
set_window_size(target_size)Set the window size to the closest whole-character increment.
spawn_callback(terminal, pid, error)Handler for the app finishing spawning.
Create the menubar options.
- Parameters
menu_options (
dict[str,list[MenuOption]])- Return type
MenuBar
-
on_child_exited(terminal, status)[source] Handler for the process running in the terminal exiting.
Closes the wrapper window.
- Parameters
terminal (
Terminal)status (
int)
Handler for menu buttons being clicked.
- Parameters
item (
MenuItem) – The clicked item.
textual_wrapper.wrapper.gtk.unity
GTK wrapper with Unity launcher support.
Classes:
|
A GTK3-based wrapper around a terminal app, with Unity launcher support. |
|
Standalone terminal wrapper for the app. |
-
class
WrapperUnity(name, arguments, icon=None, launcher_options=<factory>, menu_options=<factory>, wrapper_window_cls=<class 'WrapperWindow'>)[source] Bases:
WrapperGtkA GTK3-based wrapper around a terminal app, with Unity launcher support.
Classes:
The GTK wrapper window itself.
-
wrapper_window_cls The GTK wrapper window itself.
alias of
WrapperWindowUnity
-
-
class
WrapperWindowUnity(wrapper)[source] Bases:
WrapperWindowStandalone terminal wrapper for the app.
Displays the app in a libVTE terminal window, like gnome-terminal but without the standard terminal functionality. Closes when the app exits.
- Parameters
wrapper (
Wrapper)
Methods:
Create the Unity launcher rightclick menu options.
on_launcher_menuitem_clicked(item, timestamp)Handler for a Unity Launcher rightclick menu item being clicked.
run(arguments, working_directory)Show the wrapper window and launch the Textual app.
Handler for a Unity Launcher rightclick menu item being clicked.
- Parameters
item (
Menuitem) – The clicked item.timestamp (
int)