pychess.System package

Submodules

pychess.System.Log module

class pychess.System.Log.ExtraAdapter(logger, extra)

Bases: logging.LoggerAdapter

process(msg, kwargs)

Process the logging message and keyword arguments passed in to a logging call to insert contextual information. You can either manipulate the message itself, the keyword args or both. Return the message and kwargs modified (or not) to suit your needs.

Normally, you’ll only need to override this one method in a LoggerAdapter subclass for your specific needs.

class pychess.System.Log.LoggerWriter(logger, level)

Bases: object

flush()
write(message)
class pychess.System.Log.TaskFormatter(fmt=None, datefmt=None)

Bases: logging.Formatter

format(record)

Format the specified record as text.

The record’s attribute dictionary is used as the operand to a string formatting operation which yields the returned string. Before formatting the dictionary, a couple of preparatory steps are carried out. The message attribute of the record is computed using LogRecord.getMessage(). If the formatting string uses the time (as determined by a call to usesTime(), formatTime() is called to format the event time. If there is exception information, it is formatted using formatException() and appended to the message.

pychess.System.Log.setup_glib_logging()

Code from https://github.com/GNOME/meld/blob/master/bin/meld

pychess.System.LogEmitter module

class pychess.System.LogEmitter.GLogHandler(emitter)

Bases: logging.Handler

emit(record)

Do whatever it takes to actually log the specified logging record.

This version is intended to be implemented by subclasses and so raises a NotImplementedError.

class pychess.System.LogEmitter.LogEmitter

Bases: GObject

pychess.System.SubProcess module

pychess.System.accordion module

pychess.System.cairoextras module

class pychess.System.cairoextras.PycairoContext

Bases: _ctypes.Structure

PyObject_HEAD

Structure/Union member

base

Structure/Union member

ctx

Structure/Union member

pychess.System.cairoextras.create_cairo_font_face_for_file(filename, faceindex=0, loadoptions=0)

Given the name of a font file, and optional faceindex to pass to FT_New_Face and loadoptions to pass to cairo_ft_font_face_create_for_ft_face, creates a cairo.FontFace object that may be used to render text with that font.

pychess.System.command module

class pychess.System.command.Command(command, inputstr)

Bases: object

run(timeout=None)

Run a command then return: (status, output, error).

pychess.System.conf module

The task of this module is to provide easy saving/loading of configurations It also supports gconf like connection, so you get notices when a property has changed.

pychess.System.conf.get(key, section='General')
pychess.System.conf.hasKey(key, section='General')
pychess.System.conf.notify_add(key, func, *args, section='General')

The signature for func must be self, client, *args, **kwargs

pychess.System.conf.notify_remove(conid)
pychess.System.conf.save_config(path='/home/docs/.config/pychess/config', encoding='UTF-8')
pychess.System.conf.set(key, value, section='General')

pychess.System.debug module

pychess.System.gst_player module

pychess.System.gst_player.on_message(bus, message)
pychess.System.gst_player.play(loop)

pychess.System.gstreamer module

class pychess.System.gstreamer.GstPlayer

Bases: pychess.System.gstreamer.Player

play(uri)
class pychess.System.gstreamer.Player

Bases: object

play(uri)

pychess.System.ping module

pychess.System.prefix module

This module provides some basic functions for accessing pychess datefiles in system or user space

pychess.System.prefix.addDataPrefix(subpath)
pychess.System.prefix.addEngineDataPrefix(subpath)
pychess.System.prefix.addUserCachePrefix(subpath)
pychess.System.prefix.addUserConfigPrefix(subpath)
pychess.System.prefix.addUserDataPrefix(subpath)
pychess.System.prefix.getDataPrefix()
pychess.System.prefix.getEngineDataPrefix()
pychess.System.prefix.getUserCachePrefix()
pychess.System.prefix.getUserConfigPrefix()
pychess.System.prefix.getUserDataPrefix()
pychess.System.prefix.get_user_cache_dir()
pychess.System.prefix.get_user_config_dir()
pychess.System.prefix.get_user_data_dir()
pychess.System.prefix.isInstalled()

pychess.System.protoopen module

pychess.System.protoopen.isWriteable(uri)

Returns true if protoopen can open a write pipe to the uri

pychess.System.protoopen.protoopen(uri, encoding='latin_1')

Function for opening many things

pychess.System.protoopen.protosave(uri, append=False)

Function for saving many things

pychess.System.protoopen.splitUri(uri)

pychess.System.readuntil module

Monkey patching asyncio.StreamReader to add readuntil() from Python 3.5.2

exception pychess.System.readuntil.IncompleteReadError(partial, expected)

Bases: EOFError

Incomplete read error. Attributes:

  • partial: read bytes string before the end of stream was reached
  • expected: total number of expected bytes (or None if unknown)
exception pychess.System.readuntil.LimitOverrunError(message, consumed)

Bases: Exception

Reached the buffer limit while looking for a separator.

Attributes: - consumed: total number of to be consumed bytes.

pychess.System.readuntil.readuntil(self, separator=b'\n')

Read data from the stream until separator is found.

On success, the data and separator will be removed from the internal buffer (consumed). Returned data will include the separator at the end.

Configured stream limit is used to check result. Limit sets the maximal length of data that can be returned, not counting the separator.

If an EOF occurs and the complete separator is still not found, an IncompleteReadError exception will be raised, and the internal buffer will be reset. The IncompleteReadError.partial attribute may contain the separator partially.

If the data cannot be read because of over limit, a LimitOverrunError exception will be raised, and the data will be left in the internal buffer, so it can be read again.

pychess.System.repeat module

pychess.System.repeat.repeat(func, *args, **kwargs)

Repeats a function in a new thread until it returns False

pychess.System.repeat.repeat_sleep(func, sleeptime, recur=False)

Runs func in a thread and repeats it approximately each sleeptime [s] until func returns False. Notice that we sleep first, then run. Not the other way around. If repeat_sleep is called with recur=True, each call will be called with the return value of last call as argument. The argument has to be optional, as it wont be used first time, and it has to be non-None.

pychess.System.uistuff module

class pychess.System.uistuff.GladeWidgets(filename)

Bases: object

A simple class that wraps a the glade get_widget function into the python __getitem__ version

getGlade()
pychess.System.uistuff.appendAutowrapColumn(treeview, name, **kvargs)
pychess.System.uistuff.createCombo(combo, data=[], name=None, ellipsize_mode=None)
pychess.System.uistuff.genColor(n, startpoint=0)
pychess.System.uistuff.getMonitorBounds()
pychess.System.uistuff.keep(widget, key, get_value_=None, set_value_=None)
pychess.System.uistuff.keepDown(scrolledWindow)
pychess.System.uistuff.keepWindowSize(key, window, defaultSize=None, defaultPosition=0)

You should call keepWindowSize before show on your windows

pychess.System.uistuff.loadDialogWidget(widget, widget_name, config_number, get_value_=None, set_value_=None, first_value=None)
pychess.System.uistuff.makeYellow(box)
pychess.System.uistuff.onceWhenReady(window, func, *args, **kwargs)
pychess.System.uistuff.saveDialogWidget(widget, widget_name, config_number, get_value_=None)
pychess.System.uistuff.updateCombo(combo, data)

Module contents

class pychess.System.Timer(text)

Bases: object

pychess.System.caller_name(skip=2)

Get a name of a caller in the format module.class.method

skip specifies how many levels of stack to skip while getting caller name. skip=1 means “who calls me”, skip=2 “who calls my caller” etc.

An empty string is returned if skipped levels exceed stack height

pychess.System.download_file(url, progressbar=None)
pychess.System.download_file_async(url, progressbar=None)
pychess.System.fident(f)

Get an identifier for a function or method

pychess.System.get_threadname(thread_namer)
pychess.System.profile_me(fn)