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):
|
def run(self, argv=None):
|
||||||
if not self.signal:
|
if not self.signal:
|
||||||
raise NotImplementedError
|
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):
|
class EmptyCmd(Command):
|
||||||
nargs = 0
|
nargs = 0
|
||||||
@ -63,18 +69,12 @@ class OpenCmd(Command):
|
|||||||
key = 'o'
|
key = 'o'
|
||||||
signal = pyqtSignal(str)
|
signal = pyqtSignal(str)
|
||||||
|
|
||||||
def run(self, argv):
|
|
||||||
self.signal.emit(argv[0])
|
|
||||||
|
|
||||||
class TabOpenCmd(Command):
|
class TabOpenCmd(Command):
|
||||||
nargs = 1
|
nargs = 1
|
||||||
name = 'tabopen'
|
name = 'tabopen'
|
||||||
key = 'Shift+o'
|
key = 'Shift+o'
|
||||||
signal = pyqtSignal(str)
|
signal = pyqtSignal(str)
|
||||||
|
|
||||||
def run(self, argv):
|
|
||||||
self.signal.emit(argv[0])
|
|
||||||
|
|
||||||
class TabCloseCmd(Command):
|
class TabCloseCmd(Command):
|
||||||
nargs = 0
|
nargs = 0
|
||||||
name = 'tabclose'
|
name = 'tabclose'
|
||||||
|
Loading…
Reference in New Issue
Block a user