浏览代码

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 年前
父节点
当前提交
3e47de8aaa
共有 1 个文件被更改,包括 7 次插入7 次删除
  1. 7
    7
      pd-buddy-gtk.py

+ 7
- 7
pd-buddy-gtk.py 查看文件

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

正在加载...
取消
保存