Exemplo n.º 1
0
	def __init__(self,master,rateObject=None):
		Frame.__init__(self,master)
		self.pack(expand=YES,fill=BOTH)
		self.frm_tree = Frame(self)
		self.frm_tree.pack(side=LEFT,fill=BOTH,expand=1)
		self.m_treeBrowser = None 
		# if rateObject <> None:  self.mapObjToGui(rateObject):
	
		self.frm_details = Frame(self);

		self.well_icon = PhotoImage(data='R0lGODlhDwAPAPcAAAAAAIAAAACAAICAAAAAgIAAgACAgICAgMDAwP8AAAD/AP//AAAA//8A/wD/\n/////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMwAAZgAAmQAAzAAA/wAzAAAzMwAzZgAzmQAzzAAz/wBm\nAABmMwBmZgBmmQBmzABm/wCZAACZMwCZZgCZmQCZzACZ/wDMAADMMwDMZgDMmQDMzADM/wD/AAD/\nMwD/ZgD/mQD/zAD//zMAADMAMzMAZjMAmTMAzDMA/zMzADMzMzMzZjMzmTMzzDMz/zNmADNmMzNm\nZjNmmTNmzDNm/zOZADOZMzOZZjOZmTOZzDOZ/zPMADPMMzPMZjPMmTPMzDPM/zP/ADP/MzP/ZjP/\nmTP/zDP//2YAAGYAM2YAZmYAmWYAzGYA/2YzAGYzM2YzZmYzmWYzzGYz/2ZmAGZmM2ZmZmZmmWZm\nzGZm/2aZAGaZM2aZZmaZmWaZzGaZ/2bMAGbMM2bMZmbMmWbMzGbM/2b/AGb/M2b/Zmb/mWb/zGb/\n/5kAAJkAM5kAZpkAmZkAzJkA/5kzAJkzM5kzZpkzmZkzzJkz/5lmAJlmM5lmZplmmZlmzJlm/5mZ\nAJmZM5mZZpmZmZmZzJmZ/5nMAJnMM5nMZpnMmZnMzJnM/5n/AJn/M5n/Zpn/mZn/zJn//8wAAMwA\nM8wAZswAmcwAzMwA/8wzAMwzM8wzZswzmcwzzMwz/8xmAMxmM8xmZsxmmcxmzMxm/8yZ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AGYzM2YzZmYzmWYzzGYz/2ZmAGZmM2ZmZmZmmWZm\nzGZm/2aZAGaZM2aZZmaZmWaZzGaZ/2bMAGbMM2bMZmbMmWbMzGbM/2b/AGb/M2b/Zmb/mWb/zGb/\n/5kAAJkAM5kAZpkAmZkAzJkA/5kzAJkzM5kzZpkzmZkzzJkz/5lmAJlmM5lmZplmmZlmzJlm/5mZ\nAJmZM5mZZpmZmZmZzJmZ/5nMAJnMM5nMZpnMmZnMzJnM/5n/AJn/M5n/Zpn/mZn/zJn//8wAAMwA\nM8wAZswAmcwAzMwA/8wzAMwzM8wzZswzmcwzzMwz/8xmAMxmM8xmZsxmmcxmzMxm/8yZAMyZM8yZ\nZsyZmcyZzMyZ/8zMAMzMM8zMZszMmczMzMzM/8z/AMz/M8z/Zsz/mcz/zMz///8AAP8AM/8AZv8A\nmf8AzP8A//8zAP8zM/8zZv8zmf8zzP8z//9mAP9mM/9mZv9mmf9mzP9m//+ZAP+ZM/+ZZv+Zmf+Z\nzP+Z///MAP/MM//MZv/Mmf/MzP/M////AP//M///Zv//mf//zP///ywAAAAADwAPAAAIUAAfCBxI\nsKDBgwP9pFLIcKFDhQ8WHgTwAIBEPwgJpopY8UGCBB0pUsSIMaPAjRspfgzZkaTJkxxVgqRIkOTG\njH4oPtzZkCaAn0CDAn1J9GBAADs=')


		self.headerLabel =  Label(self.frm_details,text="ID")
		self.headerLabel.pack(side=TOP,fill=X,expand=0)

		self.parametersTable = TableList(self.frm_details,  width=40,
			background='white', columns=(16,"Parameter",16,"Value"), selecttype='cell')
		self.parametersTable.columnconfigure(1,editable='YES')
		self.parametersTable.pack(side=TOP,expand=1)

		self.perfColumns  = []                            # for showing items in perforations 
		for x in cPerfAllowedKeywords:           # allow all allowed values
			self.perfColumns.append(8)                    # allow upto 8 characters
			self.perfColumns.append(x)                    # for each character

		self.perforationsTable = ScrolledTableList(self.frm_details,         # Only if table is needed
			background='white', columns=tuple(self.perfColumns))             # and in the middle of the dialog
		for x in range(len(cPerfAllowedKeywords)):                  # Make the whole thing editable
			self.perforationsTable.columnconfigure(x,editable='YES')         # pack it and show it
		self.perforationsTable.pack(side=TOP,fill=BOTH,expand=1)
		self.perforationsTable.pack_forget()
		
		###################################################################################
		# You must handle both Well and Perforation saves.
		###################################################################################
		self.btnSaveWell = Button(self.frm_details,text="Save Values", command=self.f_saveValues)
		self.btnSaveWell.pack(side=TOP,expand=0)

		###################################################################################
		#self.buttonBox = Pmw.ButtonBox(self.frm_details,labelpos='n',label_text='TODO Actions', orient='vertical')
		###################################################################################
		self.buttonBox = Pmw.ButtonBox(self.frm_details,labelpos='n',label_text='TODO Actions')
		self.buttonBox.pack(side=BOTTOM,fill=X, expand=0,padx=0,pady=0)
		self.buttonBox.add('ADD DATE',command = lambda s=self :  s.m_addDate());
		self.buttonBox.add('DEL DATE',command = lambda s=self :  s.m_deleteDate());
		self.buttonBox.add('ADD WELL',command = lambda s=self :  s.m_addWell());
		self.buttonBox.add('DEL WELL',command = lambda s=self :  s.m_deleteWell());
		self.buttonBox.add('ADD PERF',command = lambda s=self :  s.m_addWell());
		self.buttonBox.add('DEL PERF',command = lambda s=self :  s.m_deleteWell());

		self.frm_details.pack(side=RIGHT,expand=1,fill=BOTH,pady=10)

		self.lastDate = None
		self.lastWell = None
		self.lastPerf = None
