Пример #1
0
 def keyPressEvent(self, event):
     '''
     Enable the shortcats for search and replace
     '''
     if event.key() == Qt.Key_Escape:
         self.reject()
     elif event.modifiers() == Qt.ControlModifier and event.key() == Qt.Key_F:
         if self.tabWidget.currentWidget().hasFocus():
             if not self.searchButton.isChecked():
                 self.searchButton.setChecked(True)
             else:
                 self.on_toggled_find(True)
         else:
             self.searchButton.setChecked(not self.searchButton.isChecked())
     elif event.modifiers() == Qt.ControlModifier and event.key() == Qt.Key_R:
         if self.tabWidget.currentWidget().hasFocus():
             if not self.replaceButton.isChecked():
                 self.replaceButton.setChecked(True)
             else:
                 self.on_toggled_replace(True)
         else:
             self.replaceButton.setChecked(not self.replaceButton.isChecked())
     else:
         event.accept()
         QMainWindow.keyPressEvent(self, event)
Пример #2
0
 def keyPressEvent(self, event):
     '''
     Enable the shortcats for search and replace
     '''
     if event.key() == Qt.Key_Escape:
         self.reject()
     elif event.modifiers() == Qt.ControlModifier and event.key() == Qt.Key_F:
         if self.tabWidget.currentWidget().hasFocus():
             if not self.searchButton.isChecked():
                 self.searchButton.setChecked(True)
             else:
                 self.on_toggled_find(True)
         else:
             self.searchButton.setChecked(not self.searchButton.isChecked())
     elif event.modifiers() == Qt.ControlModifier and event.key() == Qt.Key_R:
         if self.tabWidget.currentWidget().hasFocus():
             if not self.replaceButton.isChecked():
                 self.replaceButton.setChecked(True)
             else:
                 self.on_toggled_replace(True)
         else:
             self.replaceButton.setChecked(not self.replaceButton.isChecked())
     else:
         event.accept()
         QMainWindow.keyPressEvent(self, event)
Пример #3
0
 def keyPressEvent(self, event):
     '''
     Enable the shortcats for search and replace
     '''
     if event.key() == Qt.Key_Escape:
         self.reject()
     elif event.modifiers() == Qt.ControlModifier and event.key() == Qt.Key_F:
         if self.tabWidget.currentWidget().hasFocus():
             if not self.searchButton.isChecked():
                 self.searchButton.setChecked(True)
             else:
                 self.on_toggled_find(True)
         else:
             self.searchButton.setChecked(not self.searchButton.isChecked())
     elif event.modifiers() == Qt.ControlModifier and event.key() == Qt.Key_R:
         if self.tabWidget.currentWidget().hasFocus():
             if not self.replaceButton.isChecked():
                 self.replaceButton.setChecked(True)
             else:
                 self.on_toggled_replace(True)
         else:
             self.replaceButton.setChecked(not self.replaceButton.isChecked())
     elif event.modifiers() == Qt.ControlModifier and event.key() == Qt.Key_E:
         if self.tabWidget.currentWidget().hasFocus():
             if not self.graphButton.isChecked():
                 self.graphButton.setChecked(True)
             else:
                 self.on_toggled_graph(True)
         else:
             self.graphButton.setChecked(not self.graphButton.isChecked())
     elif event.modifiers() == Qt.ControlModifier and event.key() == Qt.Key_W:
         self.on_close_tab(self.tabWidget.currentIndex())
     elif event.modifiers() in [Qt.ControlModifier, Qt.AltModifier] and event.key() == Qt.Key_Up:
         self.on_upperButton_clicked()
     elif event.modifiers() in [Qt.ControlModifier, Qt.AltModifier] and event.key() == Qt.Key_Down:
         self.on_downButton_clicked()
     else:
         event.accept()
         QMainWindow.keyPressEvent(self, event)