コード例 #1
0
    def test_createWellPlotData(self):
        #QWidget: Must construct a QApplication before a QPaintDevice
        app = QApplication(sys.argv)
        self.dummyDbSetup.setupDatabase()

        well = self.dummyDbSetup.createWell()
        logs = self.dummyDbSetup.create3Logs(well.id)

        templateDao = WellPlotTemplateDao()
        logger.debug(
            "--test_createWellPlotData() created WellPlotTemplateDao()")
        allTemplaes = templateDao.getAllWellPlotTemplates()
        logger.debug(
            "--test_createWellPlotData() created templateDao.getAllWellPlotTemplates() len:{0}"
            .format(len(allTemplaes)))
        template = allTemplaes[0]
        #need to run as properties are called inside init() method
        template.__init__()
        logger.debug("uid: {0}, name: {1}".format(template.uid, template.name))
        uid = 42
        wellPlotModelAccess = WellPlotModelAccess()
        logger.debug(
            "--test_createWellPlotData() created WellPlotModelAccess() template[0].name:{0}"
            .format(template.name))
        wellPlotData = wellPlotModelAccess.createWellPlotData(
            logs, uid, well, template)
        logger.debug(
            "--test_createWellPlotData() created wellPlotModelAccess.createWellPlotData()"
        )
        self.assertEquals(uid, wellPlotData.uid)
        logger.debug("TODO test all other properties")
コード例 #2
0
    def getWellPLotdata(self):

        self.dummyDbSetup.setupDatabase()
        well = self.dummyDbSetup.createWell()
        logs = self.dummyDbSetup.create3Logs(well.id)
        wellPlotModelAccess = WellPlotModelAccess()
        uid = 42
        templateDao = WellPlotTemplateDao()
        allTemplates = templateDao.getAllWellPlotTemplates()
        template = None
        for item in allTemplates:
            if item.uid == WellPlotType.ALLLOGS.uid:
                template = item
        wellPlotData = wellPlotModelAccess.createWellPlotData(logs, uid, well, template)
        return wellPlotData
コード例 #3
0
    def populateTemplatesCombo(self):
        self.templatesComboBox.clear()
        isModifiable = True
        modifiableTemplates = WellPlotTemplateDao.getWellPlotTemplatesFilterModifiable(
            isModifiable)
        modifiableTemplates.sort(key=lambda x: x.name)
        isModifiable = False

        for template in modifiableTemplates:
            self.templatesComboBox.addItem(template.name, template.uid)
コード例 #4
0
    def getWellPlotdata(self):

        self.dummyDbSetup.setupDatabase()
        templates = WellPlotTemplateDao.getAllWellPlotTemplates()
        assert 9 == len(templates), "Incorrect template number: {0}".format(len(templates))

        templates = WellPlotTemplateDao.getAllWellPlotTemplates()
        
        well = self.dummyDbSetup.createWell()
        self.dummyDbSetup.create1Log(well.id)
        logs = LogDao.getWellLogs(well.id)
        wellPlotModelAccess = WellPlotModelAccess()
        uid = 42
        templateDao = WellPlotTemplateDao()
        #allTemplates = templateDao.getAllWellPlotTemplates()
        template = templateDao.getWellPlotTemplateFromUid("alllogs")
        #template = allTemplates[0]
        template.__init__()
        wellPlotData = wellPlotModelAccess.createWellPlotData(logs, uid, well, template)
        return wellPlotData
コード例 #5
0
    def generateLogPlotData(self):
        ''' using wellplot method to create data - preferred way 
        may want to put data creation outside wellplot?
        '''
        logger.debug(">>test_generateLogPlotData() ")
        self.dummyDbSetup.setupDatabase()
        #QWidget: Must construct a QApplication before a QPaintDevice
        #app = QApplication(sys.argv)
        well = self.dummyDbSetup.createWell()
        logs = self.dummyDbSetup.create3Logs(well.id)
        templateDao = WellPlotTemplateDao()
        allTemplates = templateDao.getAllWellPlotTemplates()
        template = None
        uid = 42
        for item in allTemplates:
            if item.uid == WellPlotType.ALLLOGS.uid:
                template = item
        wellPlot = WellPlotPG(logs, well, template)
        wellPlotModelAccess = WellPlotModelAccess()
        wellPlotData = wellPlotModelAccess.createWellPlotData(
            logs, uid, well, template)

        return well, wellPlotData
