Skip to main content

pylcddc

A python library for interfacing with LCDd, the server component of the commonly known LCDproc

Features:

  • Object-oriented interface support for all native LCDd widgets

    • Full frame support, nest widget objects in frames, treat frames like widget containers
    • Support for user-created composite widgets, that can be used just like native widgets (no easy API for now, changes to come later)
  • Decoupled thread to service LCDd screen switching responses

  • One I/O method to update screen, no funky exception handling everywhere

Installation

pip install pylcddc

More TODOs

  • See TODO.md for more information and TODOs

Version support

  • Tested on LCDd packaged with LCDproc version 0.5.9
  • Protocol version 0.3

Modules for users

  • pylcddc.client: client for LCDd
  • pylcddc.screen: screens to attach to clients
  • pylcddc.widgets: widgets to place in screens
  • pylcddc.exceptions: exceptions raised by the library

Modules for developers

  • pylcddc.responses: LCDd response decoder and abstractions
  • pylcddc.commands: LCDd request generation

Examples

Don't really use these for production code...

See more examples in /demo

Simple usage for static display

import pylcddc.client as client
import pylcddc.widgets as widgets
import pylcddc.screen as screen

title = widgets.Title('title_widget',
                      'Hello, World!')
main_scr = screen.Screen('main', [title])

c = client.Client('localhost', 13666)
c.add_screen(main_scr)
input('Press any key to exit')
c.close()

Nest widgets in frames

import pylcddc.client as client
import pylcddc.widgets as widgets
import pylcddc.screen as screen
import platform

flavorful_text_widgets = [widgets.String(f'flv_tx{i}', 1, 1 + i, text) for 
                          i, text in enumerate(
        'now you see me\nnow you dont\nso scary\nsuch wow'.splitlines())]
frame_top = widgets.Frame('frame_top', flavorful_text_widgets, 
                          1, 1, 10, 1, 10, 4, 
                          widgets.Frame.Direction.VERTICAL, 8)
platform_text = widgets.Scroller('platform', 1, 2, 20, 1,
                                 widgets.Scroller.Direction.HORIZONTAL, 1,
                                 'pylcddc running on ' 
                                 + ' '.join(platform.uname()))

main_scr = screen.Screen('main', [frame_top, platform_text])

c = client.Client('localhost', 13666)
c.add_screen(main_scr)
input('Press any key to exit')
c.close()

Simple timed display updates and display attributes

import pylcddc.client as client
import pylcddc.widgets as widgets
import pylcddc.screen as screen
import pylcddc.exceptions as lcdexcept
import time

time_string = widgets.Scroller('time', 1, 1, 20, 2,
                               widgets.Scroller.Direction.HORIZONTAL, 8,
                               time.ctime())
main_scr = screen.Screen('main', [time_string],
                         heartbeat=screen.ScreenAttributeValues.Heartbeat.OFF)

c = client.Client('localhost', 13666)
c.add_screen(main_scr)

print('pylcdd time demo\nUse ^C to exit')

try:
    while True:
        time_string.text = time.ctime()
        c.update_screens([main_scr])
        print('updated time to: ', time.ctime())
        time.sleep(0.1)
except lcdexcept.RequestError as e:
        print('LCDd refused our request', e)
except lcdexcept.FatalError as e:
        print('pylcddc fatal internal error', e)
except KeyboardInterrupt:
        print('exitting')

c.close()  # there might be exceptions from OS system call failures here

Licensing

See LICENSE.txt for more details

Metadata

Release files for pylcddc 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pylcddc 0.4.0
File Size Uploaded
pylcddc-0.4.0.tar.gz 31.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pylcddc 0.4.0
File Interpreter ABI Platform
pylcddc-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 61.1 kB

Release files / pylcddc-0.4.0.tar.gz

Download URL pylcddc-0.4.0.tar.gz
Size 31.0 kB
Tags Source
SHA-256 checksum
How to use checksums
a693321b06874d658924b9100859847ba550e034609d48ee6040521bf7c0dfe3
BLAKE2b-256 checksum
How to use checksums
8eec1d360c1b1e9b9e9b0566b5cbb29204b1707fbe2f83f937625df0469921f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.3

Release files / pylcddc-0.4.0-py3-none-any.whl

Download URL pylcddc-0.4.0-py3-none-any.whl
Size 30.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
48506244d7c9b73b77380f6e21fc5714055ea7f0789d163e6059c5a3ecb4e937
BLAKE2b-256 checksum
How to use checksums
599a9c8643257c77197e4165c00216cb5c42381f8c608f94bdd612423225102b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.3

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.0

2 release files

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page