Exemplo n.º 2
0
    def Search(self):
        if self.isConnected is True:
            searchstr = self.lineEditSearch.text()
            owner = self.editUser.text()
            
            
            if self.checkBoxAsColumn.isChecked() is True:
                resdiag = tableNameList.TableList()
                self.colui = QtWidgets.QWidget()
                resdiag.setupUi(self.colui)
                info="Showing all Tables with column Name: "+searchstr
                resdiag.setupdata(self.con.TablesWithColumnName(owner,searchstr),info,self,self.writer)
                self.colui.setWindowTitle(searchstr+':Containing Tables')
                self.colui.show()
                self.colDlg.append(self.colui)
            elif self.checkBoxFullString.isChecked() is True:
                tablelist = self.con.TablesSearch(owner,'')
                tData = []
                query = ''
                for table in tablelist:
                    columns = self.con.GetAllColumns(table)
                    for column in columns:
                        query = 'select * from '+ table+ ' where upper('+column['COLUMN_NAME']+')  like  upper(\'%'+searchstr+'%\') '
                        data = self.con.Query(query)
                        if len(data) > 0:
                            tDict = {}
                            tDict["Table Name"]=table
                            tDict["Column"]=column['COLUMN_NAME']
                            tDict["Records Found"]=len(data)
                            tData.append(tDict)

                diag = resTable.QResultDlg()
                self.resUI = QtWidgets.QWidget()
                diag.setupUi(self.resUI)
                # add data
                diag.setupdata(tData,'',self,query,self.writer)
                self.resUI.setWindowTitle('Tables with data:'+searchstr)
                self.resUI.show()
                self.colResUI.append(self.resUI)
                                
            else:
                resdiag = tableNameList.TableList()
                self.colui = QtWidgets.QWidget()
                resdiag.setupUi(self.colui)
                info="Showing all Tables with containing : "+searchstr
                resdiag.setupdata(self.con.TablesSearch(owner,searchstr),info,self,self.writer)
                self.colui.setWindowTitle(searchstr+':Tables Search')
                self.colui.show()
                self.colDlg.append(self.colui)
