예제 #1
0
    def __init__(self):
        Loggable.__init__(self)

        # Init logging as early as possible so we can log startup code
        enable_color = not os.environ.get('PITIVI_DEBUG_NO_COLOR', '0') in ('', '1')
        # Let's show a human-readable pitivi debug output by default, and only
        # show a crazy unreadable mess when surrounded by gst debug statements.
        enable_crack_output = "GST_DEBUG" in os.environ
        log.init('PITIVI_DEBUG', enable_color, enable_crack_output)

        self.info('starting up')

        self.settings = GlobalSettings()
        self.threads = ThreadMaster()
        self.effects = EffectsHandler()
        self.system = getSystem()

        self.current_project = None
        self.projectManager = ProjectManager(self)
        self._connectToProjectManager(self.projectManager)

        self.action_log = UndoableActionLog()
        self.debug_action_log_observer = DebugActionLogObserver()
        self.debug_action_log_observer.startObserving(self.action_log)
        # TODO reimplement the observing after GES port
        #self.timelineLogObserver = TimelineLogObserver(self.action_log)
        self.projectLogObserver = ProjectLogObserver(self.action_log)

        self._version_information = {}
        self._checkVersion()
예제 #2
0
    def _startupCb(self, unused_app):
        # Init logging as early as possible so we can log startup code
        enable_color = not os.environ.get('PITIVI_DEBUG_NO_COLOR',
                                          '0') in ('', '1')
        # Let's show a human-readable Pitivi debug output by default, and only
        # show a crazy unreadable mess when surrounded by gst debug statements.
        enable_crack_output = "GST_DEBUG" in os.environ
        log.init('PITIVI_DEBUG', enable_color, enable_crack_output)

        self.info('starting up')
        self.settings = GlobalSettings()
        self.threads = ThreadMaster()
        self.effects = EffectsManager()
        self.system = getSystem()

        self.action_log.connect("commit", self._actionLogCommit)
        self.action_log.connect("undo", self._actionLogUndo)
        self.action_log.connect("redo", self._actionLogRedo)
        self.action_log.connect("cleaned", self._actionLogCleaned)
        self.timeline_log_observer = TimelineLogObserver(self.action_log)
        self.project_log_observer = ProjectLogObserver(self.action_log)

        self.project_manager.connect("new-project-loaded",
                                     self._newProjectLoaded)
        self.project_manager.connect("project-closed", self._projectClosed)

        self._createActions()
        self._checkVersion()
예제 #3
0
파일: runtests.py 프로젝트: dz0ny/pitivi
def setup():
    res = True
    # Make available to configure.py the top level dir.
    pitivi_dir = get_pitivi_dir()
    os.environ.setdefault('PITIVI_TOP_LEVEL_DIR', pitivi_dir)

    _prepend_env_path("GST_PRESET_PATH", [
        os.path.join(pitivi_dir, "data", "videopresets"),
        os.path.join(pitivi_dir, "data", "audiopresets")])

    _prepend_env_path("GST_ENCODING_TARGET_PATH", [
        os.path.join(pitivi_dir, "data", "encoding-profiles")])

    # Make available the compiled C code.
    build_dir = get_build_dir()
    libs_dir = os.path.join(build_dir, "pitivi/coptimizations/.libs")
    sys.path.append(libs_dir)

    # Make sure the modules are initialized correctly.
    from pitivi import check
    check.initialize_modules()
    res = check.check_requirements()

    from pitivi.utils import loggable as log
    log.init('PITIVI_DEBUG')

    return res
예제 #4
0
    def _startupCb(self, unused_app):
        # Init logging as early as possible so we can log startup code
        enable_color = not os.environ.get(
            'PITIVI_DEBUG_NO_COLOR', '0') in ('', '1')
        # Let's show a human-readable Pitivi debug output by default, and only
        # show a crazy unreadable mess when surrounded by gst debug statements.
        enable_crack_output = "GST_DEBUG" in os.environ
        log.init('PITIVI_DEBUG', enable_color, enable_crack_output)

        self.info('starting up')
        self.settings = GlobalSettings()
        self.threads = ThreadMaster()
        self.effects = EffectsManager()
        self.system = getSystem()

        self.action_log.connect("commit", self._actionLogCommit)
        self.action_log.connect("undo", self._actionLogUndo)
        self.action_log.connect("redo", self._actionLogRedo)
        self.action_log.connect("cleaned", self._actionLogCleaned)
        self.timeline_log_observer = TimelineLogObserver(self.action_log)
        self.project_log_observer = ProjectLogObserver(self.action_log)

        self.project_manager.connect(
            "new-project-loading", self._newProjectLoadingCb)
        self.project_manager.connect(
            "new-project-loaded", self._newProjectLoaded)
        self.project_manager.connect("project-closed", self._projectClosed)

        self._createActions()
        self._checkVersion()
