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
17
from gi.repository import Gtk
18
from gi.repository import GObject
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
29
class LoomDialog(Gtk.Dialog):
35
class LoomDialog(gtk.Dialog):
30
36
"""Simple Loom browse dialog."""
32
38
def __init__(self, branch, tree=None, parent=None):
33
GObject.GObject.__init__(self, title="Threads",
39
gtk.Dialog.__init__(self, title="Threads",
36
buttons=(Gtk.STOCK_CLOSE,Gtk.ResponseType.OK))
42
buttons=(gtk.STOCK_CLOSE,gtk.RESPONSE_OK))
37
43
self.branch = branch
38
44
if tree is not None:
39
45
self.tree = loom_tree.LoomTreeDecorator(tree)
51
57
_i18n("Branch is not a loom branch. Upgrade to Loom format?"),
53
59
# Doesn't set a parent for the dialog..
54
if response == Gtk.ResponseType.NO:
60
if response == gtk.RESPONSE_NO:
56
62
assert self.branch.nick is not None
57
63
loom_branch.loomify(self.branch)
59
65
return super(LoomDialog, self).run()
61
67
def _construct(self):
64
self._threads_scroller = Gtk.ScrolledWindow()
65
self._threads_scroller.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
66
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()
67
73
self._threads_scroller.add(self._threads_view)
68
self._threads_scroller.set_shadow_type(Gtk.ShadowType.IN)
69
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)
71
self._threads_store = Gtk.ListStore(
72
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)
73
79
self._threads_view.set_model(self._threads_store)
74
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))
75
81
self._threads_view.connect('cursor-changed', self._on_view_thread)
76
82
if self.tree is not None:
77
83
self._threads_view.connect('row-activated', self._on_switch_thread)
81
87
hbox.pack_end(self._diff)
84
self.vbox.pack_start(hbox, True, True, 0)
90
self.vbox.pack_start(hbox)
86
92
# FIXME: Buttons: combine-thread, revert-loom, record
87
93
self.set_default_size(500, 350)