Table Of Contents

Previous topic

sardanadefs

Next topic

sardanacontainer

This Page

sardanabase

This module is part of the Python Sardana library. It defines the base classes for Sardana object

Classes

SardanaBaseObject

Inheritance diagram of SardanaBaseObject

class SardanaBaseObject(**kwargs)[source]

The Sardana most abstract object. It contains only two members:

  • _manager : a weak reference to the manager (pool or ms) where it belongs
  • _name : the name
  • _full_name : the name (usually a tango device name, but can be anything else.)
get_manager()[source]

Return the sardana.Manager which owns this sardana object.

Returns:the manager which owns this pool object.
Return type:sardana.Manager
get_name()[source]

Returns this sardana object name

Returns:this sardana object name
Return type:str
get_full_name()[source]

Returns this sardana object full name

Returns:this sardana object full name
Return type:str
get_type()[source]

Returns this sardana object type.

Returns:this sardana object type
Return type:ElementType
get_parent()[source]

Returns this pool object parent.

Returns:this objects parent
Return type:SardanaBaseObject
get_parent_name()[source]

Returns this sardana object parent’s name.

Returns:this objects parent
Return type:str
get_frontend()[source]

Returns this sardana frontend object or None if no frontend is registered

Returns:this objects frontend
Return type:object
fire_event(event_type, event_value, listeners=None, protected=True)[source]
get_interfaces()[source]

Returns the set of interfaces this object implements.

Returns:The set of interfaces this object implements.
Return type:class:set <sardana.sardanadefs.Interface>
get_interface()[source]

Returns the interface this object implements.

Returns:The interface this object implements.
Return type:sardana.sardanadefs.Interface
get_interface_names()[source]

Returns a sequence of interface names this object implements.

Returns:The sequence of interfaces this object implements.
Return type:sequence<str>
serialize(*args, **kwargs)[source]
serialized(*args, **kwargs)[source]
str(*args, **kwargs)[source]
manager

reference to the sardana.Manager

name

object name

full_name

object full name

frontend

the object frontend

Critical = 50
Debug = 10
DftLogFormat = <logging.Formatter object at 0xb47678cc>
DftLogLevel = 20
DftLogMessageFormat = '%(threadName)-14s %(levelname)-8s %(asctime)s %(name)s: %(message)s'
Error = 40
Fatal = 50
Info = 20
Trace = 5
Warning = 30
addChild(child)

Adds a new logging child

Parameters:child – (logging.Logger) the new child
classmethod addLevelName(level_no, level_name)

Registers a new log level

Parameters:
  • level_no – (int) the level number
  • level_name – (str) the corresponding name
addLogHandler(handler)

Registers a new handler in this object’s logger

Parameters:handler – (logging.Handler) the new handler to be added
classmethod addRootLogHandler(h)

Adds a new handler to the root logger

Parameters:h – (logging.Handler) the new log handler
add_listener(listener)

Adds a new listener for this object.

Parameters:listener – a listener
are_events_blocked()
block_events()
call__init__(klass, *args, **kw)

Method to be called from subclasses to call superclass corresponding __init__ method. This method ensures that classes from diamond like class hierarquies don’t call their super classes __init__ more than once.

call__init__wo_kw(klass, *args)

Same as call__init__ but without keyword arguments because PyQT does not support them.

changeLogName(name)

Change the log name for this object.

Parameters:name – (str) the new log name
cleanUp()

The cleanUp. Default implementation does nothing Overwrite when necessary

copyLogHandlers(other)

Copies the log handlers of other object to this object

Parameters:other – (object) object which contains ‘log_handlers’
critical(msg, *args, **kw)

Record a critical message in this object’s logger. Accepted args and kwargs are the same as logging.Logger.critical().

Parameters:
  • msg – (str) the message to be recorded
  • args – list of arguments
  • kw – list of keyword arguments
debug(msg, *args, **kw)

Record a debug message in this object’s logger. Accepted args and kwargs are the same as logging.Logger.debug().

Parameters:
  • msg – (str) the message to be recorded
  • args – list of arguments
  • kw – list of keyword arguments
deprecated(msg, *args, **kw)

Record a deprecated warning message in this object’s logger. Accepted args and kwargs are the same as logging.Logger.warning().

Parameters:
  • msg – (str) the message to be recorded
  • args – list of arguments
  • kw – list of keyword arguments
classmethod disableLogOutput()

Disables the logging.StreamHandler which dumps log records, by default, to the stderr.

classmethod enableLogOutput()

