当前位置: 首页>>代码示例>>Python>>正文


Python Mapper.getCustomMap方法代码示例

本文整理汇总了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();
        
开发者ID:doino-gretchenliev,项目名称:Mid-Magic,代码行数:103,代码来源:ui.py


注:本文中的mapper.Mapper.getCustomMap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。