本文整理汇总了Python中HardwareRepository.HardwareRepository.getHardwareRepository方法的典型用法代码示例。如果您正苦于以下问题:Python HardwareRepository.getHardwareRepository方法的具体用法?Python HardwareRepository.getHardwareRepository怎么用?Python HardwareRepository.getHardwareRepository使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HardwareRepository.HardwareRepository
的用法示例。
在下文中一共展示了HardwareRepository.getHardwareRepository方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: init
# 需要导入模块: from HardwareRepository import HardwareRepository [as 别名]
# 或者: from HardwareRepository.HardwareRepository import getHardwareRepository [as 别名]
def init(self):
try:
self.aperture_HO = HardwareRepository.getHardwareRepository().getHardwareObject(
self.getProperty("aperture")
)
self.connect(self.aperture_HO, "apertureChanged", self.aperture_pos_changed)
except BaseException:
logging.getLogger("HWR").debug("BeamInfo: aperture not defined correctly")
try:
self.slits_HO = HardwareRepository.getHardwareRepository().getHardwareObject(
self.getProperty("slits")
)
self.connect(self.slits_HO, "gapSizeChanged", self.slits_gap_changed)
except BaseException:
logging.getLogger("HWR").debug("BeamInfo: slits not defined correctly")
try:
self.beam_definer_HO = HardwareRepository.getHardwareRepository().getHardwareObject(
self.getProperty("definer")
)
self.connect(
self.beam_definer_HO, "definerPosChanged", self.definer_pos_changed
)
except BaseException:
logging.getLogger("HWR").debug(
"BeamInfo: beam definer not defined correctly"
)
self.beam_position_hor = self.getChannelObject("beam_position_hor")
self.beam_position_hor.connectSignal("update", self.beam_pos_hor_changed)
self.beam_position_ver = self.getChannelObject("beam_position_ver")
self.beam_position_ver.connectSignal("update", self.beam_pos_ver_changed)
self.chan_beam_size_microns = self.getChannelObject("beam_size_microns")
self.chan_beam_shape_ellipse = self.getChannelObject("beam_shape_ellipse")
示例2: test
# 需要导入模块: from HardwareRepository import HardwareRepository [as 别名]
# 或者: from HardwareRepository.HardwareRepository import getHardwareRepository [as 别名]
def test():
hwr = HardwareRepository.getHardwareRepository()
hwr.connect()
flux = hwr.getHardwareObject("/flux")
print "PX1 Flux is ", flux.getCurrentFlux()
示例3: test
# 需要导入模块: from HardwareRepository import HardwareRepository [as 别名]
# 或者: from HardwareRepository.HardwareRepository import getHardwareRepository [as 别名]
def test():
hwr = HardwareRepository.getHardwareRepository()
hwr.connect()
shut = hwr.getHardwareObject("/fastshutter")
print("Shutter State is: ", shut.readShutterState())
示例4: get_hardware_object
# 需要导入模块: from HardwareRepository import HardwareRepository [as 别名]
# 或者: from HardwareRepository.HardwareRepository import getHardwareRepository [as 别名]
def get_hardware_object(self, hardware_object_name, optional=False):
splash_screen = gui.get_splash_screen()
if splash_screen:
splash_screen.set_message(
"Loading hardware object defined in %s.xml" % hardware_object_name
)
if not hardware_object_name in self.__loaded_hardware_objects:
if splash_screen:
splash_screen.inc_progress_value()
self.__loaded_hardware_objects.append(hardware_object_name)
hwobj = HardwareRepository.getHardwareRepository().getHardwareObject(
hardware_object_name
)
if hwobj is not None:
self.connect(hwobj, "progressInit", self.progress_init)
self.connect(hwobj, "progressStep", self.progress_step)
self.connect(hwobj, "progressStop", self.progress_stop)
self.connect(hwobj, "statusMessage", self.status_message_changed)
if hwobj is None and not optional:
logging.getLogger("GUI").error(
"%s: Unable to initialize hardware object defined in %s.xml"
% (self.objectName(), hardware_object_name[1:])
)
self.set_background_color(Colors.LIGHT_RED)
self.__failed_to_load_hwobj = True
self.setDisabled(True)
return hwobj
示例5: __init__
# 需要导入模块: from HardwareRepository import HardwareRepository [as 别名]
# 或者: from HardwareRepository.HardwareRepository import getHardwareRepository [as 别名]
def __init__(self, parent=None, widgetName=""):
Connectable.Connectable.__init__(self)
QWidget.__init__(self, parent, widgetName)
self.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)
self.propertyBag = PropertyBag.PropertyBag()
self.__enabledState = True # saved enabled state
self.__loadedHardwareObjects = []
self._signalSlotFilters = {}
self._widgetEvents = []
#
# add what's this help
#
QWhatsThis.add(self, "%s (%s)\n" % (widgetName, self.__class__.__name__))
#
# add properties shared by all BlissWidgets
#
self.addProperty("fontSize", "string", str(self.font().pointSize()))
# self.addProperty("alignment", "combo", ("none", "top center", "top left", "top right", "bottom center", "bottom left", "bottom right", "center", "left", "right"), "none")
self.addProperty("instanceAllowAlways", "boolean", False) # , hidden=True)
self.addProperty("instanceAllowConnected", "boolean", False) # , hidden=True)
#
# connect signals / slots
#
dispatcher.connect(
self.__hardwareObjectDiscarded,
"hardwareObjectDiscarded",
HardwareRepository.getHardwareRepository(),
)
self.defineSlot("enable_widget", ())
示例6: test
# 需要导入模块: from HardwareRepository import HardwareRepository [as 别名]
# 或者: from HardwareRepository.HardwareRepository import getHardwareRepository [as 别名]
def test():
hwr = HardwareRepository.getHardwareRepository()
hwr.connect()
conn = hwr.getHardwareObject("/ldapconnection")
# conn.login("20141015", "4dBM0lx3pw")
# ok,name = conn.login("99140198", "5u4Twf70K5")
# ok,name = conn.login("mx20100023", "tisabet")
# ok,name = conn.login("anything", "tisabet")
# info = conn.getinfo("legrand")
# info = conn.getinfo("20100023")
# conn.find_groups_for_username('houdusse')
# grps = conn.find_groups_for_username('houdusse')
# for grp,users in grps.iteritems():
# print grp, " : " , users
user = "20140088" # '20100023'
sess = conn.find_sessions_for_user("%s" % user)
for onesess in sess:
print "Session for %s" % user, onesess
validsess = conn.find_valid_sessions_for_user(user)
for valid in validsess:
print "Valid session for today", valid
示例7: test
# 需要导入模块: from HardwareRepository import HardwareRepository [as 别名]
# 或者: from HardwareRepository.HardwareRepository import getHardwareRepository [as 别名]
def test():
import sys
hwr = HardwareRepository.getHardwareRepository()
hwr.connect()
ruche = hwr.getHardwareObject("/ruche")
filename = sys.argv[1]
ruche.trigger_sync(filename)
示例8: test
# 需要导入模块: from HardwareRepository import HardwareRepository [as 别名]
# 或者: from HardwareRepository.HardwareRepository import getHardwareRepository [as 别名]
def test():
hwr = HardwareRepository.getHardwareRepository()
hwr.connect()
light = hwr.getHardwareObject("/frontlight")
print '\nLight control for "%s"\n' % light.getUserName()
print " Level limits are:", light.getLimits()
print " Current level is:", light.getLevel()
print " Current state is:", light.getState()
示例9: addPage
# 需要导入模块: from HardwareRepository import HardwareRepository [as 别名]
# 或者: from HardwareRepository.HardwareRepository import getHardwareRepository [as 别名]
def addPage(self, pageName):
self.__pages.append(ProcedureWidgets.ProcedurePanel(self))
self.__pages[-1].setProcedure(
HardwareRepository.getHardwareRepository().getProcedure(self["mnemonic"])
)
self.procedureTab.addTab(self.__pages[-1], pageName)
return self.__pages[-1]
示例10: __init__
# 需要导入模块: from HardwareRepository import HardwareRepository [as 别名]
# 或者: from HardwareRepository.HardwareRepository import getHardwareRepository [as 别名]
def __init__(self, parent=None, widget_name=''):
"""
Descript. :
"""
Connectable.Connectable.__init__(self)
QFrame.__init__(self, parent)
self.setObjectName(widget_name)
self.property_bag = PropertyBag.PropertyBag()
self.__enabledState = True
self.__loaded_hardware_objects = []
self.__failed_to_load_hwobj = False
self.__use_progress_dialog = False
self._signal_slot_filters = {}
self._widget_events = []
self.setWhatsThis("%s (%s)\n" % (widget_name, self.__class__.__name__))
self.addProperty('fontSize',
'string',
str(self.font().pointSize()))
self.addProperty('frame',
'boolean',
False,
comment="Draw a frame around the widget")
self.addProperty('instanceAllowAlways',
'boolean',
False,
comment="Allow to control brick in all modes")
self.addProperty('instanceAllowConnected',
'boolean',
False,
comment="Allow to control brick in slave mode")
self.addProperty('fixedWidth',
'integer',
'-1',
comment="Set fixed width in pixels")
self.addProperty('fixedHeight',
'integer',
'-1',
comment="Set fixed height in pixels")
self.addProperty('hide',
'boolean',
False,
comment="Hide widget")
dispatcher.connect(self.__hardwareObjectDiscarded,
'hardwareObjectDiscarded',
HardwareRepository.getHardwareRepository())
self.defineSlot('enable_widget', ())
self.defineSlot('disable_widget', ())
#If PySide used then connect method was not overriden
#This solution of redirecting methods works...
self.connect = self.connect_hwobj
self.diconnect = self.disconnect_hwobj
示例11: getAxisMotor
# 需要导入模块: from HardwareRepository import HardwareRepository [as 别名]
# 或者: from HardwareRepository.HardwareRepository import getHardwareRepository [as 别名]
def getAxisMotor(self):
hwmot = None
motorname = self.getProperty("motor")
if motorname:
hwmot = HardwareRepository.getHardwareRepository().getHardwareObject(
motorname
)
return hwmot
示例12: init
# 需要导入模块: from HardwareRepository import HardwareRepository [as 别名]
# 或者: from HardwareRepository.HardwareRepository import getHardwareRepository [as 别名]
def init(self):
controller = HardwareRepository.getHardwareRepository().getHardwareObject(
self.getProperty("controller")
)
cryostat = self.getProperty("cryostat")
self.interval = self.getProperty("interval") or 10
self.ctrl = getattr(controller, cryostat)
if self.ctrl is not None:
self.get_params()
gevent.spawn(self._do_polling)
示例13: init
# 需要导入模块: from HardwareRepository import HardwareRepository [as 别名]
# 或者: from HardwareRepository.HardwareRepository import getHardwareRepository [as 别名]
def init(self):
self.__axis = []
for token in self:
if token.name() == "axis":
axis_name = token.getProperty("objectName")
if axis_name is not None:
axis = HardwareRepository.getHardwareRepository().getHardwareObject(
axis_name
)
if axis is not None:
self.__axis.append(axis)
示例14: __init__
# 需要导入模块: from HardwareRepository import HardwareRepository [as 别名]
# 或者: from HardwareRepository.HardwareRepository import getHardwareRepository [as 别名]
def __init__(self, parent=None, widget_name=""):
Connectable.Connectable.__init__(self)
QtImport.QFrame.__init__(self, parent)
self.setObjectName(widget_name)
self.property_bag = PropertyBag.PropertyBag()
self.__enabled_state = True
self.__loaded_hardware_objects = []
self.__failed_to_load_hwobj = False
self.__use_progress_dialog = False
self._signal_slot_filters = {}
self._widget_events = []
self.setWhatsThis("%s (%s)\n" % (widget_name, self.__class__.__name__))
self.add_property("fontSize", "string", str(self.font().pointSize()))
self.add_property(
"frame", "boolean", False, comment="Draw a frame around the widget"
)
self.add_property(
"instanceAllowAlways",
"boolean",
False,
comment="Allow to control brick in all modes",
)
self.add_property(
"instanceAllowConnected",
"boolean",
False,
comment="Allow to control brick in slave mode",
)
self.add_property(
"fixedWidth", "integer", "-1", comment="Set fixed width in pixels"
)
self.add_property(
"fixedHeight", "integer", "-1", comment="Set fixed height in pixels"
)
self.add_property("hide", "boolean", False, comment="Hide widget")
dispatcher.connect(
self.__hardware_object_discarded,
"hardwareObjectDiscarded",
HardwareRepository.getHardwareRepository(),
)
self.define_slot("enable_widget", ())
self.define_slot("disable_widget", ())
# If PySide used then connect method was not overriden
# This solution of redirecting methods works...
self.connect = self.connect_hwobj
self.diconnect = self.disconnect_hwobj
示例15: get_hardware_objects_info
# 需要导入模块: from HardwareRepository import HardwareRepository [as 别名]
# 或者: from HardwareRepository.HardwareRepository import getHardwareRepository [as 别名]
def get_hardware_objects_info(self):
info_dict = {}
for ho_name in self.__loaded_hardware_objects:
info = HardwareRepository.getHardwareRepository().getInfo(ho_name)
if len(info) > 0:
info_dict[ho_name] = info
if len(info_dict):
return "Hardware Objects:\n\n%s" % pprint.pformat(info_dict)
else:
return ""