Browse Source

Don't update Save button until command sent

Previously, we updated the Save button before sending the commands.
This meant that if the command failed, the save button was still updated
before the error dialog appeared, which was a bit odd.  Now that's
fixed.
Clara Hobbs 7 years ago
parent
commit
3e47de8aaa
1 changed files with 7 additions and 7 deletions
  1. 7
    7
      pd-buddy-gtk.py

+ 7
- 7
pd-buddy-gtk.py View File

233
         st.set_visible_child(select)
233
         st.set_visible_child(select)
234
 
234
 
235
     def on_header_sink_save_clicked(self, button):
235
     def on_header_sink_save_clicked(self, button):
236
-        self._store_device_settings()
237
-        self._set_save_button_visibility()
238
-
239
         window = self.builder.get_object("pdb-window")
236
         window = self.builder.get_object("pdb-window")
240
         try:
237
         try:
241
             pdb_send_message(window, self.serial_port, 'write')
238
             pdb_send_message(window, self.serial_port, 'write')
239
+
240
+            self._store_device_settings()
241
+            self._set_save_button_visibility()
242
         except:
242
         except:
243
             self.on_header_sink_back_clicked(None)
243
             self.on_header_sink_back_clicked(None)
244
 
244
 
264
                              or current.get_value() != self.current)
264
                              or current.get_value() != self.current)
265
 
265
 
266
     def on_voltage_combobox_changed(self, combo):
266
     def on_voltage_combobox_changed(self, combo):
267
-        self._set_save_button_visibility()
268
-
269
         window = self.builder.get_object("pdb-window")
267
         window = self.builder.get_object("pdb-window")
270
         try:
268
         try:
271
             pdb_send_message(window, self.serial_port,
269
             pdb_send_message(window, self.serial_port,
272
                              'set_v {}'.format(int(combo.get_active_text())*1000))
270
                              'set_v {}'.format(int(combo.get_active_text())*1000))
271
+
272
+            self._set_save_button_visibility()
273
         except:
273
         except:
274
             self.on_header_sink_back_clicked(None)
274
             self.on_header_sink_back_clicked(None)
275
 
275
 
276
     def on_current_spinbutton_changed(self, spin):
276
     def on_current_spinbutton_changed(self, spin):
277
-        self._set_save_button_visibility()
278
-
279
         window = self.builder.get_object("pdb-window")
277
         window = self.builder.get_object("pdb-window")
280
         try:
278
         try:
281
             pdb_send_message(window, self.serial_port,
279
             pdb_send_message(window, self.serial_port,
282
                              'set_i {}'.format(int(spin.get_value()*1000)))
280
                              'set_i {}'.format(int(spin.get_value()*1000)))
281
+
282
+            self._set_save_button_visibility()
283
         except:
283
         except:
284
             self.on_header_sink_back_clicked(None)
284
             self.on_header_sink_back_clicked(None)
285
 
285
 

Loading…
Cancel
Save