예제 #5
0
def setup():
    """Sets paths and initializes modules, to be able to run the tests."""
    res = True

    # Make available to configure.py the top level dir.
    pitivi_dir = get_pitivi_dir()
    sys.path.insert(0, pitivi_dir)

    from pitivi import configure

    # Make available the compiled C code.
    sys.path.append(configure.BUILDDIR)
    subproject_paths = os.path.join(configure.BUILDDIR, "subprojects", "gst-transcoder")

    _prepend_env_paths(LD_LIBRARY_PATH=subproject_paths,
                       GST_PLUGIN_PATH=subproject_paths,
                       GI_TYPELIB_PATH=subproject_paths,
                       GST_PRESET_PATH=[os.path.join(pitivi_dir, "data", "videopresets"),
                                        os.path.join(pitivi_dir, "data", "audiopresets")],
                       GST_ENCODING_TARGET_PATH=[os.path.join(pitivi_dir, "data", "encoding-profiles")])
    os.environ.setdefault('PITIVI_TOP_LEVEL_DIR', pitivi_dir)

    # Make sure the modules are initialized correctly.
    from pitivi import check
    check.initialize_modules()
    res = check.check_requirements()

    from pitivi.utils import loggable as log
    log.init('PITIVI_DEBUG')

    return res
예제 #6
0
def setup():
    """Sets paths and initializes modules, to be able to run the tests."""
    # Make sure xdg_*_home return temp dirs, to avoid touching
    # the config files of the developer.
    os.environ['XDG_DATA_HOME'] = mkdtemp()
    os.environ['XDG_CONFIG_HOME'] = mkdtemp()
    os.environ['XDG_CACHE_HOME'] = mkdtemp()

    # Make available to configure.py the top level dir.
    pitivi_dir = get_pitivi_dir()
    sys.path.insert(0, pitivi_dir)

    from pitivi import configure

    # Let Gst overrides from our prefix take precedence over any
    # other, making sure they are used. This allows us to ensure that
    # Gst overrides from gst-python are used when within flatpak
    local_overrides = os.path.join(configure.LIBDIR,
                                   "python" + sys.version[:3], "site-packages",
                                   "gi", "overrides")
    gi.overrides.__path__.insert(0, local_overrides)

    # Make available the compiled C code.
    sys.path.append(configure.BUILDDIR)
    subproject_paths = os.path.join(configure.BUILDDIR, "subprojects",
                                    "gst-transcoder")

    _prepend_env_paths(LD_LIBRARY_PATH=subproject_paths,
                       GST_PLUGIN_PATH=subproject_paths,
                       GI_TYPELIB_PATH=subproject_paths,
                       GST_PRESET_PATH=[
                           os.path.join(pitivi_dir, "data", "videopresets"),
                           os.path.join(pitivi_dir, "data", "audiopresets")
                       ],
                       GST_ENCODING_TARGET_PATH=[
                           os.path.join(pitivi_dir, "tests",
                                        "test-encoding-targets"),
                           os.path.join(pitivi_dir, "data",
                                        "encoding-profiles")
                       ])
    os.environ.setdefault('PITIVI_TOP_LEVEL_DIR', pitivi_dir)

    # Make sure the modules are initialized correctly.
    from pitivi import check
    check.initialize_modules()
    res = check.check_requirements()

    from pitivi.utils import loggable as log
    log.init('PITIVI_DEBUG')

    return res
