add option to disable automatic command transmission

pull/79/head
seebye 5 years ago
parent d81640dbe9
commit e27fa0edae

@ -199,17 +199,19 @@ import ueberzug.lib.v0 as ueberzug
Methods:
| Name | Returns | Description |
|------------------|--------------|--------------------------------------|
| create_placement | Placement | prevents the use of the same identifier multiple times,<br>takes the same arguments as the Placement constructor (excluding canvas parameter) |
| \_\_call\_\_ | Function | Decorator which returns a function which calls the decorated function with the keyword parameter canvas=this_canvas_object.<br>Of course other arguments are also passed through. |
| Name | Returns | Description |
|----------------------|--------------|--------------------------------------|
| create_placement | Placement | prevents the use of the same identifier multiple times,<br>takes the same arguments as the Placement constructor (excluding canvas parameter) |
| \_\_call\_\_ | Function | Decorator which returns a function which calls the decorated function with the keyword parameter canvas=this_canvas_object.<br>Of course other arguments are also passed through. |
| request_transmission | - | Transmits queued commands if automatic\_transmission is enabled or force=True is passed as keyword argument. |
Properties:
Properties / Attributes:
| Name | Type | Setter | Description |
|---------------|-------------------------|--------|--------------------------------------|
| lazy_drawing | context manager factory | No | prevents the transmission of commands till the with-statement was left<br>`with canvas.lazy_drawing: pass`|
| synchronous_lazy_drawing | context manager factory | No | Does the same as lazy_drawing. Additionally forces the redrawing of the windows to happen immediately. |
| automatic\_transmission | bool | Yes | Transmit commands instantly on changing a placement. If it's disabled commands won't be transmitted till a lazy_drawing or synchronous_lazy_drawing with-statement was left or request_transmission(force=True) was called. Default: True |

@ -309,6 +309,7 @@ class Canvas:
self.__process = None
self.__transmitter = None
self.__used_identifiers = set()
self.automatic_transmission = True
def create_placement(self, identifier, *args, **kwargs):
"""Creates a placement associated with this canvas.
@ -390,9 +391,10 @@ class Canvas:
self.__transmitter.enqueue(command)
def request_transmission(self):
def request_transmission(self, *, force=False):
"""Requests the transmission of every command in the queue."""
if not self.__process.responsive:
self.__process.start()
self.__transmitter.transmit()
if self.automatic_transmission or force:
self.__transmitter.transmit()

Loading…
Cancel
Save