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


Python RadioToolButton.show方法代码示例

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


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

示例1: _build_palette

# 需要导入模块: from sugar3.graphics.radiotoolbutton import RadioToolButton [as 别名]
# 或者: from sugar3.graphics.radiotoolbutton.RadioToolButton import show [as 别名]
 def _build_palette(self, tool):
     if tool.palette_enabled:
         if tool.palette_mode == tools.PALETTE_MODE_ICONS:
             grid = Gtk.Grid()
             for s, settings in enumerate(tool.palette_settings):
                 self.game.toolList[tool.name].buttons.append([])
                 for i, icon_value in enumerate(settings['icon_values']):
                     if i == 0:
                         button = RadioToolButton(group=None)
                         firstbutton = button
                     else:
                         button = RadioToolButton(group=firstbutton)
                     button.set_icon_name(settings['icons'][i])
                     button.connect('clicked',
                                    self._palette_icon_clicked,
                                    tool.name,
                                    s,
                                    settings['name'],
                                    icon_value)
                     grid.attach(button, i, s, 1, 1)
                     self.game.toolList[tool.name].buttons[s].append(button)
                     button.show()
                     if settings['active'] == settings['icons'][i]:
                         button.set_icon_name(settings['icons'][i] +
                                              '-selected')
                         button.set_active(True)
             return grid
     else:
         return None
开发者ID:godiard,项目名称:physics,代码行数:31,代码来源:activity.py

示例2: __init__

# 需要导入模块: from sugar3.graphics.radiotoolbutton import RadioToolButton [as 别名]
# 或者: from sugar3.graphics.radiotoolbutton.RadioToolButton import show [as 别名]
    def __init__(self, activity_name, has_local_help):
        Gtk.Toolbar.__init__(self)

        self._add_separator(False)

        if has_local_help and get_social_help_server():
            help_button = RadioToolButton()
            icon = Icon(icon_name='toolbar-help',
                        pixel_size=style.STANDARD_ICON_SIZE,
                        fill_color=style.COLOR_TRANSPARENT.get_svg(),
                        stroke_color=style.COLOR_WHITE.get_svg())
            help_button.set_icon_widget(icon)
            icon.show()
            help_button.props.tooltip = _('Help Manual')
            help_button.connect('toggled', self.__button_toggled_cb,
                                _MODE_HELP)
            self.insert(help_button, -1)
            help_button.show()
            self._add_separator(False)

            social_help_button = RadioToolButton()
            icon = Icon(icon_name='toolbar-social-help',
                        pixel_size=style.STANDARD_ICON_SIZE,
                        fill_color=style.COLOR_TRANSPARENT.get_svg(),
                        stroke_color=style.COLOR_WHITE.get_svg())
            social_help_button.set_icon_widget(icon)
            icon.show()
            social_help_button.props.tooltip = _('Social Help')
            social_help_button.props.group = help_button
            social_help_button.connect(
                'toggled', self.__button_toggled_cb, _MODE_SOCIAL_HELP)
            self.insert(social_help_button, -1)
            social_help_button.show()
            self._add_separator(False)

        self._back_button = ToolButton(icon_name='go-previous-paired')
        self._back_button.props.tooltip = _('Back')
        self._back_button.connect('clicked', self.__back_clicked_cb)
        self.insert(self._back_button, -1)
        self._back_button.show()
        self._forward_button = ToolButton(icon_name='go-next-paired')
        self._forward_button.props.tooltip = _('Forward')
        self._forward_button.connect('clicked', self.__forward_clicked_cb)
        self.insert(self._forward_button, -1)
        self._forward_button.show()

        title = _('Help: %s') % activity_name
        self._label = Gtk.Label()
        self._label.set_markup('<b>%s</b>' % title)
        self._label.set_alignment(0, 0.5)
        self._add_widget(self._label)

        self._add_separator(True)

        stop = ToolButton(icon_name='dialog-cancel')
        stop.set_tooltip(_('Close'))
        stop.connect('clicked', self.__stop_clicked_cb)
        self.insert(stop, -1)
        stop.show()
开发者ID:PoetticJustice,项目名称:sugar,代码行数:61,代码来源:viewhelp.py

示例3: radio_factory

