Skip to content

Commit

Permalink
gui: fix new() being called with arguments by qt (closes #444)
Browse files Browse the repository at this point in the history
jordens committed May 25, 2016
1 parent 8d0034e commit 109aa73
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions artiq/gui/applets.py
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@
import sys
import shlex
from functools import partial
from itertools import count

from PyQt5 import QtCore, QtGui, QtWidgets

@@ -217,7 +218,7 @@ def __init__(self, main_window, datasets_sub):

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:
@@ -286,9 +287,8 @@ def on_dock_closed(self, dock):

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()

0 comments on commit 109aa73

Please sign in to comment.