Exemplo n.º 3
0
 def __getattr__(self, name):
     if not isinstance(self, ImageMF):
         return "Bogus dude " + str(self.__class__)
     if name == "me":
         return Obit.ImageMF_Get_me(self.this)
     # Functions to return members
     if name == "List":
         if not self.ImageMFIsA():
             raise TypeError("input MUST be a Python Obit ImageMF")
         out = InfoList.InfoList()
         out.me = Obit.ImageMFGetList(self.me)
         return out
     if name == "TableList":
         if not self.ImageMFIsA():
             raise TypeError("input MUST be a Python Obit ImageMF")
         out = TableList.TableList("TL")
         out.me = Obit.ImageMFGetTableList(self.me)
         return out
     if name == "Desc":
         if not self.ImageMFIsA():
             raise TypeError("input MUST be a Python Obit ImageMF")
         out = ImageDesc.ImageDesc("None")
         out.me = Obit.ImageMFGetDesc(self.me)
         return out
     if name == "FArray":
         return PGetFArray(self.me)
     if name == "Beam":
         return PGetBeam(self.me)
     if name == "PixBuf":
         if not self.ImageMFIsA():
             raise TypeError("input MUST be a Python Obit ImageMF")
         fa = self.FArray
         return Obit.FArrayGetBuf(fa.me)
     raise AttributeError(str(name))  # Unknown
Exemplo n.º 4
0
    def _open_logic(self, uv, err, **kwargs):
        """
        Peforms logic for opening a UV file

        * Opening the UV File if given an AIPS path.
        * Setting up the AIPS Path if given a UV file.
        * Open any Tables attached to the UV file.

        Parameters
        ----------
        uv: :class:`UV` or :class:`AIPSPath`
            Either a Obit UV object or an AIPSPath describing it
        """

        # Given an AIPSPath. open it.
        if isinstance(uv, AIPSPath):
            self._aips_path = uv
            mode = kwargs.pop('mode', 'r')
            self._uv = uv = open_uv(uv, mode=mode)
        # Given an Obit UV file.
        # Construct an AIPSPath
        elif isinstance(uv, UV.UV):
            # FITS and AIPS files have different properties
            if uv.FileType == "FITS":
                name = uv.FileName
                aclass = None
                seq = None
            elif uv.FileType == "AIPS":
                name = uv.Aname
                aclass = uv.Aclass
                seq = uv.Aseq
            else:
                raise ValueError("Invalid FileType '%s'" % uv.FileType)

            self._aips_path = AIPSPath(name,
                                       uv.Disk,
                                       aclass,
                                       seq,
                                       dtype=uv.FileType)

            self._uv = uv
        else:
            raise TypeError("Invalid type '%s'. "
                            "Must be Obit UV object "
                            "or an AIPSPath." % type(uv))

        # Open tables attached to this UV file.
        tables = TableList.PGetList(uv.TableList, err)
        handle_obit_err("Error getting '%s' table list" % self.name)

        # History tables don't work like the other tables
        ignored_tables = ["AIPS HI"]

        self._tables = {
            name: AIPSTable(uv, name, version, 'r', err)
            for version, name in tables if name not in ignored_tables
        }

        self._tables["AIPS HI"] = AIPSHistory(uv, err)
Exemplo n.º 5
0
 def table_highver(self, desc, type):
     data = self._verify(desc)
     retval = TableList.PGetHigh(data.TableList, type)
     if self.doInit:   # Initialized Obit?
         OSystem.Shutdown(self.ObitSys)
         self.doInit = False
     OErr.printErrMsg(self.err, "Error with Obit Table")
     return retval
