/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: 2012-09-02 19:29:42 UTC
  • mfrom: (794.1.1 get_style_context)
  • Revision ID: sinzui.is@verizon.net-20120902192942-cwtww9wxvznx0wod
Do not call deprecated get_style(); use get_style_context().

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