PEATDB/Ekin/Meta.py
def updateFields(self, dataset=None):
        """Do field entry widgets for standard meta data items of the form
           data, attrib. Other fields are not displayed but are allowed """
        gvars=self.gvars={}
        cvars=self.cvars={}
        tvars=self.tvars={}
        d=self.data
        metawin = self.metawin
        glbals = self.glob
        self.currdataset = dataset
        def addwidget(frame, fname, fdata, fattrib, r):
            var=None
            tvar=IntVar(); tvar.set(0)
            if type(fdata) is types.StringType or type(fdata) is types.FloatType:
                var=StringVar()
                var.set(fdata)
                Label(frame, text=fname).grid(row=r,column=0,sticky='news',padx=4,pady=3)
                Entry(frame, textvariable=var, bg='white').grid(row=r,column=1,
                                            sticky='news',padx=4,pady=3)
            else:
                Label(frame, text=c).grid(row=r,column=0,sticky='news',padx=4,pady=3)
                st = Pmw.ScrolledText(frame, borderframe = 1,
                                        labelpos = 'n', label_text=str(type(fdata)),
                                        text_wrap='none')
                st.grid(row=r,column=1,sticky='news',padx=4,pady=3)
                p = Utils.prettyPrint(fdata) #more readable
                st.setvalue(p)
                st.component('text').configure(height=6)
                st.component('text').configure(state=DISABLED)
            #attributes
            Label(frame, text=fattrib).grid(row=r,column=2,
                                            sticky='news',padx=4,pady=3)
            Checkbutton(frame, variable=tvar).grid(row=r,column=3,sticky='news',padx=2,pady=2)


            return var, tvar

        self.datasetlabel.set(dataset)

        gf = LabelFrame(metawin, text='global')
        gf.grid(row=1,column=0,sticky='news',padx=4,pady=3)
        gf.columnconfigure(1,weight=1)
        r=0
        for g in glbals:
            var, tvars[g] = addwidget(gf, g, glbals[g]['data'], glbals[g]['attrib'], r)
            if var != None:
                gvars[g]=var
            r+=1
        if dataset!=None and d.has_key(dataset):
            currdata=d[dataset]
            cf = LabelFrame(metawin, text='dataset specific')
            cf.grid(row=2,column=0,sticky='news',padx=4,pady=3)
            cf.columnconfigure(1,weight=1)
            r=0
            for c in currdata:
                try:
                    itemdata = currdata[c]['data']
                    var, tvars[c] = addwidget(cf, c, itemdata, currdata[c]['attrib'], r)
                except:
                    itemdata = currdata[c]
                    var, tvars[c] = addwidget(cf, c, itemdata, None, r)
                if var != None:
                    cvars[c]=var
                r+=1
        return
Do field entry widgets for standard meta data items of the form
           data, attrib. Other fields are not displayed but are allowed 
Do field entry widgets for standard meta data items of the form
data, attrib. Other fields are not displayed but are allowed
Do field entry widgets for standard meta data items of the form data attrib . Other fields are not displayed but are allowed
def updateFields(self, dataset=None):
        gvars=self.gvars={}
        cvars=self.cvars={}
        tvars=self.tvars={}
        d=self.data
        metawin = self.metawin
        glbals = self.glob
        self.currdataset = dataset
        def addwidget(frame, fname, fdata, fattrib, r):
            var=None
            tvar=IntVar(); tvar.set(0)
            if type(fdata) is types.StringType or type(fdata) is types.FloatType:
                var=StringVar()
                var.set(fdata)
                Label(frame, text=fname).grid(row=r,column=0,sticky='news',padx=4,pady=3)
                Entry(frame, textvariable=var, bg='white').grid(row=r,column=1,
                                            sticky='news',padx=4,pady=3)
            else:
                Label(frame, text=c).grid(row=r,column=0,sticky='news',padx=4,pady=3)
                st = Pmw.ScrolledText(frame, borderframe = 1,
                                        labelpos = 'n', label_text=str(type(fdata)),
                                        text_wrap='none')
                st.grid(row=r,column=1,sticky='news',padx=4,pady=3)
                p = Utils.prettyPrint(fdata) 
                st.setvalue(p)
                st.component('text').configure(height=6)
                st.component('text').configure(state=DISABLED)
            Label(frame, text=fattrib).grid(row=r,column=2,
                                            sticky='news',padx=4,pady=3)
            Checkbutton(frame, variable=tvar).grid(row=r,column=3,sticky='news',padx=2,pady=2)
            return var, tvar
        self.datasetlabel.set(dataset)
        gf = LabelFrame(metawin, text='global')
        gf.grid(row=1,column=0,sticky='news',padx=4,pady=3)
        gf.columnconfigure(1,weight=1)
        r=0
        for g in glbals:
            var, tvars[g] = addwidget(gf, g, glbals[g]['data'], glbals[g]['attrib'], r)
            if var != None:
                gvars[g]=var
            r+=1
        if dataset!=None and d.has_key(dataset):
            currdata=d[dataset]
            cf = LabelFrame(metawin, text='dataset specific')
            cf.grid(row=2,column=0,sticky='news',padx=4,pady=3)
            cf.columnconfigure(1,weight=1)
            r=0
            for c in currdata:
                try:
                    itemdata = currdata[c]['data']
                    var, tvars[c] = addwidget(cf, c, itemdata, currdata[c]['attrib'], r)
                except:
                    itemdata = currdata[c]
                    var, tvars[c] = addwidget(cf, c, itemdata, None, r)
                if var != None:
                    cvars[c]=var
                r+=1
        return