Exemplo n.º 6
0
    def _open_logic(self, img, err, **kwargs):
        """
        Peforms logic for opening a Image file

        * Opening the Image File if given an AIPS path.
        * Setting up the AIPS Path if given a Image file.
        * Open any Tables attached to the Image file.
        """
        self.mode = kwargs.pop('mode', 'r')
        # Given an AIPSPath. open it.
        if isinstance(img, AIPSPath):
            self._aips_path = img
            self._img = img = open_img(img, mode=self.mode)
        # Given an Obit Image file.
        # Construct an AIPSPath
        elif isinstance(img, Image.Image):
            # FITS and AIPS files have different properties
            if img.FileType == "FITS":
                name = img.FileName
                aclass = None
                seq = None
            elif img.FileType == "AIPS":
                name = img.Aname
                aclass = img.Aclass
                seq = img.Aseq
            else:
                raise ValueError("Invalid FileType '%s'" % img.FileType)

            self._aips_path = AIPSPath(name,
                                       img.Disk,
                                       aclass,
                                       seq,
                                       atype='MA',
                                       label=img.GetName(),
                                       dtype=img.FileType)

            self._img = img
        else:
            raise TypeError("Invalid type '%s'. "
                            "Must be Obit Image object "
                            "or an AIPSPath." % type(img))

        # Open tables attached to this UV file.
        tables = TableList.PGetList(img.TableList, err)
        handle_obit_err("Error getting '%s' table list" % self.name)

        # History tables don't work like the other tables
        ignored_tables = ["AIPS HI"]

        self._tables = {
            name: AIPSTable(img, name, version, 'r', err)
            for version, name in tables if name not in ignored_tables
        }

        self._tables["AIPS HI"] = AIPSHistory(img, err)
Exemplo n.º 7
0
 def __getattr__(self, name):
     if self.__class__ != ImageMF:
         return
     if name == "me":
         return Obit.ImageMF_me_get(self.this)
     # Functions to return members
     if name == "List":
         if not self.ImageMFIsA():
             raise TypeError, "input MUST be a Python Obit ImageMF"
         out = InfoList.InfoList()
         out.me = Obit.InfoListUnref(out.me)
         out.me = Obit.ImageGetList(self.cast("ObitImage"))
         return out
     if name == "TableList":
         if not self.ImageMFIsA():
             raise TypeError, "input MUST be a Python Obit ImageMF"
         out = TableList.TableList("TL")
         out.me = Obit.TableListUnref(out.me)
         out.me = Obit.ImageGetTableList(self.cast("ObitImage"))
         return out
     if name == "Desc":
         if not self.ImageMFIsA():
             raise TypeError, "input MUST be a Python Obit ImageMF"
         out = ImageDesc.ImageDesc("None")
         out.me = Obit.ImageGetDesc(self.cast("ObitImage"))
         return out
     if name == "FArray":
         return PGetFArray(self.cast("ObitImage"))
     if name == "Beam":
         return PGetBeam(self.cast("ObitImage"))
     if name == "PixBuf":
         if not self.ImageMFIsA():
             raise TypeError, "input MUST be a Python Obit ImageMF"
         fa = self.FArray
         return Obit.FArrayGetBuf(fa.me)
     raise AttributeError, str(name)  # Unknown
Exemplo n.º 8
0
 def tablelist(self):
     tables = TableList.PGetList(self.img.TableList, self._err)
     handle_obit_err("Error getting '%s' table list" % self.name)
     return tables
