本文整理汇总了Python中mapper.Mapper.getCustomMap方法的典型用法代码示例。如果您正苦于以下问题:Python Mapper.getCustomMap方法的具体用法?Python Mapper.getCustomMap怎么用?Python Mapper.getCustomMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mapper.Mapper
的用法示例。
在下文中一共展示了Mapper.getCustomMap方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Gui
# 需要导入模块: from mapper import Mapper [as 别名]
# 或者: from mapper.Mapper import getCustomMap [as 别名]
#.........这里部分代码省略.........
if '#' in note:
button_color = self.button_color_state_map_black[False];
else:
button_color = self.button_color_state_map_white[False];
eval(button_name + ".configure(bg = '" + button_color + "')");
def load_init_button_states(self):
for note in self.utils.getNotes():
self.button_state_map[note] = False;
def process_button_change(self, note):
new_state = self.update_scale_to_map(note);
self.button_state_map[note] = new_state;
self.set_custom_mapped_scale();
#self.searchForScale(self.scale_to_map)
self.auto_mode = False;
return new_state;
def searchForScale(self, scale_to_search):
for note in self.utils.getNotes():
for scale in self.utils.getAvailableScales():
if set(scale_to_search) == set(self.mapper.getScaleToMap(note, scale)):
print note,scale;
print hash(set(scale_to_search))
print hash(set(self.mapper.getScaleToMap(note, scale)))
def update_scale_to_map(self, note):
if self.button_state_map[note] is True:
self.scale_to_map.remove(note);
return False;
else:
self.scale_to_map.append(note);
return True;
def set_custom_mapped_scale(self):
if len(self.scale_to_map) != 0:
self.mapped_scale = self.mapper.getCustomMap(self.scale_to_map);
self.showMessage("Cutom scale: \n");
def showMessage(self, message):
self._LabelStatus.config(text = message);
def _on__ButtonASharp_command(self,Event=None):
new_state = self.process_button_change('A#');
self._ButtonASharp.configure(bg = self.button_color_state_map_black[new_state]);
def _on__ButtonA_command(self,Event=None):
new_state = self.process_button_change('A');
self._ButtonA.configure(bg = self.button_color_state_map_white[new_state]);
def _on__ButtonB_command(self,Event=None):
new_state = self.process_button_change('B');
self._ButtonB.configure(bg = self.button_color_state_map_white[new_state]);
def _on__ButtonCSharp_command(self,Event=None):
new_state = self.process_button_change('C#');
self._ButtonCSharp.configure(bg = self.button_color_state_map_black[new_state]);
def _on__ButtonC_command(self,Event=None):
new_state = self.process_button_change('C');
self._ButtonC.configure(bg = self.button_color_state_map_white[new_state]);
def _on__ButtonDSharp_command(self,Event=None):
new_state = self.process_button_change('D#');
self._ButtonDSharp.configure(bg = self.button_color_state_map_black[new_state]);
def _on__ButtonD_command(self,Event=None):
new_state = self.process_button_change('D');
self._ButtonD.configure(bg = self.button_color_state_map_white[new_state]);
def _on__ButtonE_command(self,Event=None):
new_state = self.process_button_change('E');
self._ButtonE.configure(bg = self.button_color_state_map_white[new_state]);
def _on__ButtonFSharp_command(self,Event=None):
new_state = self.process_button_change('F#');
self._ButtonFSharp.configure(bg = self.button_color_state_map_black[new_state]);
def _on__ButtonF_command(self,Event=None):
new_state = self.process_button_change('F');
self._ButtonF.configure(bg = self.button_color_state_map_white[new_state]);
def _on__ButtonGSharp_command(self,Event=None):
new_state = self.process_button_change('G#');
self._ButtonGSharp.configure(bg = self.button_color_state_map_black[new_state]);
def _on__ButtonG_command(self,Event=None):
new_state = self.process_button_change('G');
self._ButtonG.configure(bg = self.button_color_state_map_white[new_state]);
def _on__ButtonQuit_command(self,Event=None):
if self.midi_in is not None:
self.midi_in.close_port();
if self.midi_out is not None:
self.midi_out.close_port();
exit(0);
def _on__ScaleTrans_command(self,Event=None):
self.transpose = self._ScaleTrans.get();