Skip to content

Commit

Permalink
Sound import editor activation on dblclick + fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MaurizioB committed May 24, 2017
1 parent 4cd7e24 commit 6103a15
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 30 deletions.
2 changes: 1 addition & 1 deletion bigglesworth/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion bigglesworth/dialogs/midi_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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()
Expand Down
85 changes: 59 additions & 26 deletions bigglesworth/dialogs/midi_import.ui
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<string>Library properties</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="4" column="0">
<item row="5" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="bankmap_lbl">
Expand Down Expand Up @@ -86,6 +86,22 @@
</item>
</layout>
</item>
<item row="3" column="0">
<widget class="QTableWidget" name="sounds_table">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="dragDropOverwriteMode">
<bool>false</bool>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
</widget>
</item>
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
Expand Down Expand Up @@ -132,23 +148,7 @@
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="QTableWidget" name="sounds_table">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="dragDropOverwriteMode">
<bool>false</bool>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
</widget>
</item>
<item row="3" column="0">
<item row="4" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="spacing">
<number>8</number>
Expand Down Expand Up @@ -208,14 +208,31 @@
</layout>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="doubleclick_dump_chk">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Dump to Sound Mode Edit Buffer on double click</string>
</property>
</widget>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QCheckBox" name="doubleclick_dump_chk">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Dump to Sound Mode Edit Buffer on double click</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="editor_activate_chk">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>open in Sound editor</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
Expand Down Expand Up @@ -581,6 +598,22 @@
</hint>
</hints>
</connection>
<connection>
<sender>doubleclick_dump_chk</sender>
<signal>toggled(bool)</signal>
<receiver>editor_activate_chk</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>145</x>
<y>68</y>
</hint>
<hint type="destinationlabel">
<x>355</x>
<y>68</y>
</hint>
</hints>
</connection>
</connections>
<buttongroups>
<buttongroup name="destination_group"/>
Expand Down
4 changes: 2 additions & 2 deletions bigglesworth/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit 6103a15

Please sign in to comment.