Add defaults for signal emitting
This commit is contained in:
parent
19d8202b01
commit
517fcb02ab
@ -50,7 +50,13 @@ class Command(QObject):
|
||||
def run(self, argv=None):
|
||||
if not self.signal:
|
||||
raise NotImplementedError
|
||||
self.signal.emit()
|
||||
# some sane defaults
|
||||
if self.nargs == 0:
|
||||
self.signal.emit()
|
||||
elif self.nargs == 1:
|
||||
self.signal.emit(argv[0])
|
||||
else:
|
||||
raise NotImplementedError
|
||||
|
||||
class EmptyCmd(Command):
|
||||
nargs = 0
|
||||
@ -63,18 +69,12 @@ class OpenCmd(Command):
|
||||
key = 'o'
|
||||
signal = pyqtSignal(str)
|
||||
|
||||
def run(self, argv):
|
||||
self.signal.emit(argv[0])
|
||||
|
||||
class TabOpenCmd(Command):
|
||||
nargs = 1
|
||||
name = 'tabopen'
|
||||
key = 'Shift+o'
|
||||
signal = pyqtSignal(str)
|
||||
|
||||
def run(self, argv):
|
||||
self.signal.emit(argv[0])
|
||||
|
||||
class TabCloseCmd(Command):
|
||||
nargs = 0
|
||||
name = 'tabclose'
|
||||
|
Loading…
Reference in New Issue
Block a user