Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.4rc1, 0.4rc2, and 0.4rc3

hggtk/commit: add combobox for recent commit messages

Changeset 1edbd4823c80

Parent 166502e466ce

by TK Soh

Changes to one file · Browse files at 1edbd4823c80 Showing diff from parent 166502e466ce Diff from another changeset...

Change 1 of 3 Show Entire File hggtk/​commit.py Stacked
 
91
92
93
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94
95
96
97
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
99
100
101
102
 
103
104
105
 
107
108
109
110
 
111
112
113
 
214
215
216
 
217
218
219
 
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
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
148
149
150
151
 
153
154
155
 
156
157
158
159
 
260
261
262
263
264
265
266
@@ -91,15 +91,61 @@
  self._commit_clicked, tip='commit'))   return tbbuttons   + def changed_cb(self, combobox): + model = combobox.get_model() + index = combobox.get_active() + if index >= 0: + buffer = self.text.get_buffer() + begin, end = buffer.get_bounds() + cur_msg = buffer.get_text(begin, end) + if len(cur_msg): + response = Confirm('Discard Message', [], self, + 'Discard current commit message?').run() + if response != gtk.RESPONSE_YES: + return + buffer.set_text(model[index][1]) + + def _update_recent_messages(self, msg=None): + if msg is not None: + self._mru_messages.add(msg) + self.settings.write() + + liststore = self.msg_cbbox.get_model() + liststore.clear() + for msg in self._mru_messages: + sumline = msg.split("\n")[0] + liststore.append([sumline, msg]) + #self.msg_cbbox.set_active(-1)     def get_body(self):   status_body = GStatus.get_body(self)   + vbox = gtk.VBox() + + mbox = gtk.HBox() + label = gtk.Label('Recent Commit Messages: ') + mbox.pack_start(label, False, False, 2) + self.msg_cbbox = gtk.combo_box_new_text() + liststore = gtk.ListStore(str, str) + self.msg_cbbox = gtk.ComboBox(liststore) + cell = gtk.CellRendererText() + self.msg_cbbox.pack_start(cell, True) + self.msg_cbbox.add_attribute(cell, 'text', 0) + #cell = gtk.CellRendererText() + #self.msg_cbbox.pack_start(cell, True) + #self.msg_cbbox.add_attribute(cell, 'text', 1) + mbox.pack_start(self.msg_cbbox) + vbox.pack_start(mbox, False, False) + self._mru_messages = self.settings.mrul('recent_messages') + self._update_recent_messages() + self.msg_cbbox.connect('changed', self.changed_cb) +   frame = gtk.Frame()   frame.set_shadow_type(gtk.SHADOW_ETCHED_IN)   scroller = gtk.ScrolledWindow()   scroller.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)   frame.add(scroller) + vbox.pack_start(frame)     self.text = gtk.TextView()   self.text.set_wrap_mode(gtk.WRAP_WORD) @@ -107,7 +153,7 @@
  scroller.add(self.text)     self._vpaned = gtk.VPaned() - self._vpaned.add1(frame) + self._vpaned.add1(vbox)   self._vpaned.add2(status_body)   self._vpaned.set_position(self._setting_vpos)   return self._vpaned @@ -214,6 +260,7 @@
    # refresh overlay icons and commit dialog   self.text.set_buffer(gtk.TextBuffer()) + self._update_recent_messages(self.opts['message'])   shell_notify([self.cwd] + files)   self.reload_status()