/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz
171 by Jelmer Vernooij
Initial work on a preferences dialog in GTK+, including a list of plugins with metadata browser.
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
450.3.3 by Jelmer Vernooij
Split identity settings out of main preferences window.
26
from identity import IdentityPage
450.3.2 by Jelmer Vernooij
Split plugins page out into a separate file.
27
from plugins import PluginsPage
171 by Jelmer Vernooij
Initial work on a preferences dialog in GTK+, including a list of plugins with metadata browser.
28
29
class PreferencesWindow(gtk.Dialog):
30
    """Displays global preferences windows."""
239 by Jelmer Vernooij
Add note about what should and should not be in the preferences dialog.
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
171 by Jelmer Vernooij
Initial work on a preferences dialog in GTK+, including a list of plugins with metadata browser.
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()
450.3.3 by Jelmer Vernooij
Split identity settings out of main preferences window.
44
        self._create_pages()
45
171 by Jelmer Vernooij
Initial work on a preferences dialog in GTK+, including a list of plugins with metadata browser.
46
47
    def _create(self):
48
        self.set_default_size(600, 600)
49
        notebook = gtk.Notebook()
450.3.3 by Jelmer Vernooij
Split identity settings out of main preferences window.
50
        for (label, page) in self._create_pages():
51
            notebook.insert_page(page, gtk.Label(label))
171 by Jelmer Vernooij
Initial work on a preferences dialog in GTK+, including a list of plugins with metadata browser.
52
        self.vbox.pack_start(notebook, True, True)
53
        self.vbox.show_all()
54
450.3.3 by Jelmer Vernooij
Split identity settings out of main preferences window.
55
    def _create_pages(self):
56
        return [("Identity", IdentityPage(self.config)), 
57
                ("Plugins", PluginsPage())]
58
171 by Jelmer Vernooij
Initial work on a preferences dialog in GTK+, including a list of plugins with metadata browser.
59
    def display(self):
60
        self.window.show_all()
61
62
    def close(self, widget=None):
63
        self.window.destroy()
213 by Jelmer Vernooij
Show preferences dialog from notify area icon, fix GPG display.
64
65
class BranchPreferencesWindow(gtk.Dialog):
66
    """Displays global preferences windows."""
67
    def __init__(self, config=None):
68
        super(BranchPreferencesWindow, self).__init__(config)
69