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