# 需要导入模块: from sugar3.graphics.radiotoolbutton import RadioToolButton [as 别名]
# 或者: from sugar3.graphics.radiotoolbutton.RadioToolButton import show [as 别名]
def radio_factory(icon_name, toolbar, callback, cb_arg=None,
                          tooltip=None, group=None):
    ''' Add a radio button to a toolbar '''
    button = RadioToolButton(group=group)
    button.set_icon_name(icon_name)
    if tooltip is not None:
        button.set_tooltip(tooltip)
    if cb_arg is None:
        button.connect('clicked', callback)
    else:
        button.connect('clicked', callback, cb_arg)
    if hasattr(toolbar, 'insert'):  # the main toolbar
        toolbar.insert(button, -1)
    else:  # or a secondary toolbar
        toolbar.props.page.insert(button, -1)
    button.show()
    return button
开发者ID:erilyth,项目名称:abacus,代码行数:19,代码来源:toolbar_utils.py

示例4: radio_factory

# 需要导入模块: from sugar3.graphics.radiotoolbutton import RadioToolButton [as 别名]
# 或者: from sugar3.graphics.radiotoolbutton.RadioToolButton import show [as 别名]
def radio_factory(button_name, toolbar, callback, cb_arg=None, tooltip=None, group=None):
    """ Add a radio button to a toolbar """
    button = RadioToolButton(group=group)
    button.set_icon_name(button_name)
    if callback is not None:
        if cb_arg is None:
            button.connect("clicked", callback)
        else:
            button.connect("clicked", callback, cb_arg)
    if hasattr(toolbar, "insert"):  # Add button to the main toolbar...
        toolbar.insert(button, -1)
    else:  # ...or a secondary toolbar.
        toolbar.props.page.insert(button, -1)
    button.show()
    if tooltip is not None:
        button.set_tooltip(tooltip)
    return button
开发者ID:Daksh,项目名称:portfolio,代码行数:19,代码来源:toolbar_utils.py

示例5: _add_button

# 需要导入模块: from sugar3.graphics.radiotoolbutton import RadioToolButton [as 别名]
# 或者: from sugar3.graphics.radiotoolbutton.RadioToolButton import show [as 别名]
    def _add_button(self, icon_name, label, accelerator, zoom_level):
        if self.get_children():
            group = self.get_children()[0]
        else:
            group = None

        button = RadioToolButton(icon_name=icon_name, group=group,
                                 accelerator=accelerator)
        button.connect('clicked', self.__level_clicked_cb, zoom_level)
        self.add(button)
        button.show()

        palette = Palette(glib.markup_escape_text(label))
        palette.props.invoker = FrameWidgetInvoker(button)
        palette.set_group_id('frame')
        button.set_palette(palette)

        return button
开发者ID:ceibal-tatu,项目名称:sugar,代码行数:20,代码来源:zoomtoolbar.py

示例6: _insert_create_tools

# 需要导入模块: from sugar3.graphics.radiotoolbutton import RadioToolButton [as 别名]
# 或者: from sugar3.graphics.radiotoolbutton.RadioToolButton import show [as 别名]
 def _insert_create_tools(self, create_toolbar):
     # Make + add the component buttons
     self.radioList = {}
     for i, c in enumerate(tools.allTools):
         if i == 0:
             button = RadioToolButton(group=None)
             firstbutton = button
         else:
             button = RadioToolButton(group=firstbutton)
         button.set_icon_name(c.icon)
         button.set_tooltip(c.toolTip)
         button.set_accelerator(c.toolAccelerator)
         button.connect("clicked", self.radioClicked)
         palette = self._build_palette(c)
         if palette is not None:
             palette.show()
             button.get_palette().set_content(palette)
         self._insert_item(create_toolbar, button, -1)
         button.show()
         self.radioList[button] = c.name
         if hasattr(c, "constructor"):
             self._constructors[c.name] = self.game.toolList[c.name].constructor
开发者ID:sugarlabs,项目名称:physics,代码行数:24,代码来源:activity.py

示例7: _load_standard_buttons

