def addDevice(Sardana=None, Pool=None): app = QtGui.QApplication([]) QtCore.QResource.registerResource(get_resources()) Pages = Enumeration('Pages', ('SelectSardanaPool', 'NewDevice', 'CommitPage', 'OutroPage')) w = wiz.SardanaBaseWizard() w.setWindowTitle("Add New Hardware Wizard") selectPool = SelectSardanaPoolBasePage(Sardana, Pool) w.setPage(Pages.SelectSardanaPool, selectPool) selectPool.setNextPageId(Pages.NewDevice) newDevice = NewDeviceBasePage() w.setPage(Pages.NewDevice, newDevice) newDevice.setNextPageId(Pages.CommitPage) commit_page = NewDeviceCommitBasePage() w.setPage(Pages.CommitPage, commit_page) commit_page.setNextPageId(Pages.OutroPage) w.show() sys.exit(app.exec_())
"TYPE_TIMERABLE_ELEMENTS", "TYPE_PSEUDO_ELEMENTS", "INTERFACES", "INTERFACES_EXPANDED", "ScalarNumberFilter" ] __docformat__ = 'restructuredtext' import math from taurus.core.util.enumeration import Enumeration #: maximum difference between two floats so that they are considered equal EpsilonError = 1E-16 #: sardana element state enumeration State = Enumeration( "State", ("On", "Off", "Close", "Open", "Insert", "Extract", "Moving", "Standby", "Fault", "Init", "Running", "Alarm", "Disable", "Unknown", "Invalid")) class _SardanaServer(object): """Class representing the current sardana server state""" def __init__(self): self.server_state = State.Invalid def __repr__(self): return "SardanaServer()" #: the global object containing the SardanaServer information SardanaServer = _SardanaServer()
############################################################################# """This package contains a collection of taurus console widgets""" __docformat__ = 'restructuredtext' import weakref from taurus import Device from taurus.core.util.enumeration import Enumeration from taurus.external.qt import Qt from IPython.config.loader import Config EnvironmentMode = Enumeration("EnvironmentMode", ("Overwrite", "Merge")) class BaseConsoleExtension(object): Name = 'ipython' Label = 'IPython' def __init__(self, console_factory, profile='default', config=None, mode=EnvironmentMode.Merge): self.console_factory = console_factory self.profile = profile self.profile_arg = '--profile=' + profile self.config = config or Config() self.mode = mode
.. note:: The SynchParam class has been included in Sardana on a provisional basis. Backwards incompatible changes (up to and including removal of the class) may occur if deemed necessary by the core developers. """ Delay = 0 Total = 1 Active = 2 Repeats = 3 Initial = 4 AcqSynchType = Enumeration("AcqSynchType", ["Trigger", "Gate", "Start"]) AcqSynchType.__doc__ = \ """Enumeration of synchronization types. Options: - Trigger - Start each acquisition (experimental channel will decide on itself when to end, based on integration time / monitor count) - Gate - Start and end each acquisition - Start - Start only the first acquisition (experimental channel will drive the acquisition based on integration time / monitor count, latency time and number of repetitions) .. todo:: convert to python enums, but having in mind problems with JSON serialization: https://bugs.python.org/issue18264 """
__docformat__ = 'restructuredtext' import time from taurus.core.util.log import DebugIt from taurus.core.util.enumeration import Enumeration from sardana import State from sardana.pool.poolaction import ActionContext, PoolActionItem, PoolAction #: enumeration representing possible motion states MotionState = Enumeration( "MotionSate", ( "Stopped", # "StoppedOnError", # "StoppedOnAbort", "Moving", "MovingBacklash", "MovingInstability", "Invalid")) MS = MotionState MovingStates = MS.Moving, MS.MovingBacklash, MS.MovingInstability StoppedStates = MS.Stopped, # MS.StoppedOnError, MS.StoppedOnAbort # MotionAction = Enumeration("MotionAction", ( \ # "StartMotion", # "Finish", # "Abort", # "NoAction", # "Invalid") )
""" Delay = 0 Total = 1 Active = 2 Repeats = 3 Initial = 4 # TODO: convert to to python enums, but having in ming problems with # JSON serialization: https://bugs.python.org/issue18264 # class AcqSynchType(Enumeration): # # Trigger = 0 # Gate = 1 AcqSynchType = Enumeration("AcqSynchType", ["Trigger", "Gate"]) # TODO: convert to to python enums, but having in ming problems with # JSON serialization: https://bugs.python.org/issue18264 class AcqSynch(Enumeration): SoftwareTrigger = 0 HardwareTrigger = 1 SoftwareGate = 2 HardwareGate = 3 @classmethod def from_synch_type(self, software, synch_type): """Helper obtain AcqSynch from information about software/hardware nature of synchronization element and AcqSynchType
__docformat__ = 'restructuredtext' from taurus.core.taurusdevice import TaurusDevice from taurus.core.util.enumeration import Enumeration from taurus.external.qt import Qt from taurus.qt.qtcore.mimetypes import TAURUS_MODEL_MIME_TYPE, \ TAURUS_MODEL_LIST_MIME_TYPE from taurus.qt.qtcore.model import TaurusBaseTreeItem, TaurusBaseModel, \ TaurusBaseProxyModel from taurus.qt.qtgui.tree import TaurusBaseTreeWidget from taurus.qt.qtgui.resource import getIcon from sardana.taurus.core.tango.sardana.macro import MacroInfo MacroView = Enumeration("MacroView", ("MacroModule", "Macro", "Unknown")) def getElementTypeIcon(t): if t == MacroView.MacroModule: return getIcon(":/python-file.png") elif t == MacroView.Macro: return getIcon(":/python.png") return getIcon(":/tango.png") def getElementTypeSize(t): return Qt.QSize(200, 24) def getElementTypeToolTip(t):
# along with Taurus. If not, see <http://www.gnu.org/licenses/>. ## ############################################################################# """This module contains all basic tango enumerations""" __all__ = ["TangoObjectType", "EVENT_TO_POLLING_EXCEPTIONS", "FROM_TANGO_TO_NUMPY_TYPE", "FROM_TANGO_TO_STR_TYPE", "DevState"] __docformat__ = "restructuredtext" from taurus.core.util.enumeration import Enumeration from taurus.external.enum import IntEnum TangoObjectType = Enumeration("TangoObjectType", ["Authority", "Server", "Class", "Device", "Attribute", "Property", "Configuration", "Object"]) TangoObjectType.Database = TangoObjectType.Authority # backwards compatibility import numpy import PyTango # The exception reasons that will force switching from events to polling # API_AttributePollingNotStarted - the attribute does not support events. # Don't try to resubscribe. # API_DSFailedRegisteringEvent - same exception then the one above but higher # in the stack # API_NotificationServiceFailed - Problems in notifd, it was not able to # register the event. # API_EventChannelNotExported - the notifd is not running # API_EventTimeout - after a successfull register the the device server
# # THIS IS USED FOR TEST PURPOSES ONLY. DO NOT USE IT OUTSIDE SARDANA TESTS #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~- __docformat__ = 'restructuredtext' import PyTango from taurus.core.util.enumeration import Enumeration from taurus.core.util.log import Logger from taurus.core.util.singleton import Singleton from taurus.core.util.containers import CaselessDict from taurus.core.util.codecs import CodecFactory PoolElementType = Enumeration("PoolElementType", ("0D", "1D", "2D", "Communication", "CounterTimer", "IORegister", "Motor", "PseudoCounter", "PseudoMotor", "TriggerGate")) ChannelView = Enumeration("ChannelView", ("Channel", "Enabled", "Output", "PlotType", "PlotAxes", "Timer", "Monitor", "Synchronization", "ValueRefPattern", "ValueRefEnabled", "Conditioning", "Normalization", "NXPath", "Shape", "DataType", "Unknown", "Synchronizer")) PlotType = Enumeration("PlotType", ("No", "Spectrum", "Image")) Normalization = Enumeration("Normalization", ("No", "Avg", "Integ")) #: an enumeration describing all possible acquisition trigger types AcqTriggerType = Enumeration("AcqTriggerType", (
## You should have received a copy of the GNU Lesser General Public License ## along with Sardana. If not, see <http://www.gnu.org/licenses/>. ## ############################################################################## """This is the macro server scan data recorder module""" __all__ = ["SaveModes", "RecorderStatus", "DataHandler", "DataRecorder"] __docformat__ = 'restructuredtext' import time from taurus.core.util.log import Logger from taurus.core.util.enumeration import Enumeration SaveModes = Enumeration('SaveModes', ('Record', 'Block')) RecorderStatus = Enumeration('RecorderStatus', ('Idle', 'Active', 'Disable')) class DataHandler: """ The data handler is the data recording center of a system. It contains one or several recorders. All data transit through the handler, then given to recorders for final saving """ def __init__(self): self.recorders = [] def addRecorder(self, recorder): if recorder is not None: self.recorders.append(recorder) def startRecordList(self, recordlist):
__all__ = ["ControllerClassTreeWidget", "ControllerClassSelectionDialog"] __docformat__ = 'restructuredtext' import sys import os import taurus.core from taurus.core.util.enumeration import Enumeration from taurus.external.qt import Qt from taurus.qt.qtcore.mimetypes import TAURUS_MODEL_MIME_TYPE, TAURUS_MODEL_LIST_MIME_TYPE from taurus.qt.qtcore.model import TaurusBaseTreeItem, TaurusBaseModel, TaurusBaseProxyModel from taurus.qt.qtgui.tree import TaurusBaseTreeWidget from taurus.qt.qtgui.resource import getThemeIcon, getIcon PoolControllerView = Enumeration( "PoolControllerView", ("ControllerModule", "ControllerClass", "Unknown")) def getElementTypeIcon(t): if t == PoolControllerView.ControllerModule: return getIcon(":/python-file.png") elif t == PoolControllerView.ControllerClass: return getIcon(":/python.png") return getIcon(":/tango.png") def getElementTypeSize(t): return Qt.QSize(200, 24) def getElementTypeToolTip(t):
############################################################################# """A pure Qt led widget""" __all__ = ["LedColor", "LedStatus", "LedSize", "QLed", "QLedOld"] __docformat__ = 'restructuredtext' import sys from taurus.external.qt import Qt from taurus.core.util.enumeration import Enumeration from taurus.qt.qtgui.icon import getCachedPixmap from taurus.qt.qtgui.display.qpixmapwidget import QPixmapWidget LedColor = Enumeration("LedColor", [ "BLUE", "GREEN", "RED", "YELLOW", "ORANGE", "MAGENTA", "GRENOBLE", "BLACK", "WHITE" ]) LedStatus = Enumeration("LedStatus", ["ON", "OFF"]) LedSize = Enumeration("LedSize", [("SMALL", 24), ("LARGE", 48)]) class QLed(QPixmapWidget): """A Led""" DefaultLedPattern = "leds_images256:led_{color}_{status}.png" DefaultLedColor = "green" DefaultLedStatus = True DefaultLedInverted = False DefaultBlinkingInterval = 0 def __init__(self, parent=None, designMode=False): self._ledStatus = self.DefaultLedStatus
__docformat__ = 'restructuredtext' import time from taurus.core.util.log import DebugIt from taurus.core.util.enumeration import Enumeration from sardana import State, ElementType, TYPE_TIMERABLE_ELEMENTS from sardana.sardanathreadpool import get_thread_pool from sardana.pool.poolaction import ActionContext, PoolActionItem, PoolAction #: enumeration representing possible motion states AcquisitionState = Enumeration("AcquisitionState", (\ "Stopped", # "StoppedOnError", # "StoppedOnAbort", "Acquiring", "Invalid")) AS = AcquisitionState AcquiringStates = AS.Acquiring, StoppedStates = AS.Stopped, #MS.StoppedOnError, MS.StoppedOnAbort AcquisitionMap = { #AS.Stopped : State.On, AS.Acquiring : State.Moving, AS.Invalid : State.Invalid, } class PoolAcquisition(PoolAction):
""" __all__ = [ "QObjectRepresentation", "get_qobject_tree", "get_qobject_tree_str", "TreeQObjectModel", "TreeQObjectWidget" ] __docformat__ = 'restructuredtext' import weakref from taurus.external.qt import Qt from taurus.core.util.enumeration import Enumeration QObjectRepresentation = Enumeration('QObjectRepresentation', ('ClassName', 'ObjectName', 'FullName')) def _build_qobjects_as_dict(qobject, container): container[qobject] = childs = {} for child in qobject.children(): if isinstance(child, Qt.QWidget): _build_qobjects_as_dict(child, childs) def get_qobject_tree_as_dict(qobject=None): if qobject is None: app = Qt.QApplication.instance() qobjects = app.topLevelWidgets()
# Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain ## # Taurus is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. ## # Taurus is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. ## # You should have received a copy of the GNU Lesser General Public License # along with Taurus. If not, see <http://www.gnu.org/licenses/>. ## ############################################################################# """ """ __all__ = ["Alignment"] __docformat__ = "restructuredtext" from taurus.core.util.enumeration import Enumeration #: Flaggable alignment for both horizontal and vertical text #: Conflicting combinations of flags have undefined meanings. Alignment = Enumeration("Alignment", (("Left", 0x0001), ("Right", 0x0002), ("HCenter", 0x0004), ("Top", 0x0020), ("Bottom", 0x0040), ("VCenter", 0x0080), ("Center", 0x0004 | 0x0080)))