Refactor button sensitivity setter
This commit is contained in:
parent
c70322bdf0
commit
20290a882f
20
git-sound.py
20
git-sound.py
@ -160,6 +160,8 @@ class GitSoundWindow(object):
|
|||||||
self.chooser_button = self.builder.get_object('repo-chooser')
|
self.chooser_button = self.builder.get_object('repo-chooser')
|
||||||
self.notelen_spin = self.builder.get_object('notelen-spin')
|
self.notelen_spin = self.builder.get_object('notelen-spin')
|
||||||
self.beatlen_spin = self.builder.get_object('beatlen-spin')
|
self.beatlen_spin = self.builder.get_object('beatlen-spin')
|
||||||
|
self.generate_button = self.builder.get_object('generate-button')
|
||||||
|
self.save_button = self.builder.get_object('save-button')
|
||||||
|
|
||||||
self.gitmidi = None
|
self.gitmidi = None
|
||||||
|
|
||||||
@ -253,22 +255,19 @@ class GitSoundWindow(object):
|
|||||||
data is already generated.
|
data is already generated.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
generate_button = self.builder.get_object('generate-button')
|
self.stop_button.set_sensitive(False)
|
||||||
save_button = self.builder.get_object('save-button')
|
|
||||||
|
|
||||||
if disable_all:
|
if disable_all:
|
||||||
generate_button.set_sensitive(False)
|
self.generate_button.set_sensitive(False)
|
||||||
self.play_button.set_sensitive(False)
|
self.play_button.set_sensitive(False)
|
||||||
self.stop_button.set_sensitive(False)
|
self.save_button.set_sensitive(False)
|
||||||
save_button.set_sensitive(False)
|
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
if self.gitmidi is not None:
|
if self.gitmidi is not None:
|
||||||
generate_button.set_sensitive(False)
|
self.generate_button.set_sensitive(False)
|
||||||
self.play_button.set_sensitive(True)
|
self.play_button.set_sensitive(True)
|
||||||
self.stop_button.set_sensitive(False)
|
self.save_button.set_sensitive(True)
|
||||||
save_button.set_sensitive(True)
|
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -277,10 +276,9 @@ class GitSoundWindow(object):
|
|||||||
scale_selected = self.scale_combo.get_active_id() is not None
|
scale_selected = self.scale_combo.get_active_id() is not None
|
||||||
|
|
||||||
if branch_selected and program_selected and scale_selected:
|
if branch_selected and program_selected and scale_selected:
|
||||||
generate_button.set_sensitive(True)
|
self.generate_button.set_sensitive(True)
|
||||||
self.play_button.set_sensitive(False)
|
self.play_button.set_sensitive(False)
|
||||||
self.stop_button.set_sensitive(False)
|
self.save_button.set_sensitive(False)
|
||||||
save_button.set_sensitive(False)
|
|
||||||
|
|
||||||
def generate_repo(self):
|
def generate_repo(self):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user