PEATDB/PEATApp.py
def addColumnDialog(self):
        """Get a description of the field and add it"""
        if self.DB == None:
            return

        def close(event=None):
            dataf_spec.destroy()
            return

        def add():
            self.DB.addField(name=name_var.var.get(), fieldtype=type_var.var.get())
            dataf_spec.destroy()
            self.updateTable()
            return

        dataf_spec=Toplevel()
        dataf_spec.title('Specify type of data field')
        top=self.master.winfo_toplevel()
        rootx=top.winfo_rootx()
        rooty=top.winfo_rooty()
        dataf_spec.geometry('+%d+%d' %(rootx+100,rooty+100))
        dataf_spec.transient(self.master)
        dataf_spec.grab_set() # Grab all input

        # Get the name
        exclude=['Ekintype']
        self.column_types=['text']+self.table.peatactions.keys()+self.table.ekin_actions.keys()
        self.column_types.remove('Ekintype')
        name_var=entry_field(dataf_spec,row=1,column=0,name='Name',ftype='text')
        type_var=entry_field(dataf_spec,
                                  row=2,
                                  column=0,
                                  name='Data field type',
                                  ftype='menu',
                                  items=self.column_types,
                                  default_item='text')
        self.default_var=entry_field(dataf_spec,row=3,column=0,name='Default value',ftype='text')
        Button(dataf_spec,
               command=add,
               text='Add data field',fg='red').grid(row=5,column=0,columnspan=1,
                                                    padx=2,pady=2,sticky='news')
        Button(dataf_spec,
               command=close,
               text='Cancel',fg='green').grid(row=5,column=1,columnspan=1,
                                              padx=2,pady=2,sticky='news')
Get a description of the field and add it
Get a description of the field and add it
Get a description of the field and add it
def addColumnDialog(self):
        if self.DB == None:
            return
        def close(event=None):
            dataf_spec.destroy()
            return
        def add():
            self.DB.addField(name=name_var.var.get(), fieldtype=type_var.var.get())
            dataf_spec.destroy()
            self.updateTable()
            return
        dataf_spec=Toplevel()
        dataf_spec.title('Specify type of data field')
        top=self.master.winfo_toplevel()
        rootx=top.winfo_rootx()
        rooty=top.winfo_rooty()
        dataf_spec.geometry('+%d+%d' %(rootx+100,rooty+100))
        dataf_spec.transient(self.master)
        dataf_spec.grab_set() 
        exclude=['Ekintype']
        self.column_types=['text']+self.table.peatactions.keys()+self.table.ekin_actions.keys()
        self.column_types.remove('Ekintype')
        name_var=entry_field(dataf_spec,row=1,column=0,name='Name',ftype='text')
        type_var=entry_field(dataf_spec,
                                  row=2,
                                  column=0,
                                  name='Data field type',
                                  ftype='menu',
                                  items=self.column_types,
                                  default_item='text')
        self.default_var=entry_field(dataf_spec,row=3,column=0,name='Default value',ftype='text')
        Button(dataf_spec,
               command=add,
               text='Add data field',fg='red').grid(row=5,column=0,columnspan=1,
                                                    padx=2,pady=2,sticky='news')
        Button(dataf_spec,
               command=close,
               text='Cancel',fg='green').grid(row=5,column=1,columnspan=1,
                                              padx=2,pady=2,sticky='news')
def addColumnDialog ( self ) : if self . DB == None : return def close ( event = None ) : dataf_spec . destroy ( ) return def add ( ) : self . DB . addField ( name = name_var . var . get ( ) , fieldtype = type_var . var . get ( ) ) dataf_spec . destroy ( ) self . updateTable ( ) return dataf_spec = Toplevel ( ) dataf_spec . title ( 'Specify type of data field' ) top = self . master . winfo_toplevel ( ) rootx = top . winfo_rootx ( ) rooty = top . winfo_rooty ( ) dataf_spec . geometry ( '+%d+%d' % ( rootx + 100 , rooty + 100 ) ) dataf_spec . transient ( self . master ) dataf_spec . grab_set ( ) exclude = [ 'Ekintype' ] self . column_types = [ 'text' ] + self . table . peatactions . keys ( ) + self . table . ekin_actions . keys ( ) self . column_types . remove ( 'Ekintype' ) name_var = entry_field ( dataf_spec , row = 1 , column = 0 , name = 'Name' , ftype = 'text' ) type_var = entry_field ( dataf_spec , row = 2 , column = 0 , name = 'Data field type' , ftype = 'menu' , items = self . column_types , default_item = 'text' ) self . default_var = entry_field ( dataf_spec , row = 3 , column = 0 , name = 'Default value' , ftype = 'text' ) Button ( dataf_spec , command = add , text = 'Add data field' , fg = 'red' ) . grid ( row = 5 , column = 0 , columnspan = 1 , padx = 2 , pady = 2 , sticky = 'news' ) Button ( dataf_spec , command = close , text = 'Cancel' , fg = 'green' ) . grid ( row = 5 , column = 1 , columnspan = 1 , padx = 2 , pady = 2 , sticky = 'news' )
Get a description of the field and add it
Get a description of the field and add it
"""Get a description of the field and add it""" # Grab all input # Get the name
self