class AdamoApplication(Application): def __init__(self,filename=None,**kw): Application.__init__(self,**kw) self.schema = Schema() self.filename = filename self.sess = None def getSession(self): return self.sess def parse_args(self, argv=None, usage="usage: %prog [options] DBFILE", description="""\ where DBFILE is the name of the sqlite database file""", **kw): (options,args) = Application.parse_args( self, usage=usage, description=description, **kw) if len(args) == 1: self.filename = args[0] else: self.filename=os.path.join(self.tempDir, self.name+".db") return (options,args) def init(self): #,*args,**kw): # called from Toolkit.main() self.sess = self.schema.quickStartup( ui=self.toolkit.console, filename=self.filename) ## return Application.init(self, ## self.toolkit.console, ## *args,**kw) def showTableGrid(self,ui,tc,*args,**kw): ds = self.sess.query(tc,*args,**kw) return ui.showDataGrid(ds) def showViewGrid(self,ui,tc,viewName="std",*args,**kw): ds = self.sess.view(tc,viewName,*args,**kw) return ui.showDataGrid(ds)
class AdamoApplication(Application): def __init__(self, filename=None, **kw): Application.__init__(self, **kw) self.schema = Schema() self.filename = filename self.sess = None def getSession(self): return self.sess def parse_args(self, argv=None, usage="usage: %prog [options] DBFILE", description="""\ where DBFILE is the name of the sqlite database file""", **kw): (options, args) = Application.parse_args(self, usage=usage, description=description, **kw) if len(args) == 1: self.filename = args[0] else: self.filename = os.path.join(self.tempDir, self.name + ".db") return (options, args) def init(self): #,*args,**kw): # called from Toolkit.main() self.sess = self.schema.quickStartup(ui=self.toolkit.console, filename=self.filename) ## return Application.init(self, ## self.toolkit.console, ## *args,**kw) def showTableGrid(self, ui, tc, *args, **kw): ds = self.sess.query(tc, *args, **kw) return ui.showDataGrid(ds) def showViewGrid(self, ui, tc, viewName="std", *args, **kw): ds = self.sess.view(tc, viewName, *args, **kw) return ui.showDataGrid(ds)
def __init__(self, filename=None, **kw): Application.__init__(self, **kw) self.schema = Schema() self.filename = filename self.sess = None
def __init__(self,filename=None,**kw): Application.__init__(self,**kw) self.schema = Schema() self.filename = filename self.sess = None