pyControl / code

pyControl GUI and framework code
https://pycontrol.readthedocs.io
GNU General Public License v3.0
23 stars 20 forks source link

bug in hardware setup variables table #87

Closed ThomasAkam closed 1 year ago

ThomasAkam commented 1 year ago

While fixing a bug in 50bd9c11b4d62a2dbf22c14bb9248fb190494929 where running any task or experiment without naming the setups gave an error message, I encountered a bug in the hardware variables dialog. The bug happens when I open the hardware variables dialog in the setups tab, and causes the error message below to appear in the log:

  File "E:\Dropbox\Hardware development\pyControl\gui\hardware_variables_dialog.py", line 113, in refresh_save_button
    if self.get_table_data() != self.starting_table:
  File "E:\Dropbox\Hardware development\pyControl\gui\hardware_variables_dialog.py", line 121, in get_table_data
    setup_name = self.cellWidget(table_row, 0).text()
AttributeError: 'NoneType' object has no attribute 'text'

I could not work out what is causing this, @alustig3 could you take a look.

Also, I have a couple of questions/comments about the code for the VariablesTable widget in hardware_variables_dialog.py:

alustig3 commented 1 year ago

where running any task or experiment without naming the setups gave an error message, I encountered a bug in the hardware variables dialog. The bug happens when I open the hardware variables dialog in the setups tab

I'm not sure I follow. would it be possible to share a screen recording of you encountering the error? You shouldn't be able to open the hardware variables dialog in the setups tab without first naming the setup (the Variables button should not be enabled)

CleanShot 2023-06-02 at 15 21 31

ThomasAkam commented 1 year ago

@alustig3 I get this error even when all the setups have names, see the configuration in the image below. The error occurs when I open the hardware variables dialog, and only happens if there are saved values for hardware variables. The setups.json file read:

{
    "COM4": {
        "name": "b2",
        "variables": {
            "hw_solenoid": 10
        }
    },
    "COM6": {
        "name": "b1",
        "variables": {
            "hw_solenoid": 8
        }
    }
}

image