/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to revbrowser.py

  • Committer: Curtis Hovey
  • Date: 2011-07-31 15:52:43 UTC
  • mto: This revision was merged to the branch mainline in revision 741.
  • Revision ID: sinzui.is@verizon.net-20110731155243-ln8istmxbryhb4pz
Mechanical changes made by pygi.convert.sh.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
 
import time
18
 
 
19
17
try:
20
18
    import pygtk
21
19
    pygtk.require("2.0")
22
20
except:
23
21
    pass
24
22
 
25
 
import gobject
26
 
import gtk
 
23
from gi.repository import GObject
 
24
from gi.repository import Gtk
27
25
 
28
 
from bzrlib.osutils import format_date
29
 
from bzrlib.plugins.gtk import _i18n
30
26
from bzrlib.plugins.gtk.branchview.treeview import TreeView
31
 
 
32
 
 
33
 
class RevisionBrowser(gtk.Dialog):
 
27
from bzrlib.plugins.gtk.i18n import _i18n
 
28
 
 
29
 
 
30
class RevisionBrowser(Gtk.Dialog):
34
31
    """ Revision Browser main window. """
35
32
    def __init__(self, branch, parent=None):
36
 
        gtk.Dialog.__init__(self, title="Revision Browser - Olive",
 
33
        GObject.GObject.__init__(self, title="Revision Browser - Olive",
37
34
                                  parent=parent,
38
 
                                  flags=gtk.DIALOG_MODAL,
39
 
                                  buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
40
 
    
 
35
                                  flags=Gtk.DialogFlags.MODAL,
 
36
                                  buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL))
 
37
 
41
38
        # Get arguments
42
39
        self.branch = branch
43
 
        
 
40
 
44
41
        # Create the widgets
45
 
        self._button_select = gtk.Button(_i18n("_Select"), use_underline=True)
 
42
        self._button_select = Gtk.Button(_i18n("_Select"), use_underline=True)
46
43
        start_revs = [branch.last_revision(),]
47
44
        self.treeview = TreeView(branch, start_revs, None)
48
 
        
 
45
 
49
46
        # Set callbacks
50
47
        self._button_select.connect('clicked', self._on_select_clicked)
51
48
        self.treeview.connect('revision-activated',
52
49
                               self._on_treeview_revision_activated)
53
 
        
 
50
 
54
51
        # Set properties
55
52
        self.set_default_size(600, 400)
56
53
        self.vbox.set_spacing(3)
57
54
        self.treeview.set_property('graph-column-visible', False)
58
55
        self.treeview.set_property('date-column-visible', True)
59
56
        self.treeview.set_property('mainline-only', True)
60
 
        
 
57
 
61
58
        # Construct the dialog
62
59
        self.action_area.pack_end(self._button_select)
63
 
        
 
60
 
64
61
        self.vbox.pack_start(self.treeview, True, True)
65
62
 
66
63
        # Show the dialog
67
64
        self.show_all()
68
65
 
69
 
    
 
66
 
70
67
    def _on_treeview_revision_activated(self, treeview, path, column):
71
68
        """ Double-click on a row should also select a revision. """
72
69
        self._on_select_clicked(treeview)
73
 
    
 
70
 
74
71
    def _on_select_clicked(self, widget):
75
72
        """ Select button clicked handler. """
76
 
        
 
73
 
77
74
        self.selected_revno = self.treeview.get_property('revision-number')
78
75
        self.selected_revid = \
79
76
                    self.treeview.get_property('revision').revision_id
80
 
        self.response(gtk.RESPONSE_OK)
 
77
        self.response(Gtk.ResponseType.OK)