/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 mergedirective.py

  • Committer: Curtis Hovey
  • Date: 2012-03-11 18:24:06 UTC
  • mto: This revision was merged to the branch mainline in revision 785.
  • Revision ID: sinzui.is@verizon.net-20120311182406-f4jqpff65b30g3al
Create the mnemonic for the button label.

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 bzrlib
24
 
import gtk
25
 
import os
26
 
 
27
 
class CreateMergeDirectiveDialog(gtk.Dialog):
 
17
from gi.repository import Gtk
 
18
 
 
19
from bzrlib.plugins.gtk.branchbox import BranchSelectionBox
 
20
 
 
21
class CreateMergeDirectiveDialog(Gtk.Dialog):
28
22
    def __init__(self, branch, stop_revid=None):
29
23
        super(CreateMergeDirectiveDialog, self).__init__()
30
24
        self.branch = branch
36
30
        # submittted
37
31
 
38
32
        # TODO: Create a frame with a the ability to select a branch
39
 
        
 
33
 
40
34
        # TODO: Create a frame with a button for selecting a file name 
41
35
        # for the bundle
42
36
        pass
43
37
 
44
38
 
45
 
class SendMergeDirectiveDialog(gtk.Dialog):
46
 
    def __init__(self):
47
 
        super(SendMergeDirectiveDialog, self).__init__()
48
 
 
49
 
 
50
 
class ApplyMergeDirectiveDialog(gtk.Dialog):
 
39
class SendMergeDirectiveDialog(Gtk.Dialog):
 
40
    def __init__(self, branch, parent=None):
 
41
        super(SendMergeDirectiveDialog, self).__init__(parent)
 
42
        self.branch = branch
 
43
        self.set_title("Send Merge Directive")
 
44
        self._create()
 
45
 
 
46
    def _create(self):
 
47
        table = Gtk.Table(rows=3, columns=2)
 
48
        self.get_content_area().add(table)
 
49
 
 
50
        label = Gtk.Label()
 
51
        label.set_markup("<b>Branch to Submit:</b>")
 
52
        table.attach(label, 0, 1, 0, 1, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
 
53
 
 
54
        label = Gtk.Label(label=str(self.branch))
 
55
        table.attach(label, 1, 2, 0, 1, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
 
56
 
 
57
        label = Gtk.Label()
 
58
        label.set_markup("<b>Target Branch:</b>")
 
59
        table.attach(label, 0, 1, 1, 2, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
 
60
 
 
61
        self.submit_branch = BranchSelectionBox(self.branch.get_submit_branch())
 
62
        table.attach(self.submit_branch, 1, 2, 1, 2, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
 
63
 
 
64
        # TODO: Display number of revisions to be sent whenever 
 
65
        # submit branch changes
 
66
 
 
67
        label = Gtk.Label()
 
68
        label.set_markup("<b>Email To:</b>")
 
69
        table.attach(label, 0, 1, 2, 3, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
 
70
 
 
71
        self.mail_to = Gtk.ComboBox.new_with_entry()
 
72
        mail_to = self.branch.get_config().get_user_option('submit_to')
 
73
        if mail_to is None:
 
74
            submit_branch = self.submit_branch.get_branch()
 
75
            if submit_branch is not None:
 
76
                mail_to = submit_branch.get_config().get_user_option(
 
77
                            'child_submit_to')
 
78
        if mail_to is not None:
 
79
            self.mail_to.get_child().set_text(mail_to)
 
80
        table.attach(self.mail_to, 1, 2, 2, 3, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
 
81
 
 
82
        self.add_buttons(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, 
 
83
                         Gtk.STOCK_OK, Gtk.ResponseType.OK)
 
84
 
 
85
        self.show_all()
 
86
 
 
87
    def get_mail_to(self):
 
88
        return self.mail_to.get_child().get_text()
 
89
 
 
90
    def get_merge_directive(self):
 
91
        from bzrlib.merge_directive import MergeDirective2
 
92
        from bzrlib import osutils
 
93
        import time
 
94
        return MergeDirective2.from_objects(self.branch.repository,
 
95
                                            self.branch.last_revision(),
 
96
                                            time.time(),
 
97
                                            osutils.local_time_offset(),
 
98
                                            self.submit_branch.get_url(),
 
99
                                            public_branch=None,
 
100
                                            include_patch=True,
 
101
                                            include_bundle=True,
 
102
                                            message=None,
 
103
                                            base_revision_id=None)
 
104
 
 
105
 
 
106
 
 
107
class ApplyMergeDirectiveDialog(Gtk.Dialog):
51
108
    def __init__(self):
52
109
        super(ApplyMergeDirectiveDialog, self).__init__()