/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: rodney.dawes at canonical
  • Date: 2008-10-25 06:02:09 UTC
  • Revision ID: rodney.dawes@canonical.com-20081025060209-irlizouino63cs1m
        * preferences/__init__.py:
        Remove the dialog separator
        Remove useless extra call to self._create_pages()
        Make the default window size smaller
        Set the default border width on various widgets
        Set the current notebook page to the first one

        * preferences/identity.py:
        Set various border widths appropriately
        Align the labels to the left
        Remove the unneeded bold markup from the labels
        Change the "User Id" label to "E-Mail"
        Align the radio group labels to the top of the groups

        * preferences/plugins.py:
        Set various border widths appropriately
        Set the default paned position to something more sensible
        Set the shadow type on the treeview's scrolled window to in
        Align the Author and Version labels to the left

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