2007-11-22 08:47:06 +00:00
|
|
|
# -*- coding: utf-8; mode: python; -*-
|
|
|
|
#
|
|
|
|
# GStreamer Debug Viewer - View and analyze GStreamer debug log files
|
|
|
|
#
|
|
|
|
# Copyright (C) 2007 René Stadler <mail@renestadler.de>
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify it
|
|
|
|
# under the terms of the GNU General Public License as published by the Free
|
|
|
|
# Software Foundation; either version 3 of the License, or (at your option)
|
|
|
|
# any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
|
|
# more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License along with
|
|
|
|
# this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
"""GStreamer Debug Viewer Plugins package."""
|
2007-11-14 08:30:19 +00:00
|
|
|
|
2007-12-10 09:49:39 +00:00
|
|
|
__all__ = ["_", "_N", "FeatureBase", "PluginBase"]
|
2007-11-14 08:30:19 +00:00
|
|
|
|
|
|
|
import os.path
|
|
|
|
|
2007-12-10 09:49:39 +00:00
|
|
|
|
2016-09-28 18:38:55 +00:00
|
|
|
def _N(s):
|
|
|
|
return s
|
|
|
|
|
|
|
|
|
|
|
|
def load(paths=()):
|
2007-11-14 08:30:19 +00:00
|
|
|
|
|
|
|
for path in paths:
|
2016-09-28 18:38:55 +00:00
|
|
|
for plugin_module in _load_plugins(path):
|
2007-11-14 08:30:19 +00:00
|
|
|
yield plugin_module.Plugin
|
|
|
|
|
|
|
|
|
2016-09-28 18:38:55 +00:00
|
|
|
def _load_plugins(path):
|
|
|
|
|
|
|
|
import imp
|
|
|
|
import glob
|
2007-11-14 08:30:19 +00:00
|
|
|
|
2016-09-28 18:38:55 +00:00
|
|
|
files = glob.glob(os.path.join(path, "*.py"))
|
2007-11-14 08:30:19 +00:00
|
|
|
|
|
|
|
for filename in files:
|
|
|
|
|
2016-09-28 18:38:55 +00:00
|
|
|
name = os.path.basename(os.path.splitext(filename)[0])
|
2007-11-14 08:30:19 +00:00
|
|
|
if name == "__init__":
|
|
|
|
continue
|
2016-09-28 18:38:55 +00:00
|
|
|
fp, pathname, description = imp.find_module(name, [path])
|
|
|
|
module = imp.load_module(name, fp, pathname, description)
|
2007-11-14 08:30:19 +00:00
|
|
|
yield module
|
|
|
|
|
2016-09-28 18:38:55 +00:00
|
|
|
|
2007-11-14 08:30:19 +00:00
|
|
|
class FeatureBase (object):
|
|
|
|
|
2016-09-28 18:38:55 +00:00
|
|
|
def __init__(self, app):
|
2007-11-26 12:42:46 +00:00
|
|
|
|
|
|
|
pass
|
2007-11-14 08:30:19 +00:00
|
|
|
|
2016-09-28 18:38:55 +00:00
|
|
|
def handle_attach_window(self, window):
|
2016-09-30 20:31:24 +00:00
|
|
|
"""
|
|
|
|
window: GstDebugViewer.GUI.window.Window
|
|
|
|
"""
|
2007-11-22 14:06:55 +00:00
|
|
|
|
|
|
|
pass
|
|
|
|
|
2016-09-28 18:38:55 +00:00
|
|
|
def handle_attach_log_file(self, window, log_file):
|
2016-09-30 20:31:24 +00:00
|
|
|
"""
|
|
|
|
window: GstDebugViewer.GUI.window.Window
|
|
|
|
log_file: GstDebugViewer.Data.LogFile
|
|
|
|
"""
|
2007-11-22 14:06:55 +00:00
|
|
|
|
|
|
|
pass
|
|
|
|
|
2016-09-28 18:38:55 +00:00
|
|
|
def handle_detach_log_file(self, window, log_file):
|
2016-09-30 20:31:24 +00:00
|
|
|
"""
|
|
|
|
window: GstDebugViewer.GUI.window.Window
|
|
|
|
log_file: GstDebugViewer.Data.LogFile
|
|
|
|
"""
|
2007-11-22 14:06:55 +00:00
|
|
|
|
|
|
|
pass
|
|
|
|
|
2016-09-28 18:38:55 +00:00
|
|
|
def handle_detach_window(self, window):
|
2016-09-30 20:31:24 +00:00
|
|
|
"""
|
|
|
|
window: GstDebugViewer.GUI.window.Window
|
|
|
|
"""
|
2007-11-22 08:29:23 +00:00
|
|
|
|
|
|
|
pass
|
|
|
|
|
2016-09-28 18:38:55 +00:00
|
|
|
|
2007-11-14 08:30:19 +00:00
|
|
|
class PluginBase (object):
|
2016-09-28 19:19:29 +00:00
|
|
|
"""
|
|
|
|
All plugins must implement a class called Plugin inheriting from PluginBase.
|
|
|
|
They should place a tuple of features they export into 'features'. Each
|
|
|
|
feature should be a subclass of FeatureBase.
|
|
|
|
"""
|
2007-11-14 08:30:19 +00:00
|
|
|
|
|
|
|
features = ()
|
|
|
|
|
2016-09-28 18:38:55 +00:00
|
|
|
def __init__(self, app):
|
2007-11-14 08:30:19 +00:00
|
|
|
|
|
|
|
pass
|