예제 #7
0
    def do_startup(self):
        Gtk.Application.do_startup(self)

        # Init logging as early as possible so we can log startup code
        enable_color = not os.environ.get(
            'PITIVI_DEBUG_NO_COLOR', '0') in ('', '1')
        # Let's show a human-readable Pitivi debug output by default, and only
        # show a crazy unreadable mess when surrounded by gst debug statements.
        enable_crack_output = "GST_DEBUG" in os.environ
        loggable.init('PITIVI_DEBUG', enable_color, enable_crack_output)

        self.info('starting up')
        self._setup()
        self._checkVersion()
예제 #8
0
    def do_startup(self):
        Gtk.Application.do_startup(self)

        # Init logging as early as possible so we can log startup code
        enable_color = os.environ.get('PITIVI_DEBUG_NO_COLOR',
                                      '0') not in ('', '1')
        # Let's show a human-readable Pitivi debug output by default, and only
        # show a crazy unreadable mess when surrounded by gst debug statements.
        enable_crack_output = "GST_DEBUG" in os.environ
        loggable.init('PITIVI_DEBUG', enable_color, enable_crack_output)

        self.info('starting up')
        self._setup()
        self._check_version()
예제 #9
0
파일: __init__.py 프로젝트: jubayed/pitivi
def setup():
    """Sets paths and initializes modules, to be able to run the tests."""
    # Make sure xdg_*_home return temp dirs, to avoid touching
    # the config files of the developer.
    os.environ['XDG_DATA_HOME'] = mkdtemp()
    os.environ['XDG_CONFIG_HOME'] = mkdtemp()
    os.environ['XDG_CACHE_HOME'] = mkdtemp()

    # Make available to configure.py the top level dir.
    pitivi_dir = get_pitivi_dir()
    sys.path.insert(0, pitivi_dir)

    from pitivi import configure

    # Let Gst overrides from our prefix take precedence over any
    # other, making sure they are used.
    local_overrides = os.path.join(configure.LIBDIR,
                                   "python" + sys.version[:3],
                                   "site-packages", "gi", "overrides")
    gi.overrides.__path__.insert(0, local_overrides)

    # Make sure that flatpak gst-python overrides are always used first.
    flatpak_gst_python_path = os.path.join("/app/lib/", "python" + sys.version[:3],
                                           "site-packages", "gi", "overrides")
    if os.path.exists(flatpak_gst_python_path):
        gi.overrides.__path__.insert(0, flatpak_gst_python_path)

    # Make available the compiled C code.
    sys.path.append(configure.BUILDDIR)
    subproject_paths = os.path.join(configure.BUILDDIR, "subprojects", "gst-transcoder")

    _prepend_env_paths(LD_LIBRARY_PATH=subproject_paths,
                       GST_PLUGIN_PATH=subproject_paths,
                       GI_TYPELIB_PATH=subproject_paths,
                       GST_PRESET_PATH=[os.path.join(pitivi_dir, "data", "videopresets"),
                                        os.path.join(pitivi_dir, "data", "audiopresets")],
                       GST_ENCODING_TARGET_PATH=[os.path.join(pitivi_dir, "tests", "test-encoding-targets"),
                                                 os.path.join(pitivi_dir, "data", "encoding-profiles")])
    os.environ.setdefault('PITIVI_TOP_LEVEL_DIR', pitivi_dir)

    # Make sure the modules are initialized correctly.
    from pitivi import check
    check.initialize_modules()
    res = check.check_requirements()

    from pitivi.utils import loggable as log
    log.init('PITIVI_DEBUG')

    return res
예제 #10
0
파일: application.py 프로젝트: jojva/pitivi
    def __init__(self):
        """
        initialize pitivi with the command line arguments
        """
        Loggable.__init__(self)

        # init logging as early as possible so we can log startup code
        enable_color = os.environ.get('PITIVI_DEBUG_NO_COLOR',
                                      '0') in ('', '0')
        # Let's show a human-readable pitivi debug output by default, and only
        # show a crazy unreadable mess when surrounded by gst debug statements.
        enable_crack_output = "GST_DEBUG" in os.environ
        log.init('PITIVI_DEBUG', enable_color, enable_crack_output)

        self.info('starting up')

        # store ourself in the instance global
        if instance.PiTiVi:
            raise RuntimeWarning(
                _("There is already a %s instance, please inform "
                  "the developers by filing a bug at "
                  "http://bugzilla.gnome.org/enter_bug.cgi?product=pitivi") %
                APPNAME)
        instance.PiTiVi = self

        self.current = None

        # get settings
        self.settings = GlobalSettings()
        self.threads = ThreadMaster()
        #self.screencast = False

        self.effects = EffectsHandler()
        self.system = getSystem()

        self.projectManager = ProjectManager(self)
        self._connectToProjectManager(self.projectManager)

        self.action_log = UndoableActionLog()
        self.debug_action_log_observer = DebugActionLogObserver()
        self.debug_action_log_observer.startObserving(self.action_log)
        # TODO reimplement the observing after GES port
        #self.timelineLogObserver = TimelineLogObserver(self.action_log)
        self.projectLogObserver = ProjectLogObserver(self.action_log)

        self.version_information = {}
        self._checkVersion()
