Commits

Ronny Pfannschmidt committed 1be9a78

move the treemodel datafunc to the class

  • Participants
  • Parent commits a29e0cc

Comments (0)

Files changed (1)

gexcept/dialogs.py

 
 
 class ExtendedExceptionDialog(SimpleExceptionDialog):
+    format = ('File <span color="darkgreen">%r</span>,'
+              ' line <span color="blue"><i>%d</i></span> in <i>%s</i>\n'
+              '  %s')
     def get_trace_view(self, exc, tb):
         store = gtk.ListStore(str, int, str, str, object)
         for item in extract_tb(tb):
         cell = gtk.CellRendererText()
         column = gtk.TreeViewColumn('Pango Markup', cell, markup=0)
         view.append_column(column)
-        format = ('File <span color="darkgreen">%r</span>,'
-                  ' line <span color="blue"><i>%d</i></span> in <i>%s</i>\n'
-                  '  %s')
-        def data_func(column, cell, model, iter):
-            filename = escape(model.get_value(iter, 0))
-            lineno = model.get_value(iter, 1)
-            name = escape(model.get_value(iter, 2))
-            line = escape(model.get_value(iter, 3))
-
-            text = format%(filename, lineno, name, line)
-            cell.set_property('markup', text)
-        column.set_cell_data_func(cell, data_func)
+        column.set_cell_data_func(cell, self.data_func)
         return view
 
+    def data_func(self, column, cell, model, iter):
+        filename = escape(model.get_value(iter, 0))
+        lineno = model.get_value(iter, 1)
+        name = escape(model.get_value(iter, 2))
+        line = escape(model.get_value(iter, 3))
+
+        text = self.format%(filename, lineno, name, line)
+        cell.set_property('markup', text)