# 需要导入模块: from sugar3.graphics.radiotoolbutton import RadioToolButton [as 别名]
# 或者: from sugar3.graphics.radiotoolbutton.RadioToolButton import show [as 别名]
    def _load_standard_buttons(self, toolbar):
        fraction_button = RadioToolButton(group=None)
        fraction_button.set_icon_name('fraction')
        fraction_button.set_tooltip(_('fractions'))
        fraction_button.connect('clicked', self._fraction_cb)
        toolbar.insert(fraction_button, -1)
        fraction_button.show()

        sector_button = RadioToolButton(group=fraction_button)
        sector_button.set_icon_name('sector')
        sector_button.set_tooltip(_('sectors'))
        sector_button.connect('clicked', self._sector_cb)
        toolbar.insert(sector_button, -1)
        sector_button.show()

        percent_button = RadioToolButton(group=fraction_button)
        percent_button.set_icon_name('percent')
        percent_button.set_tooltip(_('percents'))
        percent_button.connect('clicked', self._percent_cb)
        toolbar.insert(percent_button, -1)
        percent_button.show()

        self._player = Gtk.Image()
        self._player.set_from_pixbuf(svg_str_to_pixbuf(
            generate_xo_svg(scale=0.8, colors=['#282828', '#282828'])))
        self._player.set_tooltip_text(self.nick)
        toolitem = Gtk.ToolItem()
        toolitem.add(self._player)
        self._player.show()
        toolbar.insert(toolitem, -1)
        toolitem.show()

        self._label = Gtk.Label(_("Click the ball to start."))
        self._label.set_line_wrap(True)
        if Gdk.Screen.width() < 1024:
            self._label.set_size_request(275, -1)
        else:
            self._label.set_size_request(500, -1)
        self.toolitem = Gtk.ToolItem()
        self.toolitem.add(self._label)
        self._label.show()
        toolbar.insert(self.toolitem, -1)
        self.toolitem.show()
开发者ID:leonardcj,项目名称:fractionbounce,代码行数:45,代码来源:FractionBounceActivity.py

示例8: _insert_stop_play_button

# 需要导入模块: from sugar3.graphics.radiotoolbutton import RadioToolButton [as 别名]
# 或者: from sugar3.graphics.radiotoolbutton.RadioToolButton import show [as 别名]
    def _insert_stop_play_button(self, toolbar):

        self.stop_play_toolbar = ToolbarButton()
        st_toolbar = self.stop_play_toolbar
        st_toolbar.props.page = Gtk.Toolbar()
        st_toolbar.props.icon_name = 'media-playback-stop'

        self.stop_play_state = True
        self.stop_play = ToolButton('media-playback-stop')
        self.stop_play.set_tooltip(_('Stop'))
        self.stop_play.set_accelerator(_('<ctrl>space'))
        self.stop_play.connect('clicked', self.stop_play_cb)
        self._insert_item(st_toolbar, self.stop_play)
        self.stop_play.show()

        slowest_button = RadioToolButton(group=None)
        slowest_button.set_icon_name('slow-walk-milton-raposo')
        slowest_button.set_tooltip(_('Run slower'))
        slowest_button.connect('clicked', self._set_fps_cb, SLOWEST_FPS)
        self._insert_item(st_toolbar, slowest_button)
        slowest_button.show()

        slow_button = RadioToolButton(group=slowest_button)
        slow_button.set_icon_name('walking')
        slow_button.set_tooltip(_('Run slow'))
        slow_button.connect('clicked', self._set_fps_cb, SLOW_FPS)
        self._insert_item(st_toolbar, slow_button)
        slow_button.show()

        fast_button = RadioToolButton(group=slowest_button)
        fast_button.set_icon_name('running')
        fast_button.set_tooltip('Run fast')
        fast_button.connect('clicked', self._set_fps_cb, FAST_FPS)
        self._insert_item(st_toolbar, fast_button)
        fast_button.show()
        fast_button.set_active(True)

        toolbar.insert(self.stop_play_toolbar, -1)
        self.stop_play_toolbar.show_all()
开发者ID:godiard,项目名称:physics,代码行数:41,代码来源:activity.py

示例9: __init__