예제 #11
0
    def __init__(self):
        """
        initialize pitivi with the command line arguments
        """
        Loggable.__init__(self)

        # init logging as early as possible so we can log startup code
        enable_color = os.environ.get('PITIVI_DEBUG_NO_COLOR', '0') in ('', '0')
        # Let's show a human-readable pitivi debug output by default, and only
        # show a crazy unreadable mess when surrounded by gst debug statements.
        enable_crack_output = "GST_DEBUG" in os.environ
        log.init('PITIVI_DEBUG', enable_color, enable_crack_output)

        self.info('starting up')

        # store ourself in the instance global
        if instance.PiTiVi:
            raise RuntimeWarning(_("There is already a %s instance, please inform "
                "the developers by filing a bug at "
                "http://bugzilla.gnome.org/enter_bug.cgi?product=pitivi")
                % APPNAME)
        instance.PiTiVi = self

        self.current = None

        # get settings
        self.settings = GlobalSettings()
        self.threads = ThreadMaster()
        #self.screencast = False

        self.effects = EffectsHandler()
        self.system = getSystem()

        self.projectManager = ProjectManager(self.effects)
        self._connectToProjectManager(self.projectManager)

        self.action_log = UndoableActionLog()
        self.debug_action_log_observer = DebugActionLogObserver()
        self.debug_action_log_observer.startObserving(self.action_log)
        # TODO reimplement the observing after GES port
        #self.timelineLogObserver = TimelineLogObserver(self.action_log)
        self.projectLogObserver = ProjectLogObserver(self.action_log)
        self.medialibrary_log_observer = MediaLibraryLogObserver(self.action_log)

        self.version_information = {}
        self._checkVersion()
예제 #12
0
파일: runtests.py 프로젝트: nekohayo/pitivi
def setup():
    # Make available to configure.py the top level dir.
    pitivi_dir = get_pitivi_dir()
    os.environ.setdefault("PITIVI_TOP_LEVEL_DIR", pitivi_dir)

    # Make available the compiled C code.
    build_dir = get_build_dir()
    libs_dir = os.path.join(build_dir, "pitivi/coptimizations/.libs")
    sys.path.append(libs_dir)

    # Make sure the modules are initialized correctly.
    from pitivi import check

    check.initialize_modules()
    assert check.check_requirements()

    from pitivi.utils import loggable as log

    log.init("PITIVI_DEBUG")
예제 #13
0
def setup():
    """Sets paths and initializes modules, to be able to run the tests."""
    # Make sure xdg_*_home return temp dirs, to avoid touching
    # the config files of the developer.
    os.environ['XDG_DATA_HOME'] = mkdtemp()
    os.environ['XDG_CONFIG_HOME'] = mkdtemp()
    os.environ['XDG_CACHE_HOME'] = mkdtemp()

    # Make available to configure.py the top level dir.
    pitivi_dir = get_pitivi_dir()
    sys.path.insert(0, pitivi_dir)

    from pitivi import configure

    # Make available the compiled C code.
    sys.path.append(configure.BUILDDIR)
    subproject_paths = os.path.join(configure.BUILDDIR, "subprojects",
                                    "gst-transcoder")

    _prepend_env_paths(LD_LIBRARY_PATH=subproject_paths,
                       GST_PLUGIN_PATH=subproject_paths,
                       GI_TYPELIB_PATH=subproject_paths,
                       GST_PRESET_PATH=[
                           os.path.join(pitivi_dir, "data", "videopresets"),
                           os.path.join(pitivi_dir, "data", "audiopresets")
                       ],
                       GST_ENCODING_TARGET_PATH=[
                           os.path.join(pitivi_dir, "tests",
                                        "test-encoding-targets"),
                           os.path.join(pitivi_dir, "data",
                                        "encoding-profiles")
                       ])
    os.environ.setdefault('PITIVI_TOP_LEVEL_DIR', pitivi_dir)

    # Make sure the modules are initialized correctly.
    from pitivi import check
    check.initialize_modules()
    res = check.check_requirements()

    from pitivi.utils import loggable as log
    log.init('PITIVI_DEBUG')

    return res
