Beispiel #1
0
 def __init__(self, args):
     qt.QtGui.QApplication.__init__(self, args)
     # -- redirect stdout to null if pythonw --
     set_stdout()
     # -- reconfigure LoggerOffice to use Qt log handler and a file handler --
     logger.default_init(level=logger.DEBUG, handlers=["qt"]) #TODO get level from settings
     logger.connect_loggers_to_handlers(logger.get_logger_names(), logger.get_handler_names())
     if __debug__:
         logger.set_global_logger_level(logger.DEBUG)
     else:
         logger.set_global_logger_level(logger.DEBUG)
     # -- show the splash screen --
     self.splash = show_splash_screen()
     # -- main window --
     self.win = MainWindow(None)
     self.win.setEnabled(False)
     self.win.show()
     self.win.raise_()
     self.sessionStarted.connect(self.win.on_session_started)
     # -- start session in a thread --
     if MULTITHREAD:
         self.sessionth = threadit(timeit, self, self.__cb_session_thread_end, Session)
     else:
         session = Session()
         self.splash.finish(self.win)
         self.win.setEnabled(True)
         self.sessionStarted.emit(session)
Beispiel #2
0
 def __init__(self, parent=None):
     # -- reconfigure LoggerOffice to use Qt log handler and a file handler --
     logger.default_init(level=logger.DEBUG, handlers=["qt"]) #TODO get level from settings
     logger.connect_loggers_to_handlers(logger.get_logger_names(), logger.get_handler_names())
     model = logger.LoggerOffice().get_handler("qt")
     super(Logger, self).__init__(parent=parent, model=model)
     self.setAccessibleName("Logger")
Beispiel #3
0
 def __init__(self, args):
     qt.QtGui.QApplication.__init__(self, args)
     # -- redirect stdout to null if pythonw --
     set_stdout()
     # -- reconfigure LoggerOffice to use Qt log handler and a file handler --
     logger.default_init(level=logger.DEBUG,
                         handlers=["qt"])  #TODO get level from settings
     logger.connect_loggers_to_handlers(logger.get_logger_names(),
                                        logger.get_handler_names())
     if __debug__:
         logger.set_global_logger_level(logger.DEBUG)
     else:
         logger.set_global_logger_level(logger.DEBUG)
     # -- show the splash screen --
     self.splash = show_splash_screen()
     # -- main window --
     self.win = MainWindow(None)
     self.win.setEnabled(False)
     self.win.show()
     self.win.raise_()
     self.sessionStarted.connect(self.win.on_session_started)
     # -- start session in a thread --
     if MULTITHREAD:
         self.sessionth = threadit(timeit, self,
                                   self.__cb_session_thread_end, Session)
     else:
         session = Session()
         self.splash.finish(self.win)
         self.win.setEnabled(True)
         self.sessionStarted.emit(session)
Beispiel #4
0
 def __init__(self, parent=None):
     # -- reconfigure LoggerOffice to use Qt log handler and a file handler --
     logger.default_init(level=logger.DEBUG,
                         handlers=["qt"])  #TODO get level from settings
     logger.connect_loggers_to_handlers(logger.get_logger_names(),
                                        logger.get_handler_names())
     model = logger.LoggerOffice().get_handler("qt")
     super(Logger, self).__init__(parent=parent, model=model)
     self.setAccessibleName("Logger")
Beispiel #5
0
        def __init__(self, argv):
            QtGui.QApplication.__init__(self, argv)
            # -- reconfigure LoggerOffice to use Qt log handler and a file handler --
            logger.default_init(level=logger.DEBUG, handlers=["stream", "qt"]) #TODO get level from settings
            logger.connect_loggers_to_handlers(logger.get_logger_names(), logger.get_handler_names())

            if __debug__:
                logger.set_global_logger_level(logger.ERROR)#DEBUG
            else:
                logger.set_global_logger_level(logger.WARNING)

            # -- status clearout timer --

            self.__statusTimeout = QtCore.QTimer(self)
            self.__statusTimeout.setSingleShot(True)
            self.__statusTimeout.timeout.connect(self.clear_status_message)

            # -- main window --
            self.win = mainwindow.MainWindow(None)
            self.post_status_message("Starting up! Please wait")
            self.win.show()
            self.clear_status_message()