Enables the logging.StreamHandler which dumps log records, by default, to the stderr.

error(msg, *args, **kw)

Record an error message in this object’s logger. Accepted args and kwargs are the same as logging.Logger.error().

Parameters:
  • msg – (str) the message to be recorded
  • args – list of arguments
  • kw – list of keyword arguments
exception(msg, *args)

Log a message with severity ‘ERROR’ on the root logger, with exception information.. Accepted args are the same as logging.Logger.exception().

Parameters:
  • msg – (str) the message to be recorded
  • args – list of arguments
fatal(msg, *args, **kw)

Record a fatal message in this object’s logger. Accepted args and kwargs are the same as logging.Logger.fatal().

Parameters:
  • msg – (str) the message to be recorded
  • args – list of arguments
  • kw – list of keyword arguments
flushOutput()

Flushes the log output

flush_queue()
getAttrDict()
getChildren()

Returns the log children for this object

Returns:(sequence<logging.Logger) the list of log children
classmethod getLogFormat()

Retuns the current log message format (the root log format)

Returns:(str) the log message format
getLogFullName()

Gets the full log name for this object

Returns:(str) the full log name
classmethod getLogLevel()

Retuns the current log level (the root log level)

Returns:(int) a number representing the log level
getLogName()

Gets the log name for this object

Returns:(str) the log name
getLogObj()

Returns the log object for this object

Returns:(logging.Logger) the log object
classmethod getLogger(name=None)
getParent()

Returns the log parent for this object or None if no parent exists

Returns:(logging.Logger or None) the log parent for this object
classmethod getRootLog()

Retuns the root logger

Returns:(logging.Logger) the root logger
has_listeners()

Returns True if anybody is listening to events from this object

Returns:True is at least one listener is listening or False otherwise
info(msg, *args, **kw)

Record an info message in this object’s logger. Accepted args and kwargs are the same as logging.Logger.info().

Parameters:
  • msg – (str) the message to be recorded
  • args – list of arguments
  • kw – list of keyword arguments
classmethod initRoot()

Class method to initialize the root logger. Do NOT call this method directly in your code

log(level, msg, *args, **kw)

Record a log message in this object’s logger. Accepted args and kwargs are the same as logging.Logger.log().

Parameters:
  • level – (int) the record level
  • msg – (str) the message to be recorded
  • args – list of arguments
  • kw – list of keyword arguments
log_format = <logging.Formatter object at 0xb47678cc>
log_level = 20
queue_event(event_type, event_value, listeners=None)
classmethod removeRootLogHandler(h)

Removes the given handler from the root logger

Parameters:h – (logging.Handler) the handler to be removed
remove_listener(listener)

Removes an existing listener for this object.

Parameters:listener – the listener to be removed
Returns:True is succeeded or False otherwise
classmethod resetLogFormat()

Resets the log message format (the root log format)

classmethod resetLogLevel()

Resets the log level (the root log level)

root_init_lock = <thread.lock object at 0xb752f980>
root_inited = False
classmethod setLogFormat(format)

sets the new log message format

Parameters:level – (str) the new log message format
classmethod setLogLevel(level)

sets the new log level (the root log level)

Parameters:level – (int) the new log level
stack(target=5)

Log the usual stack information, followed by a listing of all the local variables in each frame.

Parameters:target – (int) the log level assigned to the record
Returns:(str) The stack string representation
stream_handler = None
syncLog()

Synchronises the log output

trace(msg, *args, **kw)

Record a trace message in this object’s logger. Accepted args and kwargs are the same as logging.Logger.log().

Parameters:
  • msg – (str) the message to be recorded
  • args – list of arguments
  • kw – list of keyword arguments
traceback(level=5, extended=True)

Log the usual traceback information, followed by a listing of all the local variables in each frame.

Parameters:
  • level – (int) the log level assigned to the traceback record
  • extended – (bool) if True, the log record message will have multiple lines
Returns:

(str) The traceback string representation

unblock_events()
updateAttrDict(other)
warning(msg, *args, **kw)

Record a warning message in this object’s logger. Accepted args and kwargs are the same as logging.Logger.warning().

Parameters:
  • msg – (str) the message to be recorded
  • args – list of arguments
  • kw – list of keyword arguments

SardanaObjectID

Inheritance diagram of SardanaObjectID

class SardanaObjectID(id=0)[source]

To be used by sardana objects which have an ID associated to them.

get_id()[source]

Returns this sardana object ID

Returns:this sardana object ID
Return type:int
serialize(*args, **kwargs)[source]
id

object ID