diff --git a/debug-viewer/GstDebugViewer/Common/GUI.py b/debug-viewer/GstDebugViewer/Common/GUI.py index 925f9d130f..452c4c0e6c 100644 --- a/debug-viewer/GstDebugViewer/Common/GUI.py +++ b/debug-viewer/GstDebugViewer/Common/GUI.py @@ -164,11 +164,11 @@ class MetaModel (gobject.GObjectMeta): ... Example: A gtk.ListStore derived model can use - + columns = ("COL_NAME", str, "COL_VALUE", str) - + and use this in __init__: - + gtk.ListStore.__init__ (self, *self.column_types) Then insert data like this: @@ -177,20 +177,20 @@ class MetaModel (gobject.GObjectMeta): self.COL_NAME, "spam", self.COL_VALUE, "ham") """ - + def __init__ (cls, name, bases, dict): - + super (MetaModel, cls).__init__ (name, bases, dict) - + spec = tuple (cls.columns) - + column_names = spec[::2] column_types = spec[1::2] column_indices = range (len (column_names)) - + for col_index, col_name, in zip (column_indices, column_names): setattr (cls, col_name, col_index) - + cls.column_types = column_types cls.column_ids = tuple (column_indices) @@ -342,7 +342,7 @@ class StateItem (StateString): return None return self.parse_item (value) - + def set (self, section, value): if value is None: @@ -359,7 +359,7 @@ class StateItem (StateString): try: return self.manager.find_item_class (name = name) except KeyError: - return None + return None class StateItemList (StateItem): @@ -471,7 +471,7 @@ class WindowState (object): self.window = window self.state = state - + self.window.connect ("window-state-event", self.handle_window_state_event) @@ -501,7 +501,7 @@ class WindowState (object): if not event.changed_mask & gtk.gdk.WINDOW_STATE_MAXIMIZED: return - + if event.new_window_state & gtk.gdk.WINDOW_STATE_MAXIMIZED: self.logger.debug ("maximized") self.is_maximized = True diff --git a/debug-viewer/GstDebugViewer/Common/Main.py b/debug-viewer/GstDebugViewer/Common/Main.py index 63071ecd1e..4fad0ee087 100644 --- a/debug-viewer/GstDebugViewer/Common/Main.py +++ b/debug-viewer/GstDebugViewer/Common/Main.py @@ -107,7 +107,7 @@ class MainLoopWrapper (ExceptionHandler): self.enter () finally: ExceptHookManager.unregister_handler (self) - + if self.exc_info != (None,) * 3: # Re-raise unhandled exception that occured while running the loop. exc_type, exc_value, exc_tb = self.exc_info @@ -199,7 +199,7 @@ class ExceptHookManagerClass (object): for handler in sorted (self.handlers, key = attrgetter ("priority"), reverse = True): - + if handler._handling_exception: continue @@ -253,7 +253,7 @@ class PathsBase (object): if cls.data_dir is None: source_dir = os.path.dirname (os.path.dirname (os.path.abspath (__file__))) cls.setup_uninstalled (source_dir) - + def __new__ (cls): raise RuntimeError ("do not create instances of this class -- " @@ -319,7 +319,7 @@ class OptionParser (object): if not description: description = "" - + if arg_name is None: flags |= gobject.OPTION_FLAG_NO_ARG elif arg_parser is not None: @@ -360,7 +360,7 @@ class OptionParser (object): group = gobject.OptionGroup (None, None, None, self.__handle_option) context.set_main_group (group) group.add_entries (self.__entries) - + try: result_argv = context.parse (argv) except gobject.GError, exc: @@ -377,7 +377,7 @@ class OptionParser (object): def handle_parse_complete (self, remaining_args): pass - + class LogOptionParser (OptionParser): """Like OptionParser, but adds a --log-level option.""" diff --git a/debug-viewer/GstDebugViewer/Common/utils.py b/debug-viewer/GstDebugViewer/Common/utils.py index 55dd54a6bf..c7466e7151 100644 --- a/debug-viewer/GstDebugViewer/Common/utils.py +++ b/debug-viewer/GstDebugViewer/Common/utils.py @@ -321,4 +321,4 @@ class DevhelpClient (object): except OSError, exc: self._check_os_error (exc) raise - + diff --git a/debug-viewer/GstDebugViewer/Data.py b/debug-viewer/GstDebugViewer/Data.py index 81dae081e5..c3e6c982f3 100644 --- a/debug-viewer/GstDebugViewer/Data.py +++ b/debug-viewer/GstDebugViewer/Data.py @@ -145,7 +145,7 @@ def default_log_line_regex_ (): return expressions def default_log_line_regex (): - + expressions = default_log_line_regex_ () return re.compile ("".join (expressions)) diff --git a/debug-viewer/GstDebugViewer/GUI.py b/debug-viewer/GstDebugViewer/GUI.py index 3973c6488c..6468ff079f 100644 --- a/debug-viewer/GstDebugViewer/GUI.py +++ b/debug-viewer/GstDebugViewer/GUI.py @@ -180,7 +180,7 @@ class LogModelBase (gtk.GenericTreeModel): columns = ("COL_TIME", gobject.TYPE_UINT64, "COL_PID", int, "COL_THREAD", gobject.TYPE_UINT64, - "COL_LEVEL", object, + "COL_LEVEL", object, "COL_CATEGORY", str, "COL_FILENAME", str, "COL_LINE_NUMBER", int, @@ -226,7 +226,7 @@ class LogModelBase (gtk.GenericTreeModel): return flags def on_get_n_columns (self): - + return len (self.column_types) def on_get_column_type (self, col_id): @@ -369,7 +369,7 @@ class FilteredLogModelBase (LogModelBase): self.super_model = super_model self.access_offset = super_model.access_offset self.ensure_cached = super_model.ensure_cached - self.line_cache = super_model.line_cache + self.line_cache = super_model.line_cache def line_index_to_super (self, line_index): @@ -382,7 +382,7 @@ class FilteredLogModelBase (LogModelBase): def line_index_to_top (self, line_index): _log_indices = [line_index] - + super_index = line_index for model in self._iter_hierarchy (): super_index = model.line_index_to_super (super_index) @@ -1249,7 +1249,7 @@ class ColumnManager (Common.GUI.Manager): col_class = self.find_item_class (name = column.name) new_order.append (col_class) new_order.extend (self.__iter_next_hidden (col_class)) - + names = (column.name for column in new_visible) self.logger.debug ("visible columns reordered: %s", ", ".join (names)) @@ -1643,7 +1643,7 @@ class Window (object): self.ui_factory = Common.GUI.UIFactory (ui_filename, self.actions) self.ui_manager = ui = self.ui_factory.make () - menubar = ui.get_widget ("/ui/menubar") + menubar = ui.get_widget ("/ui/menubar") self.widgets.vbox_main.pack_start (menubar, False, False, 0) self.gtk_window = self.widgets.main_window @@ -1762,7 +1762,7 @@ class Window (object): model = self.log_view.props.model if model is None: return - + try: line_index = self.get_active_line_index () except ValueError: @@ -1801,7 +1801,7 @@ class Window (object): selected_index = self.default_index start_index = self.default_start_index - + if selected_index is not None: try: @@ -2088,7 +2088,7 @@ class Window (object): try: self.setup_model (LazyLogModel ()) - + self.dispatcher = Common.Data.GSourceDispatcher () self.log_file = Data.LogFile (filename, self.dispatcher) except EnvironmentError, exc: @@ -2186,7 +2186,7 @@ class AppStateSection (Common.GUI.StateSection): maximized = Common.GUI.StateBool ("window-maximized") column_order = Common.GUI.StateItemList ("column-order", ViewColumnManager) - columns_visible = Common.GUI.StateItemList ("columns-visible", ViewColumnManager) + columns_visible = Common.GUI.StateItemList ("columns-visible", ViewColumnManager) class AppState (Common.GUI.State): diff --git a/debug-viewer/GstDebugViewer/Plugins/FindBar.py b/debug-viewer/GstDebugViewer/Plugins/FindBar.py index 3c61e031a7..69ec9455db 100644 --- a/debug-viewer/GstDebugViewer/Plugins/FindBar.py +++ b/debug-viewer/GstDebugViewer/Plugins/FindBar.py @@ -38,7 +38,7 @@ class SearchOperation (object): col_id = GUI.LogModelBase.COL_MESSAGE len_search_text = len (search_text) - + def match_func (model_row): message = model_row[col_id] @@ -247,7 +247,7 @@ class FindBarFeature (FeatureBase): ui.insert_action_group (self.action_group, 0) self.log_view = window.log_view - + self.merge_id = ui.new_merge_id () for name, action_name in [("ViewFindBar", "show-find-bar",), ("ViewNextResult", "goto-next-search-result",), diff --git a/debug-viewer/GstDebugViewer/Plugins/Timeline.py b/debug-viewer/GstDebugViewer/Plugins/Timeline.py index 1ba7813b05..1d11614ab7 100644 --- a/debug-viewer/GstDebugViewer/Plugins/Timeline.py +++ b/debug-viewer/GstDebugViewer/Plugins/Timeline.py @@ -587,7 +587,7 @@ class TimelineWidget (gtk.DrawingArea): ctx.move_to (-size // 2, 0) ctx.line_to ((size + 1) // 2, 0) ctx.line_to (0, size / 1.41) - ctx.close_path () + ctx.close_path () for level in (Data.debug_level_warning, Data.debug_level_error,): ctx.set_source_rgb (*(colors[level][1].float_tuple ())) @@ -612,7 +612,7 @@ class TimelineWidget (gtk.DrawingArea): ctx.line_to (i, h) ctx.close_path () - + ctx.fill () def __have_position (self): @@ -713,7 +713,7 @@ class AttachedWindow (object): "hide-after-line", gtk.UI_MANAGER_MENUITEM, False) ui.add_ui (self.merge_id, "/TimelineContextMenu", "TimelineShowHiddenLines", "show-hidden-lines", gtk.UI_MANAGER_MENUITEM, False) - + box = window.get_top_attach_point () self.timeline = TimelineWidget () @@ -771,7 +771,7 @@ class AttachedWindow (object): self.timeline.clear () self.vtimeline.clear () return - + self.timeline.update (model) # Need to dispatch these idly with a low priority to avoid triggering a @@ -805,7 +805,7 @@ class AttachedWindow (object): model.COL_TIME) ts2 = model.get_value (model.get_iter (end_path), model.COL_TIME) - + self.timeline.update_position (ts1, ts2) def handle_show_action_toggled (self, action): @@ -876,7 +876,7 @@ class AttachedWindow (object): view.scroll_to_cell (path, use_align = True, row_align = .5) sel = view.get_selection () sel.select_path (path) - + return False class TimelineFeature (FeatureBase): diff --git a/debug-viewer/setup.py b/debug-viewer/setup.py index 4e55e5a986..0987e7fdcc 100755 --- a/debug-viewer/setup.py +++ b/debug-viewer/setup.py @@ -289,7 +289,7 @@ class install_scripts_custom (install_scripts): install = self.distribution.get_command_obj ("install") install.ensure_finalized () - + values = {"DATADIR" : install.install_data or "", "PREFIX" : install.home or install.prefix or "", "SCRIPTSDIR" : self.install_dir or ""} @@ -317,7 +317,7 @@ class install_scripts_custom (install_scripts): cmdclass = {"build" : build_custom, "clean" : clean_custom, "install_scripts" : install_scripts_custom, - + "build_l10n" : build_l10n, "distcheck" : distcheck, "tests" : tests} @@ -334,7 +334,7 @@ setup (cmdclass = cmdclass, "data/progress-dialog.ui"],), ("share/icons/hicolor/48x48/apps", ["data/gst-debug-viewer.png"],), ("share/icons/hicolor/scalable/apps", ["data/gst-debug-viewer.svg"],)], - + name = "gst-debug-viewer", version = "0.4", description = "GStreamer Debug Viewer", diff --git a/debug-viewer/tests/test_models.py b/debug-viewer/tests/test_models.py index 3bcddb079e..03240286e9 100755 --- a/debug-viewer/tests/test_models.py +++ b/debug-viewer/tests/test_models.py @@ -299,7 +299,7 @@ class TestDynamicFilter (TestCase): self.assertEquals (rows_ranged, range (5, 16)) self.__dump_model (filtered_model, "filtered model (nofilter, 5, 15)") - + rows_filtered = row_list (filtered_model) self.assertEquals (rows_ranged, rows_filtered) @@ -450,6 +450,6 @@ class TestDynamicFilter (TestCase): print else: print comment - + if __name__ == "__main__": test_main ()