Пример #1
0
    def _branch_search_cb(self, w):
        from bzrlib.plugins.search import (
            index as _mod_index,
            errors as search_errors,
            )
        from bzrlib.plugins.gtk.search import SearchDialog

        try:
            index = _mod_index.open_index_url(self.branch.base)
        except search_errors.NoSearchIndex:
            dialog = Gtk.MessageDialog(self, type=Gtk.MessageType.QUESTION, 
                buttons=Gtk.ButtonsType.OK_CANCEL, 
                message_format="This branch has not been indexed yet. "
                               "Index now?")
            if dialog.run() == Gtk.ResponseType.OK:
                dialog.destroy()
                index = _mod_index.index_url(self.branch.base)
            else:
                dialog.destroy()
                return

        dialog = SearchDialog(index)

        if dialog.run() == Gtk.ResponseType.OK:
            revid = dialog.get_revision()
            if revid is not None:
                self.set_revision(revid)

        dialog.destroy()
Пример #2
0
    def _branch_search_cb(self, w):
        from bzrlib.plugins.search import index as _mod_index
        from bzrlib.plugins.gtk.search import SearchDialog
        from bzrlib.plugins.search import errors as search_errors

        try:
            index = _mod_index.open_index_url(self.branch.base)
        except search_errors.NoSearchIndex:
            dialog = gtk.MessageDialog(self, type=gtk.MESSAGE_QUESTION, 
                buttons=gtk.BUTTONS_OK_CANCEL, 
                message_format="This branch has not been indexed yet. "
                               "Index now?")
            if dialog.run() == gtk.RESPONSE_OK:
                dialog.destroy()
                index = _mod_index.index_url(self.branch.base)
            else:
                dialog.destroy()
                return

        dialog = SearchDialog(index)

        if dialog.run() == gtk.RESPONSE_OK:
            self.set_revision(dialog.get_revision())

        dialog.destroy()