Exemplo n.º 9
0
def PHeader(inImage, err):
    """
    Print image descriptor

    * inImage   = Python Image object
    * err       = Python Obit Error/message stack
    """
    ################################################################
    # ObitTalk or AIPSImage data?
    if inImage.myClass == 'AIPSImage':
        # header
        dict = inImage.header()
        ImageDesc.PHeaderDict(dict)
        # tablelist
        Tlist = inImage.tables()
        Tdict = {}
        # Once to find everything
        for item in Tlist:
            Tdict[item[1]] = item[0]
        # Again to get Max
        for item in Tlist:
            count = max(Tdict[item[1]], item[0])
            Tdict[item[1]] = count
        for item, count in Tdict.items():
            print "Maximum version number of %s tables is %d " % \
                  (item, count)
        return
        # End AIPSImage
    elif inImage.myClass == 'FITSImage':
        # header
        dict = inImage.header()
        ImageDesc.PHeaderDict(dict)
        # tablelist
        Tlist = inImage.tables()
        Tdict = {}
        # Once to find everything
        for item in Tlist:
            Tdict[item[1]] = item[0]
        # Again to get Max
        for item in Tlist:
            count = max(Tdict[item[1]], item[0])
            Tdict[item[1]] = count
        for item, count in Tdict.items():
            print "Maximum version number of %s tables is %d " % \
                  (item, count)
        return
        # End FITSImage

    # ObitTalk Image Checks
    if not inImage.ImageIsA():
        raise TypeError, "inImage MUST be a Python Obit Image"
    #
    # Fully instantiate
    #DAMN PFullInstantiate (inImage, READONLY, err)
    # File info
    if inImage.FileType == "AIPS":
        print "AIPS Image Name: %12s Class: %6s seq: %8d disk: %4d" % \
              (inImage.Aname, inImage.Aclass, inImage.Aseq, inImage.Disk)
    elif inImage.FileType == "FITS":
        print "FITS Image Disk: %5d File Name: %s " % \
              (inImage.Disk, inImage.FileName)
    # print in ImageDesc
    ImageDesc.PHeader(inImage.Desc)
    # Tables
    TL = inImage.TableList
    Tlist = TableList.PGetList(TL, err)
    Tdict = {}
    # Once to find everything
    for item in Tlist:
        Tdict[item[1]] = item[0]
    # Again to get Max
    for item in Tlist:
        count = max(Tdict[item[1]], item[0])
        Tdict[item[1]] = count
    for item, count in Tdict.items():
        print "Maximum version number of %s tables is %d " % \
              (item, count)
Exemplo n.º 10
0
 def delete_mysql():
     tableListObj = TableList()
     for tableClass, tableObj in tableListObj.tables:
         TableAdaper.delete(tableClass, tableObj)
Exemplo n.º 11
0
 def read_data_from_mysql(output_file):
     tableListObj = TableList()
     for tableClass, tableObj in tableListObj.tables:
         TableAdaper.read(tableClass, tableObj)
     FileAdapter.write(tableListObj, output_file)
