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

update: cleanup UI codes #1

Changeset bba95a137eb2

Parent 27cae0de1a84

by Yuki KODAMA

Changes to one file · Browse files at bba95a137eb2 Showing diff from parent 27cae0de1a84 Diff from another changeset...

 
47
48
49
50
51
 
52
53
54
 
60
61
62
63
 
64
65
66
 
81
82
83
84
85
86
87
 
 
 
 
 
 
 
 
 
88
89
 
 
 
 
90
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
92
93
94
95
96
97
 
98
99
100
 
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
 
180
181
182
183
184
 
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
 
47
48
49
 
50
51
52
53
54
 
60
61
62
 
63
64
65
66
 
81
82
83
 
 
 
 
84
85
86
87
88
89
90
91
92
93
 
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
 
 
 
 
118
119
120
121
122
 
131
132
133
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134
135
136
 
169
170
171
 
 
172
173
174
175
176
177
178
 
 
 
 
 
 
 
 
179
180
181
@@ -47,8 +47,8 @@
    # layout table for fixed items   table = gtklib.LayoutTable() - self.tables = dict(fixed=table)   self.vbox.pack_start(table, True, True, 2) + self.table = table     ## revision label & combobox   self.revcombo = combo = gtk.combo_box_entry_new_text() @@ -60,7 +60,7 @@
  ## update method   btn = gtk.CheckButton(_('Discard local changes, no backup (-C/--clean)'))   self.opt_clean = btn - table.add_row('', btn) + table.add_row(None, btn)     ## fill list of combo   if rev != None: @@ -81,20 +81,42 @@
  for t in tags:   combo.append_text(t)   - # layout table for summaries - table = gtklib.LayoutTable() - self.tables['summary'] = table - self.vbox.pack_start(table) + ## changeset summaries + def new_label(): + label = gtk.Label('-') + label.set_selectable(True) + label.set_line_wrap(True) + label.set_size_request(350, -1) + hb = gtk.HBox() + hb.pack_start(label, False, False) + return hb, label   - self.show_summaries(True) + ## summary of target revision + hb, label = new_label() + table.add_row(_('Target:'), hb) + self.new_rev_label = label   + ## summary of parent 1 revision + hb, label = new_label() + self.current_rev_label1 = label + + ## summary of parent 2 revision if needs + self.ctxs = self.repo[None].parents() + if len(self.ctxs) == 2: + table.add_row(_('Parent 1:'), hb) + hb, label = new_label() + table.add_row(_('Parent 2:'), hb) + self.current_rev_label2 = label + else: + table.add_row(_('Parent:'), hb) + self.current_rev_label2 = None + + # signal handlers + self.revcombo.connect('changed', lambda b: self.update_summaries())   self.opt_clean.connect('toggled', lambda b: self.update_summaries())   - # layout group - group = gtklib.LayoutGroup() - group.add(*self.tables.values()) -   # prepare to show + self.update_summaries()   self.updatebtn.grab_focus()   gtklib.idle_add_single_call(self.after_init)   @@ -109,39 +131,6 @@
  self.abortbtn = self.add_button(_('Abort'), gtk.RESPONSE_CANCEL)   self.abortbtn.hide()   - def build_summaries(self): - table = self.tables['summary'] - - def new_label(): - label = gtk.Label('-') - label.set_selectable(True) - label.set_line_wrap(True) - label.set_size_request(350, -1) - hb = gtk.HBox() - hb.pack_start(label, False, False) - return hb, label - - # summary of new revision - hb, label = new_label() - table.add_row(_('Target:'), hb) - self.new_rev_label = label - - # summary of current revision(s) - hb, label = new_label() - self.current_rev_label1 = label - - self.ctxs = self.repo[None].parents() - if len(self.ctxs) == 2: - table.add_row(_('Parent 1:'), hb) - hb, label = new_label() - table.add_row(_('Parent 2:'), hb) - self.current_rev_label2 = label - else: - table.add_row(_('Parent:'), hb) - self.current_rev_label2 = None - table.show_all() - self.revcombo.connect('changed', lambda b: self.update_summaries()) -   def abort(self):   self.cmd.stop()   self.cmd.show_log() @@ -180,22 +169,13 @@
  raise _('unknown mode name: %s') % mode   working = not normal   - for table in self.tables.values(): - table.set_sensitive(normal) + self.table.set_sensitive(normal)   self.updatebtn.set_property('visible', normal)   self.closebtn.set_property('visible', normal)   if cmd:   self.cmd.set_property('visible', working)   self.abortbtn.set_property('visible', working)   - def show_summaries(self, visible=True): - if visible and not hasattr(self, 'ctxs'): - self.build_summaries() - if hasattr(self, 'ctxs'): - self.update_summaries() - table = self.tables['summary'] - table.set_property('visible', visible) -   def update_summaries(self):   def setlabel(label, ctx):   revision = str(ctx.rev())