/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: 2011-04-10 18:44:39 UTC
  • mto: This revision was merged to the branch mainline in revision 730.
  • Revision ID: jelmer@samba.org-20110410184439-g7hqaacexqtviq13
Move i18n support to a separate file, so gettext files aren't loaded unless bzr-gtk is used.

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