/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 loom.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
 
from gi.repository import GObject
19
 
 
 
17
try:
 
18
    import pygtk
 
19
    pygtk.require("2.0")
 
20
except:
 
21
    pass
 
22
 
 
23
import gtk
 
24
import gobject
 
25
 
 
26
from bzrlib.plugins.gtk import _i18n
20
27
from bzrlib.plugins.gtk.diff import DiffWidget
21
28
from bzrlib.plugins.gtk.dialog import question_dialog
22
 
from bzrlib.plugins.loom import (
23
 
    branch as loom_branch,
24
 
    tree as loom_tree,
25
 
    )
26
 
from bzrlib.plugins.gtk.i18n import _i18n
27
 
 
28
 
 
29
 
class LoomDialog(Gtk.Dialog):
 
29
from bzrlib.plugins.loom import branch as loom_branch
 
30
from bzrlib.plugins.loom import tree as loom_tree
 
31
 
 
32
class LoomDialog(gtk.Dialog):
30
33
    """Simple Loom browse dialog."""
31
34
 
32
35
    def __init__(self, branch, tree=None, parent=None):
33
 
        super(LoomDialog, self).__init__(
34
 
            title="Threads", parent=parent, flags=0,
35
 
            buttons=(Gtk.STOCK_CLOSE,Gtk.ResponseType.OK))
 
36
        gtk.Dialog.__init__(self, title="Threads",
 
37
                                  parent=parent,
 
38
                                  flags=0,
 
39
                                  buttons=(gtk.STOCK_CLOSE,gtk.RESPONSE_OK))
36
40
        self.branch = branch
37
41
        if tree is not None:
38
42
            self.tree = loom_tree.LoomTreeDecorator(tree)
50
54
                _i18n("Branch is not a loom branch. Upgrade to Loom format?"),
51
55
                parent=self)
52
56
                # Doesn't set a parent for the dialog..
53
 
            if response == Gtk.ResponseType.NO:
 
57
            if response == gtk.RESPONSE_NO:
54
58
                return
55
59
            assert self.branch.nick is not None
56
60
            loom_branch.loomify(self.branch)
58
62
        return super(LoomDialog, self).run()
59
63
 
60
64
    def _construct(self):
61
 
        hbox = Gtk.HBox()
 
65
        hbox = gtk.HBox()
62
66
 
63
 
        self._threads_scroller = Gtk.ScrolledWindow()
64
 
        self._threads_scroller.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
65
 
        self._threads_view = Gtk.TreeView()
 
67
        self._threads_scroller = gtk.ScrolledWindow()
 
68
        self._threads_scroller.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
 
69
        self._threads_view = gtk.TreeView()
66
70
        self._threads_scroller.add(self._threads_view)
67
 
        self._threads_scroller.set_shadow_type(Gtk.ShadowType.IN)
68
 
        hbox.pack_start(self._threads_scroller, True, True, 0)
 
71
        self._threads_scroller.set_shadow_type(gtk.SHADOW_IN)
 
72
        hbox.pack_start(self._threads_scroller)
69
73
 
70
 
        self._threads_store = Gtk.ListStore(
71
 
                GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_PYOBJECT, GObject.TYPE_STRING)
 
74
        self._threads_store = gtk.ListStore(
 
75
                gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_PYOBJECT, gobject.TYPE_STRING)
72
76
        self._threads_view.set_model(self._threads_store)
73
 
        self._threads_view.append_column(Gtk.TreeViewColumn("Name", Gtk.CellRendererText(), text=0))
 
77
        self._threads_view.append_column(gtk.TreeViewColumn("Name", gtk.CellRendererText(), text=0))
74
78
        self._threads_view.connect('cursor-changed', self._on_view_thread)
75
79
        if self.tree is not None:
76
80
            self._threads_view.connect('row-activated', self._on_switch_thread)
77
81
 
78
82
        self._diff = DiffWidget()
79
83
        self._diff.show()
80
 
        hbox.pack_end(self._diff, False, False, 0)
 
84
        hbox.pack_end(self._diff)
81
85
 
82
86
        hbox.show_all()
83
 
        self.get_content_area().pack_start(hbox, True, True, 0)
 
87
        self.vbox.pack_start(hbox)
84
88
 
85
89
        # FIXME: Buttons: combine-thread, revert-loom, record
86
90
        self.set_default_size(500, 350)