/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: Jelmer Vernooij
  • Date: 2012-03-23 13:45:02 UTC
  • Revision ID: jelmer@samba.org-20120323134502-fsxyhpb0ilbabozp
Ignore bzr-handle-patch in software center.

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