Skip to content

Commit 07dcd17

Browse files
committed
feature: Added icons for PuleBlaster and PulseBlaster_No_DDS BLACS tabs
1 parent e9bcf03 commit 07dcd17

File tree

3 files changed

+144
-67
lines changed

3 files changed

+144
-67
lines changed

PulseBlaster.py

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,19 @@ def add_device(self, device):
578578
from blacs.device_base_class import DeviceTab
579579

580580
from qtutils import UiLoader
581+
import qtutils.icons
581582
import os
583+
import sys
584+
585+
# We can't import * from QtCore & QtGui, as one of them has a function called bin() which overrides the builtin, which is used in the pulseblaster worker
586+
if 'PySide' in sys.modules.copy():
587+
from PySide import QtCore
588+
from PySide import QtGui
589+
else:
590+
from PyQt4 import QtCore
591+
from PyQt4 import QtGui
592+
593+
582594

583595
@BLACS_tab
584596
class PulseBlasterTab(DeviceTab):
@@ -647,6 +659,13 @@ def sort(channel):
647659
ui.start_button.clicked.connect(self.start)
648660
ui.stop_button.clicked.connect(self.stop)
649661
ui.reset_button.clicked.connect(self.reset)
662+
# Add icons
663+
ui.start_button.setIcon(QtGui.QIcon(':/qtutils/fugue/control'))
664+
ui.start_button.setToolTip('Start')
665+
ui.stop_button.setIcon(QtGui.QIcon(':/qtutils/fugue/control-stop-square'))
666+
ui.stop_button.setToolTip('Stop')
667+
ui.reset_button.setIcon(QtGui.QIcon(':/qtutils/fugue/arrow-circle'))
668+
ui.reset_button.setToolTip('Reset')
650669

651670
# initialise dictionaries of data to display and get references to the QLabels
652671
self.status_states = ['stopped', 'reset', 'running', 'waiting']
@@ -713,7 +732,13 @@ def status_monitor(self,notify_queue=None):
713732

714733
# Update widgets with new status
715734
for state in self.status_states:
716-
self.status_widgets[state].setText(str(self.status[state]))
735+
if self.status[state]:
736+
icon = QtGui.QIcon(':/qtutils/fugue/tick')
737+
else:
738+
icon = QtGui.QIcon(':/qtutils/fugue/cross')
739+
740+
pixmap = icon.pixmap(QtCore.QSize(16, 16))
741+
self.status_widgets[state].setPixmap(pixmap)
717742

718743
@define_state(MODE_MANUAL|MODE_BUFFERED|MODE_TRANSITION_TO_BUFFERED|MODE_TRANSITION_TO_MANUAL,True)
719744
def start(self,widget=None):

PulseBlaster_No_DDS.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,17 @@ def generate_code(self, hdf5_file):
7878
from blacs.device_base_class import DeviceTab
7979

8080
from qtutils import UiLoader
81+
import qtutils.icons
8182
import os
83+
import sys
84+
85+
# We can't import * from QtCore & QtGui, as one of them has a function called bin() which overrides the builtin, which is used in the pulseblaster worker
86+
if 'PySide' in sys.modules.copy():
87+
from PySide import QtCore
88+
from PySide import QtGui
89+
else:
90+
from PyQt4 import QtCore
91+
from PyQt4 import QtGui
8292

8393
@BLACS_tab
8494
class Pulseblaster_No_DDS_Tab(DeviceTab):
@@ -134,6 +144,13 @@ def sort(channel):
134144
ui.start_button.clicked.connect(self.start)
135145
ui.stop_button.clicked.connect(self.stop)
136146
ui.reset_button.clicked.connect(self.reset)
147+
# Add icons
148+
ui.start_button.setIcon(QtGui.QIcon(':/qtutils/fugue/control'))
149+
ui.start_button.setToolTip('Start')
150+
ui.stop_button.setIcon(QtGui.QIcon(':/qtutils/fugue/control-stop-square'))
151+
ui.stop_button.setToolTip('Stop')
152+
ui.reset_button.setIcon(QtGui.QIcon(':/qtutils/fugue/arrow-circle'))
153+
ui.reset_button.setToolTip('Reset')
137154