예제 #14
0
def setup():
    # Make available to configure.py the top level dir.
    pitivi_dir = get_pitivi_dir()
    os.environ.setdefault('PITIVI_TOP_LEVEL_DIR', pitivi_dir)

    # Make available the compiled C code.
    build_dir = get_build_dir()
    libs_dir = os.path.join(build_dir, "pitivi/coptimizations/.libs")
    sys.path.append(libs_dir)

    # Make sure the modules are initialized correctly.
    from pitivi.check import initialize_modules
    initialize_modules()

    from pitivi.utils import loggable as log
    log.init('PITIVI_DEBUG')

    try:
        import mock
    except ImportError:
        print("\n\nPython mock library missing! www.voidspace.org.uk/python/mock\n\n", file=sys.stderr)
        raise
예제 #15
0

def gettestnames(file_names):
    test_names = [file_name[:-3] for file_name in file_names]
    return test_names

loader = unittest.TestLoader()

# Set verbosity.
descriptions = 1
verbosity = 1
if 'VERBOSE' in os.environ:
    descriptions = 2
    verbosity = 2
from pitivi.utils import loggable as log
log.init('PITIVI_DEBUG', 1)

# Make available to configure.py the top level dir.
dir = os.path.dirname(os.path.abspath(__file__))
top_srcdir = os.path.split(dir)[0]
os.environ.setdefault('PITIVI_TOP_LEVEL_DIR', top_srcdir)

# Pick which tests to run.
TEST_CASE = os.getenv("TESTCASE")
if TEST_CASE:
    test_names = [TEST_CASE]
else:
    test_names = gettestnames(sys.argv[1:])
suite = loader.loadTestsFromNames(test_names)
if not list(suite):
    raise Exception("No tests found")
예제 #16
0
파일: runtests.py 프로젝트: jojva/pitivi
def gettestnames(file_names):
    test_names = [file_name[:-3] for file_name in file_names]
    return test_names


loader = unittest.TestLoader()

# Set verbosity.
descriptions = 1
verbosity = 1
if 'VERBOSE' in os.environ:
    descriptions = 2
    verbosity = 2
from pitivi.utils import loggable as log
log.init('PITIVI_DEBUG', 1)

# Make available to configure.py the top level dir.
dir = os.path.dirname(os.path.abspath(__file__))
top_srcdir = os.path.split(dir)[0]
os.environ.setdefault('PITIVI_TOP_LEVEL_DIR', top_srcdir)

# Pick which tests to run.
TEST_CASE = os.getenv("TESTCASE")
if TEST_CASE:
    test_names = [TEST_CASE]
else:
    test_names = gettestnames(sys.argv[1:])
suite = loader.loadTestsFromNames(test_names)
if not list(suite):
    raise Exception("No tests found")
예제 #17
0
    initialize_modules()

    try:
        import mock
    except ImportError, e:
        raise Exception("Python mock library missing! www.voidspace.org.uk/python/mock", e)


if __name__ == "__main__":
    setup()

    # Set verbosity.
    descriptions = 1
    verbosity = 1
    if 'VERBOSE' in os.environ:
        descriptions = 2
        verbosity = 2
    from pitivi.utils import loggable as log
    log.init('PITIVI_DEBUG')

    suite = _tests_suite()
    if not list(suite):
        raise Exception("No tests found")

    # Run the tests.
    testRunner = unittest.TextTestRunner(descriptions=descriptions,
        verbosity=verbosity)
    result = testRunner.run(suite)
    if result.failures or result.errors:
        sys.exit(1)