PEATDB/Tables.py
def add_defaultcommands():
                """now add general actions for all cells"""
                main = ["Set Fill Color","Set Text Color","Copy", "Paste", "Fill Down","Fill Right", "Clear Data",
                         "Delete Row", "Select All", "Plot Selected","Plot Options",
                         "Show Prefs"]
                utils = ["View Record", "Formulae->Value", "Export Table"]
                defaultactions={"Set Fill Color" : lambda : self.setcellColor(rows,cols,key='bg'),
                                "Set Text Color" : lambda : self.setcellColor(rows,cols,key='fg'),
                                "Copy" : lambda : self.copyCell(rows, cols),
                                "Paste" : lambda : self.pasteCell(rows, cols),
                                "Fill Down" : lambda : self.fill_down(rows, cols),
                                "Fill Right" : lambda : self.fill_across(cols, rows),
                                "Delete Row" : lambda : self.delete_Row(),
                                "View Record" : lambda : self.getRecordInfo(row),
                                "Clear Data" : lambda : self.delete_Cells(rows, cols),
                                "Select All" : self.select_All,
                                "Plot Selected" : self.plot_Selected,
                                "Plot Options" : self.plotSetup,
                                "Export Table" : self.exportTable,
                                "Show Prefs" : self.showtablePrefs,
                                "Formulae->Value" : lambda : self.convertFormulae(rows, cols)}

                for action in main:
                    if action == 'Fill Down' and (rows == None or len(rows) <= 1):
                        continue
                    if action == 'Fill Right' and (cols == None or len(cols) <= 1):
                        continue
                    else:
                        popupmenu.add_command(label=action, command=defaultactions[action])
                popupmenu.add_separator()
                utilsmenu = Menu(popupmenu, tearoff = 0)
                popupmenu.add_cascade(label="Utils",menu=utilsmenu)
                for action in utils:
                    utilsmenu.add_command(label=action, command=defaultactions[action])
                return
now add general actions for all cells
now add general actions for all cells
now add general actions for all cells
def add_defaultcommands():
                main = ["Set Fill Color","Set Text Color","Copy", "Paste", "Fill Down","Fill Right", "Clear Data",
                         "Delete Row", "Select All", "Plot Selected","Plot Options",
                         "Show Prefs"]
                utils = ["View Record", "Formulae->Value", "Export Table"]
                defaultactions={"Set Fill Color" : lambda : self.setcellColor(rows,cols,key='bg'),
                                "Set Text Color" : lambda : self.setcellColor(rows,cols,key='fg'),
                                "Copy" : lambda : self.copyCell(rows, cols),
                                "Paste" : lambda : self.pasteCell(rows, cols),
                                "Fill Down" : lambda : self.fill_down(rows, cols),
                                "Fill Right" : lambda : self.fill_across(cols, rows),
                                "Delete Row" : lambda : self.delete_Row(),
                                "View Record" : lambda : self.getRecordInfo(row),
                                "Clear Data" : lambda : self.delete_Cells(rows, cols),
                                "Select All" : self.select_All,
                                "Plot Selected" : self.plot_Selected,
                                "Plot Options" : self.plotSetup,
                                "Export Table" : self.exportTable,
                                "Show Prefs" : self.showtablePrefs,
                                "Formulae->Value" : lambda : self.convertFormulae(rows, cols)}
                for action in main:
                    if action == 'Fill Down' and (rows == None or len(rows) <= 1):
                        continue
                    if action == 'Fill Right' and (cols == None or len(cols) <= 1):
                        continue
                    else:
                        popupmenu.add_command(label=action, command=defaultactions[action])
                popupmenu.add_separator()
                utilsmenu = Menu(popupmenu, tearoff = 0)
                popupmenu.add_cascade(label="Utils",menu=utilsmenu)
                for action in utils:
                    utilsmenu.add_command(label=action, command=defaultactions[action])
                return
def add_defaultcommands ( ) : main = [ "Set Fill Color" , "Set Text Color" , "Copy" , "Paste" , "Fill Down" , "Fill Right" , "Clear Data" , "Delete Row" , "Select All" , "Plot Selected" , "Plot Options" , "Show Prefs" ] utils = [ "View Record" , "Formulae->Value" , "Export Table" ] defaultactions = { "Set Fill Color" : lambda : self . setcellColor ( rows , cols , key = 'bg' ) , "Set Text Color" : lambda : self . setcellColor ( rows , cols , key = 'fg' ) , "Copy" : lambda : self . copyCell ( rows , cols ) , "Paste" : lambda : self . pasteCell ( rows , cols ) , "Fill Down" : lambda : self . fill_down ( rows , cols ) , "Fill Right" : lambda : self . fill_across ( cols , rows ) , "Delete Row" : lambda : self . delete_Row ( ) , "View Record" : lambda : self . getRecordInfo ( row ) , "Clear Data" : lambda : self . delete_Cells ( rows , cols ) , "Select All" : self . select_All , "Plot Selected" : self . plot_Selected , "Plot Options" : self . plotSetup , "Export Table" : self . exportTable , "Show Prefs" : self . showtablePrefs , "Formulae->Value" : lambda : self . convertFormulae ( rows , cols ) } for action in main : if action == 'Fill Down' and ( rows == None or len ( rows ) <= 1 ) : continue if action == 'Fill Right' and ( cols == None or len ( cols ) <= 1 ) : continue else : popupmenu . add_command ( label = action , command = defaultactions [ action ] ) popupmenu . add_separator ( ) utilsmenu = Menu ( popupmenu , tearoff = 0 ) popupmenu . add_cascade ( label = "Utils" , menu = utilsmenu ) for action in utils : utilsmenu . add_command ( label = action , command = defaultactions [ action ] ) return
now add general actions for all cells
now add general actions for all cells
"""now add general actions for all cells"""