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