def __init__(self, console=False): from mxdc.conf import settings super().__init__() self.console = console self.config_files = settings.get_configs() self.registry = {} self.config = DotDict() self.lock = threading.RLock() self.logger = get_module_logger(self.__class__.__name__) self.load_config() Registry.add_utility(IBeamline, self)
from gi.repository import Gtk, Gdk from zope.interface import Interface, Attribute, implementer from mxdc import Registry, IBeamline, Object, Property from mxdc.conf import save_cache, load_cache from mxdc.devices.interfaces import ICenter from mxdc.engines import centering from mxdc.engines.scripting import get_scripts from mxdc.utils import imgproc, colors, misc from mxdc.utils.decorators import async_call from mxdc.utils.log import get_module_logger from mxdc.widgets import dialogs from mxdc.widgets.video import VideoWidget from . import common logger = get_module_logger(__name__) def orientation(p): verts = p.vertices orient = ((verts[1:, 0] - verts[:-1, 0]) * (verts[1:, 1] + verts[:-1, 1])).sum() return -numpy.sign(orient) or 1 class IMicroscope(Interface): """Sample information database.""" grid = Attribute( "A list of x, y points for the grid in screen coordinates") grid_xyz = Attribute( "A list of x, y, z points for the grid in local coordinates")
import subprocess import sys import time from twisted.internet import gireactor gireactor.install() from twisted.application import internet, service from twisted.internet import defer, threads, reactor from twisted.python import components, log as twistedlog from twisted.spread import pb from zope.interface import implementer, Interface from mxdc.conf import SHARE_DIR from mxdc.utils import log, mdns logger = log.get_module_logger(__name__) DSS_PORT = 8882 DSS_CODE = '_imgsync._tcp.local.' class TwistedLogger(logging.StreamHandler): def emit(self, record): msg = self.format(record) if record.levelno == logging.WARNING: twistedlog.msg(msg) elif record.levelno > logging.WARNING: twistedlog.err(msg) else: twistedlog.msg(msg) self.flush()