Ronny Pfannschmidt avatar Ronny Pfannschmidt committed 1be9a78

move the treemodel datafunc to the class

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)
 
 
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.