Display keystring in statusbar
This commit is contained in:
parent
289f08f7a7
commit
6acac5cb71
@ -21,6 +21,8 @@ class QuteBrowser(QApplication):
|
|||||||
self.mainwindow.status.cmd.got_cmd.connect(self.commandparser.parse)
|
self.mainwindow.status.cmd.got_cmd.connect(self.commandparser.parse)
|
||||||
self.mainwindow.status.cmd.got_cmd.connect(self.mainwindow.tabs.setFocus)
|
self.mainwindow.status.cmd.got_cmd.connect(self.mainwindow.tabs.setFocus)
|
||||||
self.commandparser.error.connect(self.mainwindow.status.disp_error)
|
self.commandparser.error.connect(self.mainwindow.status.disp_error)
|
||||||
|
self.keyparser.keystring_updated.connect(
|
||||||
|
self.mainwindow.status.txt.set_keystring)
|
||||||
|
|
||||||
self.init_cmds()
|
self.init_cmds()
|
||||||
self.mainwindow.show()
|
self.mainwindow.show()
|
||||||
|
@ -7,6 +7,7 @@ import re
|
|||||||
class KeyParser(QObject):
|
class KeyParser(QObject):
|
||||||
keystring = ''
|
keystring = ''
|
||||||
set_cmd_text = pyqtSignal(str)
|
set_cmd_text = pyqtSignal(str)
|
||||||
|
keystring_updated = pyqtSignal(str)
|
||||||
key_to_cmd = {}
|
key_to_cmd = {}
|
||||||
|
|
||||||
def from_cmd_dict(self, d):
|
def from_cmd_dict(self, d):
|
||||||
@ -16,6 +17,10 @@ class KeyParser(QObject):
|
|||||||
self.key_to_cmd[cmd.key] = cmd
|
self.key_to_cmd[cmd.key] = cmd
|
||||||
|
|
||||||
def handle(self, e):
|
def handle(self, e):
|
||||||
|
self._handle(e)
|
||||||
|
self.keystring_updated.emit(self.keystring)
|
||||||
|
|
||||||
|
def _handle(self, e):
|
||||||
logging.debug('Got key: {} / text: "{}"'.format(e.key(), e.text()))
|
logging.debug('Got key: {} / text: "{}"'.format(e.key(), e.text()))
|
||||||
txt = e.text().strip()
|
txt = e.text().strip()
|
||||||
if not txt:
|
if not txt:
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
from PyQt5.QtWidgets import QLineEdit, QHBoxLayout, QLabel, QWidget, QShortcut, QProgressBar, QSizePolicy
|
from PyQt5.QtWidgets import QLineEdit, QHBoxLayout, QLabel, QWidget, QShortcut, QProgressBar, QSizePolicy
|
||||||
from PyQt5.QtCore import pyqtSignal, Qt, QSize
|
from PyQt5.QtCore import pyqtSignal, Qt, QSize
|
||||||
from PyQt5.QtGui import QValidator, QKeySequence
|
from PyQt5.QtGui import QValidator, QKeySequence
|
||||||
|
import logging
|
||||||
|
|
||||||
class StatusBar(QWidget):
|
class StatusBar(QWidget):
|
||||||
has_error = False
|
has_error = False
|
||||||
@ -101,8 +102,11 @@ class StatusText(QLabel):
|
|||||||
super().__setattr__(name, value)
|
super().__setattr__(name, value)
|
||||||
self.update()
|
self.update()
|
||||||
|
|
||||||
|
def set_keystring(self, s):
|
||||||
|
self.keystring = s
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
self.setText(''.join([self.keystring, self.error, self.text,
|
super().setText(' '.join([self.keystring, self.error, self.text,
|
||||||
self.scrollperc]))
|
self.scrollperc]))
|
||||||
|
|
||||||
class StatusCommand(QLineEdit):
|
class StatusCommand(QLineEdit):
|
||||||
|
Loading…
Reference in New Issue
Block a user