/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz
254.1.1 by Jelmer Vernooij
Add Merge Directive option to revision menu.
1
# Copyright (C) 2007 by 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
734.1.1 by Curtis Hovey
Mechanical changes made by pygi.convert.sh.
23
from gi.repository import Gtk
254.1.1 by Jelmer Vernooij
Add Merge Directive option to revision menu.
24
324 by Jelmer Vernooij
Add very simple "Send Merge Directive" window.
25
from bzrlib.plugins.gtk.branchbox import BranchSelectionBox
26
734.1.1 by Curtis Hovey
Mechanical changes made by pygi.convert.sh.
27
class CreateMergeDirectiveDialog(Gtk.Dialog):
254.1.1 by Jelmer Vernooij
Add Merge Directive option to revision menu.
28
    def __init__(self, branch, stop_revid=None):
29
        super(CreateMergeDirectiveDialog, self).__init__()
30
        self.branch = branch
31
        self.stop_revid = stop_revid
32
        self._create()
33
34
    def _create(self):
35
        # TODO: Create a frame with information about the revision that will be 
36
        # submittted
37
38
        # TODO: Create a frame with a the ability to select a branch
724 by Jelmer Vernooij
Fix formatting, imports.
39
254.1.1 by Jelmer Vernooij
Add Merge Directive option to revision menu.
40
        # TODO: Create a frame with a button for selecting a file name 
41
        # for the bundle
42
        pass
43
44
734.1.1 by Curtis Hovey
Mechanical changes made by pygi.convert.sh.
45
class SendMergeDirectiveDialog(Gtk.Dialog):
324 by Jelmer Vernooij
Add very simple "Send Merge Directive" window.
46
    def __init__(self, branch, parent=None):
47
        super(SendMergeDirectiveDialog, self).__init__(parent)
323 by Jelmer Vernooij
Add gsend command.
48
        self.branch = branch
324 by Jelmer Vernooij
Add very simple "Send Merge Directive" window.
49
        self.set_title("Send Merge Directive")
323 by Jelmer Vernooij
Add gsend command.
50
        self._create()
51
52
    def _create(self):
734.1.1 by Curtis Hovey
Mechanical changes made by pygi.convert.sh.
53
        table = Gtk.Table(rows=3, columns=2)
324 by Jelmer Vernooij
Add very simple "Send Merge Directive" window.
54
        self.vbox.add(table)
55
734.1.1 by Curtis Hovey
Mechanical changes made by pygi.convert.sh.
56
        label = Gtk.Label()
324 by Jelmer Vernooij
Add very simple "Send Merge Directive" window.
57
        label.set_markup("<b>Branch to Submit:</b>")
734.1.1 by Curtis Hovey
Mechanical changes made by pygi.convert.sh.
58
        table.attach(label, 0, 1, 0, 1, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
59
60
        label = Gtk.Label(label=str(self.branch))
61
        table.attach(label, 1, 2, 0, 1, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
62
63
        label = Gtk.Label()
324 by Jelmer Vernooij
Add very simple "Send Merge Directive" window.
64
        label.set_markup("<b>Target Branch:</b>")
734.1.1 by Curtis Hovey
Mechanical changes made by pygi.convert.sh.
65
        table.attach(label, 0, 1, 1, 2, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
324 by Jelmer Vernooij
Add very simple "Send Merge Directive" window.
66
67
        self.submit_branch = BranchSelectionBox(self.branch.get_submit_branch())
734.1.1 by Curtis Hovey
Mechanical changes made by pygi.convert.sh.
68
        table.attach(self.submit_branch, 1, 2, 1, 2, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
324 by Jelmer Vernooij
Add very simple "Send Merge Directive" window.
69
70
        # TODO: Display number of revisions to be send whenever 
71
        # submit branch changes
72
734.1.1 by Curtis Hovey
Mechanical changes made by pygi.convert.sh.
73
        label = Gtk.Label()
324 by Jelmer Vernooij
Add very simple "Send Merge Directive" window.
74
        label.set_markup("<b>Email To:</b>")
734.1.1 by Curtis Hovey
Mechanical changes made by pygi.convert.sh.
75
        table.attach(label, 0, 1, 2, 3, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
324 by Jelmer Vernooij
Add very simple "Send Merge Directive" window.
76
734.1.1 by Curtis Hovey
Mechanical changes made by pygi.convert.sh.
77
        self.mail_to = Gtk.ComboBoxEntry()
324 by Jelmer Vernooij
Add very simple "Send Merge Directive" window.
78
        mail_to = self.branch.get_config().get_user_option('submit_to')
449.1.2 by Jelmer Vernooij
Honor child_submit_to in the submit_branch if no email address was specified.
79
        if mail_to is None:
80
            submit_branch = self.submit_branch.get_branch()
81
            if submit_branch is not None:
82
                mail_to = submit_branch.get_config().get_user_option(
83
                            'child_submit_to')
324 by Jelmer Vernooij
Add very simple "Send Merge Directive" window.
84
        if mail_to is not None:
85
            self.mail_to.get_child().set_text(mail_to)
734.1.1 by Curtis Hovey
Mechanical changes made by pygi.convert.sh.
86
        table.attach(self.mail_to, 1, 2, 2, 3, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
324 by Jelmer Vernooij
Add very simple "Send Merge Directive" window.
87
734.1.1 by Curtis Hovey
Mechanical changes made by pygi.convert.sh.
88
        self.add_buttons(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, 
89
                         Gtk.STOCK_OK, Gtk.ResponseType.OK)
324 by Jelmer Vernooij
Add very simple "Send Merge Directive" window.
90
91
        self.show_all()
92
93
    def get_mail_to(self):
94
        return self.mail_to.get_child().get_text()
95
96
    def get_merge_directive(self):
97
        from bzrlib.merge_directive import MergeDirective2
98
        from bzrlib import osutils
99
        import time
100
        return MergeDirective2.from_objects(self.branch.repository,
101
                                            self.branch.last_revision(),
102
                                            time.time(),
103
                                            osutils.local_time_offset(),
104
                                            self.submit_branch.get_url(),
105
                                            public_branch=None,
106
                                            include_patch=True,
107
                                            include_bundle=True,
108
                                            message=None,
109
                                            base_revision_id=None)
110
254.1.1 by Jelmer Vernooij
Add Merge Directive option to revision menu.
111
112
734.1.1 by Curtis Hovey
Mechanical changes made by pygi.convert.sh.
113
class ApplyMergeDirectiveDialog(Gtk.Dialog):
254.1.1 by Jelmer Vernooij
Add Merge Directive option to revision menu.
114
    def __init__(self):
115
        super(ApplyMergeDirectiveDialog, self).__init__()