• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python profile.get_color函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中sugar3.profile.get_color函数的典型用法代码示例。如果您正苦于以下问题:Python get_color函数的具体用法?Python get_color怎么用?Python get_color使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: __init__

    def __init__(self, handle):
        """ Initialize the toolbars and the game board """
        super(PathsActivity, self).__init__(handle)

        self.nick = profile.get_nick_name()
        if profile.get_color() is not None:
            self.colors = profile.get_color().to_string().split(',')
        else:
            self.colors = ['#A0FFA0', '#FF8080']

        self._setup_toolbars()
        self._setup_dispatch_table()

        # Create a canvas
        canvas = Gtk.DrawingArea()
        canvas.set_size_request(Gdk.Screen.width(), Gdk.Screen.height())
        self.set_canvas(canvas)
        canvas.show()
        self.show_all()

        self._game = Game(canvas, parent=self, colors=self.colors)
        self._setup_presence_service()

        # Restore game state from Journal or start new game
        if 'deck' in self.metadata:
            self._restore()
        else:
            self._game.new_game()
开发者ID:leonardcj,项目名称:paths,代码行数:28,代码来源:PathsActivity.py


示例2: __init__

    def __init__(self, handle):
        """ Initialize the toolbars and the game board """
        try:
            super(FlipActivity, self).__init__(handle)
        except dbus.exceptions.DBusException as e:
            _logger.error(str(e))

        self.nick = profile.get_nick_name()
        if profile.get_color() is not None:
            self.colors = profile.get_color().to_string().split(',')
        else:
            self.colors = ['#A0FFA0', '#FF8080']

        self._setup_toolbars()
        self._setup_dispatch_table()

        # Create a canvas
        canvas = Gtk.DrawingArea()
        canvas.set_size_request(Gdk.Screen.width(),
                                Gdk.Screen.height())
        self.set_canvas(canvas)
        canvas.show()
        self.show_all()

        self._game = Game(canvas, parent=self, colors=self.colors)
        self._setup_presence_service()

        if 'dotlist' in self.metadata:
            self._restore()
        else:
            self._game.new_game()
开发者ID:sugarlabs,项目名称:flip,代码行数:31,代码来源:FlipActivity.py


示例3: __init__

    def __init__(self, handle):
        """ Initialize the toolbars and the game board """
        try:
            super(XOEditorActivity, self).__init__(handle)
        except dbus.exceptions.DBusException as e:
            _logger.error(str(e))

        self.nick = profile.get_nick_name()
        if profile.get_color() is not None:
            self.colors = profile.get_color().to_string().split(',')
        else:
            self.colors = ['#A0FFA0', '#FF8080']

        self.level = 0

        self._setup_toolbars(_have_toolbox)

        # Create a canvas
        canvas = Gtk.DrawingArea()
        canvas.set_size_request(Gdk.Screen.width(),
                                Gdk.Screen.height())
        self.set_canvas(canvas)
        canvas.show()
        self.show_all()

        self._game = Game(canvas, parent=self, mycolors=self.colors)

        # Read the dot positions from the Journal
        for i in range(len(colors)):
            if 'x%d' % (i) in self.metadata and 'y%d' % (i) in self.metadata:
                self._game.move_dot(i, int(self.metadata['x%d' % (i)]),
                                    int(self.metadata['y%d' % (i)]))
        if 'xox' in self.metadata and 'xoy' in self.metadata:
            self._game.move_xo_man(int(self.metadata['xox']),
                                   int(self.metadata['xoy']))
开发者ID:sugarlabs,项目名称:xocolors,代码行数:35,代码来源:XOEditorActivity.py


