From 6103a15cb8e33281085054fe42cd6e1bef46813d Mon Sep 17 00:00:00 2001 From: MaurizioB Date: Wed, 24 May 2017 02:21:53 +0200 Subject: [PATCH] Sound import editor activation on dblclick + fixes --- bigglesworth/__init__.py | 2 +- bigglesworth/dialogs/midi_import.py | 7 ++- bigglesworth/dialogs/midi_import.ui | 85 ++++++++++++++++++++--------- bigglesworth/editor.py | 4 +- 4 files changed, 68 insertions(+), 30 deletions(-) diff --git a/bigglesworth/__init__.py b/bigglesworth/__init__.py index 8cde19e..c4be38e 100755 --- a/bigglesworth/__init__.py +++ b/bigglesworth/__init__.py @@ -733,7 +733,7 @@ def sound_dump_received(self, sound): sound._bank, sound._prog = library self.blofeld_library.addSound(sound) if editor: - self.activate_editor(library) + self.activate_editor(*library) return bank = sound.bank prog = sound.prog diff --git a/bigglesworth/dialogs/midi_import.py b/bigglesworth/dialogs/midi_import.py index 8c8af51..3e17202 100644 --- a/bigglesworth/dialogs/midi_import.py +++ b/bigglesworth/dialogs/midi_import.py @@ -333,6 +333,7 @@ def selectionChanged(self, selected, deselected): def midi_output_state(self, conn): self.midi_state = True if conn else False self.doubleclick_dump_chk.setEnabled(self.midi_state) + self.editor_activate_chk.setEnabled(self.midi_state & self.doubleclick_dump_chk.isChecked()) self.single_dump_btn.setEnabled(self.midi_state) self.enable_export_btns() @@ -376,11 +377,15 @@ def dump_sounds(self): self.hide() def dump_temp(self, row, column): - if not self.doubleclick_dump_chk.isChecked(): return + if not (self.doubleclick_dump_chk.isEnabled() and self.doubleclick_dump_chk.isChecked()): return copy = self.sound_list[row].copy() copy.bank = 0x7f copy.prog = 0 self.dump_send.emit(copy) + if self.editor_activate_chk.isChecked(): + self.main.editor.setSoundDump(copy, imported=True) + self.main.editor.show() + self.main.editor.activateWindow() def dump_single(self): checked = self.destination_group.checkedId() diff --git a/bigglesworth/dialogs/midi_import.ui b/bigglesworth/dialogs/midi_import.ui index b35a384..e2e7970 100644 --- a/bigglesworth/dialogs/midi_import.ui +++ b/bigglesworth/dialogs/midi_import.ui @@ -43,7 +43,7 @@ Library properties - + @@ -86,6 +86,22 @@ + + + + Qt::CustomContextMenu + + + QAbstractItemView::NoEditTriggers + + + false + + + QAbstractItemView::SelectRows + + + @@ -132,23 +148,7 @@ - - - - Qt::CustomContextMenu - - - QAbstractItemView::NoEditTriggers - - - false - - - QAbstractItemView::SelectRows - - - - + 8 @@ -208,14 +208,31 @@ - - - false - - - Dump to Sound Mode Edit Buffer on double click - - + + + + + false + + + Dump to Sound Mode Edit Buffer on double click + + + + + + + false + + + open in Sound editor + + + true + + + + @@ -581,6 +598,22 @@ + + doubleclick_dump_chk + toggled(bool) + editor_activate_chk + setEnabled(bool) + + + 145 + 68 + + + 355 + 68 + + + diff --git a/bigglesworth/editor.py b/bigglesworth/editor.py index ed06eb5..56d35b5 100644 --- a/bigglesworth/editor.py +++ b/bigglesworth/editor.py @@ -2851,12 +2851,12 @@ def setSound(self, bank, prog, pgm_send=False): self.display.midi_btn.midi_out() self.program_change_request.emit(sound.bank, sound.prog) - def setSoundDump(self, sound=None): + def setSoundDump(self, sound=None, imported=False): if sound is None: sound = Sound(init_sound_data) else: self.sound_changed.emit(sound.bank, sound.prog) - self.display.statusUpdate('Received sound dump from Blofeld') + self.display.statusUpdate('Received sound dump from Blofeld' if not imported else 'Sound imported from file') self.sound = sound self._setSound()