Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 2.0.1, 2.0.2, and 2.0.3

stable commit: Make Commit button stand out relative to other buttons

Changeset 68af30c46eb7

Parent 899d880723cb

by Peer Sommerlund

Changes to one file · Browse files at 68af30c46eb7 Showing diff from parent 899d880723cb Diff from another changeset...

 
203
204
205
 
 
206
207
208
209
 
 
 
 
 
 
210
211
212
213
 
 
214
215
216
217
218
219
 
 
 
220
221
222
 
249
250
251
252
253
254
255
 
322
323
324
325
326
327
328
329
330
 
373
374
375
 
 
 
 
 
 
 
 
 
376
377
378
 
381
382
383
384
 
385
386
387
388
389
390
391
 
392
393
394
 
412
413
414
415
 
416
417
418
 
448
449
450
 
451
452
453
 
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
 
203
204
205
206
207
208
 
 
 
209
210
211
212
213
214
215
 
 
 
216
217
218
 
219
 
 
 
220
221
222
223
224
225
 
252
253
254
 
255
256
257
 
324
325
326
 
 
 
327
328
329
 
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
 
389
390
391
 
392
393
394
395
396
397
398
 
399
400
401
402
 
420
421
422
 
423
424
425
426
 
456
457
458
459
460
461
462
 
619
620
621
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
622
623
624
@@ -203,20 +203,23 @@
  hbox = QHBoxLayout()   hbox.setMargin(0)   hbox.setContentsMargins(*(0,)*4) + tbar = QToolBar(_("Commit Dialog Toolbar"), self) + hbox.addWidget(tbar)   - msgcombo = MessageHistoryCombo() - msgcombo.activated.connect(self.msgSelected) - hbox.addWidget(msgcombo, 1) + self.recentMessagesButton = QToolButton( + text=_('Copy message'), + popupMode=QToolButton.InstantPopup, + statusTip=_('Copy one of the recent commit messages')) + tbar.addWidget(self.recentMessagesButton) + self.updateRecentMessages()   - branchbutton = QPushButton(_('Branch: ')) - branchbutton.pressed.connect(self.branchOp) - self.branchbutton = branchbutton + self.branchbutton = tbar.addAction(_('Branch: ')) + self.branchbutton.triggered.connect(self.branchOp)   self.branchop = None - hbox.addWidget(branchbutton)   - self.detailsbutton = QPushButton(_('Options')) - self.detailsbutton.pressed.connect(self.details) - hbox.addWidget(self.detailsbutton) + tbar.addAction(_('Options')).triggered.connect(self.details) + + hbox.addStretch(1)     vbox.addLayout(hbox, 0)   self.buttonHBox = hbox @@ -249,7 +252,6 @@
  # add our splitter where the docf used to be   self.stwidget.split.addWidget(self.split)   self.msgte = msgte - self.msgcombo = msgcombo   QShortcut(QKeySequence('Ctrl+Return'), self, self.commit)     @pyqtSlot(QString, QString) @@ -322,9 +324,6 @@
  self.commitButtonEnable.emit(not ispatch)   self.msgte.refresh(self.repo)   - # Update message list - self.msgcombo.reset(self.msghistory) -   # Update branch operation button   branchu = hglib.tounicode(self.repo[None].branch())   if self.branchop is None: @@ -373,6 +372,15 @@
  self.reload()   QTimer.singleShot(500, lambda: shlib.shell_notify([self.repo.root]))   + def updateRecentMessages(self): + # Define a menu that lists recent messages + m = QMenu() + for s in self.msghistory: + title = s.split('\n', 1)[0][:70] + def overwriteMsg(newMsg): return lambda: self.msgSelected(newMsg) + m.addAction(title).triggered.connect(overwriteMsg(s)) + self.recentMessagesButton.setMenu(m) +   def getMessage(self):   text = self.msgte.text()   try: @@ -381,14 +389,14 @@
  pass # TODO   return text   - def msgSelected(self, index): + def msgSelected(self, message):   if self.msgte.text() and self.msgte.isModified():   d = QMessageBox.question(self, _('Confirm Discard Message'),   _('Discard current commit message?'),   QMessageBox.Ok | QMessageBox.Cancel)   if d != QMessageBox.Ok:   return - self.setMessage(self.msghistory[index]) + self.setMessage(message)   self.msgte.setFocus()     def setMessage(self, msg): @@ -412,7 +420,7 @@
  self.stwidget.loadSettings(s, lpref+'status')   self.msghistory = list(s.value(gpref+'history-'+repoid).toStringList())   self.msghistory = [m for m in self.msghistory if m] - self.msgcombo.reset(self.msghistory) + self.updateRecentMessages()   self.userhist = s.value(gpref+'userhist').toStringList()   self.userhist = [u for u in self.userhist if u]   try: @@ -448,6 +456,7 @@
  self.msghistory.remove(umsg)   self.msghistory.insert(0, umsg)   self.msghistory = self.msghistory[:10] + self.updateRecentMessages()     def addUsernameToHistory(self, user):   if user in self.userhist: @@ -610,26 +619,6 @@
  self.commitComplete.emit()   self.stwidget.refreshWctx()   -class MessageHistoryCombo(QComboBox): - def __init__(self, parent=None): - QComboBox.__init__(self, parent) - self.reset([]) - - def reset(self, msgs): - self.clear() - self.addItem(_('Recent commit messages...')) - self.loaded = False - self.msgs = msgs - - def showPopup(self): - if not self.loaded: - self.clear() - for s in self.msgs: - self.addItem(s.split('\n', 1)[0][:70]) - self.loaded = True - QComboBox.showPopup(self) - -  class DetailsDialog(QDialog):   'Utility dialog for configuring uncommon settings'   def __init__(self, opts, userhistory, parent):