Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.9, 0.9.1, and 0.9.1.1

archive: use gtk.Dialog instead of gtk.Window

Changeset e66cdc2e1b83

Parent 020838e36042

by Yuki KODAMA

Changes to one file · Browse files at e66cdc2e1b83 Showing diff from parent 020838e36042 Diff from another changeset...

 
19
20
21
22
 
23
 
24
25
26
 
27
28
 
 
29
30
31
 
 
 
 
 
32
33
34
 
39
40
41
42
43
44
45
46
47
 
49
50
51
52
 
53
54
55
 
63
64
65
66
67
 
 
68
69
70
71
72
73
 
 
 
 
 
 
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
 
 
93
94
95
 
124
125
126
 
127
128
129
 
173
174
175
176
177
178
179
180
181
 
19
20
21
 
22
23
24
25
26
 
27
28
29
30
31
32
 
 
33
34
35
36
37
38
39
40
 
45
46
47
 
 
 
48
49
50
 
52
53
54
 
55
56
57
58
 
66
67
68
 
 
69
70
71
 
 
 
 
 
72
73
74
75
76
77
78
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
80
81
82
83
 
112
113
114
115
116
117
118
 
162
163
164
 
 
 
165
166
167
@@ -19,16 +19,22 @@
   _working_dir_parent_ = _('= Working Directory Parent =')   -class ArchiveDialog(gtk.Window): +class ArchiveDialog(gtk.Dialog):   """ Dialog to archive a Mercurial repo """ +   def __init__(self, rev=None):   """ Initialize the Dialog """ - gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL) + gtk.Dialog.__init__(self)   gtklib.set_tortoise_icon(self, 'menucheckout.ico')   gtklib.set_tortoise_keys(self) + self.set_resizable(False) + self.set_has_separator(False)   - self.set_default_size(550, 120) - self.notify_func = None + # buttons + self.archivebtn = gtk.Button(_('Archive')) + self.action_area.pack_start(self.archivebtn) + self.closebtn = gtk.Button(_('Close')) + self.action_area.pack_start(self.closebtn)     try:   repo = hg.repository(ui.ui(), path=paths.find_root()) @@ -39,9 +45,6 @@
  title = _('Archive - %s') % hglib.toutf(os.path.basename(repo.root))   self.set_title(title)   - vbox = gtk.VBox() - self.add(vbox) -   hbox = gtk.HBox()   lbl = gtk.Label(_('Archive revision:'))   hbox.pack_start(lbl, False, False, 2) @@ -49,7 +52,7 @@
  # revisions editable combo box   combo = gtk.combo_box_entry_new_text()   hbox.pack_start(combo, True, True, 2) - vbox.pack_start(hbox, False, False, 10) + self.vbox.pack_start(hbox, False, False, 10)   if rev:   combo.append_text(str(rev))   else: @@ -63,33 +66,18 @@
  for t in tags:   combo.append_text(t)   - vbox.add(self.get_destination_container(self.get_default_path())) - vbox.add(self.get_type_container()) + self.vbox.add(self.get_destination_container(self.get_default_path())) + self.vbox.add(self.get_type_container())   - hbbox = gtk.HButtonBox() - hbbox.set_layout(gtk.BUTTONBOX_END) - vbox.pack_start(hbbox, False, False, 2) - close = gtk.Button(_('Close')) - close.connect('clicked', lambda x: self.destroy()) + # register signal handlers + def archive_handler(*args): + self.archive(self.archivebtn, combo, repo) + self.archivebtn.connect('clicked', archive_handler) + combo.child.connect('activate', archive_handler) + self.closebtn.connect('clicked', lambda b: self.destroy())   - accelgroup = gtk.AccelGroup() - self.add_accel_group(accelgroup) - key, modifier = gtk.accelerator_parse('Escape') - close.add_accelerator('clicked', accelgroup, key, 0, - gtk.ACCEL_VISIBLE) - hbbox.add(close) - - archive = gtk.Button(_('Archive')) - archive.connect('clicked', self.archive, combo, repo) - mod = gtklib.get_thg_modifier() - key, modifier = gtk.accelerator_parse(mod+'Return') - archive.add_accelerator('clicked', accelgroup, key, modifier, - gtk.ACCEL_VISIBLE) - hbbox.add(archive) - archive.grab_focus() - - entry = combo.child - entry.connect('activate', self.entry_activated, archive, combo, repo) + # prepare to show + self.archivebtn.grab_focus()     def get_type_container(self):   """Return a frame containing the supported archive types""" @@ -124,6 +112,7 @@
  self.destentry = destcombo.get_child()   self.destentry.set_text(default_path)   self.destentry.set_position(-1) + self.destentry.set_width_chars(38)     # replace the drop-down widget so we can modify it's properties   destcombo.clear() @@ -173,9 +162,6 @@
    return dict   - def entry_activated(self, entry, button, combo, repo): - self.update(button, combo, repo) -   def browse_clicked(self, button):   """Select the destination directory or file"""   archive_type = self.get_selected_archive_type()