Skip to content

Commit 7144f6d

Browse files
committed
Rename functions to be consistent with other tab widget functions.
Also adds a `auto_create_enum_widgets` that mirrors `auto_create_widgets` functionality, but just for enums (ie preserves backwards compat, enforces opt-in).
1 parent 3f23502 commit 7144f6d

1 file changed

Lines changed: 20 additions & 13 deletions

File tree

blacs/device_base_class.py

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -231,24 +231,14 @@ def create_dds_outputs(self,dds_properties):
231231

232232
self._DDS[hardware_name] = DDS(hardware_name,connection_name,sub_chnls)
233233

234-
def create_eo_outputs(self, eo_properties):
234+
def create_enum_outputs(self, eo_properties):
235235
for output_name, properties in eo_properties.items():
236-
self._EO[output_name] = self._create_eo_object(self.device_name, output_name, properties)
236+
self._EO[output_name] = self._create_EO_object(self.device_name, output_name, properties)
237237

238-
def _create_eo_object(self, parent_device, device_property, properties):
238+
def _create_EO_object(self, parent_device, device_property, properties):
239239
properties.setdefault('return_index', False)
240240
return EO(device_property, parent_device, self.device_name, self.program_device, self.settings,
241241
properties['options'], properties['return_index'])
242-
243-
def create_eo_widgets(self,device_properties):
244-
widgets = {}
245-
for output_name, properties in device_properties.items():
246-
properties.setdefault('display_name',output_name)
247-
properties.setdefault('horizontal_alignment',False)
248-
properties.setdefault('parent',None)
249-
widgets[output_name] = self._EO[output_name].create_widget(properties['display_name'], properties['horizontal_alignment'], properties['parent'])
250-
251-
return widgets
252242

253243
def get_child_from_connection_table(self, parent_device_name, port):
254244
return self.connection_table.find_child(parent_device_name, port)
@@ -298,6 +288,23 @@ def create_dds_widgets(self,channel_properties):
298288

299289
return widgets
300290

291+
def create_enum_widgets(self,device_properties):
292+
293+
widgets = {}
294+
for output_name, properties in device_properties.items():
295+
properties.setdefault('display_name',output_name)
296+
properties.setdefault('horizontal_alignment',False)
297+
properties.setdefault('parent',None)
298+
widgets[output_name] = self._EO[output_name].create_widget(properties['display_name'], properties['horizontal_alignment'], properties['parent'])
299+
300+
return widgets
301+
302+
def auto_create_enum_widgets(self):
303+
eo_properties = {}
304+
for channel,_ in self._EO.items():
305+
eo_properties[channel] = {}
306+
return self.create_enum_widgets(eo_properties)
307+
301308
def auto_create_widgets(self):
302309
dds_properties = {}
303310
for channel,output in self._DDS.items():

0 commit comments

Comments
 (0)