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


Python ToggleToolButton.handler_block_by_func方法代码示例

本文整理汇总了Python中sugar3.graphics.toggletoolbutton.ToggleToolButton.handler_block_by_func方法的典型用法代码示例。如果您正苦于以下问题:Python ToggleToolButton.handler_block_by_func方法的具体用法?Python ToggleToolButton.handler_block_by_func怎么用?Python ToggleToolButton.handler_block_by_func使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sugar3.graphics.toggletoolbutton.ToggleToolButton的用法示例。


在下文中一共展示了ToggleToolButton.handler_block_by_func方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: CardEditor

# 需要导入模块: from sugar3.graphics.toggletoolbutton import ToggleToolButton [as 别名]
# 或者: from sugar3.graphics.toggletoolbutton.ToggleToolButton import handler_block_by_func [as 别名]

#.........这里部分代码省略.........
    def set_font_name(self, font_name):
        self.fontbutton.handler_block(self.id_font_changed)
        self.fontbutton.set_font_name(font_name)
        self.fontbutton.handler_unblock(self.id_font_changed)

    def update_text(self, entry):
        self.card.change_text(entry.get_text())
        if len(entry.get_text()) == 0:
            self.emit('has-text', False)
        else:
            self.emit('has-text', True)

    def get_text(self):
        return self.textentry.get_text()

    def set_text(self, newtext):
        if newtext is None:
            newtext = ''
        self.textentry.set_text(newtext)

    def get_speak(self):
        if self.usespeak is None:
            return None
        if self.usespeak.props.active:
            return self.usespeak.palette.face.status.voice.language

    def set_speak(self, value):
        if self.usespeak is None:
            return
        if value is None:
            self.usespeak.props.active = False
        else:
            try:
                self.usespeak.handler_block_by_func(self._usespeak_cb)
                self.usespeak.props.active = True
            finally:
                self.usespeak.handler_unblock_by_func(self._usespeak_cb)
            self.usespeak.palette.voices.resume(value)

    def get_image_path(self):
        return self.card.get_image_path()

    def set_image_path(self, image_path):
        self.card.set_image_path(image_path)
        self.emit('has-picture', True)

    def _load_image(self, widget):
        def load(jobject):
            origin_path = jobject.file_path
            self._game.model.mark_modified()
            self._game.model.create_temp_directories()
            destination_path = join(self._game.model.data['pathimg'],
                                    basename(origin_path))
            shutil.copy(origin_path, destination_path)
            self.set_speak(None)
            self.card.set_image_path(destination_path)
            logging.debug('Picture Loaded: %s', destination_path)
            self.emit('has-picture', True)

        chooser.pick(parent=self.get_toplevel(),
                     what=chooser.IMAGE,
                     cb=load)

    def _load_audio(self, widget):
        def load(jobject):
            origin_path = jobject.file_path
开发者ID:godiard,项目名称:memorize-activity,代码行数:70,代码来源:createcardpanel.py


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