Merge branch 'master' into nac3

This commit is contained in:
Sebastien Bourdeauducq 2022-06-06 18:18:05 +08:00
commit ce027d9c51
11 changed files with 29 additions and 20 deletions

View File

@ -71,7 +71,7 @@ class ZoomIconView(QtWidgets.QListView):
self._char_width = QtGui.QFontMetrics(self.font()).averageCharWidth()
self.setViewMode(self.IconMode)
w = self._char_width*self.default_size
self.setIconSize(QtCore.QSize(w, w*self.aspect))
self.setIconSize(QtCore.QSize(w, int(w*self.aspect)))
self.setFlow(self.LeftToRight)
self.setResizeMode(self.Adjust)
self.setWrapping(True)

View File

@ -76,7 +76,8 @@ def main():
args = get_argparser().parse_args()
common_args.init_logger_from_args(args)
loop = asyncio.get_event_loop()
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
try:
signal_handler = SignalHandler()
signal_handler.setup()

View File

@ -196,7 +196,8 @@ def main():
bind_address = common_args.bind_address_from_args(args)
loop = asyncio.get_event_loop()
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
try:
signal_handler = SignalHandler()
signal_handler.setup()

View File

@ -245,7 +245,8 @@ def _show_datasets(datasets):
def _run_subscriber(host, port, subscriber):
loop = asyncio.get_event_loop()
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
try:
loop.run_until_complete(subscriber.connect(host, port))
try:

View File

@ -74,7 +74,8 @@ class MasterConfig:
def main():
args = get_argparser().parse_args()
log_forwarder = init_log(args)
loop = asyncio.get_event_loop()
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
atexit.register(loop.close)
signal_handler = SignalHandler()
signal_handler.setup()

View File

@ -21,7 +21,8 @@ def get_argparser():
def main():
args = get_argparser().parse_args()
loop = asyncio.get_event_loop()
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
try:
signal_handler = SignalHandler()
signal_handler.setup()

View File

@ -49,7 +49,7 @@ class ScanWidget(QtWidgets.QWidget):
return self.minimumSizeHint()
def minimumSizeHint(self):
return QtCore.QSize(2.5*3*self._labelSize.width(),
return QtCore.QSize(int(2.5*3*self._labelSize.width()),
4*self._labelSize.height())
def _axisToPixel(self, val):
@ -214,7 +214,7 @@ class ScanWidget(QtWidgets.QWidget):
self._setView(left, scale)
def wheelEvent(self, ev):
y = ev.angleDelta().y()/120.
y = round(ev.angleDelta().y()/120.)
if not y:
return
if ev.modifiers() & QtCore.Qt.ShiftModifier:
@ -252,22 +252,22 @@ class ScanWidget(QtWidgets.QWidget):
for t, l in zip(ticks, labels):
t = self._axisToPixel(t)
painter.drawText(t - len(l)/2*avgCharWidth, 0, l)
painter.drawLine(t, descent, t, lineSpacing/2)
painter.translate(0, lineSpacing/2)
painter.drawText(int(t - len(l)/2*avgCharWidth), 0, l)
painter.drawLine(int(t), descent, int(t), int(lineSpacing/2))
painter.translate(0, int(lineSpacing/2))
painter.drawLine(0, 0, self.width(), 0)
for p in np.linspace(self._axisToPixel(self._start),
self._axisToPixel(self._stop),
self._num):
painter.drawLine(p, 0, p, lineSpacing/2)
painter.translate(0, lineSpacing/2)
painter.drawLine(int(p), 0, int(p), int(lineSpacing/2))
painter.translate(0, int(lineSpacing/2))
for x, c in (self._start, QtCore.Qt.blue), (self._stop, QtCore.Qt.red):
x = self._axisToPixel(x)
painter.setPen(c)
painter.setBrush(c)
painter.drawPolygon(*(QtCore.QPointF(*i) for i in [
(x, 0), (x - lineSpacing/2, lineSpacing),
(x + lineSpacing/2, lineSpacing)]))
(int(x), 0), (int(x - lineSpacing/2), lineSpacing),
(int(x + lineSpacing/2), lineSpacing)]))

View File

@ -75,7 +75,7 @@ class QtWaitingSpinner(QWidget):
color = self.currentLineColor(distance, self._numberOfLines, self._trailFadePercentage,
self._minimumTrailOpacity, self._color)
painter.setBrush(color)
painter.drawRoundedRect(QRect(0, -self._lineWidth / 2, self._lineLength, self._lineWidth), self._roundness,
painter.drawRoundedRect(QRect(0, int(-self._lineWidth / 2), self._lineLength, self._lineWidth), self._roundness,
self._roundness, Qt.RelativeSize)
painter.restore()
@ -160,7 +160,7 @@ class QtWaitingSpinner(QWidget):
self.setFixedSize(self.size, self.size)
def updateTimer(self):
self._timer.setInterval(1000 / (self._numberOfLines * self._revolutionsPerSecond))
self._timer.setInterval(int(1000 / (self._numberOfLines * self._revolutionsPerSecond)))
def lineCountDistanceFromPrimary(self, current, primary, totalNrOfLines):
distance = primary - current

View File

@ -28,7 +28,8 @@ class MonInjTest(ExperimentCase):
def injection_status_cb(channel, override, value):
injection_statuses.append((channel, override, value))
loop = asyncio.get_event_loop()
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
try:
moninj_comm = CommMonInj(monitor_cb, injection_status_cb)
loop.run_until_complete(moninj_comm.connect(core_host))

View File

@ -34,7 +34,8 @@ mock_modules = ["artiq.gui.waitingspinnerwidget",
"nac3artiq",
"sipyco", "sipyco.pc_rpc", "sipyco.sync_struct",
"sipyco.asyncio_tools", "sipyco.logging_tools",
"sipyco.broadcast", "sipyco.packed_exceptions"]
"sipyco.broadcast", "sipyco.packed_exceptions",
"sipyco.keepalive"]
for module in mock_modules:
sys.modules[module] = Mock()
@ -305,3 +306,4 @@ texinfo_documents = [
# -- Options for sphinxcontrib-wavedrom -----------------------------------
offline_skin_js_path = '_static/default.js'
offline_wavedrom_js_path = '_static/WaveDrom.js'
render_using_wavedrompy = True

View File

@ -275,7 +275,7 @@
sha256 = "sha256-ukZd3ajt0Sx3LByof4R80S31F5t1yo+L8QUADrMMm2A=";
};
buildInputs = [ pkgs.python3Packages.setuptools_scm ];
propagatedBuildInputs = [ pkgs.nodejs pkgs.nodePackages.wavedrom-cli ] ++ (with pkgs.python3Packages; [ wavedrom sphinx xcffib cairosvg ]);
propagatedBuildInputs = (with pkgs.python3Packages; [ wavedrom sphinx xcffib cairosvg ]);
};
latex-artiq-manual = pkgs.texlive.combine {
inherit (pkgs.texlive)
@ -371,6 +371,7 @@
artiq-comtools-msys2-pkg = packages.x86_64-w64-mingw32.artiq-comtools-pkg;
artiq-msys2-pkg = packages.x86_64-w64-mingw32.artiq-pkg;
msys2-repos = packages.x86_64-w64-mingw32.msys2-repos;
inherit (packages.x86_64-linux) artiq-manual-html artiq-manual-pdf;
};
};