# 需要导入模块: from sugar3.graphics.radiotoolbutton import RadioToolButton [as 别名]
# 或者: from sugar3.graphics.radiotoolbutton.RadioToolButton import show [as 别名]
    def __init__(self, title, bundle_path, document_path, sugar_toolkit_path):
        Gtk.Toolbar.__init__(self)

        document_button = None
        self.bundle_path = bundle_path
        self.sugar_toolkit_path = sugar_toolkit_path

        self._add_separator()

        activity_bundle = ActivityBundle(bundle_path)
        file_name = activity_bundle.get_icon()

        if document_path is not None and os.path.exists(document_path):
            document_button = DocumentButton(file_name, document_path, title)
            document_button.connect('toggled', self.__button_toggled_cb,
                                    document_path)
            self.insert(document_button, -1)
            document_button.show()
            self._add_separator()

        if bundle_path is not None and os.path.exists(bundle_path):
            activity_button = DocumentButton(file_name, bundle_path, title,
                                             bundle=True)
            icon = Icon(file=file_name,
                        icon_size=Gtk.IconSize.LARGE_TOOLBAR,
                        fill_color=style.COLOR_TRANSPARENT.get_svg(),
                        stroke_color=style.COLOR_WHITE.get_svg())
            activity_button.set_icon_widget(icon)
            icon.show()
            if document_button is not None:
                activity_button.props.group = document_button
            activity_button.props.tooltip = _('Activity Bundle Source')
            activity_button.connect('toggled', self.__button_toggled_cb,
                                    bundle_path)
            self.insert(activity_button, -1)
            activity_button.show()
            self._add_separator()

        if sugar_toolkit_path is not None:
            sugar_button = RadioToolButton()
            icon = Icon(icon_name='computer-xo',
                        icon_size=Gtk.IconSize.LARGE_TOOLBAR,
                        fill_color=style.COLOR_TRANSPARENT.get_svg(),
                        stroke_color=style.COLOR_WHITE.get_svg())
            sugar_button.set_icon_widget(icon)
            icon.show()
            if document_button is not None:
                sugar_button.props.group = document_button
            else:
                sugar_button.props.group = activity_button
            sugar_button.props.tooltip = _('Sugar Toolkit Source')
            sugar_button.connect('toggled', self.__button_toggled_cb,
                                 sugar_toolkit_path)
            self.insert(sugar_button, -1)
            sugar_button.show()
            self._add_separator()

        self.activity_title_text = _('View source: %s') % title
        self.sugar_toolkit_title_text = _('View source: %r') % 'Sugar Toolkit'
        self.label = Gtk.Label()
        self.label.set_markup('<b>%s</b>' % self.activity_title_text)
        self.label.set_alignment(0, 0.5)
        self._add_widget(self.label)

        self._add_separator(True)

        stop = ToolButton(icon_name='dialog-cancel')
        stop.set_tooltip(_('Close'))
        stop.connect('clicked', self.__stop_clicked_cb)
        self.insert(stop, -1)
        stop.show()
开发者ID:axitkhurana,项目名称:sugar,代码行数:73,代码来源:viewsource.py

示例10: ViewToolbar

# 需要导入模块: from sugar3.graphics.radiotoolbutton import RadioToolButton [as 别名]
# 或者: from sugar3.graphics.radiotoolbutton.RadioToolButton import show [as 别名]
class ViewToolbar(Gtk.Toolbar):
    __gtype_name__ = 'SugarViewToolbar'

    __gsignals__ = {
        'query-changed': (GObject.SignalFlags.RUN_FIRST, None,
                          ([str])),
        'view-changed': (GObject.SignalFlags.RUN_FIRST, None,
                         ([object])),
    }

    def __init__(self):
        Gtk.Toolbar.__init__(self)

        self._query = None
        self._autosearch_timer = None

        self._add_separator()

        tool_item = Gtk.ToolItem()
        self.insert(tool_item, -1)
        tool_item.show()

        self.search_entry = iconentry.IconEntry()
        self.search_entry.set_icon_from_name(iconentry.ICON_ENTRY_PRIMARY,
                                             'entry-search')
        self.set_placeholder_text_for_view(_('Home'))
        self.search_entry.add_clear_button()
        self.search_entry.set_width_chars(25)
        self.search_entry.connect('activate', self._entry_activated_cb)
        self.search_entry.connect('changed', self._entry_changed_cb)
        tool_item.add(self.search_entry)
        self.search_entry.show()

        self._add_separator(expand=True)

        self._favorites_button = FavoritesButton()
        self._favorites_button.connect('toggled',
                                       self.__view_button_toggled_cb,
                                       _FAVORITES_VIEW)
        self.insert(self._favorites_button, -1)

        self._list_button = RadioToolButton(icon_name='view-list')
        self._list_button.props.group = self._favorites_button
        self._list_button.props.tooltip = _('List view')
        self._list_button.props.accelerator = _('<Ctrl>2')
        self._list_button.connect('toggled', self.__view_button_toggled_cb,
                                      _LIST_VIEW)
        self.insert(self._list_button, -1)

        self._add_separator()

    def show_view_buttons(self):
        self._favorites_button.show()
        self._list_button.show()

    def hide_view_buttons(self):
        self._favorites_button.hide()
        self._list_button.hide()

    def clear_query(self):
        self.search_entry.props.text = ''

    def set_placeholder_text_for_view(self, view_name):
        text = _('Search in %s') % view_name
        self.search_entry.set_placeholder_text(text)

    def _add_separator(self, expand=False):
        separator = Gtk.SeparatorToolItem()
        separator.props.draw = False
        if expand:
            separator.set_expand(True)
        else:
            separator.set_size_request(style.GRID_CELL_SIZE,
                                       style.GRID_CELL_SIZE)
        self.insert(separator, -1)
        separator.show()

    def _entry_activated_cb(self, entry):
        if self._autosearch_timer:
            GObject.source_remove(self._autosearch_timer)
        new_query = entry.props.text
        if self._query != new_query:
            self._query = new_query
            self.emit('query-changed', self._query)

    def _entry_changed_cb(self, entry):
        if not entry.props.text:
            entry.activate()
            return

        if self._autosearch_timer:
            GObject.source_remove(self._autosearch_timer)
        self._autosearch_timer = GObject.timeout_add(_AUTOSEARCH_TIMEOUT,
                                                     self._autosearch_timer_cb)

    def _autosearch_timer_cb(self):
        logging.debug('_autosearch_timer_cb')
        self._autosearch_timer = None
        self.search_entry.activate()
        return False