Beispiel #6
0

class IllFormedUrlError (Exception):
    def __init__(self, url):
        Exception.__init__(self)
        self.message = "Url is ill-formed : %s" % (url)

    def __str__(self):
        return self.message


###############################################################################
# Logging

pmanLogger = logger.get_logger(__name__)
logger.connect_loggers_to_handlers(pmanLogger, logger.get_handler_names())


class Logger(object):
    """ OpenAlea logging class """

    def __init__(self):
        self.log_index = 0
        self.log_file = os.path.join(tempfile.gettempdir(), "openalea.log")

        f = open(self.log_file, 'w')
        f.write(u"OpenAlea Log\n\n")
        f.close()

    def add(self, msg):
        """ Write to log file """
from openalea.plantgl.all import NurbsCurve2D, BezierCurve2D, Polyline2D, NurbsPatch

try:
    logger.DEBUG
except NameError:
    from openalea.core import logger
    logger.default_init(level=logger.DEBUG, handlers=["qt"]) #TODO get level from settings
    logger.connect_loggers_to_handlers(logger.get_logger_names(), logger.get_handler_names())

class RedNurbs2D(NurbsCurve2D):
    def __init__(self, ctrlPoint, typename=""):
        super(RedNurbs2D, self).__init__(ctrlPoint)
        self.typename = typename
        
    def __reduce__(self):
        return (RedNurbs2D, (self.ctrlPointList, self.typename,))
        
class RedBezierNurbs2D(BezierCurve2D):
    def __init__(self, ctrlPoint, typename=""):
        super(RedBezierNurbs2D, self).__init__(ctrlPoint)
        self.typename = typename
        
    def __reduce__(self):
        return (RedBezierNurbs2D, (self.ctrlPointList, self.typename,))
        
class RedPolyline2D(Polyline2D):
    def __init__(self, ctrlPoint, typename=""):
        super(RedPolyline2D, self).__init__(ctrlPoint)
        self.typename = typename
        
    def __reduce__(self):
Beispiel #8
0
###############################################################################

__license__ = "Cecill-C"
__revision__ = " $Id: splitterui.py 4222 2014-04-23 09:15:04Z gbaty $ "


"""
Contains the implementation of a recursively splittable UI.
"""

from openalea.vpltk.qt import QtCore, QtGui

try:
    from openalea.core import logger
    myLogger = logger.get_logger("openalea.visualea.splitterui")
    logger.connect_loggers_to_handlers(myLogger, logger.get_handler_names())

    def log(level, msg):
        myLogger.log(level, msg)
except:
    def log(level, msg):
        print "debug messsage", level, msg

from collections import deque


class BinaryTree(object):

    """A quirky binary tree that only implements
    node splitting methods. It also implements a
    visitable Breadth First iterating traversal.
Beispiel #9
0
from openalea.plantgl.all import NurbsCurve2D, BezierCurve2D, Polyline2D, NurbsPatch

try:
    logger.DEBUG
except NameError:
    from openalea.core import logger
    logger.default_init(level=logger.DEBUG,
                        handlers=["qt"])  #TODO get level from settings
    logger.connect_loggers_to_handlers(logger.get_logger_names(),
                                       logger.get_handler_names())


class RedNurbs2D(NurbsCurve2D):
    def __init__(self, ctrlPoint, typename=""):
        super(RedNurbs2D, self).__init__(ctrlPoint)
        self.typename = typename

    def __reduce__(self):
        return (RedNurbs2D, (
            self.ctrlPointList,
            self.typename,
        ))


class RedBezierNurbs2D(BezierCurve2D):
    def __init__(self, ctrlPoint, typename=""):
        super(RedBezierNurbs2D, self).__init__(ctrlPoint)
        self.typename = typename

    def __reduce__(self):
        return (RedBezierNurbs2D, (