forked from M-Labs/artiq
gui: fix new() being called with arguments by qt (closes #444)
This commit is contained in:
parent
f5da3f63aa
commit
f24f7380f5
|
@ -4,6 +4,7 @@ import sys
|
|||
import string
|
||||
import shlex
|
||||
from functools import partial
|
||||
from itertools import count
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
|
@ -296,7 +297,7 @@ class AppletsDock(QtWidgets.QDockWidget):
|
|||
|
||||
self.table.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
|
||||
new_action = QtWidgets.QAction("New applet", self.table)
|
||||
new_action.triggered.connect(self.new)
|
||||
new_action.triggered.connect(lambda: self.new())
|
||||
self.table.addAction(new_action)
|
||||
templates_menu = QtWidgets.QMenu()
|
||||
for name, template in _templates:
|
||||
|
@ -370,9 +371,8 @@ class AppletsDock(QtWidgets.QDockWidget):
|
|||
|
||||
def new(self, uid=None):
|
||||
if uid is None:
|
||||
uid = next(iter(set(range(len(self.applet_uids) + 1))
|
||||
- self.applet_uids))
|
||||
assert uid not in self.applet_uids
|
||||
uid = next(i for i in count() if i not in self.applet_uids)
|
||||
assert uid not in self.applet_uids, uid
|
||||
self.applet_uids.add(uid)
|
||||
|
||||
row = self.table.rowCount()
|
||||
|
|
Loading…
Reference in New Issue