def updateFields ( self , dataset = None ) : gvars = self . gvars = { } cvars = self . cvars = { } tvars = self . tvars = { } d = self . data metawin = self . metawin glbals = self . glob self . currdataset = dataset def addwidget ( frame , fname , fdata , fattrib , r ) : var = None tvar = IntVar ( ) ; tvar . set ( 0 ) if type ( fdata ) is types . StringType or type ( fdata ) is types . FloatType : var = StringVar ( ) var . set ( fdata ) Label ( frame , text = fname ) . grid ( row = r , column = 0 , sticky = 'news' , padx = 4 , pady = 3 ) Entry ( frame , textvariable = var , bg = 'white' ) . grid ( row = r , column = 1 , sticky = 'news' , padx = 4 , pady = 3 ) else : Label ( frame , text = c ) . grid ( row = r , column = 0 , sticky = 'news' , padx = 4 , pady = 3 ) st = Pmw . ScrolledText ( frame , borderframe = 1 , labelpos = 'n' , label_text = str ( type ( fdata ) ) , text_wrap = 'none' ) st . grid ( row = r , column = 1 , sticky = 'news' , padx = 4 , pady = 3 ) p = Utils . prettyPrint ( fdata ) st . setvalue ( p ) st . component ( 'text' ) . configure ( height = 6 ) st . component ( 'text' ) . configure ( state = DISABLED ) Label ( frame , text = fattrib ) . grid ( row = r , column = 2 , sticky = 'news' , padx = 4 , pady = 3 ) Checkbutton ( frame , variable = tvar ) . grid ( row = r , column = 3 , sticky = 'news' , padx = 2 , pady = 2 ) return var , tvar self . datasetlabel . set ( dataset ) gf = LabelFrame ( metawin , text = 'global' ) gf . grid ( row = 1 , column = 0 , sticky = 'news' , padx = 4 , pady = 3 ) gf . columnconfigure ( 1 , weight = 1 ) r = 0 for g in glbals : var , tvars [ g ] = addwidget ( gf , g , glbals [ g ] [ 'data' ] , glbals [ g ] [ 'attrib' ] , r ) if var != None : gvars [ g ] = var r += 1 if dataset != None and d . has_key ( dataset ) : currdata = d [ dataset ] cf = LabelFrame ( metawin , text = 'dataset specific' ) cf . grid ( row = 2 , column = 0 , sticky = 'news' , padx = 4 , pady = 3 ) cf . columnconfigure ( 1 , weight = 1 ) r = 0 for c in currdata : try : itemdata = currdata [ c ] [ 'data' ] var , tvars [ c ] = addwidget ( cf , c , itemdata , currdata [ c ] [ 'attrib' ] , r ) except : itemdata = currdata [ c ] var , tvars [ c ] = addwidget ( cf , c , itemdata , None , r ) if var != None : cvars [ c ] = var r += 1 return
Do field entry widgets for standard meta data items of the form
data, attrib.
Do field entry widgets for standard meta data items of the form data attrib .
"""Do field entry widgets for standard meta data items of the form
           data, attrib. Other fields are not displayed but are allowed """ #more readable #attributes
self
dataset