コード例 #6
0
 def generateTemplate(self):
     #easier to use the WellPlotType for QUICKPLOT than database
     if self._quickTemplateName == WellPlotType.QUICKPLOT.name:
         quickPlotUid = WellPlotType.QUICKPLOT.uid
     elif self._quickTemplateName == WellPlotType.ALLLOGS.name:
         quickPlotUid = WellPlotType.ALLLOGS.uid
     elif self._quickTemplateName == WellPlotType.ACTIVELOGS.name:
         quickPlotUid = WellPlotType.ACTIVELOGS.uid
     elif self._quickTemplateName == WellPlotType.EMPTY.name:
         quickPlotUid = WellPlotType.EMPTY.uid
     else:
         logger.error("--handleQuickPlotChecked() no match for quickTemplateName: {0}".format(self._quickTemplateName))
         if AppSettings.isDebugMode:
             raise ValueError
     self._template = WellPlotTemplateDao.getWellPlotTemplateFromUid(quickPlotUid)
コード例 #7
0
    def populateQuickPlotCombo(self):
        #check if have any active logs
        haveActiveLogs = self.checkForActiveLogs(self._logs)
        self.quickPlotComboBox.clear()
        isModifiable = False
        unModifiableTemplates = WellPlotTemplateDao.getWellPlotTemplatesFilterModifiable(
            isModifiable)
        unModifiableTemplates.sort(key=lambda x: x.name)

        for template in unModifiableTemplates:
            if template.name == WellPlotType.ACTIVELOGS.name:
                #only add active template name if have active logs
                if haveActiveLogs:
                    self.quickPlotComboBox.addItem(template.name, template.uid)
            else:
                self.quickPlotComboBox.addItem(template.name, template.uid)
コード例 #8
0
 def handleQuickPlotSelection(self):
     quickTemplateName = str(self.quickPlotComboBox.currentText())
     #currentItem = self.getComboBoxItemFromIndex(self.trackListView.model(), self.templatesComboBox.currentIndex())
     #push logTypes into QuickPlot template
     index = self.quickPlotComboBox.currentIndex()
     data = self.quickPlotComboBox.itemData(index)
     if quickTemplateName == WellPlotType.QUICKPLOT.name:
         quickplotDialog = QuickPlotDialog(self._logs, self._well,
                                           quickTemplateName)
         self.setVisible(False)
         quickplotDialog.exec_()
         self.close()
     elif (quickTemplateName == WellPlotType.ALLLOGS.name) or (
             quickTemplateName == WellPlotType.ACTIVELOGS.name) or (
                 quickTemplateName == WellPlotType.EMPTY.name):
         self._template = WellPlotTemplateDao.getWellPlotTemplateFromUid(
             str(data))
     else:
         logger.error("Plot type not found")
         if AppSettings.isDebugMode:
             raise ValueError
コード例 #9
0
 def setTemplate(self):
     template_uid = self._wellPlotData.template_uid
     self._template = WellPlotTemplateDao.getWellPlotTemplateFromUid(
         template_uid)
コード例 #10
0
 def handleTemplateSelection(self):
     templateName = str(self.templatesComboBox.currentText())
     index = self.templatesComboBox.currentIndex()
     data = self.templatesComboBox.itemData(index)
     self._template = WellPlotTemplateDao.getWellPlotTemplateFromUid(
         str(data))
コード例 #11
0
 def setTemplateLineEditText(self):
     isModifiable = True
     templates = WellPlotTemplateDao.getWellPlotTemplatesFilterModifiable(
         isModifiable)
     self.newTemplateNameLineEdit.setText(self.DEFAULT_TEMPLATE_PREFIX +
                                          " " + str(len(templates) + 1))