PEATDB/Labbook.py
def add_Sheet(self, sheetname=None, sheetdata=None, model=None):
        """Add a new sheet - handles all the table creation stuff"""
        def checksheet_name(name):
            if name == '':
                tkMessageBox.showwarning("Whoops", "Name should not be blank.")
                return 0
            if self.sheets.has_key(name):
                tkMessageBox.showwarning("Name exists", "Sheet name already exists!")
                return 0
        noshts = len(self.notebook.pagenames())
        if sheetname == None:
            sheetname = tkSimpleDialog.askstring("New sheet name?", "Enter sheet name:",
                                                initialvalue='sheet'+str(noshts+1),
                                                parent=self.labbook_win)
        checksheet_name(sheetname)
        page = self.notebook.add(sheetname)
        #Create the model if none provided
        if model == None:
            if sheetdata != None:
                model = LabbookTableModel(sheetdata)
            else:
                model = LabbookTableModel(rows=10,columns=5)

        #create the table: we pass the parent instance of peat
        #and peat row/col if present
        self.currenttable = LabbookTable(parent=page, model=model, sheetname=sheetname,
                                        peat=self.parent, peatinfo=self.peatinfo)

        #Load preferences into table
        self.currenttable.loadPrefs(self.preferences)
        #This handles all the canvas and header in the frame passed to constructor
        self.currenttable.createTableFrame()
        #add the table to the sheet dict
        self.sheets[sheetname] = self.currenttable
        self.saved = 0
        return sheetname
Add a new sheet - handles all the table creation stuff
Add a new sheet - handles all the table creation stuff
Add a new sheet - handles all the table creation stuff
def add_Sheet(self, sheetname=None, sheetdata=None, model=None):
        def checksheet_name(name):
            if name == '':
                tkMessageBox.showwarning("Whoops", "Name should not be blank.")
                return 0
            if self.sheets.has_key(name):
                tkMessageBox.showwarning("Name exists", "Sheet name already exists!")
                return 0
        noshts = len(self.notebook.pagenames())
        if sheetname == None:
            sheetname = tkSimpleDialog.askstring("New sheet name?", "Enter sheet name:",
                                                initialvalue='sheet'+str(noshts+1),
                                                parent=self.labbook_win)
        checksheet_name(sheetname)
        page = self.notebook.add(sheetname)
        if model == None:
            if sheetdata != None:
                model = LabbookTableModel(sheetdata)
            else:
                model = LabbookTableModel(rows=10,columns=5)
        self.currenttable = LabbookTable(parent=page, model=model, sheetname=sheetname,
                                        peat=self.parent, peatinfo=self.peatinfo)
        self.currenttable.loadPrefs(self.preferences)
        self.currenttable.createTableFrame()
        self.sheets[sheetname] = self.currenttable
        self.saved = 0
        return sheetname
def add_Sheet ( self , sheetname = None , sheetdata = None , model = None ) : def checksheet_name ( name ) : if name == '' : tkMessageBox . showwarning ( "Whoops" , "Name should not be blank." ) return 0 if self . sheets . has_key ( name ) : tkMessageBox . showwarning ( "Name exists" , "Sheet name already exists!" ) return 0 noshts = len ( self . notebook . pagenames ( ) ) if sheetname == None : sheetname = tkSimpleDialog . askstring ( "New sheet name?" , "Enter sheet name:" , initialvalue = 'sheet' + str ( noshts + 1 ) , parent = self . labbook_win ) checksheet_name ( sheetname ) page = self . notebook . add ( sheetname ) if model == None : if sheetdata != None : model = LabbookTableModel ( sheetdata ) else : model = LabbookTableModel ( rows = 10 , columns = 5 ) self . currenttable = LabbookTable ( parent = page , model = model , sheetname = sheetname , peat = self . parent , peatinfo = self . peatinfo ) self . currenttable . loadPrefs ( self . preferences ) self . currenttable . createTableFrame ( ) self . sheets [ sheetname ] = self . currenttable self . saved = 0 return sheetname
Add a new sheet - handles all the table creation stuff
Add a new sheet - handles all the table creation stuff
"""Add a new sheet - handles all the table creation stuff""" #Create the model if none provided #create the table: we pass the parent instance of peat #and peat row/col if present #Load preferences into table #This handles all the canvas and header in the frame passed to constructor #add the table to the sheet dict
self
sheetname
sheetdata
model