def setupView(self): """ setupView() -> recreate the QListView attribute """ parent = self.parent() view = self.view view.clear() header = view.header() for index in range(header.count()): header.removeLabel(index) view.addColumn(i18n('Account Key')) view.addColumn(i18n('Last Value')) view.setSelectionMode(qt.QListView.Single) view.setColumnWidthMode(0, qt.QListView.Maximum) ## ## sampleKeys needs to become account data keys ## displayed_keys = parent.summaries.keys() all_keys = sampleKeys for key in all_keys: item = qt.QCheckListItem(view, key, qt.QCheckListItem.CheckBox) #item.setText(1, '%s' % some_last_value) if key in displayed_keys: item.setOn(True)
def slotAccount(self, event): """slotAccount(event) -> update list view from broker data """ key, value = event.key, event.value item = self.findItem(key, 0) if item: item.setText(1, str(value)) else: item = qt.QCheckListItem(self, key, qt.QCheckListItem.CheckBox) item.setText(1, '%s' % value)
def fill(self): self._treeview.clear() channels = sysconf.get("channels", {}) aliases = channels.keys() aliases.sort() for alias in aliases: channel = channels[alias] if not channel.get("disabled"): item = qt.QCheckListItem(self._treeview, "", qt.QCheckListItem.CheckBox) item.setOn(False) item.setText(1, str(alias)) item.setText(2, channel.get("type", "")) item.setText(3, channel.get("name", ""))
def fill(self): self._treeview.clear() channels = sysconf.get("channels", {}) aliases = channels.keys() aliases.sort() for alias in aliases: channel = channels[alias] item = qt.QCheckListItem(self._treeview, "", qt.QCheckListItem.CheckBoxController) item.setOn(not strToBool(channel.get("disabled"))) item.setText(1, str(channel.get("priority", 0))) item.setText(2, alias) item.setText(3, channel.get("type", "")) item.setText(4, channel.get("name", ""))
def propertyChanged(self, propertyName, oldValue, newValue): if propertyName == 'horizontal': if self.__hMotor: self.disconnect(self.__hMotor, qt.PYSIGNAL("positionChanged"), self.__hMotorPositionChanged) self.__hMotor = self.getHardwareObject(newValue) self.connect(self.__hMotor, qt.PYSIGNAL("positionChanged"), self.__hMotorPositionChanged) self.connect(self.__hMotor, qt.PYSIGNAL("limitsChanged"), self.__hMotorLimitsChanged) elif propertyName == 'vertical': if self.__vMotor: self.disconnect(self.__vMotor, qt.PYSIGNAL("positionChanged"), self.__vMotorPositionChanged) self.__vMotor = self.getHardwareObject(newValue) self.connect(self.__vMotor, qt.PYSIGNAL("positionChanged"), self.__vMotorPositionChanged) self.connect(self.__vMotor, qt.PYSIGNAL("limitsChanged"), self.__vMotorLimitsChanged) elif propertyName == 'save_motors': equipment = self.getHardwareObject(newValue) self.__motor_pos_save = [] if equipment: try: ho = equipment['motors'] except KeyError: print equipment.userName( ), 'is not an Equipment : no <motors> section.' return for motor in ho.getDevices(): self.__motor_pos_save.append(motor) #Refresh Tree column nbColumn = self.__imageList.columns() for columnId in range(1, self.__imageList.columns()): self.__imageList.removeColumn(columnId) for motor in self.__motor_pos_save: self.__imageList.addColumn(motor.userName()) elif propertyName == 'master_motor': if self.__master_motor is not None: self.__imageList.takeItem(self.__masterControler) self.__master_motor = self.getHardwareObject(newValue) if self.__master_motor is not None: self.__masterControler = qt.QCheckListItem( self.__imageList, self.__master_motor.userName()) self.__masterControler.setSelectable(False) self.__masterControler.setOpen(True) elif propertyName == 'focus_motor': self.__focus_motor = self.getHardwareObject(newValue) moveFocusCheckBox = self.child('__moveFocusCheckBox') if self.__focus_motor is not None: moveFocusCheckBox.show() else: moveFocusCheckBox.hide() elif propertyName == 'live_camera': if self.__camDecompNPlug: camera, decomp, _ = self.__camDecompNPlug self.disconnect(camera, qt.PYSIGNAL('imageReceived'), decomp.putData) self.__camDecompNPlug = None camera = self.getHardwareObject(newValue) liveCheckBox = self.child('__liveCheckBox') if camera is not None: decomp = QubStdData2Image() plug = _LiveImagePlug(self) decomp.plug(plug) imageInfo = camera.imageType() if imageInfo and imageInfo.type() == 'bayer': imType = decomp.BAYER_RG elif imageInfo and imageInfo.type() == 'raw': imType = decomp.RAW else: imType = decomp.STANDARD # JPEG decomp.setImageType(imType) self.__camDecompNPlug = camera, decomp, plug liveCheckBox.show() else: liveCheckBox.hide() elif propertyName == 'formatString': self._formatString = self['formatString']