示例4: __init__

    def __init__(self, handle):
        """ Initialize the toolbars and the game board """
        super(RecallActivity, self).__init__(handle)

        self.path = activity.get_bundle_path()

        self.nick = profile.get_nick_name()
        if profile.get_color() is not None:
            self.colors = profile.get_color().to_string().split(",")
        else:
            self.colors = ["#A0FFA0", "#FF8080"]

        self._restoring = False
        self._setup_toolbars(True)
        self._setup_dispatch_table()

        # Create a canvas
        canvas = Gtk.DrawingArea()
        canvas.set_size_request(Gdk.Screen.width(), Gdk.Screen.height())
        self.set_canvas(canvas)
        canvas.show()
        self.show_all()

        self._game = Game(canvas, parent=self, path=self.path, colors=self.colors)
        self._setup_presence_service()

        if "dotlist" in self.metadata:
            self._restore()
        else:
            self._game.new_game()
开发者ID:cristian99garcia,项目名称:recall,代码行数:30,代码来源:RecallActivity.py


示例5: __init__

    def __init__(self, title, url, owner_document):
        Palette.__init__(self)

        self._title = title
        self._url = url
        self._owner_document = owner_document

        self.props.primary_text = title
        self.props.secondary_text = url

        menu_item = MenuItem(_('Keep image'))
        icon = Icon(icon_name='document-save', xo_color=profile.get_color(),
                    icon_size=Gtk.IconSize.MENU)
        menu_item.set_image(icon)
        menu_item.connect('activate', self.__download_activate_cb)
        self.menu.append(menu_item)
        menu_item.show()

        menu_item = MenuItem(_('Copy image'))
        icon = Icon(icon_name='edit-copy', xo_color=profile.get_color(),
                    icon_size=Gtk.IconSize.MENU)
        menu_item.set_image(icon)
        menu_item.connect('activate', self.__copy_activate_cb)
        self.menu.append(menu_item)
        menu_item.show()
开发者ID:georgejhunt,项目名称:HaitiDictionary.activity,代码行数:25,代码来源:palettes.py


示例6: __init__

    def __init__(self, handle):
        ''' Initiate activity. '''
        super(FractionBounceActivity, self).__init__(handle)

        self.nick = profile.get_nick_name()
        if profile.get_color() is not None:
            self._colors = profile.get_color().to_string().split(',')
        else:
            self._colors = ['#A0FFA0', '#FF8080']

        self.max_participants = 4  # sharing
        self._playing = True

        self._setup_toolbars()
        self._setup_dispatch_table()
        canvas = self._setup_canvas()

        # Read any custom fractions from the project metadata
        if 'custom' in self.metadata:
            custom = self.metadata['custom']
        else:
            custom = None

        self._current_ball = 'soccerball'

        self._toolbar_was_expanded = False

        # Initialize the canvas
        self._bounce_window = Bounce(canvas, activity.get_bundle_path(), self)

        Gdk.Screen.get_default().connect('size-changed', self._configure_cb)

        # Restore any custom fractions
        if custom is not None:
            fractions = custom.split(',')
            for f in fractions:
                self._bounce_window.add_fraction(f)

        if self.shared_activity:
            # We're joining
            if not self.get_shared():
                xocolors = XoColor(profile.get_color().to_string())
                share_icon = Icon(icon_name='zoom-neighborhood',
                                  xo_color=xocolors)
                self._joined_alert = NotifyAlert()
                self._joined_alert.props.icon = share_icon
                self._joined_alert.props.title = _('Please wait')
                self._joined_alert.props.msg = _('Starting connection...')
                self._joined_alert.connect('response', self._alert_cancel_cb)
                self.add_alert(self._joined_alert)

                self._label.set_label(_('Wait for the sharer to start.'))

                # Wait for joined signal
                self.connect("joined", self._joined_cb)

        self._setup_sharing()
开发者ID:leonardcj,项目名称:fractionbounce,代码行数:57,代码来源:FractionBounceActivity.py


示例7: _get_colors

 def _get_colors(self):
     colors = None
     if self._tw.running_sugar:
         if profile.get_color() is not None:
             colors = profile.get_color().to_string()
     else:
         colors = self._activity.get_colors()
     if colors is None:
         colors = '%s,%s' % (DEFAULT_TURTLE_COLORS[0],
                             DEFAULT_TURTLE_COLORS[1])
     return colors.split(',')
开发者ID:sugarlabs,项目名称:activity-turtle-confusion,代码行数:11,代码来源:tacollaboration.py


