本文整理汇总了Python中sugar3.graphics.toolbutton.ToolButton.set_expanded方法的典型用法代码示例。如果您正苦于以下问题:Python ToolButton.set_expanded方法的具体用法?Python ToolButton.set_expanded怎么用?Python ToolButton.set_expanded使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sugar3.graphics.toolbutton.ToolButton
的用法示例。
在下文中一共展示了ToolButton.set_expanded方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TrainingActivity
# 需要导入模块: from sugar3.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar3.graphics.toolbutton.ToolButton import set_expanded [as 别名]
#.........这里部分代码省略.........
self._task_master.current_task = \
self._task_master.uid_to_task_number(uid)
self._task_master.reload_graphics()
else:
section_index, task_index = \
self._task_master.get_section_and_task_index()
self._progress_buttons[section_index].set_active(True)
def _help_cb(self, button):
# title, help_file = self._task_master.get_help_info()
# _logger.debug('%s: %s' % (title, help_file))
# if not hasattr(self, 'window_xid'):
# self.window_xid = self.get_window().get_xid()
# if title is not None and help_file is not None:
# self.viewhelp = ViewHelp(title, help_file, self.window_xid)
# self.viewhelp.show()
try:
self._help_panel.set_connected(
utils.nm_status() == 'network-wireless-connected')
except Exception as e:
_logger.error('Could not read NM status: %s' % (e))
self._help_panel.set_connected(False)
if self.help_palette:
# FIXME: is_up() is always returning False, so we
# "debounce" using help_panel_visible.
if not self.help_palette.is_up() and not self.help_panel_visible:
self.help_palette.popup(
immediate=True, state=self.help_palette.SECONDARY)
self.help_panel_visible = True
else:
self.help_palette.popdown(immediate=True)
self.help_panel_visible = False
self._help_button.set_expanded(False)
def add_badge(self, msg, icon="training-trophy", name="One Academy"):
sugar_icons = os.path.join(os.path.expanduser('~'), '.icons')
if not os.path.exists(sugar_icons):
try:
subprocess.call(['mkdir', sugar_icons])
except OSError as e:
_logger.error('Could not mkdir %s, %s' % (sugar_icons, e))
badge = {
'icon': icon,
'from': name,
'message': msg
}
# Use icons from html-content directory since default colors are
# intended for white background.
icon_dir = os.path.join(self.bundle_path, 'html-content', 'images')
icon_path = os.path.join(icon_dir, icon + '.svg')
try:
subprocess.call(['cp', icon_path, sugar_icons])
except OSError as e:
_logger.error('Could not copy %s to %s, %s' %
(icon_path, sugar_icons, e))
if 'comments' in self.metadata:
comments = json.loads(self.metadata['comments'])
comments.append(badge)
self.metadata['comments'] = json.dumps(comments)
else:
self.metadata['comments'] = json.dumps([badge])