Source

pytest-gui / pytest_gui / gtkui / filefails.py

'''
detailed information on thefailures within a file
'''
import gtk
from pygtkhelpers.ui.objectlist import ObjectList, Column
from pygtkhelpers.delegates import WindowView


class FileFailView(WindowView):
    fileentry = None

    def create_ui(self):
        self.collection = ObjectList([
            Column('nodeid',
                   format_func=lambda x:x.split('::', 1)[-1]),
        ])
        self.collection.set_headers_visible(False)
        self.collection.show()

        self.paned = gtk.HPaned()
        self.paned.add(self.collection)
        self.paned.show()
        self.textview = gtk.TextView()
        self.scroll = gtk.ScrolledWindow()
        self.scroll.add(self.textview)
        self.paned.add(self.scroll)
        self.widget.add(self.paned)

        self.widget.connect('delete_event', gtk.Widget.hide_on_delete)

    def set_entry(self, fileentry):
        if self.fileentry:
            del self.fileentry.view
        self.collection.clear()
        self.fileentry = fileentry
        if fileentry:
            fileentry.view = self
            self.collection.extend(fileentry.reports)
        if self.collection:
            self.collection.selected_item = self.collection[0]

    def on_collection__selection_changed(self, _):
        repr = self.collection.selected_item.longrepr
        self.textview.get_buffer().set_text(repr)
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.