#.........这里部分代码省略.........
开发者ID:ajaygarg84,项目名称:sugar,代码行数:103,代码来源:viewtoolbar.py

示例11: ToolbarBox

# 需要导入模块: from sugar3.graphics.radiotoolbutton import RadioToolButton [as 别名]
# 或者: from sugar3.graphics.radiotoolbutton.RadioToolButton import show [as 别名]

test = common.Test()
test.show()

vbox = Gtk.VBox()
test.pack_start(vbox, True, True, 0)
vbox.show()

toolbar_box = ToolbarBox()
vbox.pack_start(toolbar_box, False, False, 0)
toolbar_box.show()

radial_button = RadioToolButton(icon_name='view-radial')
toolbar_box.toolbar.insert(radial_button, -1)
radial_button.show()

list_button = RadioToolButton(icon_name='view-list')
list_button.props.group = radial_button
toolbar_box.toolbar.insert(list_button, -1)
list_button.show()

separator = Gtk.SeparatorToolItem()
toolbar_box.toolbar.insert(separator, -1)
separator.show()

color_button = ColorToolButton()
toolbar_box.toolbar.insert(color_button, -1)
color_button.show()

favorite_button = ToggleToolButton('emblem-favorite')
开发者ID:ceibal-tatu,项目名称:sugar-toolkit-gtk3,代码行数:32,代码来源:toolbuttons.py

示例12: ViewToolbar

