mirror of https://github.com/m-labs/artiq.git
gui: fix new() being called with arguments by qt (closes #444)
This commit is contained in:
parent
8d0034e11d
commit
109aa73a6b
|
@ -3,6 +3,7 @@ import asyncio
|
||||||
import sys
|
import sys
|
||||||
import shlex
|
import shlex
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
from itertools import count
|
||||||
|
|
||||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
@ -217,7 +218,7 @@ class AppletsDock(QtWidgets.QDockWidget):
|
||||||
|
|
||||||
self.table.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
|
self.table.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
|
||||||
new_action = QtWidgets.QAction("New applet", self.table)
|
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)
|
self.table.addAction(new_action)
|
||||||
templates_menu = QtWidgets.QMenu()
|
templates_menu = QtWidgets.QMenu()
|
||||||
for name, template in _templates:
|
for name, template in _templates:
|
||||||
|
@ -286,9 +287,8 @@ class AppletsDock(QtWidgets.QDockWidget):
|
||||||
|
|
||||||
def new(self, uid=None):
|
def new(self, uid=None):
|
||||||
if uid is None:
|
if uid is None:
|
||||||
uid = next(iter(set(range(len(self.applet_uids) + 1))
|
uid = next(i for i in count() if i not in self.applet_uids)
|
||||||
- self.applet_uids))
|
assert uid not in self.applet_uids, uid
|
||||||
assert uid not in self.applet_uids
|
|
||||||
self.applet_uids.add(uid)
|
self.applet_uids.add(uid)
|
||||||
|
|
||||||
row = self.table.rowCount()
|
row = self.table.rowCount()
|
||||||
|
|
Loading…
Reference in New Issue