示例8: __members_changed_cb

    def __members_changed_cb(self, adhoc_manager, channel, has_members):
        if channel == self._channel:
            if has_members is True:
                self._state_color = profile.get_color()
            else:
                color = '%s,%s' % (profile.get_color().get_stroke_color(),
                                   style.COLOR_TRANSPARENT.get_svg())
                self._state_color = XoColor(color)

            if not self._filtered:
                self.props.base_color = self._state_color
                self._palette_icon.props.xo_color = self._state_color
                self.alpha = 1.0
            else:
                self.alpha = _FILTERED_ALPHA
开发者ID:AbrahmAB,项目名称:sugar,代码行数:15,代码来源:networkviews.py


示例9: _update

    def _update(self):
        state = self._device_state

        if (state >= network.NM_DEVICE_STATE_PREPARE) and \
           (state <= network.NM_DEVICE_STATE_IP_CONFIG):
            self._icon.props.base_color = self._inactive_color
            self._icon.props.pulse_color = profile.get_color()
            self._palette.set_connecting()
            self._icon.props.pulsing = True
        elif state == network.NM_DEVICE_STATE_ACTIVATED:
            address = self._device_props.Get(network.NM_DEVICE_IFACE, 'Ip4Address')
            self._palette.set_connected_with_channel(self._channel, address)
            self._icon.props.base_color = profile.get_color()
            self._icon.props.pulsing = False
        self._update_text()
开发者ID:ceibal-tatu,项目名称:sugar,代码行数:15,代码来源:network.py


示例10: __init__

    def __init__(self, cb_object, group):
        RadioToolButton.__init__(self, group=group)

        self.props.palette_invoker = FrameWidgetInvoker(self)
        self.palette_invoker.props.toggle_palette = True

        self._cb_object = cb_object
        self.owns_clipboard = False
        self.props.sensitive = False
        self.props.active = False
        self._notif_icon = None
        self._current_percent = None

        self._icon = Icon()
        color = profile.get_color()
        self._icon.props.xo_color = color
        self.set_icon_widget(self._icon)
        self._icon.show()

        cb_service = clipboard.get_instance()
        cb_service.connect('object-state-changed',
                           self._object_state_changed_cb)
        cb_service.connect('object-selected', self._object_selected_cb)

        child = self.get_child()
        child.connect('drag_data_get', self._drag_data_get_cb)
        self.connect('notify::active', self._notify_active_cb)
开发者ID:Akirato,项目名称:sugar,代码行数:27,代码来源:clipboardicon.py


示例11: read_file

 def read_file(self, file_path):
     if 'icon-color' in self.metadata:
         color = self.metadata['icon-color']
     else:
         color = profile.get_color().to_string()
     self.change_game(None, file_path, 4, 'file',
                      self.metadata['title'], color)
开发者ID:leonardcj,项目名称:memorize-activity,代码行数:7,代码来源:activity.py


示例12: export_font

    def export_font(self):
        """
        Export the current font loaded in globals.FONT as a .otf file.

        The file will be saved in the activity data folder
        """
        # create the file path

        file_path =\
            os.path.join(self.get_activity_root(),
                         'data', '%s.otf' % self.get_title)
        # save the otf
        globals.FONT.export_binary(file_path)

        # create a journal entry
        jobject = datastore.create()
        jobject.metadata['icon-color'] = profile.get_color().to_string()
        jobject.metadata['mime_type'] = 'application/x-font-opentype'
        jobject.metadata['title'] = '%s.otf' % self.get_title
        jobject.file_path = file_path
        datastore.write(jobject, transfer_ownership=True)
        self._object_id = jobject.object_id

        success_title = 'Success'
        success_msg = 'A OTF Font file was created in the Journal'
        self._show_journal_alert(_(success_title), _(success_msg))
开发者ID:sugarlabs,项目名称:edit-fonts-activity,代码行数:26,代码来源:EditFonts.py


