Пример #1
0
 def __init__(self, parent):
     CRBComboBox.__init__(self, parent)
     self.popupView  = None
     self._tableName = 'SuiteReagent'
     self._testId = None
     self._tissueJournalDate = None
     CRBComboBox.setTable(self, self._tableName)
Пример #2
0
class CRBPrintDialog(CSimplePrintDialog):
    u"""Выбор элемента из справочника
    var - код элемента
    или объект класса, если этот класс задан"""
    def __init__(self, title, table, class_=None, combo=None, default=None):
        CSimplePrintDialog.__init__(self, title, 200, 100, default)
        self.class_ = class_
        if combo:
            self.comboBox = combo(self)
        else:
            self.comboBox = CRBComboBox(self)
            self.comboBox.setTable(table)
        self.comboBox.setObjectName("comboBox")
        self.verticalLayout.insertWidget(0, self.comboBox)

    def getId(self):
        return self.comboBox.value()

    def getCode(self):
        return self.comboBox.code()

    def getName(self):
        return self.comboBox.model().getName(self.comboBox.currentIndex())

    def saveData(self):
        if self.class_:
            self.var = self.context.getInstance(self.class_, self.getId())
        else:
            self.var = self.getCode()
        return True
Пример #3
0
 def __init__(self, parent):
     CRBComboBox.__init__(self, parent)
     self.popupView  = CTestPopup(self)
     self.popupView.setModels(self._model, self._selectionModel)
     self._tableName = 'rbTest'
     self._additionalFilter = None
     CRBComboBox.setTable(self, self._tableName, addNone=False)
     self.connect(self.popupView, QtCore.SIGNAL('testRowSelected(int)'), self.on_popupView_testRowSelected)
     self.connect(self.popupView, QtCore.SIGNAL('updateTestFilter()'), self.on_popupView_updateTestFilter)
Пример #4
0
 def createEditor(self, parent, column):
     if column == TreeColumns.TISSUE_TYPE:
         editor = CRBComboBox(parent)
         tbl = QtGui.qApp.db.table('rbTissueType')
         editor.setTable('rbTissueType', False,
                         tbl['id'].inlist(self._tissueTypes.keys()))
         return editor
     else:
         return super(CJobTicketTreeActionItem,
                      self).createEditor(parent, column)
Пример #5
0
 def createEditor(self, parent, option, index):
     row = index.row()
     column = index.column()
     model = index.model()
     eventFeedId = forceInt(model.mealDays[row].value('id'))
     showAllDiets = True
     if column == 1 and eventFeedId in model.items:
         for mealList in model.items[eventFeedId].values():
             if len(mealList) != 0:
                 showAllDiets = False
                 break
     editor = CRBComboBox(parent)
     editor.setTable('rbDiet', addNone=True)
     if not showAllDiets:
         editor.setFilter('allow_meals = 1')
     return editor
Пример #6
0
 def __init__(self, parent):
     CRBComboBox.__init__(self, parent)
     self._tableName = 'vrbPersonWithSpeciality'
     self._addNone = True
     self._orgId = QtGui.qApp.currentOrgId()
     self._orgStructureId = None
     self._orgStructureIdList = None
     self._specialityId = None
     self._specialityPresent = True
     self._postId = None
     self._begDate = None
     self._endDate = None
     self._customFilter = None
     self._isInvestigator = None
     self.setOrderByName()
     CRBComboBox.setTable(self, self._tableName, self._addNone,
                          self.compileFilter(), self._order)
Пример #7
0
 def createEditor(self, parent, option, index):
     cmb = CRBComboBox(parent)
     cmb.setTable('rbToothStatus')
     return cmb
