/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: 2008-07-30 23:52:06 UTC
  • mto: (580.2.1 gtk.gloom)
  • mto: This revision was merged to the branch mainline in revision 581.
  • Revision ID: jelmer@samba.org-20080730235206-4stv1rmgw5ey0ttw
Add gloom command.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2008 Jelmer Vernooij <jelmer@samba.org>
 
2
#
 
3
# This program is free software; you can redistribute it and/or modify
 
4
# it under the terms of the GNU General Public License as published by
 
5
# the Free Software Foundation; either version 2 of the License, or
 
6
# (at your option) any later version.
 
7
#
 
8
# This program is distributed in the hope that it will be useful,
 
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
# GNU General Public License for more details.
 
12
#
 
13
# You should have received a copy of the GNU General Public License
 
14
# along with this program; if not, write to the Free Software
 
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
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
 
27
from bzrlib.plugins.gtk.dialog import question_dialog
 
28
from bzrlib.plugins.loom import branch as loom_branch
 
29
 
 
30
class LoomDialog(gtk.Dialog):
 
31
    """Simple Loom browse dialog."""
 
32
 
 
33
    def __init__(self, branch, parent=None):
 
34
        gtk.Dialog.__init__(self, title="Threads",
 
35
                                  parent=parent,
 
36
                                  flags=0,
 
37
                                  buttons=(gtk.STOCK_CLOSE,gtk.RESPONSE_OK))
 
38
        self.branch = branch
 
39
 
 
40
        self._construct()
 
41
 
 
42
    def run(self):
 
43
        try:
 
44
            loom_branch.require_loom_branch(self.branch)
 
45
        except loom_branch.NotALoom:
 
46
            response = question_dialog(
 
47
                _i18n("Upgrade to Loom branch?"),
 
48
                _i18n("Branch is not a loom branch. Upgrade to Loom format?"),
 
49
                parent=self)
 
50
                # Doesn't set a parent for the dialog..
 
51
            if response == gtk.RESPONSE_NO:
 
52
                return
 
53
            loom_branch.loomify(self.branch)
 
54
        return super(LoomDialog, self).run()
 
55
 
 
56
    def _construct(self):
 
57
        self._threads_view = gtk.TreeView()
 
58
        self._threads_view.show()
 
59
        self.vbox.pack_start(self._threads_view)
 
60
 
 
61
        # Buttons: combine-thread, export-loom, revert-loom, up-thread
 
62