本文整理汇总了Python中sugar3.graphics.toggletoolbutton.ToggleToolButton.set_icon_widget方法的典型用法代码示例。如果您正苦于以下问题:Python ToggleToolButton.set_icon_widget方法的具体用法?Python ToggleToolButton.set_icon_widget怎么用?Python ToggleToolButton.set_icon_widget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sugar3.graphics.toggletoolbutton.ToggleToolButton
的用法示例。
在下文中一共展示了ToggleToolButton.set_icon_widget方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SimplePianoActivity
# 需要导入模块: from sugar3.graphics.toggletoolbutton import ToggleToolButton [as 别名]
# 或者: from sugar3.graphics.toggletoolbutton.ToggleToolButton import set_icon_widget [as 别名]
#.........这里部分代码省略.........
pipe.set_state(Gst.State.NULL)
title = '%s saved as audio' % self.metadata['title']
jobject = datastore.create()
jobject.metadata['title'] = title
jobject.metadata['keep'] = '0'
jobject.metadata['mime_type'] = 'audio/ogg'
jobject.file_path = self._ogg_tempfile.name
datastore.write(jobject)
self._wav_tempfile.close()
self._ogg_tempfile.close()
alert = NotifyAlert(10)
alert.props.title = _('Audio recorded')
alert.props.msg = _('The audio file was saved in the Journal')
alert.connect('response', self.__alert_response_cb)
self.add_alert(alert)
return False
def __alert_response_cb(self, alert, result):
self.remove_alert(alert)
def __record_button_click_cb(self, button):
if not self.recording:
self.play_recording_button.set_sensitive(False)
self._save_as_audio_bt.set_sensitive(False)
self.recorded_keys = []
self.recording = True
icon = Icon(icon_name='media-record', fill_color='#ff0000')
icon.show()
self.record_button.set_icon_widget(icon)
else:
self.recording = False
icon = Icon(icon_name='media-record', fill_color='#ffffff')
icon.show()
self.record_button.set_icon_widget(icon)
if len(self.recorded_keys) != 0:
self.play_recording_button.set_sensitive(True)
self._save_as_audio_bt.set_sensitive(True)
def tempoSliderChange(self, widget, event):
self._updateTempo(self.tempo_button.get_value())
img = int(self.scale(self.tempo, PLAYER_TEMPO_LOWER,
PLAYER_TEMPO_UPPER, 1, 9))
self.tempo_button.set_image(imagefile('tempo' + str(img) + '.png'))
def _updateTempo(self, val):
self.tempo = val
self.beatDuration = 60.0 / self.tempo
self.ticksPerSecond = Config.TICKS_PER_BEAT * self.tempo / 60.0
self.csnd.setTempo(self.tempo)
self.sequencer.tempo = self.tempo
self.drumFillin.setTempo(self.tempo)
def handlePlayButton(self, val):
if not self.playing:
if not self.firstTime:
self.regenerate()
self.firstTime = True
self.drumFillin.play()
self.csnd.loopSetTick(0)
self.csnd.loopStart()
self.playing = True