138155
# initialise dictionaries of data to display and get references to the QLabels
139156
self.status_states = ['stopped', 'reset', 'running', 'waiting']
@@ -199,7 +216,13 @@ def status_monitor(self,notify_queue=None):
199216
self.program_device()
200217
# Update widgets with new status
201218
for state in self.status_states:
202-
self.status_widgets[state].setText(str(self.status[state]))
219+
if self.status[state]:
220+
icon = QtGui.QIcon(':/qtutils/fugue/tick')
221+
else:
222+
icon = QtGui.QIcon(':/qtutils/fugue/cross')
223+
224+
pixmap = icon.pixmap(QtCore.QSize(16, 16))
225+
self.status_widgets[state].setPixmap(pixmap)
203226

204227

205228
@define_state(MODE_MANUAL|MODE_BUFFERED|MODE_TRANSITION_TO_BUFFERED|MODE_TRANSITION_TO_MANUAL,True)

pulseblaster.ui

Lines changed: 94 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
<item>
3535
<widget class="QLabel" name="label_3">
3636
<property name="text">
37-
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600; text-decoration: underline;&quot;&gt;Status&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
37+
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Status&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
3838
</property>
3939
<property name="alignment">
4040
<set>Qt::AlignCenter</set>
@@ -46,85 +46,145 @@
4646
<item row="0" column="0">
4747
<widget class="QLabel" name="label">
4848
<property name="text">
49-
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Stopped:&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
49+
<string>Stopped</string>
5050
</property>
5151
<property name="alignment">
52-
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
52+
<set>Qt::AlignCenter</set>
5353
</property>
5454
</widget>
5555
</item>
56-
<item row="1" column="0">
56+
<item row="0" column="1">
5757
<widget class="QLabel" name="label_2">
5858
<property name="text">
59-
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Reset:&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
59+
<string>Reset</string>
6060
</property>
6161
<property name="alignment">
62-
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
62+
<set>Qt::AlignCenter</set>
6363
</property>
6464
</widget>
6565
</item>
66-
<item row="0" column="1">
67-
<widget class="QLabel" name="stopped_label">
68-
<property name="text">
69-
<string>??</string>
70-
</property>
71-
</widget>
72-
</item>
73-
<item row="2" column="0">
66+
<item row="0" column="2">
7467
<widget class="QLabel" name="label_4">
7568
<property name="text">
76-
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Running:&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
69+
<string>Running</string>
7770
</property>
7871
<property name="alignment">
79-
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
72+
<set>Qt::AlignCenter</set>
8073
</property>
8174
</widget>
8275
</item>
83-
<item row="3" column="0">
84-
<widget class="QLabel" name="label_5">
76+
<item row="1" column="0">
77+
<widget class="QLabel" name="stopped_label">
8578
<property name="text">
86-
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Waiting:&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
79+
<string/>
8780
</property>
8881
<property name="alignment">
89-
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
82+
<set>Qt::AlignCenter</set>
9083
</property>
9184
</widget>
9285
</item>
9386
<item row="1" column="1">
9487
<widget class="QLabel" name="reset_label">
9588
<property name="text">
96-
<string>??</string>
89+
<string/>
90+
</property>
91+
<property name="alignment">
92+
<set>Qt::AlignCenter</set>
9793
</property>
9894
</widget>
9995
</item>
100-
<item row="2" column="1">
96+
<item row="1" column="2">
10197
<widget class="QLabel" name="running_label">
10298
<property name="text">
103-
<string>??</string>
99+
<string/>
100+
</property>
101+
<property name="alignment">
102+
<set>Qt::AlignCenter</set>
104103
</property>
105104
</widget>
106105
</item>
107-
<item row="3" column="1">
106+
<item row="1" column="3">
108107
<widget class="QLabel" name="waiting_label">
109108
<property name="text">
110-
<string>??</string>
109+
<string/>
110+
</property>
111+
<property name="alignment">
112+
<set>Qt::AlignCenter</set>
113+
</property>
114+
</widget>
115+
</item>
116+
<item row="0" column="3">
117+
<widget class="QLabel" name="label_5">
118+
<property name="text">
119+
<string>Waiting</string>
120+
</property>
121+
<property name="alignment">
122+
<set>Qt::AlignCenter</set>
111123
</property>
112124
</widget>
113125
</item>
114126
</layout>
115127
</item>
116128
<item>
117-
<spacer name="verticalSpacer_2">
118-
<property name="orientation">
119-
<enum>Qt::Vertical</enum>
129+
<widget class="QLabel" name="label_6">
130+
<property name="text">
131+
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Manual control&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
120132
</property>
121-
<property name="sizeHint" stdset="0">
122-
<size>
123-
<width>20</width>
124-
<height>40</height>
125-
</size>
133+
<property name="alignment">
134+
<set>Qt::AlignCenter</set>
126135
</property>
127-
</spacer>
136+
</widget>
137+
</item>
138+
<item>
139+
<layout class="QHBoxLayout" name="horizontalLayout">
140+
<item>
141+
<spacer name="horizontalSpacer_4">
142+
<property name="orientation">
143+
<enum>Qt::Horizontal</enum>
144+
</property>
145+
<property name="sizeHint" stdset="0">
146+
<size>
147+
<width>40</width>
148+
<height>20</height>
149+
</size>
150+
</property>
151+
</spacer>
152+
</item>
153+
<item>
154+
<widget class="QPushButton" name="start_button">
155+
<property name="text">
156+
<string/>
157+
</property>
158+
</widget>
159+
</item>
160+
<item>
161+
<widget class="QPushButton" name="stop_button">
162+
<property name="text">
163+
<string/>
164+
</property>
165+
</widget>
166+
</item>
167+
<item>
168+
<widget class="QPushButton" name="reset_button">
169+
<property name="text">
170+
<string/>
171+
</property>
172+
</widget>
173+
</item>
174+
<item>
175+
<spacer name="horizontalSpacer_5">
176+
<property name="orientation">
177+
<enum>Qt::Horizontal</enum>
178+
</property>
179+
<property name="sizeHint" stdset="0">
180+
<size>
181+
<width>40</width>
182+
<height>20</height>
183+
</size>
184+
</property>
185+
</spacer>
186+
</item>
187+
</layout>
128188
</item>
129189
</layout>
130190
</item>
@@ -146,37 +206,6 @@
146206
</item>
147207
<item>
148208
<layout class="QVBoxLayout" name="verticalLayout">
149-
<item>
150-
<widget class="QLabel" name="label_6">
151-
<property name="text">
152-
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600; text-decoration: underline;&quot;&gt;Manual Control&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
153-
</property>
154-
<property name="alignment">
155-
<set>Qt::AlignCenter</set>
156-
</property>
157-
</widget>
158-
</item>
159-
<item>
160-
<widget class="QPushButton" name="start_button">
161-
<property name="text">
162-
<string>Start</string>
163-
</property>
164-
</widget>
165-
</item>
166-
<item>
167-
<widget class="QPushButton" name="stop_button">
168-
<property name="text">
169-
<string>Stop</string>
170-
</property>
171-
</widget>
172-
</item>
173-
<item>
174-
<widget class="QPushButton" name="reset_button">
175-
<property name="text">
176-
<string>Reset</string>
177-
</property>
178-
</widget>
179-
</item>
180209
<item>
181210
<spacer name="verticalSpacer_3">
182211
<property name="orientation">

0 commit comments

Comments
 (0)