示例13: _comment_activate_cb

    def _comment_activate_cb(self, entry):
        text = entry.props.text
        if not 'comments' in self._reflection.data:
            self._reflection.data['comments'] = []
        data = {'nick': profile.get_nick_name(),
                'color': self._reflection.activity.fg_color.get_html(),
                'comment': text}
        self._reflection.data['comments'].append(data)
        self.add_new_comment(data)
        # Send the comment
        if self._reflection.activity.sharing:
            send_data = data.copy()
            send_data["obj_id"] = self._reflection.data["obj_id"]
            self._reflection.activity.send_event(COMMENT_CMD, send_data)

        entry.set_text('')

        # Update journal entry
        dsobj = datastore.get(self._reflection.data['obj_id'])
        if 'comments' in dsobj.metadata:
            data = json.loads(dsobj.metadata['comments'])
        else:
            data = []
        data.append({'from': profile.get_nick_name(),
                     'message': text,
                     'icon-color': profile.get_color().to_string()})
        dsobj.metadata['comments'] = json.dumps(data)
        datastore.write(dsobj,
                        update_mtime=False,
                        reply_handler=self.datastore_write_cb,
                        error_handler=self.datastore_write_error_cb)
开发者ID:AbrahmAB,项目名称:reflect,代码行数:31,代码来源:reflectwindow.py


示例14: load_object

    def load_object(self, full_path, filename):
        if self.set_to_page_like(full_path):
            return
        scrollwnd = Gtk.ScrolledWindow()
        scrollwnd.set_policy(Gtk.PolicyType.AUTOMATIC,
                             Gtk.PolicyType.AUTOMATIC)

        page = GtkSourceview2Page(full_path)
        page.set_theme(self.theme_state)
        page.set_font_size(self.font_size)

        vbox = Gtk.VBox()
        if full_path.endswith('.svg'):
            icon = Icon(file=full_path, pixel_size=100,
                        xo_color=profile.get_color())
            vbox.pack_start(icon, False, False, 0)

        vbox.pack_start(scrollwnd, True, True, 0)
        scrollwnd.add(page)
        vbox.page = page
        label = filename
        page.text_buffer.connect('changed', self.__text_changed_cb)

        tablabel = TabLabel(scrollwnd, label)
        tablabel.connect(
            'tab-close',
            lambda widget, child: self.remove_page(self.page_num(child)))
        tablabel.page = page

        self.append_page(vbox, tablabel)

        self.__text_changed_cb(page.text_buffer)
        self.show_all()
        self.set_current_page(-1)
开发者ID:samdroid-apps,项目名称:develop-activity,代码行数:34,代码来源:sourceview_editor.py


示例15: _comment_activate_cb

    def _comment_activate_cb(self, entry):
        text = entry.props.text
        if not "comments" in self._reflection.data:
            self._reflection.data["comments"] = []
        data = {
            "nick": profile.get_nick_name(),
            "color": self._reflection.activity.fg_color.get_html(),
            "comment": text,
        }
        self._reflection.data["comments"].append(data)
        self.add_new_comment(data)
        # Send the comment
        if self._reflection.activity.sharing:
            self._reflection.activity.send_event(
                "%s|%s|%s|%s|%s"
                % (COMMENT_CMD, self._reflection.data["obj_id"], data["nick"], data["color"], data["comment"])
            )
        entry.set_text("")

        # Update journal entry
        dsobj = datastore.get(self._reflection.data["obj_id"])
        if "comments" in dsobj.metadata:
            data = json.loads(dsobj.metadata["comments"])
        else:
            data = []
        data.append({"from": profile.get_nick_name(), "message": text, "icon-color": profile.get_color().to_string()})
        dsobj.metadata["comments"] = json.dumps(data)
        datastore.write(
            dsobj,
            update_mtime=False,
            reply_handler=self.datastore_write_cb,
            error_handler=self.datastore_write_error_cb,
        )
开发者ID:samdroid-apps,项目名称:reflect,代码行数:33,代码来源:reflectwindow.py


