/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 preferences/__init__.py

  • Committer: Jelmer Vernooij
  • Date: 2008-06-29 19:18:34 UTC
  • mto: This revision was merged to the branch mainline in revision 515.
  • Revision ID: jelmer@samba.org-20080629191834-ha2ecpv5szt96nge
Make sure signed testament matches repository data.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2007 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
 
 
25
from bzrlib.config import GlobalConfig
 
26
from identity import IdentityPage
 
27
from plugins import PluginsPage
 
28
 
 
29
class PreferencesWindow(gtk.Dialog):
 
30
    """Displays global preferences windows."""
 
31
    # Note that we don't allow configuration of aliases or 
 
32
    # default log formats. This is because doing so wouldn't make 
 
33
    # a lot of sense to pure GUI users. Users that need these settings 
 
34
    # will already be familiar with the configuration file.
 
35
 
 
36
    def __init__(self, config=None):
 
37
        """ Initialize the Status window. """
 
38
        super(PreferencesWindow, self).__init__(flags=gtk.DIALOG_MODAL)
 
39
        self.set_title("Bazaar Preferences")
 
40
        self.config = config
 
41
        if self.config is None:
 
42
            self.config = GlobalConfig()
 
43
        self._create()
 
44
        self._create_pages()
 
45
 
 
46
 
 
47
    def _create(self):
 
48
        self.set_default_size(600, 600)
 
49
        notebook = gtk.Notebook()
 
50
        for (label, page) in self._create_pages():
 
51
            notebook.insert_page(page, gtk.Label(label))
 
52
        self.vbox.pack_start(notebook, True, True)
 
53
        self.vbox.show_all()
 
54
 
 
55
    def _create_pages(self):
 
56
        return [("Identity", IdentityPage(self.config)), 
 
57
                ("Plugins", PluginsPage())]
 
58
 
 
59
    def display(self):
 
60
        self.window.show_all()
 
61
 
 
62
    def close(self, widget=None):
 
63
        self.window.destroy()
 
64
 
 
65
class BranchPreferencesWindow(gtk.Dialog):
 
66
    """Displays global preferences windows."""
 
67
    def __init__(self, config=None):
 
68
        super(BranchPreferencesWindow, self).__init__(config)
 
69