# 需要导入模块: from sugar3.graphics.radiotoolbutton import RadioToolButton [as 别名]
# 或者: from sugar3.graphics.radiotoolbutton.RadioToolButton import show [as 别名]
class ViewToolbar(Gtk.Toolbar):
    __gtype_name__ = 'SugarViewToolbar'

    __gsignals__ = {
        'query-changed': (GObject.SignalFlags.RUN_FIRST, None,
                          ([str])),
        'view-changed': (GObject.SignalFlags.RUN_FIRST, None,
                         ([object])),
    }

    def __init__(self):
        Gtk.Toolbar.__init__(self)

        self._favorites_views_indicies = []
        for i in range(desktop.get_number_of_views()):
            self._favorites_views_indicies.append(i)
        self._list_view_index = self._favorites_views_indicies[-1] + 1

        self._desktop_model = desktop.get_model()
        self._desktop_model.connect('desktop-view-icons-changed',
                                    self.__desktop_view_icons_changed_cb)

        self._query = None
        self._autosearch_timer = None

        self._add_separator()

        tool_item = Gtk.ToolItem()
        self.insert(tool_item, -1)
        tool_item.show()

        self.search_entry = iconentry.IconEntry()
        self.search_entry.set_icon_from_name(iconentry.ICON_ENTRY_PRIMARY,
                                             'entry-search')
        self.set_placeholder_text_for_view(_('Home'))
        self.search_entry.add_clear_button()
        self.search_entry.set_width_chars(25)
        self.search_entry.connect('activate', self._entry_activated_cb)
        self.search_entry.connect('changed', self._entry_changed_cb)
        tool_item.add(self.search_entry)
        self.search_entry.show()

        self._add_separator(expand=True)

        self._button_box = Gtk.HBox()
        self._favorites_buttons = []
        for i in range(desktop.get_number_of_views()):
            self._add_favorites_button(i)
        toolitem = Gtk.ToolItem()
        toolitem.add(self._button_box)
        self.insert(toolitem, -1)
        self._button_box.show()
        toolitem.show()

        self._list_button = RadioToolButton(icon_name='view-list')
        self._list_button.props.group = self._favorites_buttons[0]
        self._list_button.props.tooltip = _('List view')
        self._list_button.props.accelerator = \
            _('<Ctrl>%d' % (len(self._favorites_views_indicies) + 1))
        self._list_view_toggle_id = self._list_button.connect(
            'toggled', self.__view_button_toggled_cb, self._list_view_index)
        self.insert(self._list_button, -1)

        self._add_separator()

    def _add_favorites_button(self, i):
        logging.debug('adding FavoritesButton %d' % (i))
        self._favorites_buttons.append(FavoritesButton(i))
        self._favorites_buttons[i].connect('toggled',
                                           self.__view_button_toggled_cb,
                                           self._favorites_views_indicies[i])
        if i > 0:
            self._favorites_buttons[i].props.group = self._favorites_buttons[0]
        self._button_box.add(self._favorites_buttons[i])
        self._favorites_buttons[i].show()

    def show_view_buttons(self):
        for i in range(desktop.get_number_of_views()):
            self._favorites_buttons[i].show()
        self._list_button.show()

    def hide_view_buttons(self):
        for i in range(desktop.get_number_of_views()):
            self._favorites_buttons[i].hide()
        self._list_button.hide()

    def clear_query(self):
        self.search_entry.props.text = ''

    def set_placeholder_text_for_view(self, view_name):
        text = _('Search in %s') % view_name
        self.search_entry.set_placeholder_text(text)

    def _add_separator(self, expand=False):
        separator = Gtk.SeparatorToolItem()
        separator.props.draw = False
        if expand:
            separator.set_expand(True)
        else:
            separator.set_size_request(style.GRID_CELL_SIZE,
#.........这里部分代码省略.........
开发者ID:Akirato,项目名称:sugar,代码行数:103,代码来源:viewtoolbar.py

示例13: HelpPanel

# 需要导入模块: from sugar3.graphics.radiotoolbutton import RadioToolButton [as 别名]
# 或者: from sugar3.graphics.radiotoolbutton.RadioToolButton import show [as 别名]
class HelpPanel(Gtk.Grid):

    def __init__(self, task_master):
        Gtk.Grid.__init__(self)
        self.set_row_spacing(style.DEFAULT_SPACING)
        self.set_column_spacing(style.DEFAULT_SPACING)
        self.set_column_homogeneous(True)
        self.set_border_width(style.DEFAULT_SPACING)

        self._task_master = task_master
        self._connected = False
        self._mode = _FEEDBACK_TICKET

        alignment = Gtk.Alignment.new(0., 0.5, 0., 0.)
        phone_label = Gtk.Label()
        phone_label.set_use_markup(True)
        phone_label.set_justify(Gtk.Justification.LEFT)
        phone_label.set_markup(
            '<span foreground="%s" size="large">%s</span>' %
            (style.COLOR_WHITE.get_html(), _('Call: 1-800 ONE EDU\n'
                                             'Email: [email protected]')))
        alignment.add(phone_label)
        phone_label.show()
        self.attach(alignment, 0, 0, 4, 1)
        alignment.show()

        alignment = Gtk.Alignment.new(0., 0.5, 0., 0.)
        self._info_label = Gtk.Label()
        self._info_label.set_use_markup(True)
        self._info_label.set_justify(Gtk.Justification.LEFT)
        self._info_label.set_markup(
            '<span foreground="%s" size="large">%s</span>' %
            (style.COLOR_WHITE.get_html(), _('Or use the form below:')))
        alignment.add(self._info_label)
        self._info_label.show()
        self.attach(alignment, 0, 4, 4, 1)
        alignment.show()

        self._email_entry = Gtk.Entry()
        email_address = self._task_master.read_task_data(EMAIL_UID)
        if email_address is not None:
            self._email_entry.set_text(email_address)
        else:
            self._email_entry.set_text(_EMAIL_TEXT)
        self.attach(self._email_entry, 0, 5, 4, 1)
        self._email_entry.show()
        self._email_entry.connect('changed', self._email_changed_cb)
        self._email_entry.set_can_focus(True)

        grid = Gtk.Grid()
        self._feedback_button = RadioToolButton(group=None)
        self._feedback_button.set_icon_name('edit-description')
        self._feedback_button.connect('clicked', self._feedback_button_cb)
        grid.attach(self._feedback_button, 0, 0, 1, 1)
        self._feedback_button.show()

        label = Gtk.Label()
        label.set_use_markup(True)
        label.set_justify(Gtk.Justification.LEFT)
        label.set_markup('<span foreground="%s" size="large">%s</span>' %
                         (style.COLOR_WHITE.get_html(), _('Send feedback')))
        grid.attach(label, 1, 0, 1, 1)
        label.show()

        alignment = Gtk.Alignment.new(0., 0.5, 0., 0.)
        alignment.add(grid)
        grid.show()
        self.attach(alignment, 0, 6, 2, 1)
        alignment.show()

        grid = Gtk.Grid()
        self._help_button = RadioToolButton(group=self._feedback_button)
        self._help_button.set_icon_name('toolbar-help-gray')
        self._help_button.connect('clicked', self._help_button_cb)
        grid.attach(self._help_button, 0, 0, 1, 1)
        self._help_button.show()

        label = Gtk.Label()
        label.set_use_markup(True)
        label.set_justify(Gtk.Justification.LEFT)
        label.set_markup('<span foreground="%s" size="large">%s</span>' %
                         (style.COLOR_WHITE.get_html(), _('Ask for help')))
        grid.attach(label, 1, 0, 1, 1)
        label.show()

        alignment = Gtk.Alignment.new(0., 0.5, 0., 0.)
        alignment.add(grid)
        grid.show()
        self.attach(alignment, 2, 6, 2, 1)
        alignment.show()

        self._feedback_button.set_active(True)

        self._text_view = Gtk.TextView()
        self._text_view.set_wrap_mode(Gtk.WrapMode.WORD)
        self._text_view.set_size_request(-1, style.GRID_CELL_SIZE * 2)
        self._text_buffer = self._text_view.get_buffer()
        self._text_buffer.set_text(_ACTIVE_TEXT)
        self.attach(self._text_view, 0, 7, 4, 4)
        self._text_view.show()
#.........这里部分代码省略.........
开发者ID:walterbender,项目名称:training,代码行数:103,代码来源:helppanel.py

示例14: ReflectActivity

# 需要导入模块: from sugar3.graphics.radiotoolbutton import RadioToolButton [as 别名]
# 或者: from sugar3.graphics.radiotoolbutton.RadioToolButton import show [as 别名]

#.........这里部分代码省略.........
                                        dsobj.object_id + '.png')
                    utils.save_pixbuf_to_file(pixbuf, path)
                    self.reflection_data[-1]['content'].append(
                        {'image': path})
            self.reflection_data[-1]['stars'] = 0

    def delete_item(self, obj_id):
        for i, obj in enumerate(self.reflection_data):
            if obj['obj_id'] == obj_id:
                self.reflection_data.remove(self.reflection_data[i])
                return

    def busy_cursor(self):
        self.get_window().set_cursor(Gdk.Cursor.new(Gdk.CursorType.WATCH))

    def reset_cursor(self):
        self.get_window().set_cursor(Gdk.Cursor.new(Gdk.CursorType.LEFT_PTR))

    def _open_reflect_windows(self):
        # Most things need only be done once
        if self._fixed is None:
            self._fixed = Gtk.Fixed()
            self._fixed.set_size_request(Gdk.Screen.width(),
                                         Gdk.Screen.height())

            # Offsets from the bottom of the screen
            dy1 = 2 * style.GRID_CELL_SIZE
            dy2 = 1 * style.GRID_CELL_SIZE

            self._button_area = Gtk.Alignment.new(0.5, 0, 0, 0)
            self._button_area.set_size_request(Gdk.Screen.width(),
                                               style.GRID_CELL_SIZE)
            self._fixed.put(self._button_area, 0, 0)
            self._button_area.show()

            self._scrolled_window = Gtk.ScrolledWindow()
            self._scrolled_window.set_size_request(
                Gdk.Screen.width(), Gdk.Screen.height() - dy1)
            self._set_scroll_policy()
            self._graphics_area = Gtk.Alignment.new(0.5, 0, 0, 0)
            self._scrolled_window.add_with_viewport(self._graphics_area)
            self._graphics_area.show()
            self._fixed.put(self._scrolled_window, 0, dy2)
            self._scrolled_window.show()

            self._overlay_window = Gtk.ScrolledWindow()
            self._overlay_window.set_size_request(
                style.GRID_CELL_SIZE * 10,
                style.GRID_CELL_SIZE * 6)
            self._overlay_window.modify_bg(
                Gtk.StateType.NORMAL, style.COLOR_WHITE.get_gdk_color())
            self._overlay_window.set_policy(
                 Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
            self._overlay_area = Gtk.Alignment.new(0.5, 0, 0, 0)
            self._overlay_window.add_with_viewport(self._overlay_area)
            self._overlay_area.show()
            x = int((Gdk.Screen.width() - style.GRID_CELL_SIZE * 10) / 2)
            self._fixed.put(self._overlay_window, 0, Gdk.Screen.height())
            self._overlay_window.show()
            self._old_overlay_widget = None

            self._reflect_window = ReflectWindow(self)
            self._reflect_window.show()

            Gdk.Screen.get_default().connect('size-changed',
                                             self._configure_cb)
开发者ID:AbrahmAB,项目名称:reflect,代码行数:70,代码来源:activity.py

示例15: __init__

# 需要导入模块: from sugar3.graphics.radiotoolbutton import RadioToolButton [as 别名]
# 或者: from sugar3.graphics.radiotoolbutton.RadioToolButton import show [as 别名]
    def __init__(self, model, alerts=None):
        SectionView.__init__(self)

        self._model = model
        self._images_loaded = False
        self._append_to_store_sid = None

        self.connect('realize', self.__realize_cb)
        self.connect('unrealize', self.__unrealize_cb)

        self.set_border_width(style.DEFAULT_SPACING * 2)
        self.set_spacing(style.DEFAULT_SPACING)

        label_box = Gtk.Box()
        label_bg = Gtk.Label(label=_('Select a background:'))
        label_bg.modify_fg(Gtk.StateType.NORMAL,
                           style.COLOR_SELECTION_GREY.get_gdk_color())
        label_bg.show()
        label_box.pack_start(label_bg, False, True, 0)
        label_box.show()
        self.pack_start(label_box, False, True, 1)

        clear_button = Gtk.Button()
        clear_button.set_label(_('Clear background'))
        clear_button.connect('clicked', self._clear_clicked_cb)
        clear_button.show()
        self.pack_end(clear_button, False, True, 0)

        scrolled_window = Gtk.ScrolledWindow()
        scrolled_window.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
        scrolled_window.set_policy(Gtk.PolicyType.AUTOMATIC,
                                   Gtk.PolicyType.AUTOMATIC)
        self.pack_start(scrolled_window, True, True, 0)
        scrolled_window.show()

        self._store = Gtk.ListStore(GdkPixbuf.Pixbuf, str)

        self._icon_view = Gtk.IconView.new_with_model(self._store)
        self._icon_view.set_selection_mode(Gtk.SelectionMode.SINGLE)
        self._icon_view.connect('selection-changed', self._background_selected)
        self._icon_view.set_pixbuf_column(0)
        self._icon_view.grab_focus()
        scrolled_window.add(self._icon_view)
        self._icon_view.show()

        alpha = self._model.get_background_alpha_level()

        alpha_box = Gtk.HBox()
        alpha_buttons = []
        alpha_icons = [
            [1.0, 'network-wireless-000'],
            [0.8, 'network-wireless-020'],
            [0.6, 'network-wireless-040'],
            [0.4, 'network-wireless-060'],
            [0.2, 'network-wireless-080']]
        for value, icon_name in alpha_icons:
            if len(alpha_buttons) > 0:
                button = RadioToolButton(group=alpha_buttons[0])
            else:
                button = RadioToolButton(group=None)
            button.set_icon_name(icon_name)
            button.value = value
            button.props.active = value == alpha
            button.show()
            alpha_box.pack_start(button, False, True, 0)
            alpha_buttons.append(button)

        for button in alpha_buttons:
            button.connect('toggled', self._set_alpha_cb)

        alpha_alignment = Gtk.Alignment()
        alpha_alignment.set(0.5, 0, 0, 0)
        alpha_alignment.add(alpha_box)
        alpha_box.show()
        self.pack_start(alpha_alignment, False, False, 0)
        alpha_alignment.show()

        self._paths_list = []

        file_paths = []
        for directory in self._model.BACKGROUNDS_DIRS:
            if directory is not None and os.path.exists(directory):
                for root, dirs, files in os.walk(directory):
                    for file_ in files:
                        file_paths.append(os.path.join(root, file_))

        self._append_to_store(file_paths)
        self.setup()
开发者ID:sugarlabs,项目名称:sugar,代码行数:90,代码来源:view.py


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