示例16: start_game

    def start_game(self, numPlayers):
        self._create_domino()
        self.placed_pieces = []
        self.players = []
        auto_player = SimpleAutoPlayer(self, 0)
        auto_player.set_pieces(self.take_pieces(7))
        self.players.append(auto_player)

        if self.ENABLE_AUTO_MODE:
            auto_player2 = SimpleAutoPlayer(self, 1)
            auto_player2.set_pieces(self.take_pieces(7))
            auto_player2.pieces_position = self.table.second_player_position
            self.players.append(auto_player2)
        else:
            for n in range(1, numPlayers):
                player = DominoPlayer(self, n)
                player.set_pieces(self.take_pieces(7))
                self.players.append(player)

        # comienza a jugar el primer jugador
        self.players[0].play()
        self.ui_player = self.players[1]
        self.ui_player.color = profile.get_color()
        self.ui_player.name = profile.get_nick_name()
        self._actual_player = 0
开发者ID:godiard,项目名称:domino-activity,代码行数:25,代码来源:dominogame.py


示例17: __favorite_set_data_cb

 def __favorite_set_data_cb(self, column, cell, tree_model,
                            tree_iter, data):
     favorite = tree_model[tree_iter][ListModel.COLUMN_FAVORITE]
     if favorite:
         cell.props.xo_color = profile.get_color()
     else:
         cell.props.xo_color = None
开发者ID:AxEofBone7,项目名称:sugar,代码行数:7,代码来源:listview.py


示例18: __init__

    def __init__(self, cb_object):
        Palette.__init__(self, text_maxlen=100)

        self._cb_object = cb_object

        self.set_group_id('frame')

        cb_service = clipboard.get_instance()
        cb_service.connect('object-state-changed',
                           self._object_state_changed_cb)

        self._remove_item = MenuItem(pgettext('Clipboard', 'Remove'),
                                     'list-remove')
        self._remove_item.connect('activate', self._remove_item_activate_cb)
        self.menu.append(self._remove_item)
        self._remove_item.show()

        self._open_item = MenuItem(_('Open'), 'zoom-activity')
        self._open_item.connect('activate', self._open_item_activate_cb)
        self.menu.append(self._open_item)
        self._open_item.show()

        self._journal_item = MenuItem(_('Keep'))
        color = profile.get_color()
        icon = Icon(icon_name='document-save', icon_size=Gtk.IconSize.MENU,
                    xo_color=color)
        self._journal_item.set_image(icon)

        self._journal_item.connect('activate', self._journal_item_activate_cb)
        self.menu.append(self._journal_item)
        self._journal_item.show()

        self._update()
开发者ID:mdengler,项目名称:sugar,代码行数:33,代码来源:clipboardmenu.py


示例19: __init__

    def __init__(self):
        self._color = profile.get_color()
        TrayIcon.__init__(self, icon_name=_ICON_NAME, xo_color=self._color)
        self.set_palette_invoker(FrameWidgetInvoker(self))
        self.palette_invoker.props.toggle_palette = True

        self._manager = speech.get_speech_manager()
开发者ID:Akirato,项目名称:sugar,代码行数:7,代码来源:speech.py


示例20: do_drag_data_get

    def do_drag_data_get(self, path, selection):
        data = self.get_iter(path)
        mime_type = self.get_value(data, 13)
        fileid = self.get_value(data, 14)
        title = self.get_value(data, 15)
        data = self._account.download_file(fileid, self._display_alert)

        fd, file_path = tempfile.mkstemp(dir="/tmp/")
        os.close(fd)

        if data[0]:
            f = open(file_path, 'w')
            f.write(data[0])
            f.close()

        jobject = datastore.create()
        jobject.metadata['title'] = title
        jobject.metadata['icon-color'] = profile.get_color().to_string()
        jobject.metadata['mime_type'] = mime_type
        if data[1]:
            jobject.metadata['activity'] = data[1]

        if data[0]:
            jobject.file_path = file_path
        datastore.write(jobject)
        self._load_files()
        self._journal_button.set_active(True)
        self._listview.refresh()
开发者ID:i5o,项目名称:sugar-gdrive,代码行数:28,代码来源:account.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python profile.get_nick_name函数代码示例发布时间:2022-05-27
下一篇:
Python presenceservice.get_instance函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap