def propertyChanged(self, property, oldValue, newValue): #print "LightControlBrick2.propertyChanged",property,newValue if property == 'wagolight': if self.wagoLight is not None: self.disconnect(self.wagoLight, PYSIGNAL('wagoStateChanged'), self.wagoLightStateChanged) self.wagoLight = self.getHardwareObject(newValue) if self.wagoLight is not None: self.connect(self.wagoLight, PYSIGNAL('wagoStateChanged'), self.wagoLightStateChanged) self.wagoLightStateChanged(self.wagoLight.getWagoState()) elif property == 'wagoicons': icons_list = newValue.split() try: self.lightOffButton.setPixmap(Icons.load(icons_list[0])) self.lightOnButton.setPixmap(Icons.load(icons_list[1])) except IndexError: pass elif property == 'mnemonic': MotorSpinBoxBrick.MotorSpinBoxBrick.propertyChanged( self, property, oldValue, newValue) if self.motor is not None: if self.motor.isReady(): limits = self.motor.getLimits() motor_range = float(limits[1] - limits[0]) self['delta'] = str(motor_range / 10.0) else: self['delta'] = 1.0 else: MotorSpinBoxBrick.MotorSpinBoxBrick.propertyChanged( self, property, oldValue, newValue)
def __init__(self, *args): MotorSpinBoxBrick.MotorSpinBoxBrick.__init__(self, *args) self.actuatorLight = None self.lightSavedPosition = None self.addProperty("actuatorlight", "string", "") self.addProperty("actuatoricons", "string", "") self.addProperty("out_delta", "string", "") self.lightOffButton = QPushButton("0", self.extraButtonsBox) self.lightOffButton.setPixmap(Icons.load("far_left")) self.connect( self.lightOffButton, SIGNAL("clicked()"), self.lightButtonOffClicked ) self.lightOnButton = QPushButton("1", self.extraButtonsBox) self.lightOnButton.setPixmap(Icons.load("far_right")) self.connect(self.lightOnButton, SIGNAL("clicked()"), self.lightButtonOnClicked) self.spinBox.close() self.stepButton.close() self.stopButton.close() QToolTip.add( self.lightOffButton, "Switches off the light and sets the intensity to zero" ) QToolTip.add( self.lightOnButton, "Switches on the light and sets the intensity back to the previous setting", ) # self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.lightOffButton.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Minimum) self.lightOnButton.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Minimum)
def __init__(self, *args): MotorSpinBoxBrick.MotorSpinBoxBrick.__init__(self, *args) self.wagoLight = None self.lightSavedPosition = None self.addProperty('wagolight', 'string', '') self.addProperty('wagoicons', 'string', '') self.addProperty('out_delta', 'string', '') self.lightOffButton = QPushButton("0", self.extraButtonsBox) self.lightOffButton.setPixmap(Icons.load('far_left')) self.connect(self.lightOffButton, SIGNAL('clicked()'), self.lightButtonOffClicked) self.lightOnButton = QPushButton("1", self.extraButtonsBox) self.lightOnButton.setPixmap(Icons.load('far_right')) self.connect(self.lightOnButton, SIGNAL('clicked()'), self.lightButtonOnClicked) self.spinBox.close() self.stepButton.close() self.stopButton.close() QToolTip.add(self.lightOffButton, "Switches off the light and sets the intensity to zero") QToolTip.add( self.lightOnButton, "Switches on the light and sets the intensity back to the previous setting" ) #self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.lightOffButton.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Minimum) self.lightOnButton.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Minimum)
def __init__(self, parent, caption = '', minValue = 0, maxValue = 32768, step = 1, unit = ''): """Constructor parent -- the parent QObject caption -- a caption string (default: no caption) minValue -- minimal accepted value (default: 0) maxValue -- maximal accepted value (default: 32768) step -- step (default: 1) unit -- unit string is appended to the end of the displayed value (default: no string)""" ProcedureEntryField.__init__(self, parent, caption) box = QWidget(self) self.spinbox = QSpinBox(minValue, maxValue, step, box) self.spinbox.setSuffix(' ' + str(unit)) okCancelBox = QHBox(box) okCancelBox.setSpacing(0) okCancelBox.setMargin(0) self.cmdOK = QPushButton(okCancelBox) self.cmdCancel = QPushButton(okCancelBox) self.cmdOK.setPixmap(Icons.load('button_ok_small')) #QPixmap(Icons.okXPM)) self.cmdOK.setFixedSize(20, 20) self.cmdCancel.setPixmap(Icons.load('button_cancel_small')) #QPixmap(Icons.cancelXPM)) self.cmdCancel.setFixedSize(20, 20) QObject.connect(self.cmdOK, SIGNAL('clicked()'), self.valueChanged) QObject.connect(self.cmdCancel, SIGNAL('clicked()'), self.cancelClicked) QObject.connect(self.spinbox, SIGNAL('valueChanged(int)'), self.valueChanging) QHBoxLayout(box, 0, 5) box.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.MinimumExpanding) box.layout().addWidget(self.spinbox, 0, Qt.AlignLeft) box.layout().addWidget(okCancelBox, 0, Qt.AlignLeft) box.layout().addItem(QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Fixed)) self.setIsOk(False)
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 __init__(self, parent, caption = ''): """Constructor parent -- the parent QObject caption -- a caption string (default: no caption)""" ProcedureEntryField.__init__(self, parent, caption) box = QWidget(self) self.savedValue = None self.textbox = QLineEdit('', box) okCancelBox = QHBox(box) okCancelBox.setSpacing(0) okCancelBox.setMargin(0) self.cmdOK = QPushButton(okCancelBox) self.cmdOK.setFixedSize(20, 20) self.cmdCancel = QPushButton(okCancelBox) self.cmdCancel.setFixedSize(20, 20) self.cmdOK.setPixmap(Icons.load('button_ok_small')) #QPixmap(Icons.okXPM)) self.cmdCancel.setPixmap(Icons.load('button_cancel_small')) #QPixmap(Icons.cancelXPM)) QObject.connect(self.textbox, SIGNAL('textChanged( const QString & )'), self.valueChanging) QObject.connect(self.textbox, SIGNAL('returnPressed()'), self.valueChanged) QObject.connect(self.cmdOK, SIGNAL('clicked()'), self.valueChanged) QObject.connect(self.cmdCancel, SIGNAL('clicked()'), self.cancelClicked) self.cmdCancel.setEnabled(False) self.cmdOK.setEnabled(True) QHBoxLayout(box, 0, 5) box.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.MinimumExpanding) box.layout().addWidget(self.textbox, 0, Qt.AlignLeft) box.layout().addWidget(okCancelBox, 0, Qt.AlignLeft) box.layout().addItem(QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Fixed))
def __init__(self, *args): MotorSpinBoxBrick.MotorSpinBoxBrick.__init__(self, *args) self.actuatorLight = None self.lightSavedPosition = None self.addProperty("actuatorlight", "string", "") self.addProperty("actuatoricons", "string", "") self.addProperty("out_delta", "string", "") self.lightOffButton = QPushButton("0", self.extraButtonsBox) self.lightOffButton.setPixmap(Icons.load("far_left")) self.connect(self.lightOffButton, SIGNAL("clicked()"), self.lightButtonOffClicked) self.lightOnButton = QPushButton("1", self.extraButtonsBox) self.lightOnButton.setPixmap(Icons.load("far_right")) self.connect(self.lightOnButton, SIGNAL("clicked()"), self.lightButtonOnClicked) self.spinBox.close() self.stepButton.close() self.stopButton.close() QToolTip.add(self.lightOffButton, "Switches off the light and sets the intensity to zero") QToolTip.add( self.lightOnButton, "Switches on the light and sets the intensity back to the previous setting", ) # self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.lightOffButton.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Minimum) self.lightOnButton.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Minimum)
def __init__(self, *args): MotorSpinBoxBrick.MotorSpinBoxBrick.__init__(self, *args) self.wagoLight =None self.lightSavedPosition=None self.addProperty('wagolight', 'string', '') self.addProperty('wagoicons', 'string', '') self.addProperty('out_delta', 'string', '') self.lightOffButton=QPushButton("0",self.extraButtonsBox) self.lightOffButton.setPixmap(Icons.load('far_left')) self.connect(self.lightOffButton,SIGNAL('clicked()'),self.lightButtonOffClicked) self.lightOnButton=QPushButton("1",self.extraButtonsBox) self.lightOnButton.setPixmap(Icons.load('far_right')) self.connect(self.lightOnButton,SIGNAL('clicked()'),self.lightButtonOnClicked) self.spinBox.close() self.stepButton.close() self.stopButton.close() QToolTip.add(self.lightOffButton,"Switches off the light and sets the intensity to zero") QToolTip.add(self.lightOnButton,"Switches on the light and sets the intensity back to the previous setting") #self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.lightOffButton.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Minimum) self.lightOnButton.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Minimum)
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 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, parent): QWidget.__init__(self, parent) self.oldPositions = [] #history of motor positions lblMove = QLabel('go to ', self) self.txtMove = QLineEdit('', self) self.cmdMove = QPushButton('', self) self.cmdGoBack = QPushButton('', self) self.cmdStop = QPushButton('', self) self.txtMove.setFixedWidth(self.txtMove.fontMetrics().width('8888.8888')) self.cmdMove.setToggleButton(True) self.cmdStop.setPixmap(Icons.load('stop_small')) #QPixmap(Icons.stopXPM_small)) self.cmdStop.setEnabled(False) self.cmdGoBack.setPixmap(Icons.load('goback_small')) #QPixmap(Icons.gobackXPM_small)) self.cmdMove.setPixmap(Icons.load('move_small')) #QPixmap(Icons.moveXPM_small)) self.cmdGoBack.setEnabled(False) self.connect(self.cmdMove, SIGNAL('clicked()'), self.cmdMoveClicked) self.connect(self.cmdStop, SIGNAL('clicked()'), PYSIGNAL('stopMotor')) self.connect(self.txtMove, SIGNAL('returnPressed()'), self.txtMoveReturnPressed) self.connect(self.txtMove, SIGNAL('textChanged(const QString &)'), self.txtMoveTextChanged) self.connect(self.cmdGoBack, SIGNAL('clicked()'), self.cmdGoBackClicked) QHBoxLayout(self) self.layout().addItem(QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Fixed)) self.layout().addWidget(lblMove) self.layout().addWidget(self.txtMove) self.layout().addWidget(self.cmdMove) self.layout().addWidget(self.cmdGoBack) self.layout().addWidget(self.cmdStop) self.layout().addItem(QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Fixed))
def setIcons(self, icon_run, icon_stop): self.runIcon = Icons.load(icon_run) self.stopIcon = Icons.load(icon_stop) if self.executing: self.setPixmap(self.stopIcon) else: self.setPixmap(self.runIcon)
def __init__(self, parent, text=''): QHBox.__init__(self, parent) self.setSpacing(5) self.txtControl = QLineEdit(self) self.buttonBox = QHBox(self) self.cmdOK = QPushButton(self.buttonBox) size = self.txtControl.height() * 0.8 buttonSize = QSize(size, size) self.cmdOK.setMaximumSize(buttonSize) self.cmdCancel = QPushButton(self.buttonBox) self.cmdCancel.setMaximumSize(buttonSize) self.cmdOK.setPixmap( Icons.load('button_ok_small')) #QPixmap(Icons.okXPM)) self.cmdCancel.setPixmap( Icons.load('button_cancel_small')) #QPixmap(Icons.cancelXPM)) self.connect(self.cmdOK, SIGNAL('clicked()'), self.cmdOKClicked) self.connect(self.cmdCancel, SIGNAL('clicked()'), self.cmdCancelClicked) self.connect(self.txtControl, SIGNAL('returnPressed()'), self.cmdOKClicked) self.connect(self.txtControl, SIGNAL('textChanged(const QString &)'), self.textChanged) self.setText(text)
def __revertSelectedPolygon(self, nb): for item in self.__getIterator(True): item.includeMode = not item.includeMode if item.includeMode: pixmap = Icons.load('Plus2') else: pixmap = Icons.load('Minus2') item.setPixmap(0, pixmap) self.__setRegion()
def propertyChanged(self,property,oldValue,newValue): #print "LightControlBrick2.propertyChanged",property,newValue if property=='wagolight': if self.wagoLight is not None: self.disconnect(self.wagoLight,PYSIGNAL('wagoStateChanged'),self.wagoLightStateChanged) self.wagoLight=self.getHardwareObject(newValue) if self.wagoLight is not None: self.connect(self.wagoLight,PYSIGNAL('wagoStateChanged'),self.wagoLightStateChanged) self.wagoLightStateChanged(self.wagoLight.getWagoState()) elif property=='wagoicons': icons_list=newValue.split() try: self.lightOffButton.setPixmap(Icons.load(icons_list[0])) self.lightOnButton.setPixmap(Icons.load(icons_list[1])) except IndexError: pass elif property=='mnemonic': MotorSpinBoxBrick.MotorSpinBoxBrick.propertyChanged(self,property,oldValue,newValue) if self.motor is not None: if self.motor.isReady(): limits=self.motor.getLimits() motor_range=float(limits[1]-limits[0]) self['delta']=str(motor_range/10.0) else: self['delta']=1.0 else: MotorSpinBoxBrick.MotorSpinBoxBrick.propertyChanged(self,property,oldValue,newValue)
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 propertyChanged(self, propertyName, oldValue, newValue): if propertyName == 'mnemonic': if self.beamstop is not None: self.disconnect(self.beamstop, PYSIGNAL('equipmentReady'), self.equipmentReady) self.disconnect(self.beamstop, PYSIGNAL('equipmentNotReady'), self.equipmentNotReady) self.disconnect(self.beamstop, PYSIGNAL("positionReached"), self.positionChanged) self.disconnect(self.beamstop, PYSIGNAL("noPosition"), self.positionChanged) self.beamstop = self.getHardwareObject(newValue) if self.beamstop is not None: self.connect(self.beamstop, PYSIGNAL('equipmentReady'), self.equipmentReady) self.connect(self.beamstop, PYSIGNAL('equipmentNotReady'), self.equipmentNotReady) self.connect(self.beamstop, PYSIGNAL("positionReached"), self.positionChanged) self.connect(self.beamstop, PYSIGNAL("noPosition"), self.positionChanged) self.connect(self.beamstop, PYSIGNAL("stateChanged"), self.stateChanged) help = self['setin'] + " the " + self.beamstop.userName( ).lower() QToolTip.add(self.setInButton, help) help = self['setout'] + " the " + self.beamstop.userName( ).lower() QToolTip.add(self.setOutButton, help) self.containerBox.setTitle(self.beamstop.userName()) #self.alignmentDialog.setMnemonic(newValue) if self.beamstop.isReady(): self.equipmentReady() else: self.equipmentNotReady() else: self.equipmentNotReady() self.wrapperHO = self.beamstop elif propertyName == 'setupIcon': if newValue == "": self.stateLabel.setButtonText('+') else: self.stateLabel.setButtonPixmap(Icons.load(newValue)) elif propertyName == 'stopIcon': if newValue == "": self.stateLabel.setButtonStopText('*') else: self.stateLabel.setButtonStopPixmap(Icons.load(newValue)) elif propertyName == 'icons': DuoStateBrick.propertyChanged.im_func(self, propertyName, oldValue, newValue) else: BaseComponents.BlissWidget.propertyChanged(self, propertyName, oldValue, newValue)
def addConnection(senderWindow, sender, connection): newItem = QListViewItem(self.lstConnections) windowName = senderWindow["name"] newItem.setText(1, windowName) if sender != senderWindow: # object-* newItem.setText(2, sender["name"]) newItem.setText(4, connection["receiverWindow"]) try: receiverWindow = self.configuration.windows[connection["receiverWindow"]] except KeyError: receiverWindow = {} ok = False else: ok = True if len(connection["receiver"]): # *-object newItem.setText(5, connection["receiver"]) ok = ok and receiverInWindow(connection["receiver"], receiverWindow) if ok: newItem.setPixmap(0, Icons.load('button_ok_small')) else: newItem.setPixmap(0, Icons.load('button_cancel_small')) newItem.setText(3, connection['signal']) newItem.setText(6, connection['slot']) self.lstConnections.insertItem(newItem)
def __revertSelectedPolygon(self,nb) : for item in self.__getIterator(True) : item.includeMode = not item.includeMode if item.includeMode: pixmap = Icons.load('Plus2') else: pixmap = Icons.load('Minus2') item.setPixmap(0,pixmap) self.__setRegion()
def setIcons(self, load_icon, unload_icon): self.loadIcon = Icons.load(load_icon) self.unloadIcon = Icons.load(unload_icon) txt = str(self.buttonLoad.textLabel()).split()[0] if txt == "Mount": self.buttonLoad.setPixmap(self.loadIcon) elif txt == "Unmount": self.buttonLoad.setPixmap(self.unloadIcon)
def __init__(self, table, text): QTableItem.__init__( self, table, QTableItem.Never, text) self.pixs = [ Icons.load('blank'), # OFF Icons.load('red_led'), # MOVING Icons.load('green_led'), # ON Icons.load('yellow_led') ] # ERROR self.off()
def setIcons(self,load_icon,unload_icon): self.loadIcon=Icons.load(load_icon) self.unloadIcon=Icons.load(unload_icon) txt=str(self.buttonLoad.textLabel()).split()[0] if txt=="Mount": self.buttonLoad.setPixmap(self.loadIcon) elif txt=="Unmount": self.buttonLoad.setPixmap(self.unloadIcon)
def propertyChanged(self,propertyName,oldValue,newValue): if propertyName=='mnemonic': if self.beamstop is not None: self.disconnect(self.beamstop, PYSIGNAL('equipmentReady'), self.equipmentReady) self.disconnect(self.beamstop, PYSIGNAL('equipmentNotReady'), self.equipmentNotReady) self.disconnect(self.beamstop, PYSIGNAL("positionReached"), self.positionChanged) self.disconnect(self.beamstop, PYSIGNAL("noPosition"), self.positionChanged) self.beamstop = self.getHardwareObject(newValue) if self.beamstop is not None: self.connect(self.beamstop, PYSIGNAL('equipmentReady'), self.equipmentReady) self.connect(self.beamstop, PYSIGNAL('equipmentNotReady'), self.equipmentNotReady) self.connect(self.beamstop, PYSIGNAL("positionReached"), self.positionChanged) self.connect(self.beamstop, PYSIGNAL("noPosition"), self.positionChanged) help=self['setin']+" the "+self.beamstop.userName().lower() QToolTip.add(self.setInButton,help) help=self['setout']+" the "+self.beamstop.userName().lower() QToolTip.add(self.setOutButton,help) if not "in" in self.beamstop.positions or not "out" in self.beamstop.positions: logging.getLogger().warning("%s: vertical beamstop motor does not define In and Out positions", str(self.name())) self.containerBox.setTitle(self.beamstop.userName()) self.alignmentDialog.setMnemonic(newValue) # do some checkings... try: bstopz = self.beamstop.getDeviceByRole("vertical").getMotorMnemonic() bstopy = self.beamstop.getDeviceByRole("horizontal").getMotorMnemonic() except: logging.getLogger().error("%s: could not find vertical and horizontal motors in Hardware Object %s", str(self.name()), self.beamstop.name()) if self.beamstop.isReady(): self.beamstop.setNewPositions("out", {"vertical": self.beamstop.getDeviceByRole("vertical").getLimits()[0] }) self.equipmentReady() self.beamstop.checkPosition() else: self.equipmentNotReady() else: self.equipmentNotReady() self.wrapperHO=self.beamstop elif propertyName=='setupIcon': if newValue=="": self.stateLabel.setButtonText('+') else: self.stateLabel.setButtonPixmap(Icons.load(newValue)) elif propertyName=='stopIcon': if newValue=="": self.stateLabel.setButtonStopText('*') else: self.stateLabel.setButtonStopPixmap(Icons.load(newValue)) elif propertyName=='icons': DuoStateBrick.propertyChanged.__func__(self,propertyName,oldValue,newValue) else: BaseComponents.BlissWidget.propertyChanged(self,propertyName,oldValue,newValue)
def propertyChanged(self,propertyName,oldValue,newValue): if propertyName=='mnemonic': if self.beamstop is not None: self.disconnect(self.beamstop, PYSIGNAL('equipmentReady'), self.equipmentReady) self.disconnect(self.beamstop, PYSIGNAL('equipmentNotReady'), self.equipmentNotReady) self.disconnect(self.beamstop, PYSIGNAL("positionReached"), self.positionChanged) self.disconnect(self.beamstop, PYSIGNAL("noPosition"), self.positionChanged) self.beamstop = self.getHardwareObject(newValue) if self.beamstop is not None: self.connect(self.beamstop, PYSIGNAL('equipmentReady'), self.equipmentReady) self.connect(self.beamstop, PYSIGNAL('equipmentNotReady'), self.equipmentNotReady) self.connect(self.beamstop, PYSIGNAL("positionReached"), self.positionChanged) self.connect(self.beamstop, PYSIGNAL("noPosition"), self.positionChanged) help=self['setin']+" the "+self.beamstop.userName().lower() QToolTip.add(self.setInButton,help) help=self['setout']+" the "+self.beamstop.userName().lower() QToolTip.add(self.setOutButton,help) if not "in" in self.beamstop.positions or not "out" in self.beamstop.positions: logging.getLogger().warning("%s: vertical beamstop motor does not define In and Out positions", str(self.name())) self.containerBox.setTitle(self.beamstop.userName()) self.alignmentDialog.setMnemonic(newValue) # do some checkings... try: bstopz = self.beamstop.getDeviceByRole("vertical").getMotorMnemonic() bstopy = self.beamstop.getDeviceByRole("horizontal").getMotorMnemonic() except: logging.getLogger().error("%s: could not find vertical and horizontal motors in Hardware Object %s", str(self.name()), self.beamstop.name()) if self.beamstop.isReady(): self.beamstop.setNewPositions("out", {"vertical": self.beamstop.getDeviceByRole("vertical").getLimits()[0] }) self.equipmentReady() self.beamstop.checkPosition() else: self.equipmentNotReady() else: self.equipmentNotReady() self.wrapperHO=self.beamstop elif propertyName=='setupIcon': if newValue=="": self.stateLabel.setButtonText('+') else: self.stateLabel.setButtonPixmap(Icons.load(newValue)) elif propertyName=='stopIcon': if newValue=="": self.stateLabel.setButtonStopText('*') else: self.stateLabel.setButtonStopPixmap(Icons.load(newValue)) elif propertyName=='icons': DuoStateBrick.propertyChanged.im_func(self,propertyName,oldValue,newValue) else: BaseComponents.BlissWidget.propertyChanged(self,propertyName,oldValue,newValue)
def setIcons(self,icon_run,icon_stop=None): self.runIcon=Icons.load(icon_run) if icon_stop is not None: self.stopIcon=Icons.load(icon_stop) if self.executing and icon_stop is not None: self.setPixmap(self.stopIcon) else: self.setPixmap(self.runIcon)
def propertyChanged(self, propertyName, oldValue, newValue): if propertyName == 'mnemonic': if self.instanceServer is not None: self.disconnect(self.instanceServer,PYSIGNAL('instanceInitializing'),self.instanceInitializing) self.disconnect(self.instanceServer,PYSIGNAL('serverInitialized'),self.serverInitialized) self.disconnect(self.instanceServer,PYSIGNAL('clientInitialized'),self.clientInitialized) self.disconnect(self.instanceServer,PYSIGNAL('serverClosed'),self.serverClosed) self.disconnect(self.instanceServer,PYSIGNAL('newClient'), self.newClient) self.disconnect(self.instanceServer,PYSIGNAL('haveControl'), self.haveControl) self.disconnect(self.instanceServer,PYSIGNAL('passControl'), self.passControl) self.disconnect(self.instanceServer,PYSIGNAL('wantsControl'), self.wantsControl) self.disconnect(self.instanceServer,PYSIGNAL('widgetUpdate'), self.widgetUpdate) self.disconnect(self.instanceServer,PYSIGNAL('clientChanged'), self.clientChanged) self.disconnect(self.instanceServer,PYSIGNAL('clientClosed'), self.clientClosed) self.disconnect(self.instanceServer,PYSIGNAL('widgetCall'), self.widgetCall) self.instanceServer = self.getHardwareObject(newValue) if self.instanceServer is not None: self.connect(self.instanceServer,PYSIGNAL('instanceInitializing'),self.instanceInitializing) self.connect(self.instanceServer,PYSIGNAL('serverInitialized'),self.serverInitialized) self.connect(self.instanceServer,PYSIGNAL('clientInitialized'),self.clientInitialized) self.connect(self.instanceServer,PYSIGNAL('serverClosed'),self.serverClosed) self.connect(self.instanceServer,PYSIGNAL('newClient'), self.newClient) self.connect(self.instanceServer,PYSIGNAL('haveControl'), self.haveControl) self.connect(self.instanceServer,PYSIGNAL('passControl'), self.passControl) self.connect(self.instanceServer,PYSIGNAL('wantsControl'), self.wantsControl) self.connect(self.instanceServer,PYSIGNAL('widgetUpdate'), self.widgetUpdate) self.connect(self.instanceServer,PYSIGNAL('clientChanged'), self.clientChanged) self.connect(self.instanceServer,PYSIGNAL('clientClosed'), self.clientClosed) self.connect(self.instanceServer,PYSIGNAL('widgetCall'), self.widgetCall) elif propertyName=="xmlrpc_server": self.xmlrpc_server = self.getHardwareObject(newValue) elif propertyName == 'hutchtrigger': self.hutchtrigger = self.getHardwareObject(newValue) if self.hutchtrigger is not None: self.connect(self.hutchtrigger, PYSIGNAL("hutchTrigger"), self.hutchTriggerChanged) elif propertyName == 'icons': icons_list=newValue.split() try: self.serverIcon=Icons.load(icons_list[0]) except IndexError: pass try: self.clientIcon=Icons.load(icons_list[1]) except IndexError: pass try: self.takeControlButton.setPixmap(Icons.load(icons_list[2])) except IndexError: pass try: self.askForControlButton.setPixmap(Icons.load(icons_list[3])) except IndexError: pass else: BlissWidget.propertyChanged(self,propertyName,oldValue,newValue)
def __init__(self, table, text): QTableItem.__init__(self, table, QTableItem.Never, text) self.pixs = [ Icons.load('blank'), # OFF Icons.load('red_led'), # MOVING Icons.load('green_led'), # ON Icons.load('yellow_led') ] # ERROR self.off()
def setIcons(self, icons): icons_list = icons.split() try: self.snapshotButton.setPixmap(Icons.load(icons_list[0])) except IndexError: pass try: self.settingsButton.setPixmap(Icons.load(icons_list[1])) except IndexError: pass
def createEditor(self): validationPanel = QHBox(self.table().viewport(), 'validationPanel') self.OK = QToolButton(validationPanel) self.OK.setAutoRaise(True) self.OK.setIconSet(QIconSet(Icons.load('button_ok_small'))) #QPixmap(Icons.tinyOK))) self.Cancel = QToolButton(validationPanel) self.Cancel.setAutoRaise(True) self.Cancel.setIconSet(QIconSet(Icons.load('button_cancel_small'))) #QPixmap(Icons.tinyCancel))) self.Reset = QToolButton(validationPanel) self.Reset.setIconSet(QIconSet(Icons.load('button_default_small'))) #QPixmap(Icons.defaultXPM))) self.Reset.setAutoRaise(True) self.setEnabled(False) return validationPanel
def propertyChanged(self, propertyName, oldValue, newValue): if propertyName == 'mnemonic': if self.instanceServer is not None: self.disconnect(self.instanceServer,PYSIGNAL('chatMessageReceived'), self.messageArrived) self.disconnect(self.instanceServer,PYSIGNAL('newClient'), self.newClient) self.disconnect(self.instanceServer,PYSIGNAL('serverInitialized'),self.serverInitialized) self.disconnect(self.instanceServer,PYSIGNAL('clientInitialized'),self.clientInitialized) self.disconnect(self.instanceServer,PYSIGNAL('serverClosed'), self.clientClosed) self.disconnect(self.instanceServer,PYSIGNAL('wantsControl'), self.wantsControl) self.disconnect(self.instanceServer,PYSIGNAL('haveControl'), self.haveControl) self.disconnect(self.instanceServer,PYSIGNAL('passControl'), self.passControl) self.disconnect(self.instanceServer,PYSIGNAL('clientClosed'), self.clientClosed) self.disconnect(self.instanceServer,PYSIGNAL('clientChanged'), self.clientChanged) self.instanceServer = self.getHardwareObject(newValue) if self.instanceServer is not None: self.connect(self.instanceServer,PYSIGNAL('chatMessageReceived'), self.messageArrived) self.connect(self.instanceServer,PYSIGNAL('newClient'), self.newClient) self.connect(self.instanceServer,PYSIGNAL('serverInitialized'),self.serverInitialized) self.connect(self.instanceServer,PYSIGNAL('clientInitialized'),self.clientInitialized) self.connect(self.instanceServer,PYSIGNAL('serverClosed'), self.clientClosed) self.connect(self.instanceServer,PYSIGNAL('wantsControl'), self.wantsControl) self.connect(self.instanceServer,PYSIGNAL('haveControl'), self.haveControl) self.connect(self.instanceServer,PYSIGNAL('passControl'), self.passControl) self.connect(self.instanceServer,PYSIGNAL('clientClosed'), self.clientClosed) self.connect(self.instanceServer,PYSIGNAL('clientChanged'), self.clientChanged) elif propertyName == 'icons': icons_list=newValue.split() try: self.sendButton.setPixmap(Icons.load(icons_list[0])) except IndexError: pass else: BaseComponents.BlissWidget.propertyChanged(self,propertyName,oldValue,newValue)
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, title = "", name = "", iconName = "", min = 0, max = 0): QVBox.__init__(self, parent) self.currentItem = 0 #not initialized self.currentMatrixCode = None self.name = name self.min = min self.max = max self.setMargin(5) self.setSpacing(5) titleBox = QHBox(self) HorizontalSpacer(titleBox) lblItemIcon = QLabel(titleBox) lblTitle = QLabel(title, titleBox) HorizontalSpacer(titleBox) titleBox.setSpacing(5) lblItemIcon.setPixmap(Icons.load(iconName)) self.lblCurrentItem = QLabel(self) lblItemIcon.setAlignment(Qt.AlignHCenter) self.lblCurrentItem.setAlignment(Qt.AlignHCenter) cmdBox = QHBox(self) self.cmdPrevious = QPushButton("<", cmdBox) self.cmdChange = QPushButton("Change", cmdBox) self.cmdNext = QPushButton(">", cmdBox) QObject.connect(self.cmdChange, SIGNAL("clicked()"), self.cmdChangeClicked) QObject.connect(self.cmdPrevious, SIGNAL("clicked()"), self.cmdPreviousClicked) QObject.connect(self.cmdNext, SIGNAL("clicked()"), self.cmdNextClicked)
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 tab_slot( self, hide=True, page={ "widget": scrollview, "label": self.tabLabel(scrollview), "index": self.indexOf(scrollview), "icon": icon, "hidden": False }): if hide: if not page["hidden"]: self.removePage(page["widget"]) page["hidden"] = True else: if page["hidden"]: if icon: pixmap = Icons.load(icon) self.insertTab(page["widget"], qt.QIconSet(pixmap, pixmap), label, page["index"]) else: self.insertTab(page["widget"], page["label"], page["index"]) self.showPage(page["widget"]) page["hidden"] = False else: self.showPage(page["widget"])
def __createPolygon(self, nb): try: showgButton = self._widgetTree.child('__showGrab') showgButton.setOn(True) grabButton = self._widgetTree.child('__grabButton') grabButton.setOn(False) polygon = QubPolygoneDrawingMgr(self._view.canvas(), self._view.matrix()) polygon.setActionInfo('Drawing mask plygon %d' % self.__polyNb) polygon.setEndDrawCallBack(self.__polygonCBK) polygon.setAutoDisconnectEvent(True) drawingObject = QubCanvasCloseLinePolygone(self._view.canvas()) polygon.addDrawingObject(drawingObject) self._view.addDrawingMgr(polygon) polygon.setColor(self._view.foregroundColor()) newItem = qt.QListViewItem(self.__polygonListWidget) newItem.setText(0, 'Polygon %d' % self.__polyNb) newItem.setPixmap(0, Icons.load('Plus2')) newItem.drawingManager = polygon newItem.includeMode = True self.__polyNb += 1 polygon.startDrawing() except: import traceback traceback.print_exc()
def __init__(self, parent = None, name = "task_toolbox"): qt.QWidget.__init__(self, parent, name) # Data atributes self.shape_history = None self.tree_brick = None self.previous_page_index = 0 #Layout self.v_layout = qt.QVBoxLayout(self) self.v_layout.setSpacing(10) self.method_group_box = qt.QVGroupBox("Collection method", self) font = self.method_group_box.font() font.setPointSize(12) self.method_group_box.setFont(font) self.tool_box = qt.QToolBox(self.method_group_box , "tool_box") self.tool_box.setFixedWidth(475) font = self.tool_box.font() font.setPointSize(10) self.tool_box.setFont(font) self.discrete_page = CreateDiscreteWidget(self.tool_box, "Discrete",) self.discrete_page.setBackgroundMode(qt.QWidget.PaletteBackground) self.char_page = CreateCharWidget(self.tool_box, "Characterise") self.char_page.setBackgroundMode(qt.QWidget.PaletteBackground) self.helical_page = CreateHelicalWidget(self.tool_box, "helical_page") self.helical_page.setBackgroundMode(qt.QWidget.PaletteBackground) self.energy_scan_page = CreateEnergyScanWidget(self.tool_box, "energy_scan") self.xrf_scan_page = CreateXRFScanWidget(self.tool_box, "xrf_scan") self.workflow_page = CreateWorkflowWidget(self.tool_box, 'workflow') self.tool_box.addItem(self.discrete_page, "Standard Collection") self.tool_box.addItem(self.char_page, "Characterisation") self.tool_box.addItem(self.helical_page, "Helical Collection") self.tool_box.addItem(self.energy_scan_page, "Energy Scan") self.tool_box.addItem(self.xrf_scan_page, "XRF Scan") self.tool_box.addItem(self.workflow_page, "Advanced") self.add_pixmap = Icons.load("add_row.png") self.create_task_button = qt.QPushButton(" Add to queue", self) self.create_task_button.setIconSet(qt.QIconSet(self.add_pixmap)) msg = "Add the collection method to the selected sample" qt.QToolTip.add(self.create_task_button, msg) self.v_layout.addWidget(self.method_group_box) self.button_hlayout = qt.QHBoxLayout(None) self.spacer = qt.QSpacerItem(1, 20, qt.QSizePolicy.Expanding, qt.QSizePolicy.Minimum) self.button_hlayout.addItem(self.spacer) self.button_hlayout.addWidget(self.create_task_button) self.method_group_box.layout().setSpacing(10) self.method_group_box.layout().addLayout(self.button_hlayout) qt.QObject.connect(self.create_task_button, qt.SIGNAL("clicked()"), self.create_task_button_click) qt.QObject.connect(self.tool_box, qt.SIGNAL("currentChanged( int )"), self.current_page_changed)
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 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 __createPolygon(self,nb) : try: showgButton = self._widgetTree.child('__showGrab') showgButton.setOn(True) grabButton = self._widgetTree.child('__grabButton') grabButton.setOn(False) polygon = QubPolygoneDrawingMgr(self._view.canvas(),self._view.matrix()) polygon.setActionInfo('Drawing mask plygon %d' % self.__polyNb) polygon.setEndDrawCallBack(self.__polygonCBK) polygon.setAutoDisconnectEvent(True) drawingObject = QubCanvasCloseLinePolygone(self._view.canvas()) polygon.addDrawingObject(drawingObject) self._view.addDrawingMgr(polygon) polygon.setColor(self._view.foregroundColor()) newItem = qt.QListViewItem(self.__polygonListWidget) newItem.setText(0,'Polygon %d' % self.__polyNb) newItem.setPixmap(0,Icons.load('Plus2')) newItem.drawingManager = polygon newItem.includeMode = True self.__polyNb += 1 polygon.startDrawing() except: import traceback traceback.print_exc()
def propertyChanged(self,propertyName,oldValue,newValue): if propertyName=='mnemonic': if self.beamstop is not None: self.disconnect(self.beamstop, PYSIGNAL('equipmentReady'), self.equipmentReady) self.disconnect(self.beamstop, PYSIGNAL('equipmentNotReady'), self.equipmentNotReady) self.disconnect(self.beamstop, PYSIGNAL("positionReached"), self.positionChanged) self.disconnect(self.beamstop, PYSIGNAL("noPosition"), self.positionChanged) self.beamstop = self.getHardwareObject(newValue) if self.beamstop is not None: self.connect(self.beamstop, PYSIGNAL('equipmentReady'), self.equipmentReady) self.connect(self.beamstop, PYSIGNAL('equipmentNotReady'), self.equipmentNotReady) self.connect(self.beamstop, PYSIGNAL("positionReached"), self.positionChanged) self.connect(self.beamstop, PYSIGNAL("noPosition"), self.positionChanged) self.connect(self.beamstop, PYSIGNAL("stateChanged"), self.stateChanged) help=self['setin']+" the "+self.beamstop.userName().lower() QToolTip.add(self.setInButton,help) help=self['setout']+" the "+self.beamstop.userName().lower() QToolTip.add(self.setOutButton,help) self.containerBox.setTitle(self.beamstop.userName()) #self.alignmentDialog.setMnemonic(newValue) if self.beamstop.isReady(): self.equipmentReady() else: self.equipmentNotReady() else: self.equipmentNotReady() self.wrapperHO=self.beamstop elif propertyName=='setupIcon': if newValue=="": self.stateLabel.setButtonText('+') else: self.stateLabel.setButtonPixmap(Icons.load(newValue)) elif propertyName=='stopIcon': if newValue=="": self.stateLabel.setButtonStopText('*') else: self.stateLabel.setButtonStopPixmap(Icons.load(newValue)) elif propertyName=='icons': DuoStateBrick.propertyChanged.im_func(self,propertyName,oldValue,newValue) else: BaseComponents.BlissWidget.propertyChanged(self,propertyName,oldValue,newValue)
def propertyChanged(self, propertyName, oldValue, newValue): # print "propertyChanged",propertyName,newValue if propertyName == "mnemonic": if self.listObj is not None: self.disconnect(self.listObj, PYSIGNAL("connected"), self.connected) self.disconnect( self.listObj, PYSIGNAL("disconnected"), self.disconnected ) self.disconnect( self.listObj, PYSIGNAL("motorListChanged"), self.motorsChanged ) self.listObj = self.getHardwareObject(newValue) if self.listObj is not None: self.connect(self.listObj, PYSIGNAL("connected"), self.connected) self.connect(self.listObj, PYSIGNAL("disconnected"), self.disconnected) self.connect( self.listObj, PYSIGNAL("motorListChanged"), self.motorsChanged ) if self.listObj.isConnected(): self.connected() else: self.disconnected() self.motorsChanged( self.listObj.getSpecVersion(), self.listObj.getMotorList() ) else: self.disconnected() self.motorsChanged(None, None) elif propertyName == "icons": icons_list = newValue.split() try: self.openButton.setPixmap(Icons.load(icons_list[0])) self.motorsList.setSizePolicy( QSizePolicy.MinimumExpanding, QSizePolicy.Minimum ) self.openButton.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum) except IndexError: pass elif propertyName == "showDialogButton": if newValue: self.openButton.show() else: self.openButton.hide() elif propertyName == "showBox": if newValue: self.containerBox.setFrameShape(self.containerBox.GroupBoxPanel) self.containerBox.setInsideMargin(4) self.containerBox.setInsideSpacing(0) self.containerBox.setTitle("Available motors") else: self.containerBox.setFrameShape(self.containerBox.NoFrame) self.containerBox.setInsideMargin(0) self.containerBox.setInsideSpacing(0) self.containerBox.setTitle("") else: BaseComponents.BlissWidget.propertyChanged( self, propertyName, oldValue, newValue )
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 propertyChanged(self, propertyName, oldValue, newValue): # print "propertyChanged",propertyName,newValue if propertyName == "mnemonic": if self.listObj is not None: self.disconnect(self.listObj, PYSIGNAL("connected"), self.connected) self.disconnect(self.listObj, PYSIGNAL("disconnected"), self.disconnected) self.disconnect(self.listObj, PYSIGNAL("motorListChanged"), self.motorsChanged) self.listObj = self.getHardwareObject(newValue) if self.listObj is not None: self.connect(self.listObj, PYSIGNAL("connected"), self.connected) self.connect(self.listObj, PYSIGNAL("disconnected"), self.disconnected) self.connect(self.listObj, PYSIGNAL("motorListChanged"), self.motorsChanged) if self.listObj.isConnected(): self.connected() else: self.disconnected() self.motorsChanged(self.listObj.getSpecVersion(), self.listObj.getMotorList()) else: self.disconnected() self.motorsChanged(None, None) elif propertyName == "icons": icons_list = newValue.split() try: self.openButton.setPixmap(Icons.load(icons_list[0])) self.motorsList.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Minimum) self.openButton.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum) except IndexError: pass elif propertyName == "showDialogButton": if newValue: self.openButton.show() else: self.openButton.hide() elif propertyName == "showBox": if newValue: self.containerBox.setFrameShape( self.containerBox.GroupBoxPanel) self.containerBox.setInsideMargin(4) self.containerBox.setInsideSpacing(0) self.containerBox.setTitle("Available motors") else: self.containerBox.setFrameShape(self.containerBox.NoFrame) self.containerBox.setInsideMargin(0) self.containerBox.setInsideSpacing(0) self.containerBox.setTitle("") else: BaseComponents.BlissWidget.propertyChanged(self, propertyName, oldValue, newValue)
def __init__(self, parent, layout, initialValue, title='', prefix=''): QVBox.__init__(self, parent) self.prefix = prefix self.value = initialValue self.lblTitle = QLabel(title, self) selectionBox = QHBox(self) self.editionBox = QHBox(selectionBox) if layout == stepEditor.RightLayout: self.cmdSelectValue = QPushButton(prefix + str(initialValue), selectionBox) self.cmdEditValue = QPushButton('...', selectionBox) else: self.cmdEditValue = QPushButton('...', selectionBox) self.cmdSelectValue = QPushButton(prefix + str(initialValue), selectionBox) self.txtNewValue = QLineEdit(self.editionBox) self.cmdOK = QPushButton(self.editionBox) self.cmdCancel = QPushButton(self.editionBox) self.cmdCancel.setPixmap( Icons.load('button_cancel_small')) #QPixmap(Icons.tinyCancel)) self.cmdOK.setPixmap(Icons.load('button_ok_small')) #Icons.tinyOK)) self.editionBox.hide() self.lblTitle.hide() self.setFocusProxy(self.txtNewValue) self.txtNewValue.setFixedWidth(self.fontMetrics().width(' 888.888 ')) self.cmdEditValue.setFixedWidth(self.fontMetrics().width(' ... ')) self.cmdSelectValue.setFixedWidth( self.fontMetrics().width(prefix + ' 888.888 ')) self.cmdSelectValue.setAutoDefault(False) self.cmdOK.setFixedWidth(20) self.cmdCancel.setFixedWidth(20) self.editionBox.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.connect(self.cmdSelectValue, SIGNAL('clicked()'), self.cmdSelectValueClicked) self.connect(self.cmdEditValue, SIGNAL('clicked()'), self.cmdEditValueClicked) self.connect(self.txtNewValue, SIGNAL('returnPressed()'), self.validateNewValue) self.connect(self.cmdOK, SIGNAL('clicked()'), self.validateNewValue) self.connect(self.cmdCancel, SIGNAL('clicked()'), self.endEdit)
def setIcons(self, icons): icons_list = icons.split() try: self.startScanButton.setIcons(icons_list[0], icons_list[1]) except IndexError: pass try: self.acceptButton.setPixmap(Icons.load(icons_list[2])) except IndexError: pass try: self.resetButton.setPixmap(Icons.load(icons_list[3])) except IndexError: pass try: self.browseButton.setPixmap(Icons.load(icons_list[4])) except IndexError: pass
def createEditor(self): validationPanel = QHBox(self.table().viewport(), "validationPanel") self.OK = QToolButton(validationPanel) self.OK.setAutoRaise(True) # QPixmap(Icons.tinyOK))) self.OK.setIconSet(QIconSet(Icons.load("button_ok_small"))) self.Cancel = QToolButton(validationPanel) self.Cancel.setAutoRaise(True) # QPixmap(Icons.tinyCancel))) self.Cancel.setIconSet(QIconSet(Icons.load("button_cancel_small"))) self.Reset = QToolButton(validationPanel) # QPixmap(Icons.defaultXPM))) self.Reset.setIconSet(QIconSet(Icons.load("button_default_small"))) self.Reset.setAutoRaise(True) self.setEnabled(False) return validationPanel
def setIcons(self, icons): icons_list = icons.split() try: self.buttonCentre.setIcons(icons_list[0], icons_list[1]) except IndexError: pass try: self.buttonAccept.setPixmap(Icons.load(icons_list[2])) except IndexError: pass try: self.buttonSnapshot.setPixmap(Icons.load(icons_list[3])) except IndexError: pass try: self.buttonReject.setPixmap(Icons.load(icons_list[4])) except IndexError: pass
def setIcons(self,icons): icons_list=icons.split() try: self.buttonCentre.setIcons(icons_list[0],icons_list[1]) except IndexError: pass try: self.buttonAccept.setPixmap(Icons.load(icons_list[2])) except IndexError: pass try: self.buttonSnapshot.setPixmap(Icons.load(icons_list[3])) except IndexError: pass try: self.buttonReject.setPixmap(Icons.load(icons_list[4])) except IndexError: pass
def addPendingConnection(self, connectionDict): newItem = QListViewItem( self.lstConnections, '', connectionDict['senderWindow'], connectionDict['senderObject'], connectionDict['signal'], connectionDict['receiverWindow'], connectionDict['receiverObject'], connectionDict['slot']) newItem.setPixmap(0, Icons.load('button_ok_small')) self.lstConnections.insertItem(newItem)
def __init__(self, parent): QWidget.__init__(self, parent) self.oldPositions = [] # history of motor positions lblMove = QLabel("go to ", self) self.txtMove = QLineEdit("", self) self.cmdMove = QPushButton("", self) self.cmdGoBack = QPushButton("", self) self.cmdStop = QPushButton("", self) self.txtMove.setFixedWidth(self.txtMove.fontMetrics().width("8888.8888")) self.cmdMove.setToggleButton(True) # QPixmap(Icons.stopXPM_small)) self.cmdStop.setPixmap(Icons.load("stop_small")) self.cmdStop.setEnabled(False) # QPixmap(Icons.gobackXPM_small)) self.cmdGoBack.setPixmap(Icons.load("goback_small")) # QPixmap(Icons.moveXPM_small)) self.cmdMove.setPixmap(Icons.load("move_small")) self.cmdGoBack.setEnabled(False) self.connect(self.cmdMove, SIGNAL("clicked()"), self.cmdMoveClicked) self.connect(self.cmdStop, SIGNAL("clicked()"), PYSIGNAL("stopMotor")) self.connect(self.txtMove, SIGNAL("returnPressed()"), self.txtMoveReturnPressed) self.connect( self.txtMove, SIGNAL("textChanged(const QString &)"), self.txtMoveTextChanged, ) self.connect(self.cmdGoBack, SIGNAL("clicked()"), self.cmdGoBackClicked) QHBoxLayout(self) self.layout().addItem( QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Fixed) ) self.layout().addWidget(lblMove) self.layout().addWidget(self.txtMove) self.layout().addWidget(self.cmdMove) self.layout().addWidget(self.cmdGoBack) self.layout().addWidget(self.cmdStop) self.layout().addItem( QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Fixed) )
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 setIcons(self, icons): icons_list = icons.split() try: self.startSpectrumButton.setIcons(icons_list[0], icons_list[1]) except IndexError: pass try: self.browseButton.setPixmap(Icons.load(icons_list[2])) except IndexError: pass