Add empty command
This commit is contained in:
parent
5eab225fa1
commit
837f53edea
@ -26,13 +26,13 @@ class CommandParser(QObject):
|
|||||||
|
|
||||||
class Command(QObject):
|
class Command(QObject):
|
||||||
nargs = 0
|
nargs = 0
|
||||||
name = ''
|
name = None
|
||||||
key = None
|
key = None
|
||||||
signal = None
|
signal = None
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def bind(cls):
|
def bind(cls):
|
||||||
if cls.name:
|
if cls.name is not None:
|
||||||
cmd_dict[cls.name] = cls()
|
cmd_dict[cls.name] = cls()
|
||||||
|
|
||||||
def check(self, argv):
|
def check(self, argv):
|
||||||
@ -46,6 +46,11 @@ class Command(QObject):
|
|||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
self.signal.emit()
|
self.signal.emit()
|
||||||
|
|
||||||
|
class EmptyCmd(Command):
|
||||||
|
nargs = 0
|
||||||
|
name = ''
|
||||||
|
key = ':'
|
||||||
|
|
||||||
class OpenCmd(Command):
|
class OpenCmd(Command):
|
||||||
nargs = 1
|
nargs = 1
|
||||||
name = 'open'
|
name = 'open'
|
||||||
|
@ -9,6 +9,7 @@ class KeyParser(QObject):
|
|||||||
def from_cmd_dict(self, d, parent):
|
def from_cmd_dict(self, d, parent):
|
||||||
for cmd in d.values():
|
for cmd in d.values():
|
||||||
if cmd.key is not None:
|
if cmd.key is not None:
|
||||||
|
print('reg: {} -> {}'.format(cmd.name, cmd.key))
|
||||||
sc = QShortcut(parent)
|
sc = QShortcut(parent)
|
||||||
sc.setKey(QKeySequence(cmd.key))
|
sc.setKey(QKeySequence(cmd.key))
|
||||||
sc.setContext(Qt.WidgetWithChildrenShortcut)
|
sc.setContext(Qt.WidgetWithChildrenShortcut)
|
||||||
|
Loading…
Reference in New Issue
Block a user