예제 #1
0
    def main(self, *args, **kw):
        """Process command-line arguments and run the application.

        """

        self.toolkit = syscon.getSystemConsole()
        syscon.setMainSession(self)

        desc = self.get_description()
        if desc is not None:
            desc = " ".join(desc.split())

        p = OptionParser(usage=self.usage, description=desc)

        self.setupOptionParser(p)

        argv = sys.argv[1:]

        try:
            poptions, pargs = p.parse_args(argv)
            self.applyOptions(poptions, pargs)
            self.start_running()
            ret = self.run(*args, **kw)
            self.stop_running()
            return ret

        except UsageError, e:
            self.error("Usage error: " + str(e))
            p.print_help()
            return -1
예제 #2
0
 def __init__(self,writer=None,cpl=72,frameStyle="+-+|+-+|",**kw):
     TextPrinter.__init__(self,pageSize=(cpl,0),cpl=cpl,**kw)
     if writer is None:
         """
         
         tests/75.py fails if I take stdout from
         self.session.toolkit because TestCase.setUp() only does
         setSystemConsole() while self.session remains the RunTests
         instance.
         
         """
         writer=syscon.getSystemConsole()
         #writer=syscon.getSystemConsole().stdout
         #writer=self.session.toolkit.stdout
         #writer=sys.stdout
     self._writer = writer
     assert len(frameStyle) == 8
     self.topLeft = frameStyle[0]
     self.topBorder = frameStyle[1]
     self.topRight = frameStyle[2]
     self.rightBorder = frameStyle[3]
     self.bottomRight = frameStyle[4]
     self.bottomBorder = frameStyle[5]
     self.bottomLeft = frameStyle[6]
     self.leftBorder = frameStyle[7]
예제 #3
0
 def __init__(self, writer=None, cpl=72, frameStyle="+-+|+-+|", **kw):
     TextPrinter.__init__(self, pageSize=(cpl, 0), cpl=cpl, **kw)
     if writer is None:
         """
         
         tests/75.py fails if I take stdout from
         self.session.toolkit because TestCase.setUp() only does
         setSystemConsole() while self.session remains the RunTests
         instance.
         
         """
         writer = syscon.getSystemConsole()
         #writer=syscon.getSystemConsole().stdout
         #writer=self.session.toolkit.stdout
         #writer=sys.stdout
     self._writer = writer
     assert len(frameStyle) == 8
     self.topLeft = frameStyle[0]
     self.topBorder = frameStyle[1]
     self.topRight = frameStyle[2]
     self.rightBorder = frameStyle[3]
     self.bottomRight = frameStyle[4]
     self.bottomBorder = frameStyle[5]
     self.bottomLeft = frameStyle[6]
     self.leftBorder = frameStyle[7]
예제 #4
0
    def main(self,*args,**kw):
        """Process command-line arguments and run the application.

        """

        self.toolkit = syscon.getSystemConsole()
        syscon.setMainSession(self)
        
        desc = self.get_description()
        if desc is not None:
            desc=" ".join(desc.split())
        
        p = OptionParser(
            usage=self.usage,
            description=desc)
            
        self.setupOptionParser(p)

        argv = sys.argv[1:]
        
        try:
            poptions,pargs = p.parse_args(argv)
            self.applyOptions(poptions,pargs)
            self.start_running()
            ret=self.run(*args,**kw)
            self.stop_running()
            return ret

        except UsageError,e:
            self.error("Usage error: "+str(e))
            p.print_help()
            return -1
예제 #5
0
 def __init__(self, console=None):
     self.root = None
     self._running = False
     if console is None:
         from lino.console import syscon
         console = syscon.getSystemConsole()
     self.console = console
     self._activeForm = None
예제 #6
0
 def __init__(self,console=None):
     self.root=None
     self._running=False
     if console is None:
         from lino.console import syscon
         console=syscon.getSystemConsole()
     self.console = console
     self._activeForm=None
예제 #7
0
    def __init__(self, toolkit=None, **kw):
        #assert toolkit is not None
        if toolkit is None:
            toolkit = syscon.getSystemConsole()
        self.toolkit = toolkit
        #self.debug(self.__class__.__name__+".__init__()")

        self._connections = []
        self._databases = []

        self.configure(**kw)
예제 #8
0
 def setUp(self):
     self._tempFiles = []
     self._showFiles = []
     self.keepTemporaryFiles = False
     #self.ui = console.CaptureConsole(verbosity=-2,batch=True)
     self._oldToolkit=syscon.getSystemConsole()
     self.toolkit=CaptureConsole(
         #encoding="latin1",
         verbosity=self.verbosity,
         batch=self.batch)
     syscon.setSystemConsole(self.toolkit)
예제 #9
0
    def __init__(self,toolkit=None,**kw):
        #assert toolkit is not None
        if toolkit is None:
            toolkit=syscon.getSystemConsole()
        self.toolkit=toolkit
        #self.debug(self.__class__.__name__+".__init__()")

        self._connections = []
        self._databases = []
        
        self.configure(**kw)
예제 #10
0
 def setUp(self):
     self._tempFiles = []
     self._showFiles = []
     self.keepTemporaryFiles = False
     #self.ui = console.CaptureConsole(verbosity=-2,batch=True)
     self._oldToolkit = syscon.getSystemConsole()
     self.toolkit = CaptureConsole(
         #encoding="latin1",
         verbosity=self.verbosity,
         batch=self.batch)
     syscon.setSystemConsole(self.toolkit)
예제 #11
0
 def show(self, **kw):
     syscon.getSystemConsole().show_report(self, **kw)
예제 #12
0
 def show(self,**kw):
     syscon.getSystemConsole().show_report(self,**kw)