# Path: mGui/debugging.py
# USER_LOG_LEVEL = 19
# DEV_LOG_LEVEL = 1
#     DEV = "%(module)s.%(funcName)s(%(lineno)s):  %(message)s"
#     USER = "  %(message)s"
# class DevFilter(logging.Filter):
# class DevFormatter(logging.Formatter):
#     def filter(self, record):
#     def set_dev(cls, val):
#     def __init__(self):
#     def format(self, record):
#     def set_dev(cls, val):
# def verbose(state):


import maya.cmds as cmds
import mGui.events as events
import mGui.properties as properties
import  weakref
from mGui.debugging import Logger
       sj.start(protected = True)

    to find out if the scriptJob is still running:

        if sj.running:
            print 'scriptjob is still running'

    to stop a scriptJob:

        sj.kill()

    Run conditions (such as -runOnce, -parent,  or -protected) should be specified when the scriptJob is started.
    """

    def __init__(self, scriptJobFlag, eventType, **kwargs):
        self.script_flag = scriptJobFlag
        self.event_type = eventType
        super(ScriptJobEvent, self).__init__(**kwargs)
        self.data['scriptJob'] = -1

    def start(self, **sjFlags):
        kwargs = {self.script_flag: (self.event_type, self)}
        kwargs.update(sjFlags)
        self.data['scriptJob'] = cmds.scriptJob(**kwargs)
        Logger.info('start scriptJob %s' % self.__class__)

    def kill(self):
        if self.data.get('scriptJob') > 0:
            cmds.scriptJob(k=self.data['scriptJob'])
            self.data['scriptJob'] = -1

# Path: mGui/debugging.py
# USER_LOG_LEVEL = 19
# DEV_LOG_LEVEL = 1
#     DEV = "%(module)s.%(funcName)s(%(lineno)s):  %(message)s"
#     USER = "  %(message)s"
# class DevFilter(logging.Filter):
# class DevFormatter(logging.Formatter):
#     def filter(self, record):
#     def set_dev(cls, val):
#     def __init__(self):
#     def format(self, record):
#     def set_dev(cls, val):
# def verbose(state):


# Path: mGui/scriptJobs.py
import maya.cmds as cmds
import mGui.events as events
import mGui.properties as properties
import  weakref
from mGui.debugging import Logger

       sj.start(protected = True)

    to find out if the scriptJob is still running:

        if sj.running:
            print 'scriptjob is still running'

    to stop a scriptJob:

        sj.kill()

    Run conditions (such as -runOnce, -parent,  or -protected) should be specified when the scriptJob is started.
    """

    def __init__(self, scriptJobFlag, eventType, **kwargs):
        self.script_flag = scriptJobFlag
        self.event_type = eventType
        super(ScriptJobEvent, self).__init__(**kwargs)
        self.data['scriptJob'] = -1

    def start(self, **sjFlags):
        kwargs = {self.script_flag: (self.event_type, self)}
        kwargs.update(sjFlags)
        self.data['scriptJob'] = cmds.scriptJob(**kwargs)
        Logger.info('start scriptJob %s' % self.__class__)

    def kill(self):
        if self.data.get('scriptJob') > 0:
            cmds.scriptJob(k=self.data['scriptJob'])
            self.data['scriptJob'] = -1

            Logger.info('kill scriptJob %s' % self.__class__)