Exemplo n.º 12
0
class frameDateInfoParameters(Frame):
	"""
	This is used to create the frame for hte `
	"""
	def __init__(self,master,rateObject=None):
		Frame.__init__(self,master)
		self.pack(expand=YES,fill=BOTH)
		self.frm_tree = Frame(self)
		self.frm_tree.pack(side=LEFT,fill=BOTH,expand=1)
		self.m_treeBrowser = None 
		# if rateObject <> None:  self.mapObjToGui(rateObject):
	
		self.frm_details = Frame(self);

		self.well_icon = PhotoImage(data='R0lGODlhDwAPAPcAAAAAAIAAAACAAICAAAAAgIAAgACAgICAgMDAwP8AAAD/AP//AAAA//8A/wD/\n/////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMwAAZgAAmQAAzAAA/wAzAAAzMwAzZgAzmQAzzAAz/wBm\nAABmMwBmZgBmmQBmzABm/wCZAACZMwCZZgCZmQCZzACZ/wDMAADMMwDMZgDMmQDMzADM/wD/AAD/\nMwD/ZgD/mQD/zAD//zMAADMAMzMAZjMAmTMAzDMA/zMzADMzMzMzZjMzmTMzzDMz/zNmADNmMzNm\nZjNmmTNmzDNm/zOZADOZMzOZZjOZ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LIcKFDhQ8WHgTwAIBEPwgJpopY8UGCBB0pUsSIMaPAjRspfgzZkaTJkxxVgqRIkOTG\njH4oPtzZkCaAn0CDAn1J9GBAADs=')


		self.headerLabel =  Label(self.frm_details,text="ID")
		self.headerLabel.pack(side=TOP,fill=X,expand=0)

		self.parametersTable = TableList(self.frm_details,  width=40,
			background='white', columns=(16,"Parameter",16,"Value"), selecttype='cell')
		self.parametersTable.columnconfigure(1,editable='YES')
		self.parametersTable.pack(side=TOP,expand=1)

		self.perfColumns  = []                            # for showing items in perforations 
		for x in cPerfAllowedKeywords:           # allow all allowed values
			self.perfColumns.append(8)                    # allow upto 8 characters
			self.perfColumns.append(x)                    # for each character

		self.perforationsTable = ScrolledTableList(self.frm_details,         # Only if table is needed
			background='white', columns=tuple(self.perfColumns))             # and in the middle of the dialog
		for x in range(len(cPerfAllowedKeywords)):                  # Make the whole thing editable
			self.perforationsTable.columnconfigure(x,editable='YES')         # pack it and show it
		self.perforationsTable.pack(side=TOP,fill=BOTH,expand=1)
		self.perforationsTable.pack_forget()
		
		###################################################################################
		# You must handle both Well and Perforation saves.
		###################################################################################
		self.btnSaveWell = Button(self.frm_details,text="Save Values", command=self.f_saveValues)
		self.btnSaveWell.pack(side=TOP,expand=0)

		###################################################################################
		#self.buttonBox = Pmw.ButtonBox(self.frm_details,labelpos='n',label_text='TODO Actions', orient='vertical')
		###################################################################################
		self.buttonBox = Pmw.ButtonBox(self.frm_details,labelpos='n',label_text='TODO Actions')
		self.buttonBox.pack(side=BOTTOM,fill=X, expand=0,padx=0,pady=0)
		self.buttonBox.add('ADD DATE',command = lambda s=self :  s.m_addDate());
		self.buttonBox.add('DEL DATE',command = lambda s=self :  s.m_deleteDate());
		self.buttonBox.add('ADD WELL',command = lambda s=self :  s.m_addWell());
		self.buttonBox.add('DEL WELL',command = lambda s=self :  s.m_deleteWell());
		self.buttonBox.add('ADD PERF',command = lambda s=self :  s.m_addWell());
		self.buttonBox.add('DEL PERF',command = lambda s=self :  s.m_deleteWell());

		self.frm_details.pack(side=RIGHT,expand=1,fill=BOTH,pady=10)

		self.lastDate = None
		self.lastWell = None
		self.lastPerf = None

	############################################################################
	# Tree manipulation functions
	############################################################################
	def m_addDate(self):
		if self.lastDate == None: return
		print "I will add a new date after " , index

	def m_deleteDate(self):
		if self.lastDate <> None: 
			print "I will delete a Date here."
			self.lastDate = None

	def m_addWell(self):
		print "I will add a Well here."

	def m_deleteWell(self):
		if self.lastWell <> None: 
			print "I will delete a Well here."
			self.lastWell = None

	def mapObjToGui(self,perfObject,forceTheIssue=0):
		self.myObject = perfObject
		if self.m_treeBrowser == None: 
			self.m_treeBrowser = Tree.Tree(master=self.frm_tree, 
				root_id = os.sep,  root_label='Dates', 
				get_contents_callback=self.get_contents,
				callback_parms=self,
				width=150, 
				expanded_icon=self.closed_icon, 
				collapsed_icon=self.open_icon, 
				regular_icon=self.well_icon, 

				node_class=MyDateInfoTreeNode)
			self.m_treeBrowser.pack(side=LEFT,fill=BOTH,expand=1,padx=0) 
			self.sb=Scrollbar(self.frm_tree)
			self.sb.pack(side=RIGHT,fill=Y,expand=1,padx=0)
			self.m_treeBrowser.configure(yscrollcommand=self.sb.set)
			self.sb.configure(command=self.m_treeBrowser.yview)
		self.m_treeBrowser.root.expand()

	def get_contents(self,another,node): 
		path=apply(os.path.join, node.full_id())    # Get the main name.
		if path == '/':                             # root node.
			mydates = self.myObject.allDates.keys()
			mydates.sort()
			for kk in mydates:
				dt = self.myObject.allDates[kk]
				full=os.path.join(path, dt.getDate())
				node.widget.add_node(name=dt.getDate(), id=dt.getDate(), flag=1)
			return			
		ids = node.full_id()                         # Second level only
		myDateString = ids[1]                      # If this is a date 
		if len(ids) == 2: 
			for dt in self.myObject.allDates.values():                    # Get the date name
				if dt.getDate().find(myDateString) == 0: 
					wells = dt.Wells.keys()
					wells.sort()
					for well in wells:
						node.widget.add_node(name=well,id=well,flag=1) # Add it in there
			return
		if len(ids) == 3: 
			thisWellString = ids[2]                              # If this is a well 
			for dt in self.myObject.allDates.values():                    # Get the date name
				if dt.getDate().find(myDateString) == 0:	 # Get the well on this date  

					print "This well string = [%s]", (thisWellString) 
					print "dt.Wells = ", len(dt.Wells)           

					well = dt.Wells[thisWellString]              # as an object. 
					for perf in well.perforations:               # List the perfs here
						xstr = perf.getPerfName()                # with the ID string
						node.widget.add_node(name=xstr,id=xstr,flag=0) # Add it in the tree

	def mapGuiToObj(self,rateObject):
		pass 

	def f_enmasseSetValue(self):
		""" 
		Untested code
		"""
		if self.lastPerf <> None and self.lastWell <> None: 
			reply = askyesno('Whoa!',"Are you sure you want to set the non-empty entries for all other Perfs in this well?")
			sz = self.parametersTable.size()
			for r in range(sz):
				parm = self.parametersTable.get(r)
				self.lastWell.setKeywordValue(parm[0],parm[1])
				if parm[1] <> '': 
					for perf in self.lastWell.perforations:
						perf.setKeywordValue(txt,parm[1])   # Validate here @@@@!!!!LOOK I AM NOT DOING IT HERE 

	def f_saveValues(self):
		#
		# Collect the stuff from the form on frm_item and plunk it into the well or perforation
		#
		if self.lastPerf == None: 
			if self.lastWell == None: 
				print "There is no last Perf nor a well" 
				return 
			sz = self.parametersTable.size()
			for r in range(sz):
				parm = self.parametersTable.get(r)
				self.lastWell.setKeywordValue(parm[0],parm[1])

			return 
		sz = self.parametersTable.size()
		for r in range(sz):
			parm = self.parametersTable.get(r)
			self.lastPerf.setKeywordValue(parm[0],parm[1])

	def f_showDate(self,kk):
		self.headerLabel['text'] = kk.getDate()
		self.parametersTable.clear()
		self.lastPerf = None;
		self.lastWell = None;
		self.perforationsTable.pack_forget()

	def f_showPerf(self,kk):
		self.headerLabel['text'] = kk.getPerfName()
		self.parametersTable.clear()
		for txt in cPerfAllowedKeywords:
			y = kk.getKeywordValue(txt)   #
			self.parametersTable.insert("end",(txt,y))
		self.lastPerf = kk;
		self.perforationsTable.clear()
		self.perforationsTable.pack_forget()

	def f_saveDate(self):
		pass

	def f_showWell(self,kk):
		self.headerLabel['text'] = kk.getWellName()
		self.parametersTable.clear()
		dummy = cRateParser.cRateFile()
		for txt in dummy.aAllowedWellKeywords:   # You preserved the key when you store it.
			y = kk.getKeywordValue(txt)   #
			self.parametersTable.insert("end",(txt,y))
		self.lastWell = kk;
		self.lastPerf = None;   # Explicitly force the issue.
		self.perforationsTable.pack(fill=BOTH,expand=1)
		self.perforationsTable.clear()
		for kk in self.lastWell.perforations: 
			rowData = []
			for txt in cPerfAllowedKeywords:
				y = kk.getKeywordValue(txt)   #
				rowData.append(y)
			self.perforationsTable.insert("end",tuple(rowData))
Exemplo n.º 13
0
 def table_highver(self, desc, type):
     data = self._verify(desc)
     retval = TableList.PGetHigh(data.TableList, type)
     OErr.printErrMsg(self.err, "Error with Obit Table")
     return retval
Exemplo n.º 14
0
 def tables(self, desc):
     data = self._verify(desc)
     retval = TableList.PGetList(data.TableList, self.err)
     OErr.printErrMsg(self.err, "Error with Obit Table")
     return retval