Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 2.1, 2.1.1, and 2.1.2

repowidget, qtlib: add key press handling to InfoBar

Now InfoBar automatically gets focus to process key press event.

Changeset e449f27db26a

Parent 8c18b18f1146

by Yuya Nishihara

Changes to 2 files · Browse files at e449f27db26a Showing diff from parent 8c18b18f1146 Diff from another changeset...

 
785
786
787
 
 
 
 
 
788
789
790
 
829
830
831
 
 
 
832
833
834
 
785
786
787
788
789
790
791
792
793
794
795
 
834
835
836
837
838
839
840
841
842
@@ -785,6 +785,11 @@
  def addRightWidget(self, w):   self.layout().insertWidget(self.layout().count() - 1, w)   + def keyPressEvent(self, event): + if event.key() == Qt.Key_Escape: + self.close() + super(InfoBar, self).keyPressEvent(event) +  class StatusInfoBar(InfoBar):   """Show status message"""   def __init__(self, message, parent=None): @@ -829,6 +834,9 @@
  self._buttons.rejected.connect(self._reject)   self.addWidget(self._buttons)   + # so that acceptButton gets focus by default + self.setFocusProxy(self._buttons) +   def closeEvent(self, event):   if self.isVisible():   self.rejected.emit()
 
240
241
242
 
243
244
245
 
240
241
242
243
244
245
246
@@ -240,6 +240,7 @@
  w = cls(*args, **kwargs)   w.linkActivated.connect(self._openLink)   self._infobarlayout.insertWidget(0, w) + w.setFocus() # to handle key press by InfoBar   return w     def clearInfoBar(self, priority=None):