def propertyChanged(self, propertyName, oldValue, newValue): if propertyName == "dataCollect": if self.collectObj is not None: self.disconnect( self.collectObj, PYSIGNAL("collectOscillationFinished"), self.updateOscillation, ) self.disconnect( self.collectObj, PYSIGNAL("collectImageTaken"), self.imageCollected ) self.collectObj = self.getHardwareObject(newValue) if self.collectObj is not None: self.connect( self.collectObj, PYSIGNAL("collectOscillationFinished"), self.updateOscillation, ) self.connect( self.collectObj, PYSIGNAL("collectImageTaken"), self.imageCollected ) self.dbServer = self.collectObj.dbServerHO() elif propertyName == "icons": icons_list = newValue.split() try: self.commentsButton.setPixmap(Icons.load(icons_list[0])) except IndexError: pass else: BlissWidget.propertyChanged(self, propertyName, oldValue, newValue)
def __init__(self, parent, name): BlissWidget.__init__(self, parent, name) """ variables """ self.drawingMgrRect = None self.infoDict = None """ property """ self.addProperty("bpm", "string", "") self.hwo = None """ Signal """ self.defineSignal('getView',()) self.defineSignal('beamPositionChanged',()) """ Slot """ """ widgets """ self.buildInterface()
def __init__(self, *args): BlissWidget.__init__(self, *args) self.current_element = None self.current_edge = None self.addProperty('mnemonic', 'string', '') self.addProperty('title', 'string', '') self.addProperty('kevFormatString','formatString','##.####') self.addProperty('maximumWidth', 'integer', 525) self.defineSignal('edgeSelected',()) self.defineSlot('setDisabled',()) self.defineSlot('setEnabled',()) self.defineSlot('setSession',()) self.topBox = QHBox(self) #self.topBox.setInsideMargin(4) #self.topBox.setInsideSpacing(2) self.periodicTable=myPeriodicTable(self.topBox) self.connect(self.periodicTable,PYSIGNAL('edgeSelected'),self.edgeSelected) self.instanceSynchronize("periodicTable") QHBoxLayout(self) self.layout().addWidget(self.topBox)
def __init__(self, parent, name, **keys): BlissWidget.__init__(self, parent, name) self.__hMotor = None self.__vMotor = None self.__motor_pos_save = [] self.__master_motor = None self.__masterPosition2Item = weakref.WeakValueDictionary() self.__currentCalib = None self.__currentBeamPos = None self.__camDecompNPlug = None self.mosaicView = None self.drawing = None self.__saveImageTreeDirName = '.' self.__imageMosaicPosition = None ####### Property ####### self.addProperty('horizontal', 'string', '') self.addProperty('vertical', 'string', '') self.addProperty('save_motors', 'string', '') self.addProperty('master_motor', 'string', '') self.addProperty('focus_motor', 'string', '') self.addProperty('live_camera', 'string', '') self.addProperty("formatString", "formatString", "###.##") ####### SIGNAL ####### self.defineSignal("getImage", ()) self.defineSignal('getView', ()) self.defineSignal('getMosaicView', ()) ####### SLOT ####### self.defineSlot("ChangePixelCalibration", ()) self.defineSlot("ChangeBeamPosition", ()) self.defineSlot('setMosaicImageSelected', ()) self.__widgetTree = self.loadUIFile('CameraOffLineImageManager.ui') self.__frame = self.__widgetTree.child('__frame') self.__frame.reparent(self, qt.QPoint(0, 0)) layout = qt.QHBoxLayout(self) layout.addWidget(self.__frame) snapButton = self.child('__snapShoot') iconSet = qt.QIconSet(loadIcon("snapshot.png")) snapButton.setIconSet(iconSet) qt.QObject.connect(snapButton, qt.SIGNAL('clicked()'), self.__snapCBK) liveCheckBox = self.child('__liveCheckBox') liveCheckBox.hide() qt.QObject.connect(liveCheckBox, qt.SIGNAL('toggled(bool)'), self.__liveOnOff) self.__imageList = self.child('__imageList') self.__imageList.setSelectionMode(qt.QListView.Extended) self.__imageList.setSortColumn(-1) self.__popUpMenu = qt.QPopupMenu(self) self.__popUpMenu.insertItem('layer up', self.__layerUp) self.__popUpMenu.insertItem('layer down', self.__layerDown) self.__popUpMenu.insertItem('remove', self.__removeImage) self.__popUpMenu.insertSeparator() self.__popUpMenu.insertItem('load', self.__loadImageTree) self.__popUpMenu.insertItem('save', self.__saveImageTree) qt.QObject.connect(self.__imageList, qt.SIGNAL('rightButtonPressed(QListViewItem*,const QPoint &,int)'), self.__popUpDisplay)
def __init__(self, *args): BlissWidget.__init__(self, *args) self.specStateHO = None self.statusBar = None self.specStateLabel = None self.addProperty("specstate", "string", "") self.addProperty("statusSearchDepth", "integer", 3) self.defineSlot("setMessage", ()) self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) # Information messages self.MAX_BUFFER_SIZE = 5 self.messages = [] self.read_idx = 0 self.insert_idx = 0 self.button = QPushButton("Add", self, "add_button") self.v_scroll = SpinBoxButtons(self, "v_scroll") QObject.connect(self.v_scroll, PYSIGNAL("scroll_up"), self.next_message) QObject.connect(self.v_scroll, PYSIGNAL("scroll_down"), self.prev_message)
def __init__(self, *args): BlissWidget.__init__(self, *args) self.firstTime = True self.addProperty('mnemonic', 'string', '') # Hadrware Object. self.hwo = None # electrometer self.elec = None self._name = None self._number = None # Electrometer Widget. self.elecWidget = None qt.QHBoxLayout(self, 0, 0) self.setSizePolicy(qt.QSizePolicy.Minimum, qt.QSizePolicy.Fixed) """ GRAPHICAL INTERFACE """ self.buildInterface() self.__idle = qt.QTimer() self.connect(self.__idle, qt.SIGNAL("timeout()"), self.__lastInit)
def propertyChanged(self, propertyName, oldValue, newValue): if propertyName == "ldapServer": self.ldapConnection = self.getHardwareObject(newValue) elif propertyName == "codes": self.setCodes(newValue) elif propertyName == "localLogin": self.localLogin = self.getHardwareObject(newValue) elif propertyName == "dbConnection": self.dbConnection = self.getHardwareObject(newValue) logging.getLogger().info("dbconnection is %s", str(newValue)) self.updateLoginID() elif propertyName == "instanceServer": if self.instanceServer is not None: self.disconnect(self.instanceServer, PYSIGNAL("passControl"), self.passControl) self.disconnect(self.instanceServer, PYSIGNAL("haveControl"), self.haveControl) self.instanceServer = self.getHardwareObject(newValue) if self.instanceServer is not None: self.connect(self.instanceServer, PYSIGNAL("passControl"), self.passControl) self.connect(self.instanceServer, PYSIGNAL("haveControl"), self.haveControl) elif propertyName == "icons": icons_list = newValue.split() try: self.loginButton.setPixmap(Icons.load(icons_list[0])) except IndexError: pass try: self.logoutButton.setPixmap(Icons.load(icons_list[1])) except IndexError: pass elif propertyName == "session": self.session_hwobj = self.getHardwareObject(newValue) else: BlissWidget.propertyChanged(self, propertyName, oldValue, newValue)
def close(self,aFlag) : if aFlag: for plug in self.__plugs : plug.close() self.__plugs = [] self.__pads = [] BlissWidget.close(self,aFlag)
def __init__(self, *args): BlissWidget.__init__(self, *args) self.inExpert=None self.addProperty('mnemonic', 'string', '') self.addProperty('safetyShutter', 'string', '') self.addProperty('icons', 'string', '') self.addProperty('iconsStopCancel', 'string', '') self.addProperty('label', 'string', '') self.addProperty('showBorder', 'boolean', True) self.addProperty('confirmationMessages', 'string', '') self.addProperty('toolTips', 'string', '') self.addProperty('userModeMask', 'string', '') self.addProperty('expertModeMask', 'string', '') self.defineSlot('setEnabled',()) self.defineSignal('commandStarted',()) self.defineSignal('commandDone',()) self.defineSignal('commandFailed',()) #self.defineSlot('enable_widget', ()) self.safetyShutter = None self.commandHO = None self.commandButtons = {} self.commands2Hide=[] self.containerBox = QVBox(self) #self.containerBox.setInsideMargin(4) #self.containerBox.setInsideSpacing(2) QVBoxLayout(self) self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.containerBox.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.layout().addWidget(self.containerBox)
def serverInitialized(self,started,server_id=None): if started: #BlissWidget.setInstanceUserId(BlissWidget.INSTANCE_USERID_UNKNOWN) BlissWidget.setInstanceRole(BlissWidget.INSTANCE_ROLE_SERVER) BlissWidget.setInstanceMode(BlissWidget.INSTANCE_MODE_MASTER) self.initName(server_id[0]) self.haveControl(True,gui_only=True) #self.giveControl.setChecked(False) #self.allowTimeoutControl.setChecked(False) else: #BlissWidget.setInstanceRole(BlissWidget.INSTANCE_ROLE_SERVERSTARTING) #BlissWidget.setInstanceMode(BlissWidget.INSTANCE_MODE_MASTER) msg_dialog=QMessageBox("mxCuBE",\ "Couldn't start the multiple instances server!",\ QMessageBox.Critical,QMessageBox.Ok,QMessageBox.NoButton,\ QMessageBox.NoButton,self) # Application name (mxCuBE) is hardwired!!! msg_dialog.setButtonText(QMessageBox.Ok,"Quit") s=self.font().pointSize() f=msg_dialog.font() f.setPointSize(s) msg_dialog.setFont(f) msg_dialog.updateGeometry() msg_dialog.exec_loop() os._exit(1)
def __init__(self, parent, name): BlissWidget.__init__(self, parent, name) """ variables """ self.__brickStarted = False self.__lastPosition = None """ properties """ self.addProperty('appearance', "combo", ("Display", "Move", "Configure", "Incremental"), "Move") self.appearance = None self.addProperty('mnemonic', 'string') self.hwro = None self.addProperty('check', 'boolean', False) self.checkMove = None """ signals """ self.defineSignal("clicked", ()) self.defineSlot("setEnabled", ()) """ interface """ self.buildInterface()
def __init__(self, *args): BlissWidget.__init__(self, *args) self.collect_hwobj = None self.addProperty("mnemonic", "string", "") self.addProperty("appearance", "combo", ("simple", "normal"), "normal") self.addProperty("title", "string", "") self.addProperty("timeFormat", "string", "%H:%M:%S") self.executing = None self.time_total_sec = 0 self.time_remaining_sec = 0 self.time_format = None self.progress_task = None self.container_hbox = qt.QHGroupBox(self) self.container_hbox.setInsideMargin(4) self.container_hbox.setInsideSpacing(2) self.time_total_label = qt.QLabel("Total:", self.container_hbox) self.time_total_value_label = qt.QLabel("??:??:??", self.container_hbox) self.progressBar = qt.QProgressBar(self.container_hbox) self.progressBar.setCenterIndicator(True) self.time_remaining_label = qt.QLabel("Remaining:", self.container_hbox) self.time_remaining_value_label = qt.QLabel("??:??:??", self.container_hbox) qt.QVBoxLayout(self) self.setSizePolicy(qt.QSizePolicy.MinimumExpanding, qt.QSizePolicy.Fixed) self.layout().addWidget(self.container_hbox) self.setEnabled(False) self.instanceSynchronize("")
def __init__(self, *args): BlissWidget.__init__(self, *args) self.mainMenu = None self.instrumentationMenu = None self.instrumentationMenuId = None self.defineSignal("enableAutoStartLoopCentring", ()) self.defineSignal("toggle_kappa", ()) # Initialize HO self.cryostreamHO = None self.fluodetectorHO = None self.hutchtriggerHO = None self.lightHO = None self.scintillatorHO = None self.apertureHO = None self.addProperty("cryostream", "string", "") self.addProperty("fluodetector", "string", "") self.addProperty("hutchtrigger", "string", "") self.addProperty("light", "string", "") self.addProperty("scintillator", "string", "") self.addProperty("Kappa on/off", "string", "") self.addProperty("aperture", "string", "") self.addProperty("menuTitle", "string", "Instrumentation") self.addProperty("menuPosition", "integer", 1) self.addProperty("hutchtriggerDefaultMode", "combo", ("automatic", "manual"), "automatic") self.addProperty("scintillatorWarning", "string", "") self.addProperty("apertureWarning", "string", "") self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
def __init__(self, parent, name): BlissWidget.__init__(self, parent, name) """ variables """ self.firstTime = True self.layout1 = None self.layout2 = None self.displayWidget = None self.valueSize = 0 self.titleSize = 0 """ properties """ self.addProperty('file', 'string') self.hwFile = None self.addProperty('title', 'string') self.title = None self.addProperty('type', 'combo', ("string", "integer", "float", "onoff", "offon", "motor"), "string") self.varType = None self.addProperty('id', 'string') self.hwId = None self.nameId = None self.addProperty('orientation', 'combo', ("horizontal", "vertical"), "horizontal") self.orientation = "horizontal" self.addProperty('title size', 'integer', 0) self.titleSize = 0 self.addProperty('value size', 'integer', 0) self.valueSize = 0
def propertyChanged(self, property, oldValue, newValue): if property == 'mnemonic': if self.cryodev is not None: self.disconnect(self.cryodev, PYSIGNAL("levelChanged"), self.setLevel) self.disconnect(self.cryodev, PYSIGNAL("temperatureChanged"), self.setTemperature) #self.disconnect(self.cryodev, PYSIGNAL("cryoStatusChanged"), self.setIcing) #self.disconnect(self.cryodev, PYSIGNAL("dryStatusChanged"), self.setDrier) #self.disconnect(self.cryodev, PYSIGNAL("sdryStatusChanged"), self.setSDrier) self.cryodev = self.getHardwareObject(newValue) if self.cryodev is not None: self.containerBox.setEnabled(True) self.connect(self.cryodev, PYSIGNAL("levelChanged"), self.setLevel) self.connect(self.cryodev, PYSIGNAL("temperatureChanged"), self.setTemperature) #self.connect(self.cryodev, PYSIGNAL("cryoStatusChanged"), self.setIcing) #self.connect(self.cryodev, PYSIGNAL("dryStatusChanged"), self.setDrier) #self.connect(self.cryodev, PYSIGNAL("sdryStatusChanged"), self.setSDrier) self.setLevel(self.cryodev.n2level) self.setTemperature(self.cryodev.temp) #self.setIcing(self.cryodev.cryo_status) #self.setDrier(self.cryodev.dry_status) #self.setSDrier(self.cryodev.sdry_status) else: self.containerBox.setEnabled(False) self.setTemperature(None) #self.setDrier("UNKNOWN") #self.setSDrier("UNKNOWN") #self.setIcing("UNKNOWN") self.setLevel(None) else: BlissWidget.propertyChanged(self,property,oldValue,newValue)
def propertyChanged(self, propertyName, oldValue, newValue): if propertyName == 'mnemonic': if self.energyScan is not None: self.disconnect(self.energyScan, 'energyScanStarted', self.scanStarted) self.disconnect(self.energyScan, 'energyScanFinished', self.scanFinished) self.disconnect(self.energyScan, 'energyScanFailed', self.scanFailed) self.disconnect(self.energyScan, 'scanStatusChanged', self.scanStatusChanged) self.disconnect(self.energyScan, 'energyScanReady', self.scanReady) self.disconnect(self.energyScan, 'connected', self.connected) self.disconnect(self.energyScan, 'disconnected', self.disconnected) self.clearEnergies() self.energyScan = self.getHardwareObject(newValue) if self.energyScan is not None: self.connect(self.energyScan, 'energyScanStarted', self.scanStarted) self.connect(self.energyScan, 'energyScanFinished', self.scanFinished) self.connect(self.energyScan, 'energyScanFailed', self.scanFailed) self.connect(self.energyScan, 'scanStatusChanged', self.scanStatusChanged) self.connect(self.energyScan, 'energyScanReady', self.scanReady) self.connect(self.energyScan, 'connected', self.connected) self.connect(self.energyScan, 'disconnected', self.disconnected) self.connect(self.energyScan, 'chooch_finished', self.chooch_finished) if self.energyScan.isConnected(): self.connected() else: self.disconnected() else: self.disconnected() elif propertyName == 'icons': self.setIcons(newValue) else: BlissWidget.propertyChanged(self,propertyName,oldValue,newValue)
def propertyChanged(self, property, oldValue, newValue): if property == "specVersion": if self.scanObject is not None: self.safeDisconnect() self.scanObject = None if self.scanObject is not None: self.safeConnect() elif property == "backgroundColor": if newValue == "white": self.setPaletteBackgroundColor(Qt.white) elif newValue == "default": self.setPaletteBackgroundColor(QWidget.paletteBackgroundColor(self)) elif property == "graphColor": if newValue == "white": self.graph.canvas().setPaletteBackgroundColor(Qt.white) elif newValue == "default": self.graph.canvas().setPaletteBackgroundColor( QWidget.paletteBackgroundColor(self) ) else: BlissWidget.propertyChanged(self, property, oldValue, newValue)
def propertyChanged(self, propertyName, oldValue, newValue): if propertyName == 'mnemonic': if self.energy is not None: self.disconnect(self.energy,PYSIGNAL('energyChanged'),self.energyChanged) self.disconnect(self.energy,PYSIGNAL('connected'),self.connected) self.disconnect(self.energy,PYSIGNAL('disconnected'),self.disconnected) self.disconnect(self.energy,PYSIGNAL('moveEnergyStarted'),self.changeEnergyStarted) self.disconnect(self.energy,PYSIGNAL('moveEnergyFailed'),self.changeEnergyFailed) self.disconnect(self.energy,PYSIGNAL('moveEnergyFinished'),self.changeEnergyOk) self.disconnect(self.energy,PYSIGNAL('moveEnergyReady'),self.changeEnergyReady) self.disconnect(self.energy,PYSIGNAL('energyLimitsChanged'),self.energyLimitsChanged) self.disconnect(self.energy,PYSIGNAL('wavelengthLimitsChanged'),self.wavelengthLimitsChanged) self.units.clear() self.kevHistory=[] self.angHistory=[] self.energy = self.getHardwareObject(newValue) if self.energy is not None: self.units.insertItem('keV') self.units.insertItem(chr(197)) def_mode=self['defaultMode'] if def_mode=='Ang': def_mode=chr(197) self.units.setCurrentText(def_mode) self.unitChanged(def_mode) self.connect(self.energy,PYSIGNAL('energyChanged'),self.energyChanged) self.connect(self.energy,PYSIGNAL('connected'),self.connected) self.connect(self.energy,PYSIGNAL('disconnected'),self.disconnected) self.connect(self.energy,PYSIGNAL('moveEnergyStarted'),self.changeEnergyStarted) self.connect(self.energy,PYSIGNAL('moveEnergyFailed'),self.changeEnergyFailed) self.connect(self.energy,PYSIGNAL('moveEnergyFinished'),self.changeEnergyOk) self.connect(self.energy,PYSIGNAL('moveEnergyReady'),self.changeEnergyReady) self.connect(self.energy,PYSIGNAL('energyLimitsChanged'),self.energyLimitsChanged) self.connect(self.energy,PYSIGNAL('wavelengthLimitsChanged'),self.wavelengthLimitsChanged) if self.energy.isConnected(): self.connected() else: self.disconnected() else: self.updateGUI() elif propertyName == 'icons': icons_list=newValue.split() #try: # self.applyButton.setPixmap(Icons.load(icons_list[0])) #except IndexError: # pass try: self.stopButton.setPixmap(Icons.load(icons_list[1])) except IndexError: pass elif propertyName == 'alwaysReadonly': pass else: BlissWidget.propertyChanged(self,propertyName,oldValue,newValue)
def __init__(self, *args): BlissWidget.__init__(self, *args) self.addProperty("microdiff", "boolean", False) self.addProperty("mnemonic", "string", "") self.addProperty("defaultHolderLength", "integer", 22) #self.defineSignal("sampleLoaded", ()) self.sampleChanger = None self.loading = False # GUI self.statusBox = QVGroupBox("Status", self) self.lblStatus = QLabel("", self.statusBox) abortResetBox = QHBox(self.statusBox) self.cmdReset = QToolButton(abortResetBox) sampleBox = QVBox(self) self.lblSampleLoadingState = QLabel(sampleBox) self.cmdBox = QGrid(3, sampleBox) self.basketSelectionWidget = BasketSelectionWidget(self.cmdBox) HorizontalSpacer(self.cmdBox) self.sampleSelectionWidget = SampleSelectionWidget(self.cmdBox) self.basketView = SampleBasketView(self.cmdBox, 5) self.loadSampleCmdWidget = LoadSampleCmdWidget(self.cmdBox) self.sampleView = SampleBasketView(self.cmdBox, 10) self.statusBox.setInsideMargin(5) self.statusBox.setInsideSpacing(10) self.statusBox.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) self.cmdReset.setIconSet(QIconSet(Icons.load("reload"))) self.cmdReset.setTextLabel("Reset") self.cmdReset.setUsesTextLabel(True) self.lblStatus.setAlignment(Qt.AlignHCenter) sampleBox.setMargin(5) sampleBox.setSpacing(5) self.lblSampleLoadingState.setAlignment(Qt.AlignHCenter) # final layout """ QGridLayout(self.cmdBox, 3, 3, 5, 5) self.cmdBox.layout().addWidget(self.basketSelectionWidget, 0, 0) self.cmdBox.layout().addWidget(self.basketView, 1, 0) self.cmdBox.layout().addWidget(self.loadSampleCmdWidget, 2, 1, Qt.AlignBottom) self.cmdBox.layout().addWidget(hspacer, 0, 1) self.cmdBox.layout().addWidget(self.sampleSelectionWidget, 0, 2) self.cmdBox.layout().addWidget(self.sampleView, 1, 2) """ QVBoxLayout(self, 5, 5) self.layout().addWidget(self.statusBox) self.layout().addWidget(sampleBox) self.layout().addItem(QSpacerItem(QSizePolicy.Fixed, QSizePolicy.MinimumExpanding)) QObject.connect(self.cmdReset, SIGNAL("clicked()"), self.resetSampleChanger) QObject.connect(self.basketSelectionWidget, PYSIGNAL("changeSelectedItem"), self.changeBasketClicked) QObject.connect(self.sampleSelectionWidget, PYSIGNAL("changeSelectedItem"), self.changeSampleClicked) QObject.connect(self.basketSelectionWidget, PYSIGNAL("scanBasket"), self.scanBasket) QObject.connect(self.loadSampleCmdWidget, PYSIGNAL("loadSample"), self.loadSample) QObject.connect(self.loadSampleCmdWidget, PYSIGNAL("unloadSample"), self.unloadSample)
def __init__(self, *args): BlissWidget.__init__(self, *args) self.addProperty('mnemonic', 'string') self.addProperty('numberFormatString', 'formatString', '+####.##') self.addProperty('title', 'string', '') self.addProperty('commands_channels', 'string', '', hidden=True) self.__brick_properties = self.propertyBag.properties.keys() self.__commands_channels = {} self.defineSlot("showBrick", ()) self.hardwareObject = None self.cmdButtons = [] self.channelLabels = [] self.lblTitle = QLabel(self) self.channelsBox = QGrid(2, self) self.commandsBox = QVBox(self) self.lblTitle.setAlignment(Qt.AlignTop | Qt.AlignHCenter) QVBoxLayout(self, 0, 0) self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.layout().addWidget(self.lblTitle) self.layout().addWidget(self.channelsBox, 0, Qt.AlignHCenter) self.layout().addWidget(self.commandsBox, 0, Qt.AlignHCenter)
def propertyChanged(self,propertyName,oldValue,newValue): if propertyName == "icons": icons_list=newValue.split() try: self.browseButton.setPixmap(Icons.load(icons_list[0])) except IndexError: pass try: self.reloadButton.setPixmap(Icons.load(icons_list[1])) except IndexError: pass elif propertyName == 'dataCollect': if self.collectObj is not None: self.disconnect(self.collectObj, PYSIGNAL('progressUpdate'), self.imageCollected) self.collectObj=self.getHardwareObject(newValue) if self.collectObj is not None: self.connect(self.collectObj, PYSIGNAL('progressUpdate'), self.imageCollected) elif propertyName == 'fileHistorySize': self.imageFilename.setMaxCount(newValue) elif propertyName == 'showLegends': if not newValue: self.lineSelection._graph.setTitle=lambda t:mySetTitle(self.lineSelection._graph,t) self.lineSelection._graph.enableAxis(self.lineSelection._graph.xTop,False) self.lineSelection._graph.enableAxis(self.lineSelection._graph.xBottom,False) elif propertyName == 'graphFixedHeight': if newValue!=-1: self.lineSelection._graph.setFixedHeight(newValue) else: BlissWidget.propertyChanged(self,propertyName,oldValue,newValue)
def __init__(self, *args): BlissWidget.__init__(self, *args) self.collect_hwobj = None self.addProperty('mnemonic', 'string', '') self.addProperty('appearance','combo',('simple', 'normal'),'normal') self.addProperty('title', 'string','') self.addProperty('timeFormat','string','%H:%M:%S') self.executing = None self.time_total_sec = 0 self.time_remaining_sec = 0 self.time_format = None self.progress_task = None self.container_hbox = qt.QHGroupBox(self) self.container_hbox.setInsideMargin(4) self.container_hbox.setInsideSpacing(2) self.time_total_label = qt.QLabel('Total:',self.container_hbox) self.time_total_value_label = qt.QLabel('??:??:??',self.container_hbox) self.progressBar = qt.QProgressBar(self.container_hbox) self.progressBar.setCenterIndicator(True) self.time_remaining_label = qt.QLabel('Remaining:',self.container_hbox) self.time_remaining_value_label = qt.QLabel('??:??:??',self.container_hbox) qt.QVBoxLayout(self) self.setSizePolicy(qt.QSizePolicy.MinimumExpanding, qt.QSizePolicy.Fixed) self.layout().addWidget(self.container_hbox) self.setEnabled(False) self.instanceSynchronize("")
def propertyChanged(self, propertyName, oldValue, newValue): #print propertyName,oldValue,newValue if propertyName=='appearance': if newValue=='simple': self.containerBox.setFrameShape(self.containerBox.NoFrame) self.containerBox.setInsideMargin(0) self.containerBox.setInsideSpacing(0) self.labElapsed.hide() self.labTimeSpent.hide() self.labRemaining.hide() self.labTimeLeft.hide() elif newValue=='normal': self.containerBox.setFrameShape(self.containerBox.GroupBoxPanel) self.containerBox.setInsideMargin(4) self.containerBox.setInsideSpacing(2) self.labElapsed.show() self.labTimeSpent.show() self.labRemaining.show() self.labTimeLeft.show() if propertyName=='title': if newValue!="": self.containerBox.setTitle(newValue) self.updateGeometry() else: BlissWidget.propertyChanged(self,propertyName,oldValue,newValue)
def propertyChanged(self, property, oldValue, newValue): if property == "icons": self.setIcons(newValue) elif property == "defaultFormat": self.formatType = newValue else: BlissWidget.propertyChanged(self, property, oldValue, newValue)
def __init__(self, *args): BlissWidget.__init__(self, *args) self.addProperty("mnemonic", "string", "") self.defineSignal("centringSuccessful", ()) self.microdiff = None # GUI self.statusBox = QVGroupBox("Status", self) self.lblStatus = QLabel("", self.statusBox) self.statusBox.setInsideMargin(5) self.statusBox.setInsideSpacing(10) self.statusBox.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) self.lblStatus.setAlignment(Qt.AlignHCenter) self.chkBackground = QCheckBox("Auto-check automatic centring background", self) QObject.connect(self.chkBackground, SIGNAL("clicked()"), self.setAutocheckBackground) # final layout QVBoxLayout(self, 5, 5) self.layout().addWidget(self.statusBox) self.layout().addWidget(self.chkBackground) self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
def __init__(self, *args): BlissWidget.__init__(self, *args) self.inExpert = None self.addProperty("mnemonic", "string", "") self.addProperty("safetyShutter", "string", "") self.addProperty("icons", "string", "") self.addProperty("iconsStopCancel", "string", "") self.addProperty("label", "string", "") self.addProperty("showBorder", "boolean", True) self.addProperty("confirmationMessages", "string", "") self.addProperty("toolTips", "string", "") self.addProperty("userModeMask", "string", "") self.addProperty("expertModeMask", "string", "") self.defineSlot("setEnabled", ()) self.defineSignal("commandStarted", ()) self.defineSignal("commandDone", ()) self.defineSignal("commandFailed", ()) # self.defineSlot('enable_widget', ()) self.safetyShutter = None self.commandHO = None self.commandButtons = {} self.commands2Hide = [] self.containerBox = QVBox(self) # self.containerBox.setInsideMargin(4) # self.containerBox.setInsideSpacing(2) QVBoxLayout(self) self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.containerBox.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.layout().addWidget(self.containerBox)
def __init__(self, parent, name): BlissWidget.__init__(self, parent, name) """ variables """ self.YBeam = None self.ZBeam = None """ property """ self.addProperty("zoom", "string", "") self.hwZoom = None """ signals """ self.defineSignal("ChangeBeamPosition", ()) """ slots """ self.defineSlot("getBeamPosition", ()) self.defineSlot("beamPositionChanged", ()) self.defineSlot("setBrickEnabled", ()) self.buildInterface()
def propertyChanged(self,propertyName,oldValue,newValue): if propertyName=='ldapServer': self.ldapConnection=self.getHardwareObject(newValue) elif propertyName=='codes': self.setCodes(newValue) elif propertyName=='localLogin': self.localLogin=self.getHardwareObject(newValue) elif propertyName=='dbConnection': self.dbConnection = self.getHardwareObject(newValue) elif propertyName=='instanceServer': if self.instanceServer is not None: self.disconnect(self.instanceServer,PYSIGNAL('passControl'), self.passControl) self.disconnect(self.instanceServer,PYSIGNAL('haveControl'), self.haveControl) self.instanceServer=self.getHardwareObject(newValue) if self.instanceServer is not None: self.connect(self.instanceServer,PYSIGNAL('passControl'), self.passControl) self.connect(self.instanceServer,PYSIGNAL('haveControl'), self.haveControl) elif propertyName == 'icons': icons_list=newValue.split() try: self.loginButton.setPixmap(Icons.load(icons_list[0])) except IndexError: pass try: self.logoutButton.setPixmap(Icons.load(icons_list[1])) except IndexError: pass elif propertyName == 'session': self.session_hwobj = self.getHardwareObject(newValue) else: BlissWidget.propertyChanged(self,propertyName,oldValue,newValue)
def _pageChanged(self, page): index=self.indexOf(page) self.countChanged[index]=False tab_label=str(self.tabLabel(page)) label_list=tab_label.split() found=False try: count=label_list[-1] try: found=count[0]=="(" except: pass else: try: found=count[-1]==")" except: pass except: pass if found: orig_label=" ".join(label_list[0:-1]) else: orig_label=" ".join(label_list) self.emit(qt.PYSIGNAL("notebookPageChanged"), (orig_label, )) qt.qApp.emit(qt.PYSIGNAL('tab_changed'), (index, page)) tab_name=self.name() BlissWidget.updateTabWidget(tab_name,index)
def __init__(self, *args): BlissWidget.__init__(self, *args) self.__widgetTree = self.loadUIFile("Centering.ui") self.__widgetTree.reparent(self, qt.QPoint(0, 0)) layout = qt.QHBoxLayout(self, 11, 6, "layout") layout.addWidget(self.__widgetTree) self.__centeringPlug = None self.__currentXSize, self.__currentYSize = 0, 0 # current pixel size self.__verticalPhi = True self.pxclient = None self.beam_pos = (None, None) self.addProperty("mnemonic", "string", "") self.addProperty("clockwise", "boolean", False) self.addProperty("table_y_inverted", "boolean", False) self.addProperty("table_z_inverted", "boolean", False) ####### SIGNAL ####### self.defineSignal("getView", ()) self.defineSignal("getBeamPosition", ()) ####### SLOTS ####### self.defineSlot("changePixelScale", ())
def __init__(self, parent, name): BlissWidget.__init__(self, parent, name) self.addProperty("xmlFile", "string", "") self.addProperty("uiFile", "string", "") self.addProperty("expert_channels", "string", "", hidden=True) self.__brick_properties = self.propertyBag.properties.keys() self.hwo = None self.expert_channels = [] self.property_expert_channels = {}
def __init__(self, *args): BlissWidget.__init__(self, *args) actions = [] self.__zoomList = QubZoomListAction( place="toolbar", zoomValList=[0.1, 0.25, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4], show=1, group="zoom", ) actions.append(self.__zoomList) self.__zoomFitOrFill = QubZoomAction(place="toolbar", keepROI=True, group="zoom") self.__zoomFitOrFill.setList(self.__zoomList) self.__zoomList.setActionZoomMode(self.__zoomFitOrFill) actions.append(self.__zoomFitOrFill) zoomAction = QubZoomRectangle( label="Zoom Crop", place="toolbar", show=1, group="zoom", activate_click_drag=True, drawingObjectLayer=2**31, unactiveActionWhenDub=True, ) qt.QObject.connect(zoomAction, qt.PYSIGNAL("RectangleSelected"), self.__rectangleZoomChanged) actions.append(zoomAction) ####### CHANGE FOREGROUND COLOR ####### fcoloraction = QubForegroundColorAction(name="color", group="image") actions.append(fcoloraction) ####### MEASURE ####### measureAction = QubOpenDialogAction( parent=self, name="measure", iconName="measure", label="Measure", group="Tools", ) measureAction.setConnectCallBack(self._measure_dialog_new) actions.append(measureAction) self.__mainView = QubMosaicView(self, actions=actions) layout = qt.QHBoxLayout(self) layout.addWidget(self.__mainView) ####### SLOT ####### self.defineSlot("getView", ())
def propertyChanged(self, propertyName, oldValue, newValue): if propertyName == "mnemonic": if self.diffractometer_hwobj is not None: self.disconnect( self.diffractometer_hwobj, qt.PYSIGNAL("kappaMoved"), self.kappa_value_changed, ) self.disconnect( self.diffractometer_hwobj, qt.PYSIGNAL("kappPhiMoved"), self.phi_value_changed, ) self.diffractometer_hwobj = self.getHardwareObject(newValue) if self.diffractometer_hwobj is not None: self.connect( self.diffractometer_hwobj, qt.PYSIGNAL("kappaMoved"), self.kappa_value_changed, ) self.connect( self.diffractometer_hwobj, qt.PYSIGNAL("kappaPhiMoved"), self.phi_value_changed, ) elif propertyName == "label": self.setLabel(newValue) elif propertyName == "showLabel": if newValue: self.setLabel(self["label"]) else: self.setLabel(None) elif propertyName == "showStop": if newValue: self.stop_motors_button.show() else: self.stop_motors_button.hide() elif propertyName == "showBox": if newValue: self.container_hbox.setFrameShape(self.container_hbox.GroupBoxPanel) self.container_hbox.setInsideMargin(4) self.container_hbox.setInsideSpacing(0) else: self.container_hbox.setFrameShape(self.container_hbox.NoFrame) self.container_hbox.setInsideMargin(0) self.container_hbox.setInsideSpacing(0) self.setLabel(self["label"]) elif propertyName == "icons": icons_list = newValue.split() try: self.move_motors_button.setPixmap(Icons.load(icons_list[0])) except IndexError: pass else: BlissWidget.propertyChanged(self, propertyName, oldValue, newValue)
def __init__(self, *args): BlissWidget.__init__(self, *args) self.inExpert = None self.slitbox = None self.minidiff = None self.motorsDialog = MotorsDialog(self) self.addProperty('slitbox', 'string', '') self.addProperty('minidiff', 'string', '') self.addProperty('icons', 'string', '') self.addProperty('motorIcons', 'string', '') #self.addProperty('title', 'string', 'Beam size') self.addProperty('formatString', 'formatString', '##.####') self.addProperty('decimalPlaces', 'string', '4') self.addProperty('expertOnly', 'boolean', False) self.topBox = QHBoxLayout(self) self.topBox.setMargin(5) self.topBox.setSpacing(20) self.beamHorSize = MotorSpinBoxBrick.MotorSpinBoxBrick(self) self.topBox.addWidget(self.beamHorSize) self.beamHorSize['showMoveButtons'] = False self.beamHorSize['showBox'] = False self.beamHorSize['showLabel'] = True self.beamHorSize['label'] = "Hor" self.beamHorSize['showStep'] = False self.beamHorSize['showStepList'] = True self.beamVerSize = MotorSpinBoxBrick.MotorSpinBoxBrick(self) self.topBox.addWidget(self.beamVerSize) self.beamVerSize['showMoveButtons'] = False self.beamVerSize['showBox'] = False self.beamVerSize['showLabel'] = True self.beamVerSize['label'] = "Ver" self.beamVerSize['showStep'] = False self.beamVerSize['showStepList'] = True #self.topBox.addSpace(10) self.offset_layout = QHBoxLayout(self.topBox, 5) self.offsetsLabel = QLabel("Move:", self) self.offset_layout.addWidget(self.offsetsLabel) self.offsetsButton = QToolButton(self) self.offset_layout.addWidget(self.offsetsButton) self.offsetsButton.setTextLabel("Offsets") self.offsetsButton.setUsesTextLabel(True) self.offsetsButton.setTextPosition(QToolButton.BesideIcon) QObject.connect(self.offsetsButton, SIGNAL('clicked()'), self.openOffsetsDialog) #QVBoxLayout(self) #self.layout().addLayout(self.topBox) self.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
def setSession(self, session_id, prop_code=None, prop_number=None, prop_id=None, expiration=None, orig_prop_code=None, is_inhouse=None): self.externalUserInfoDialog.clearUserInfo() if prop_code is not None and prop_number is not None and prop_code != '' and prop_number != '': if self.instanceServer is not None: try: proposal_dict={ "code":orig_prop_code,\ "alias": prop_code,\ "number":prop_number,\ "session":int(session_id),\ "inhouse":is_inhouse } except: logging.getLogger().exception( "InstanceListBrick: problem setting session") return else: self.myProposal = proposal_dict self.instanceServer.setProposal(proposal_dict) if is_inhouse: BlissWidget.setInstanceUserId( BlissWidget.INSTANCE_USERID_INHOUSE) self.askForControlButton.hide() self.takeControlButton.show() self.takeControlButton.setEnabled( BlissWidget.isInstanceRoleServer( )) #BlissWidget.isInstanceModeMaster()) if self.hutchtrigger is not None and not BlissWidget.isInstanceModeMaster( ): hutch_opened = self.hutchtrigger.hutchIsOpened() #hutch_opened = 1-int(self.hutchtrigger.getChannelObject("status").getValue()) logging.getLogger().info( "%s: hutch is %s, %s 'Take control' button", self.name(), hutch_opened and "opened" or "close", hutch_opened and "disabling" or "enabling") self.takeControlButton.setEnabled(1 - hutch_opened) else: BlissWidget.setInstanceUserId( BlissWidget.INSTANCE_USERID_LOGGED) self.takeControlButton.hide() self.askForControlButton.show() self.askForControlButton.setEnabled( not BlissWidget.isInstanceModeMaster()) else: if self.instanceServer is not None: self.myProposal = None self.instanceServer.setProposal(None) BlissWidget.setInstanceUserId(BlissWidget.INSTANCE_USERID_UNKNOWN) self.takeControlButton.hide() self.askForControlButton.show() #self.askForControlButton.setEnabled(BlissWidget.isInstanceRoleServer() and not BlissWidget.isInstanceModeMaster()) self.askForControlButton.setEnabled(False)
def __init__(self, *args): BlissWidget.__init__(self, *args) self.inExpert = None self.slitbox = None self.minidiff = None self.motorsDialog = MotorsDialog(self) self.addProperty("slitbox", "string", "") self.addProperty("minidiff", "string", "") self.addProperty("icons", "string", "") self.addProperty("motorIcons", "string", "") # self.addProperty('title', 'string', 'Beam size') self.addProperty("formatString", "formatString", "##.####") self.addProperty("decimalPlaces", "string", "4") self.addProperty("expertOnly", "boolean", False) self.topBox = QHBoxLayout(self) self.topBox.setMargin(5) self.topBox.setSpacing(20) self.beamHorSize = MotorSpinBoxBrick.MotorSpinBoxBrick(self) self.topBox.addWidget(self.beamHorSize) self.beamHorSize["showMoveButtons"] = False self.beamHorSize["showBox"] = False self.beamHorSize["showLabel"] = True self.beamHorSize["label"] = "Hor" self.beamHorSize["showStep"] = False self.beamHorSize["showStepList"] = True self.beamVerSize = MotorSpinBoxBrick.MotorSpinBoxBrick(self) self.topBox.addWidget(self.beamVerSize) self.beamVerSize["showMoveButtons"] = False self.beamVerSize["showBox"] = False self.beamVerSize["showLabel"] = True self.beamVerSize["label"] = "Ver" self.beamVerSize["showStep"] = False self.beamVerSize["showStepList"] = True # self.topBox.addSpace(10) self.offset_layout = QHBoxLayout(self.topBox, 5) self.offsetsLabel = QLabel("Move:", self) self.offset_layout.addWidget(self.offsetsLabel) self.offsetsButton = QToolButton(self) self.offset_layout.addWidget(self.offsetsButton) self.offsetsButton.setTextLabel("Offsets") self.offsetsButton.setUsesTextLabel(True) self.offsetsButton.setTextPosition(QToolButton.BesideIcon) QObject.connect(self.offsetsButton, SIGNAL("clicked()"), self.openOffsetsDialog) # QVBoxLayout(self) # self.layout().addLayout(self.topBox) self.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
def __init__(self, *args): BlissWidget.__init__(self, *args) self.defineSlot("newScan", ()) self.defineSlot("newScanPoint", ()) self.scanObject = None self.xdata = [] self.ydata = [] self.isConnected = None self.canAddPoint = True self.addProperty("specVersion", "string", "") self.addProperty("backgroundColor", "combo", ("white", "default"), "white") self.addProperty("graphColor", "combo", ("white", "default"), "white") self.lblTitle = QLabel(self) self.graphPanel = QFrame(self) buttonBox = QHBox(self) self.lblPosition = QLabel(buttonBox) self.graph = QtBlissGraph(self.graphPanel) QObject.connect(self.graph, PYSIGNAL("QtBlissGraphSignal"), self.handleBlissGraphSignal) QObject.disconnect( self.graph, SIGNAL("plotMousePressed(const QMouseEvent&)"), self.graph.onMousePressed, ) QObject.disconnect( self.graph, SIGNAL("plotMouseReleased(const QMouseEvent&)"), self.graph.onMouseReleased, ) self.graph.canvas().setMouseTracking(True) self.graph.enableLegend(False) self.graph.enableZoom(False) self.graph.setAutoLegend(False) self.lblPosition.setAlignment(Qt.AlignRight) self.lblTitle.setAlignment(Qt.AlignHCenter) self.lblTitle.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) self.lblPosition.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) buttonBox.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) QVBoxLayout(self.graphPanel) self.graphPanel.layout().addWidget(self.graph) QVBoxLayout(self) self.layout().addWidget(self.lblTitle) self.layout().addWidget(buttonBox) self.layout().addWidget(self.graphPanel)
def propertyChanged(self, propertyName, oldValue, newValue): if propertyName == 'specstate': if self.specStateHO is not None: self.disconnect(self.specStateHO, 'specStateChanged', self.specStateChanged) self.specStateHO = self.getHardwareObject(newValue) if self.specStateHO is not None: self.connect(self.specStateHO, 'specStateChanged', self.specStateChanged) else: BlissWidget.propertyChanged(self, propertyName, oldValue, newValue)
def __init__(self, *args): BlissWidget.__init__(self, *args) self.defineSignal('newScan', ()) self.scanObject = None self.xdata = [] self.ylable = "" self.mylog = 0 self.isConnected = None #self.canAddPoint = None self.canAddPoint = True self.addProperty('specVersion', 'string', '') self.addProperty('backgroundColor', 'combo', ('white', 'default'), 'white') self.addProperty('graphColor', 'combo', ('white', 'default'), 'white') self.lblTitle = QLabel(self) self.graphPanel = QFrame(self) buttonBox = QHBox(self) #self.cmdZoomIn = QToolButton(buttonBox) #self.cmdZoomOut = QToolButton(buttonBox) self.lblPosition = QLabel(buttonBox) self.graph = QtBlissGraph(self.graphPanel) QObject.connect(self.graph, PYSIGNAL('QtBlissGraphSignal'), self.handleBlissGraphSignal) QObject.disconnect(self.graph, SIGNAL('plotMousePressed(const QMouseEvent&)'), self.graph.onMousePressed) QObject.disconnect(self.graph, SIGNAL('plotMouseReleased(const QMouseEvent&)'), self.graph.onMouseReleased) #QObject.connect(self.cmdZoomIn, SIGNAL('clicked()'), self.cmdZoomInClicked) #QObject.connect(self.cmdZoomOut, SIGNAL('clicked()'), self.cmdZoomOutClicked) #self.cmdZoomIn.setIconSet(QIconSet(Icons.load("zoomin"))) #self.cmdZoomOut.setIconSet(QIconSet(Icons.load("zoomout"))) #self.cmdZoomIn.setToggleButton(True) #self.cmdZoomOut.setToggleButton(True) #self.cmdZoomIn.setUsesTextLabel(False) #self.cmdZoomOut.setUsesTextLabel(False) self.graph.canvas().setMouseTracking(True) self.graph.enableLegend(False) self.graph.enableZoom(False) self.graph.setAutoLegend(False) self.lblPosition.setAlignment(Qt.AlignRight) self.lblTitle.setAlignment(Qt.AlignHCenter) self.lblTitle.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) self.lblPosition.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) buttonBox.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) QVBoxLayout(self.graphPanel) self.graphPanel.layout().addWidget(self.graph) QVBoxLayout(self) self.layout().addWidget(self.lblTitle) self.layout().addWidget(buttonBox) self.layout().addWidget(self.graphPanel)
def __init__(self, *args): BlissWidget.__init__(self, *args) self.defineSlot("updateCollectParameters", ()) self.minikappa = None self.motors = {} self.__refs = {} self.motorSteps = {} self.currentMotorName = None self.kappaOnOngoing = None self.kappaOffOngoing = None self.addProperty('mnemonic', 'string', '') self.addProperty('commandIcons', 'string', '') self.addProperty('motorIcons', 'string', '') self.addProperty('formatString', 'formatString', '###.###') self.addProperty('decimalPlaces', 'string', '') self.addProperty('maxMotorsPerLine', 'integer', 3) self.topBox = QHGroupBox("Minikappa", self) self.topBox.setInsideMargin(4) self.topBox.setInsideSpacing(2) self.topBox.setCheckable(True) QObject.connect(self.topBox, SIGNAL('toggled(bool)'), self.enableChanged) self.motorBox = QVGroupBox("Motors", self.topBox) box1 = QHBox(self.motorBox) self.motorBox.setInsideMargin(4) self.motorBox.setInsideSpacing(2) self.motorsList = QComboBox(box1) QObject.connect(self.motorsList, SIGNAL('activated(const QString &)'), self.motorChanged) self.currentMotor = MotorSpinBoxBrick.MotorSpinBoxBrick(box1) self.currentMotor['showMoveButtons'] = False self.currentMotor['showBox'] = False self.currentMotor['showLabel'] = False self.currentMotor['showStep'] = False self.currentMotor['showStepList'] = True self.motorsGrid = QWidget(self.motorBox) QGridLayout(self.motorsGrid, 0, 0, 2, 2) self.commands = CommandMenuBrick.CommandMenuBrick(self.topBox) self.commands.hideCommands(self.MINIKAPPA_ONOFF_COMMANDS) self.kappaOnCmd = None self.kappaOffCmd = None self.kappaInUseChan = None QVBoxLayout(self) self.layout().addWidget(self.topBox) self.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
def serverClosed(self, server_id): self.listBox.clear() self.connections = {} BlissWidget.setInstanceRole(BlissWidget.INSTANCE_ROLE_CLIENTCONNECTING) BlissWidget.setInstanceMode(BlissWidget.INSTANCE_MODE_SLAVE) msg_event=MsgDialogEvent(QMessageBox.Warning,\ "The server application closed the connection!",\ self.font().pointSize()) qApp.postEvent(self, msg_event) QTimer.singleShot(InstanceListBrick.RECONNECT_TIME, self.reconnectToServer)
def instanceInitializing(self): is_local = self.instanceServer.isLocal() if is_local: loc = BlissWidget.INSTANCE_LOCATION_LOCAL else: loc = BlissWidget.INSTANCE_LOCATION_EXTERNAL BlissWidget.setInstanceLocation(loc) self.connect(qApp.mainWidget(), PYSIGNAL('applicationBrickChanged'), self.applicationBrickChanged) self.connect(qApp.mainWidget(), PYSIGNAL('applicationTabChanged'), self.applicationTabChanged)
def propertyChanged(self, property, oldValue, newValue): if property == 'mnemonic': if self.attenuators is not None: self.disconnect(self.attenuators, PYSIGNAL('deviceReady'), self.connected) self.disconnect(self.attenuators, PYSIGNAL('deviceNotReady'), self.disconnected) self.disconnect(self.attenuators, PYSIGNAL('attStateChanged'), self.attStateChanged) self.disconnect(self.attenuators, PYSIGNAL('attFactorChanged'), self.attFactorChanged) self.transHistory = [] self.attenuators = self.getHardwareObject(newValue) if self.attenuators is not None: self.filtersDialog.setAttenuators(self.attenuators) self.connect(self.attenuators, PYSIGNAL('deviceReady'), self.connected) self.connect(self.attenuators, PYSIGNAL('deviceNotReady'), self.disconnected) self.connect(self.attenuators, PYSIGNAL('attStateChanged'), self.attStateChanged) self.connect(self.attenuators, PYSIGNAL('attFactorChanged'), self.attFactorChanged) if self.attenuators.isReady(): self.connected() self.attFactorChanged(self.attenuators.getAttFactor()) self.attStateChanged(self.attenuators.getAttState()) else: self.disconnected() else: self.disconnected() elif property == 'filtersMode': if newValue == 'Disabled': self.filtersButton.hide() elif property == 'icons': icons_list = newValue.split() #try: # self.applyButton.setPixmap(Icons.load(icons_list[0])) #except IndexError: # pass try: self.filtersButton.setPixmap(Icons.load(icons_list[1])) except IndexError: pass else: BlissWidget.propertyChanged(self, property, oldValue, newValue)
def __init__(self, parent, name, uifile='', cmd_name=None): BlissWidget.__init__(self, parent, name) self._widgetTree = self.loadUIFile(uifile) self._widgetTree.reparent(self, qt.QPoint(0, 0)) layout = qt.QHBoxLayout(self) layout.addWidget(self._widgetTree) self.addProperty('horizontal', 'string', '') self.addProperty('vertical', 'string', '') self.addProperty('command', 'string', '') self.addProperty("formatString", "formatString", "###.##") ####### SIGNAL ####### self.defineSignal('getView', ()) self.defineSignal('scanFinished', ()) ####### SLOT ####### self.defineSlot("ChangePixelCalibration", ()) self.defineSlot("ChangeBeamPosition", ()) self._view = None self._beamx, self._beamy = 0, 0 self._XSize, self._YSize = 1, 1 self._horizontalMotors = [] self._verticalMotors = [] self._graphicSelection = None self._SpecCmd = None self.__commandName = cmd_name self._logArgs = {} self._formatString = '%f' ####### GUI INIT ####### gButton = self._widgetTree.child('__grabButton') gButton.hide() showgButton = self._widgetTree.child('__showGrab') showgButton.hide() try: mvButton = self._widgetTree.child('__movetoStart') qt.QObject.connect(mvButton, qt.SIGNAL('clicked()'), self._movetoStart) mvButton.hide() except: pass startButton = self._widgetTree.child('__startScan') qt.QObject.connect(startButton, qt.SIGNAL('clicked()'), self._startScan) startButton.setEnabled(False) stopButton = self._widgetTree.child('__stopScan') qt.QObject.connect(stopButton, qt.SIGNAL('clicked()'), self._stopScan) stopButton.setEnabled(False)
def __init__(self, *args): BlissWidget.__init__(self, *args) self.addProperty("help_url", "string", "http://intranet") self.addProperty("browser", "combo", ("default", "mozilla", "netscape"), "default") self.cmdShowHelp = ToolButton(self, "rescue", "Help !", self.cmdShowHelpClicked, "Open help web page") QVBoxLayout(self) self.layout().addWidget(self.cmdShowHelp) self.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)
def __init__(self, *args): BlissWidget.__init__(self, *args) self.addProperty("mnemonic", "string", "") self.addProperty("formatString", "formatString", "###.#") self.addProperty("warningTemp", "integer", 110) self.cryodev = None # Cryo Hardware Object self.containerBox = QVGroupBox("Cryo", self) self.containerBox.setInsideMargin(4) self.containerBox.setInsideSpacing(0) self.containerBox.setAlignment(QLabel.AlignCenter) self.temperature = QLabel(self.containerBox) self.temperature.setAlignment(QLabel.AlignCenter) self.temperature.setPaletteForegroundColor(widget_colors.WHITE) # self.temperature.setPaletteBackgroundColor(widget_colors.LIGHT_BLUE) font = self.temperature.font() font.setStyleHint(QFont.OldEnglish) self.temperature.setFont(font) # self.level=QProgressBar(self.containerBox) # grid1=QWidget(self.containerBox) # QGridLayout(grid1, 3, 2, 2, 1) # label1=QLabel("Dry:",grid1) # grid1.layout().addWidget(label1, 0, 0) # self.dryState=QLabel(grid1) # self.dryState.setAlignment(QLabel.AlignCenter) # self.dryState.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed) # grid1.layout().addWidget(self.dryState, 0, 1) # label2=QLabel("Superdry:",grid1) # grid1.layout().addWidget(label2, 1, 0) # self.superdryState=QLabel(grid1) # self.superdryState.setAlignment(QLabel.AlignCenter) # self.superdryState.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed) # grid1.layout().addWidget(self.superdryState, 1, 1) # label3=QLabel("Icing:",grid1) # grid1.layout().addWidget(label3, 2, 0) # self.icingState=QLabel(grid1) # self.icingState.setAlignment(QLabel.AlignCenter) # self.icingState.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed) # grid1.layout().addWidget(self.icingState, 2, 1) self.containerBox.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed) QVBoxLayout(self) self.layout().addWidget(self.containerBox)
def __init__(self, *args): BlissWidget.__init__(self, *args) self.addProperty('mnemonic', 'string', '') self.addProperty('icons', 'string', '') self.addProperty('formatString', 'formatString', '###.##') self.defineSlot('setEnabled', ()) self.defineSlot('transmissionRequest', ()) self.attenuators = None self.transmissionLimits = None self.currentTransmissionValue = None self.topBox = QHGroupBox('Transmission', self) self.topBox.setInsideMargin(4) self.topBox.setInsideSpacing(2) self.paramsBox = QWidget(self.topBox) QGridLayout(self.paramsBox, 2, 3, 0, 2) label1 = QLabel("Current:", self.paramsBox) self.paramsBox.layout().addWidget(label1, 0, 0) self.currentTransmission = QLineEdit(self.paramsBox) self.currentTransmission.setReadOnly(True) self.currentTransmission.setFixedWidth(75) self.paramsBox.layout().addWidget(self.currentTransmission, 0, 1) label2 = QLabel("Set to:", self.paramsBox) self.paramsBox.layout().addWidget(label2, 1, 0) self.newTransmission = QLineEdit(self.paramsBox) self.newTransmission.setAlignment(QWidget.AlignRight) self.paramsBox.layout().addWidget(self.newTransmission, 1, 1) self.newTransmission.setFixedWidth(75) self.newTransmission.setValidator(QDoubleValidator(self)) self.newTransmission.setPaletteBackgroundColor(self.CONNECTED_COLOR) QObject.connect(self.newTransmission, SIGNAL('returnPressed()'), self.changeCurrentTransmission) QObject.connect(self.newTransmission, SIGNAL('textChanged(const QString &)'), self.inputFieldChanged) self.newTransmission.createPopupMenu = self.openHistoryMenu self.instanceSynchronize("newTransmission") QVBoxLayout(self) self.layout().addWidget(self.topBox) self.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.MinimumExpanding)
def propertyChanged(self, property, oldValue, newValue): if property == 'mnemonic': if self.dataCollect is not None: #self.disconnect(self.dataCollect,'collectStarted', self.collectStarted) self.disconnect(self.dataCollect, 'collectNumberOfFrames', self.collectSpecStarted) #self.disconnect(self.dataCollect,'collectEnded', self.collectEnded) #self.disconnect(self.dataCollect,'collectFailed', self.collectFailed) #self.disconnect(self.dataCollect,'collectStartCentring', self.collectStartCentring) #self.disconnect(self.dataCollect,'collectCentringFinished', self.collectCentringFinished) self.disconnect(self.dataCollect, 'collectValidateCentring', self.collectValidateCentring) self.disconnect(self.dataCollect, 'collectRejectCentring', self.collectRejectCentring) #self.disconnect(self.dataCollect,'collectCentringFinished', self.collectCentringFinished) self.disconnect(self.dataCollect, 'collectMountingSample', self.collectMountingSample) #self.disconnect(self.dataCollect,'collectUnmountingSample', self.collectUnmountingSample) self.disconnect(self.dataCollect, 'collectOscillationStarted', self.collectOscillationStarted) self.disconnect(self.dataCollect, 'collectOscillationFailed', self.collectOscillationFailed) self.disconnect(self.dataCollect, 'collectOscillationFinished', self.collectOscillationFinished) self.dataCollect = self.getHardwareObject(newValue) if self.dataCollect is not None: #self.connect(self.dataCollect,'collectStarted', self.collectStarted) self.connect(self.dataCollect, 'collectNumberOfFrames', self.collectSpecStarted) #self.connect(self.dataCollect,'collectEnded', self.collectEnded) #self.connect(self.dataCollect,'collectFailed', self.collectFailed) #self.connect(self.dataCollect,'collectStartCentring', self.collectStartCentring) #self.connect(self.dataCollect,'collectCentringFinished', self.collectCentringFinished) self.connect(self.dataCollect, 'collectValidateCentring', self.collectValidateCentring) self.connect(self.dataCollect, 'collectRejectCentring', self.collectRejectCentring) self.connect(self.dataCollect, 'collectMountingSample', self.collectMountingSample) #self.connect(self.dataCollect,'collectUnmountingSample', self.collectUnmountingSample) self.connect(self.dataCollect, 'collectOscillationStarted', self.collectOscillationStarted) self.connect(self.dataCollect, 'collectOscillationFailed', self.collectOscillationFailed) self.connect(self.dataCollect, 'collectOscillationFinished', self.collectOscillationFinished) else: BlissWidget.propertyChanged(self, property, oldValue, newValue)
def propertyChanged(self, property, oldValue, newValue): if property == 'backgroundColor': if newValue == 'white': self.setPaletteBackgroundColor(Qt.white) elif newValue == 'default': self.setPaletteBackgroundColor(QWidget.paletteBackgroundColor(self)) elif property == 'graphColor': if newValue == 'white': self.graph.canvas().setPaletteBackgroundColor(Qt.white) elif newValue == 'default': self.graph.canvas().setPaletteBackgroundColor(QWidget.paletteBackgroundColor(self)) else: BlissWidget.propertyChanged(self,property,oldValue,newValue)
def __init__(self,*args) : BlissWidget.__init__(self,*args) self.__view = None self.__drawing = None self.__line = None self.__pointSelected = None self.__graphs = None self.__refreshTimer = qt.QTimer(self) qt.QObject.connect(self.__refreshTimer,qt.SIGNAL('timeout()'),self.__refreshGraph) # Properties ####### SIGNAL ####### self.defineSignal('getView',()) self.defineSignal('getImage',()) self.setFixedSize(0,0)
def __init__(self, *args): BlissWidget.__init__(self, *args) self.addProperty("paths", "string", "") self.contentsBox = QHGroupBox("Free disk space", self) self.diskDisplay = QLabel("********", self.contentsBox) self.timer = QTimer() QHBoxLayout(self) self.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding) self.layout().addWidget(self.contentsBox)
def propertyChanged(self, propertyName, oldValue, newValue): if propertyName == 'appearance': if newValue == 'simple': self.container_hbox.setFrameShape(self.container_hbox.NoFrame) self.container_hbox.setInsideMargin(0) self.container_hbox.setInsideSpacing(0) self.time_total_label.hide() self.time_total_value_label.hide() self.time_remaining_label.hide() self.time_remaining_value_label.hide() elif newValue == 'normal': self.container_hbox.setFrameShape( self.container_hbox.GroupBoxPanel) self.container_hbox.setInsideMargin(4) self.container_hbox.setInsideSpacing(2) self.time_total_label.show() self.time_total_value_label.show() self.time_remaining_label.show() self.time_remaining_value_label.show() elif propertyName == 'title': if newValue != "": self.container_hbox.setTitle(newValue) self.updateGeometry() elif propertyName == 'timeFormat': self.time_format = newValue elif propertyName == "mnemonic": if self.collect_hwobj is not None: self.disconnect(self.collect_hwobj, qt.PYSIGNAL('collectNumberOfFrames'), self.set_progress_total_time) self.disconnect(self.collect_hwobj, qt.PYSIGNAL('collectImageTaken'), self.start_progress) self.disconnect(self.collect_hwobj, qt.PYSIGNAL('collectEnded'), self.stop_progress) self.collect_hwobj = self.getHardwareObject(newValue) if self.collect_hwobj is not None: self.connect(self.collect_hwobj, qt.PYSIGNAL('collectNumberOfFrames'), self.set_progress_total_time) self.connect(self.collect_hwobj, qt.PYSIGNAL('collectImageTaken'), self.start_progress) self.connect(self.collect_hwobj, qt.PYSIGNAL('collectEnded'), self.stop_progress) else: BlissWidget.propertyChanged(self, propertyName, oldValue, newValue)
def __init__(self, *args): BlissWidget.__init__(self, *args) self.addProperty("mnemonic", "string", "") self.addProperty("icons", "string", "") self.addProperty("formatString", "formatString", "###.##") self.beamstop_hwobj = None self.top_gbox = qt.QHGroupBox("Beamstop distance", self) self.top_gbox.setInsideMargin(4) self.top_gbox.setInsideSpacing(2) self.params_widget = qt.QWidget(self.top_gbox) qt.QGridLayout(self.params_widget, 2, 3, 0, 2) label1 = qt.QLabel("Current:", self.params_widget) label1.setFixedWidth(70) self.params_widget.layout().addWidget(label1, 0, 0) self.current_position_ledit = qt.QLineEdit(self.params_widget) self.current_position_ledit.setReadOnly(True) self.params_widget.layout().addWidget(self.current_position_ledit, 0, 1) label2 = qt.QLabel("Set to:", self.params_widget) label2.setFixedWidth(70) self.params_widget.layout().addWidget(label2, 1, 0) self.new_position_ledit = qt.QLineEdit(self.params_widget) self.new_position_ledit.setAlignment(qt.QWidget.AlignRight) self.params_widget.layout().addWidget(self.new_position_ledit, 1, 1) self.new_position_ledit.setValidator(qt.QDoubleValidator(self)) self.new_position_ledit.setPaletteBackgroundColor( BeamstopDistanceBrick.CONNECTED_COLOR) qt.QObject.connect(self.new_position_ledit, qt.SIGNAL("returnPressed()"), self.change_position) qt.QObject.connect( self.new_position_ledit, qt.SIGNAL("textChanged(const QString &)"), self.input_field_changed, ) self.instanceSynchronize("new_position_ledit") qt.QVBoxLayout(self) self.layout().addWidget(self.top_gbox)
def __init__(self, *args): BlissWidget.__init__(self, *args) # # add properties # self.addProperty('iconFile', 'file', 'Images (*.bmp *.gif *.jpg *.png *.xpm)') self.addProperty('hint', 'string', '') self.addProperty('showSynoptic', 'boolean', True) self.addProperty('showBorder', 'boolean', False) self.addProperty('showTitle', 'boolean', True) self.addProperty('alignment', 'combo', ('top', 'bottom', 'center'), 'top') self.addProperty('title', 'string', '') # # define BRICK signals/slots # self.defineSignal('synopticClicked', ()) #signal with no arguments # # GUI components # self.__topPanel = QFrame(self) self.containerBox = QVBox(self.__topPanel) self.__lblTitle = QLabel(self.__topPanel) self.__lblTitle.setAutoResize(True) self.__synoptic = QLabel(self.__topPanel) # # layout # self.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding) QVBoxLayout(self, 0, 0) self.layout().addWidget(self.__topPanel, 0, Qt.AlignTop | Qt.AlignHCenter) QVBoxLayout(self.__topPanel, 2, 2) #margin, spacing self.__topPanel.layout().addWidget(self.__lblTitle, 0, Qt.AlignTop | Qt.AlignHCenter) self.__topPanel.layout().addWidget(self.__synoptic, 0, Qt.AlignTop | Qt.AlignHCenter) self.__topPanel.layout().addWidget(self.containerBox, 0, Qt.AlignTop | Qt.AlignHCenter)
def __init__(self, *args): BlissWidget.__init__(self, *args) # # add properties # self.addProperty("iconFile", "file", "Images (*.bmp *.gif *.jpg *.png *.xpm)") self.addProperty("hint", "string", "") self.addProperty("showSynoptic", "boolean", True) self.addProperty("showBorder", "boolean", False) self.addProperty("showTitle", "boolean", True) self.addProperty("alignment", "combo", ("top", "bottom", "center"), "top") self.addProperty("title", "string", "") # # define BRICK signals/slots # self.defineSignal("synopticClicked", ()) # signal with no arguments # # GUI components # self.__topPanel = QFrame(self) self.containerBox = QVBox(self.__topPanel) self.__lblTitle = QLabel(self.__topPanel) self.__lblTitle.setAutoResize(True) self.__synoptic = QLabel(self.__topPanel) # # layout # self.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding) QVBoxLayout(self, 0, 0) self.layout().addWidget(self.__topPanel, 0, Qt.AlignTop | Qt.AlignHCenter) QVBoxLayout(self.__topPanel, 2, 2) # margin, spacing self.__topPanel.layout().addWidget(self.__lblTitle, 0, Qt.AlignTop | Qt.AlignHCenter) self.__topPanel.layout().addWidget(self.__synoptic, 0, Qt.AlignTop | Qt.AlignHCenter) self.__topPanel.layout().addWidget(self.containerBox, 0, Qt.AlignTop | Qt.AlignHCenter)
def propertyChanged(self, propertyName, oldValue, newValue): if propertyName == 'mnemonic': if self.energyScan is not None: self.disconnect(self.energyScan, 'energyScanStarted', self.scanStarted) self.disconnect(self.energyScan, 'energyScanFinished', self.scanFinished) self.disconnect(self.energyScan, 'energyScanFailed', self.scanFailed) self.disconnect(self.energyScan, 'scanStatusChanged', self.scanStatusChanged) self.disconnect(self.energyScan, 'energyScanReady', self.scanReady) self.disconnect(self.energyScan, 'connected', self.connected) self.disconnect(self.energyScan, 'disconnected', self.disconnected) self.clearEnergies() self.energyScan = self.getHardwareObject(newValue) if self.energyScan is not None: self.connect(self.energyScan, 'energyScanStarted', self.scanStarted) self.connect(self.energyScan, 'energyScanFinished', self.scanFinished) self.connect(self.energyScan, 'energyScanFailed', self.scanFailed) self.connect(self.energyScan, 'scanStatusChanged', self.scanStatusChanged) self.connect(self.energyScan, 'energyScanReady', self.scanReady) self.connect(self.energyScan, 'connected', self.connected) self.connect(self.energyScan, 'disconnected', self.disconnected) self.connect(self.energyScan, 'chooch_finished', self.chooch_finished) if self.energyScan.isConnected(): self.connected() else: self.disconnected() else: self.disconnected() elif propertyName == 'icons': self.setIcons(newValue) else: BlissWidget.propertyChanged(self, propertyName, oldValue, newValue)
def hutchTriggerChanged(self, hutch_opened): if hutch_opened: if not BlissWidget.isInstanceRoleServer(): logging.getLogger().info( "%s: HUTCH IS OPENED, YOU LOSE CONTROL", self.name()) self.takeControlButton.setEnabled(False) else: logging.getLogger().info( "%s: HUTCH IS OPENED, TAKING CONTROL OVER REMOTE USERS", self.name()) self.instanceServer.takeControl() else: if not BlissWidget.isInstanceRoleServer(): logging.getLogger().info( "%s: HUTCH IS CLOSED, YOU ARE ALLOWED TO TAKE CONTROL AGAIN", self.name()) self.takeControlButton.setEnabled(True)
def __init__(self, *args): BlissWidget.__init__(self, *args) self.__pid = -1 self.__startIdle = qt.QTimer(self) qt.QObject.connect(self.__startIdle, qt.SIGNAL('timeout()'), self.__idleRun) self.__container = qttools.QtXEmbedContainer(self) qt.QObject.connect(self.__container, qt.SIGNAL('clientClosed()'), self.run) layout = qt.QVBoxLayout(self) layout.addWidget(self.__container) self.__container.setSizePolicy(qt.QSizePolicy.Expanding, qt.QSizePolicy.Expanding) qt.QObject.connect(qt.qApp, qt.SIGNAL('aboutToQuit()'), self.__killOxidis)
def propertyChanged(self, property, oldValue, newValue): if property == 'mnemonic': energy = self.getHardwareObject(newValue) if energy is not None: #self.setElements(energy.getElements()) self.periodicTable.setElements(energy.getElements()) else: #self.setElements(()) self.periodicTable.setElements(()) elif property == 'title': self.topBox.setTitle(newValue) elif property == 'kevFormatString': pass elif property == 'maximumWidth': self.setMaximumWidth(newValue) else: BlissWidget.propertyChanged(self, property, oldValue, newValue)
def propertyChanged(self, propertyName, oldValue, newValue): if propertyName == 'mnemonic': if self.xfeSpectrum is not None: self.disconnect(self.xfeSpectrum, 'xfeSpectrumStarted', self.spectrumStarted) self.disconnect(self.xfeSpectrum, 'xfeSpectrumFinished', self.spectrumFinished) self.disconnect(self.xfeSpectrum, 'xfeSpectrumFailed', self.spectrumFailed) self.disconnect(self.xfeSpectrum, 'spectrumStatusChanged', self.spectrumStatusChanged) self.disconnect(self.xfeSpectrum, 'xfeSpectrumReady', self.spectrumReady) self.disconnect(self.xfeSpectrum, 'connected', self.connected) self.disconnect(self.xfeSpectrum, 'disconnected', self.disconnected) self.clearEnergies() self.xfeSpectrum = self.getHardwareObject(newValue) if self.xfeSpectrum is not None: self.connect(self.xfeSpectrum, 'xfeSpectrumStarted', self.spectrumStarted) self.connect(self.xfeSpectrum, 'xfeSpectrumFinished', self.spectrumFinished) self.connect(self.xfeSpectrum, 'xfeSpectrumFailed', self.spectrumFailed) self.connect(self.xfeSpectrum, 'spectrumStatusChanged', self.spectrumStatusChanged) self.connect(self.xfeSpectrum, 'xfeSpectrumReady', self.spectrumReady) self.connect(self.xfeSpectrum, 'connected', self.connected) self.connect(self.xfeSpectrum, 'disconnected', self.disconnected) if self.xfeSpectrum.isConnected(): self.connected() else: self.disconnected() else: self.disconnected() elif propertyName == 'icons': self.setIcons(newValue) else: BlissWidget.propertyChanged(self, propertyName, oldValue, newValue)