Пример #8
0
class CSamplingApplyDialog(CDialogBase):
    def __init__(self,
                 parent,
                 tissueExternalId,
                 equipmentId,
                 testGroupVisible=False,
                 autoEquipment=False):
        CDialogBase.__init__(self, parent)
        self.vLayout = QtGui.QVBoxLayout()
        self.lblExternalId = QtGui.QLabel(u'Идентификатор', self)
        self.vLayout.addWidget(self.lblExternalId)
        self.edtExternalId = QtGui.QLineEdit(tissueExternalId, self)
        self.vLayout.addWidget(self.edtExternalId)
        self.lblEquipment = QtGui.QLabel(u'Оборудование', self)
        self.vLayout.addWidget(self.lblEquipment)

        self.cmbEquipment = CRBComboBox(self)
        specialValues = (
            (-1, '-',
             u'Автоопределение оборудования'), ) if autoEquipment else None
        self.cmbEquipment.setTable('rbEquipment',
                                   addNone=True,
                                   specialValues=specialValues)
        self.cmbEquipment.setValue(equipmentId)

        self.vLayout.addWidget(self.cmbEquipment)
        self.lblTestGroup = QtGui.QLabel(u'Группа тестов', self)
        self.vLayout.addWidget(self.lblTestGroup)
        self.cmbTestGroup = CRBComboBox(self)
        self.cmbTestGroup.setTable('rbTestGroup', addNone=True)
        self.vLayout.addWidget(self.cmbTestGroup)

        self.lblExternalId.setVisible(not testGroupVisible)
        self.edtExternalId.setVisible(not testGroupVisible)

        self.lblTestGroup.setVisible(testGroupVisible)
        self.cmbTestGroup.setVisible(testGroupVisible)

        self.buttonBox = QtGui.QDialogButtonBox(self)
        self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok
                                          | QtGui.QDialogButtonBox.Cancel)
        self.vLayout.addWidget(self.buttonBox)
        self.setLayout(self.vLayout)
        self.connect(self.buttonBox, QtCore.SIGNAL('accepted()'), self.accept)
        self.connect(self.buttonBox, QtCore.SIGNAL('rejected()'), self.reject)

        self._tissueJournalId = None
        self._tissueTypeId = None
        self._datetimeTaken = None

        self.setWindowTitle(u'Регистрация проб')

    def setSettings(self, tissueJournalId, tissueTypeId, datetimeTaken):
        self._tissueJournalId = tissueJournalId
        self._tissueTypeId = tissueTypeId
        self._datetimeTaken = datetimeTaken

    def checkDataEntered(self):
        result = True
        result = result and self.checkExternalId()
        return result

    def saveData(self):
        return self.checkDataEntered()

    def checkExternalId(self):
        result = True

        if self.edtExternalId.isVisible():
            message = u''
            externalId = forceStringEx(self.edtExternalId.text())
            if bool(externalId):
                if not externalId.isdigit():
                    result = False
                    message = u'корректный идентификатор'
            else:
                result = False
                message = u'идентификатор'

            result = result or self.checkInputMessage(message, False,
                                                      self.edtExternalId)
            result = result and self.checkSelectedToSave(
                externalId, self._tissueJournalId)

        return result

    def checkSelectedToSave(self, externalId, tissueJournalId):
        db = QtGui.qApp.db
        tableProbe = db.table('Probe')
        tableTissueJournal = db.table('TakenTissueJournal')

        cond = [
            tableProbe['takenTissueJournal_id'].ne(tissueJournalId),
            tableProbe['externalId'].eq(externalId),
            tableTissueJournal['tissueType_id'].eq(self._tissueTypeId),
            tableTissueJournal['deleted'].eq(0)
        ]

        dateCond = getExternalIdDateCond(self._tissueTypeId,
                                         self._datetimeTaken)

        if dateCond:
            cond.append(dateCond)

        queryTable = tableProbe.innerJoin(
            tableTissueJournal,
            tableTissueJournal['id'].eq(tableProbe['takenTissueJournal_id']))

        record = QtGui.qApp.db.getRecordEx(queryTable, tableProbe['id'].name(),
                                           cond)
        if record and forceRef(record.value('id')):
            return self.checkInputMessage(
                u'другой идентификатор.\nТакой уже существует', False,
                self.edtExternalId)
        return True

    def externalId(self):
        result = forceStringEx(self.edtExternalId.text()).lstrip('0')
        return (6 - len(result)) * '0' + result

    def equipmentId(self):
        return self.cmbEquipment.value()

    def testGroupId(self):
        return self.cmbTestGroup.value()
Пример #9
0
 def updateFilter(self):
     v = self.value()
     CRBComboBox.setTable(self, self._tableName, self._addNone,
                          self.compileFilter(), self._order)
     self.setValue(v)
Пример #10
0
 def __init__(self, parent):
     CRBComboBox.__init__(self, parent)
     self.popupView  = None
     self._tableName = 'rbEquipment'
     CRBComboBox.setTable(self, self._tableName)