本文整理汇总了Python中HardwareRepository.HardwareRepository类的典型用法代码示例。如果您正苦于以下问题:Python HardwareRepository类的具体用法?Python HardwareRepository怎么用?Python HardwareRepository使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HardwareRepository类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: init
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: _connect_hwserver
def _connect_hwserver(self):
print self.hwr_directory
self.hwr_server = HardwareRepository.HardwareRepository(self.hwr_directory)
self.hwr_server.connect()
hwo_path = os.path.join(self.mxcube_dir, "HardwareObjects")
sc_hwo_path = os.path.join(hwo_path, "sample_changer")
if self.institute:
inst_hwo_path = os.path.join(hwo_path, self.institute)
HardwareRepository.addHardwareObjectsDirs([hwo_path, inst_hwo_path, sc_hwo_path])
示例3: test
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
示例4: get_hardware_object
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__
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
def test():
hwr = HardwareRepository.getHardwareRepository()
hwr.connect()
shut = hwr.getHardwareObject("/fastshutter")
print("Shutter State is: ", shut.readShutterState())
示例7: test
def test():
hwr = HardwareRepository.getHardwareRepository()
hwr.connect()
flux = hwr.getHardwareObject("/flux")
print "PX1 Flux is ", flux.getCurrentFlux()
示例8: __init__
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
示例9: hardwareObjectClicked
def hardwareObjectClicked(self, item):
_instance = HardwareRepository()
try:
#item could be None
name = str(item.text(2))
except:
return
else:
if len(name) == 0:
return
if item.isOn() and not self.itemStates[name]:
_instance.loadHardwareObject(name)
elif not item.isOn() and self.itemStates[name]:
_instance.discardHardwareObject(name)
self.itemStates[name] = item.isOn()
示例10: test
def test():
import sys
hwr = HardwareRepository.getHardwareRepository()
hwr.connect()
ruche = hwr.getHardwareObject("/ruche")
filename = sys.argv[1]
ruche.trigger_sync(filename)
示例11: setProcedure
def setProcedure(self, proc):
if proc is None:
self.procedure = None
else:
import weakref
self.procedure = weakref.ref(proc)()
QtCore.QObject.connect(HardwareRepository.emitter(self.procedure), SIGNAL('replyArrived'), self.replyArrived)
示例12: test
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()
示例13: addPage
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]
示例14: setProcedure
def setProcedure(self, proc):
if proc is None:
self.procedure = None
else:
import weakref
self.procedure = weakref.ref(proc)()
self.connect( HardwareRepository.emitter(self.procedure), 'replyArrived', self.replyArrived)
示例15: init
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)