Example #1
0
def main( app_cls, argv ):
    #
    #   set a working STDOUT before loading most modules
    #
    # help debug when stdout goes nowhere useful
    # Mac OS X and Windows are the main problems
    if wb_platform_specific.isMacOs() or wb_platform_specific.isWindows():
        if '--noredirect' not in argv:
            sys.stdout = open( os.environ.get( 'WB_STDOUT_LOG', str(wb_platform_specific.getNullDevice()) ), 'w', 1 )
            sys.stderr = sys.stdout

    # don't pollute any subprocesses with env vars
    # from packaging processing
    for envvar in ['PYTHONPATH', 'PYTHONHOME', 'PYTHONEXECUTABLE']:
        if envvar in os.environ:
            del os.environ[ envvar ]

    # Create the win application and start its message loop
    app = app_cls( argv )

    app.main_window.show()

    rc = app.exec_()

    # force clean up of objects to avoid segv on exit
    del app

    # prevent exit handlers from running as this allows for a segv
    # My guess is that there are some Qt objects that are not owned
    # but I have no way to take them down
    #os._exit( rc )
    return rc
Example #2
0
    def __init__(self, app):
        self.app = app
        self.__log_widget = WbLogTextWidget(self.app)

        self.__line = ""

        # Redirect the console IO to this panel
        sys.stdin = wb_platform_specific.getNullDevice().open("r")
        if self.app.stdIoRedirected():
            sys.stdout = self
            sys.stderr = self
            sys.excepthook = self.excepthook

        # Redirect log to the Log panel
        self.widget_log_handler = WidgetLogHandler(self.app, self.__log_widget)
        self.app.log.addHandler(self.widget_log_handler)

        self.__session_log = open(str(wb_platform_specific.getLogFilename()) + ".session.log", "w", buffering=1)
Example #3
0
    def __init__(self, app):
        self.app = app
        self.__log_widget = WbLogTextWidget(self.app)

        self.__line = ''

        # Redirect the console IO to this panel
        sys.stdin = wb_platform_specific.getNullDevice().open('r')
        if self.app.stdIoRedirected():
            sys.stdout = self
            sys.stderr = self
            sys.excepthook = self.excepthook

        # Redirect log to the Log panel
        self.widget_log_handler = WidgetLogHandler(self.app, self.__log_widget)
        self.app.log.addHandler(self.widget_log_handler)

        self.__session_log = open(str(wb_platform_specific.getLogFilename()) +
                                  '.session.log',
                                  'w',
                                  buffering=1)