/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: Curtis Hovey
  • Date: 2012-09-02 19:29:42 UTC
  • mfrom: (794.1.1 get_style_context)
  • Revision ID: sinzui.is@verizon.net-20120902192942-cwtww9wxvznx0wod
Do not call deprecated get_style(); use get_style_context().

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