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


Python profile.get_color函数代码示例

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


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

示例1: reset_toggled

    def reset_toggled(self, button):
        """
        Resets toggled property and combobox liststore.

        @param button: The reset button (can be omitted by passing None).
        @note: If a tag was selected within the L{geotagmodel.GeotagModel},
        the tag will be deleted.
        """
        self.toggled = NONE_CATEGORY

        # reset liststore
        combo = self.toolbar.combobox
        combo.set_model(self.EMPTY_LIST_STORE)

        # reset selected widget
        color_fill = profile.get_color().get_fill_color()
        color_stroke = profile.get_color().get_stroke_color()
        self._set_selected(get_gtkimage_from_plugin(NONE_CATEGORY,
                                                    color_stroke,
                                                    color_fill,
                                                    self.IMG_SIZE))

        self.reset_selected_btn.set_active(True)
        self.selected.queue_draw()
        combo.queue_draw()
开发者ID:52North,项目名称:glaps,代码行数:25,代码来源:geotagplugin.py

示例2: __init__

    def __init__(self, nickname, properties=None):
        """
        Initializes a player.

        @param nickname: The players name.
        @param properties: A list containing features.
        """
        gobject.GObject.__init__(self)
        self._logger = logging.getLogger('player.' + nickname)
        self._logger.setLevel(constants.LOG_LEVEL)

        # players properties
        self.nickname = nickname
        self.position = Point(0,0)
        self.trace = dict()

        # set colors of the current player as default
        self.color_fill = profile.get_color().get_fill_color()
        self.color_stroke = profile.get_color().get_stroke_color()

        # the players features
        if properties is None:
            self.feature_collection = geojson.FeatureCollection(features=list())
        else:
            self.feature_collection = geojson.FeatureCollection(features=properties)
开发者ID:52North,项目名称:glaps,代码行数:25,代码来源:geomodel.py

示例3: __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(_have_toolbox)
        self._setup_dispatch_table()

        # Create a canvas
        canvas = gtk.DrawingArea()
        canvas.set_size_request(gtk.gdk.screen_width(), \
                                gtk.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:erilyth,项目名称:paths,代码行数:28,代码来源:PathsActivity.py

示例4: set_toggled

    def set_toggled(self, button, category):
        """
        Switches the empty Button and the tagged category button clicked.
        Also, sets the appropriate liststore for the combobox.

        @param button: Toggled button (can be omittted).
        @param category: The corresponding category to set.
        """
        self._logger.debug("set_toggled()")

        self.toggled = category

        # set liststore
        combo = self.toolbar.combobox
        combo.set_model(self.toolbar.description_sets[category])

        color_fill = profile.get_color().get_fill_color()
        color_stroke = profile.get_color().get_stroke_color()

#        self._logger.debug("storage type: %s", self.selected.get_property("storage-type"))
        self._set_selected(get_gtkimage_from_plugin(category,
                                                    color_stroke,
                                                    color_fill,
                                                    self.IMG_SIZE))
        combo.queue_draw()
开发者ID:52North,项目名称:glaps,代码行数:25,代码来源:geotagplugin.py

示例5: set_color

    def set_color(self, fill=profile.get_color().get_fill_color(), \
                  stroke=profile.get_color().get_stroke_color()):
        """
        Sets the xo colors for this player.

        @param fill: hex string for fill color.
        @param stroke: hex string for stroke color.
        """
        self.color_stroke = stroke
        self.color_fill   = fill
开发者ID:52North,项目名称:glaps,代码行数:10,代码来源:geomodel.py

示例6: _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:AlanJAS,项目名称:turtleart,代码行数:11,代码来源:tacollaboration.py

示例7: get_xo_icon

def get_xo_icon(color_stroke=None, color_fill=None, size=(20,20)):
    """
    @param color_stroke: The stroke color as hex string (default is players stroke).
    @param color_fill: The fill color as hex string (default is players fill).
    @param size: A tupel of size in pixels: (width,height).
    @return: The XO icon with given colors and size
    """
    if (color_stroke == None) or (color_fill == None):
        color_stroke = profile.get_color().get_stroke_color()
        color_fill = profile.get_color().get_fill_color()
    name = os.path.join(constants.BUNDLE_PATH, 'icons/computer-xo.svg')
    return load_svg_image(name, color_stroke, color_fill, size)
开发者ID:52North,项目名称:glaps,代码行数:12,代码来源:utils.py

示例8: __members_changed_cb

    def __members_changed_cb(self, adhoc_manager, channel, has_members):
        if channel == self._channel:
            if has_members == 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:nemesiscodex,项目名称:JukyOS-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:nemesiscodex,项目名称:JukyOS-sugar,代码行数:15,代码来源:network.py

示例10: _save_recording

 def _save_recording(self):
     if os.path.exists(os.path.join(self.datapath, 'output.ogg')):
         _logger.debug('Saving recording to Journal...')
         obj_id = self._get_audio_obj_id()
         copyfile(os.path.join(self.datapath, 'output.ogg'),
                  os.path.join(self.datapath, '%s.ogg' % (obj_id)))
         dsobject = self._search_for_audio_note(obj_id)
         if dsobject is None:
             dsobject = datastore.create()
         if dsobject is not None:
             _logger.debug(self.dsobjects[self.i].metadata['title'])
             dsobject.metadata['title'] = _('Audio recording by %s') % \
                 (self.metadata['title'])
             dsobject.metadata['icon-color'] = \
                 profile.get_color().to_string()
             dsobject.metadata['tags'] = obj_id
             dsobject.metadata['mime_type'] = 'audio/ogg'
             dsobject.set_file_path(
                 os.path.join(self.datapath, '%s.ogg' % (obj_id)))
             datastore.write(dsobject)
             dsobject.destroy()
         self._add_playback_button(
             profile.get_nick_name(), self.colors,
             os.path.join(self.datapath, '%s.ogg' % (obj_id)))
         if hasattr(self, 'chattube') and self.chattube is not None:
             self._share_audio()
     else:
         _logger.debug('Nothing to save...')
     return
开发者ID:walterbender,项目名称:bulletinboard,代码行数:29,代码来源:BBoardActivity.py

示例11: __init__

    def __init__(self, handle):
        ''' Initialize the toolbars and the work surface '''
        super(BBoardActivity, self).__init__(handle)

        self.datapath = get_path(activity, 'instance')

        self._hw = get_hardware()

        self._playback_buttons = {}
        self._audio_recordings = {}
        self.colors = profile.get_color().to_string().split(',')

        self._setup_toolbars()
        self._setup_canvas()

        self.slides = []
        self._setup_workspace()

        self._buddies = [profile.get_nick_name()]
        self._setup_presence_service()

        self._thumbs = []
        self._thumbnail_mode = False

        self._recording = False
        self._grecord = None
        self._alert = None

        self._dirty = False
开发者ID:walterbender,项目名称:bulletinboard,代码行数:29,代码来源:BBoardActivity.py

示例12: _load_game

 def _load_game(self, button):
     chooser = ObjectChooser(_('Choose memorize game'),
             parent=self.activity,
             flags=gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT)
     jobject = ''
     try:
         result = chooser.run()
         if result == gtk.RESPONSE_ACCEPT:
             logging.debug('ObjectChooser: %r', 
                           chooser.get_selected_object())
             jobject = chooser.get_selected_object()
             if not jobject or  not jobject.file_path:
                 return
     finally:
         chooser.destroy()
         del chooser
         
     if jobject and jobject.file_path:   
         title = jobject.metadata['title']
         if jobject.metadata.has_key('icon-color'):
             color = jobject.metadata['icon-color']
         else:
             color = profile.get_color().to_string()
         self.emit('game_changed', jobject.file_path, 4,
                   'file', title, color)
          
         if self.jobject != None:
             self.jobject.destroy()
         self.jobject = jobject
开发者ID:pmoleri,项目名称:memorize-accesible,代码行数:29,代码来源:memorizetoolbar.py

示例13: myblock

def myblock(tw, title):
    ''' Save heap to journal (Sugar only) '''

    import os.path
    from gettext import gettext as _

    from sugar.activity import activity
    from sugar.datastore import datastore
    from sugar import profile

    from TurtleArt.tautils import get_path, data_to_file

    # Save JSON-encoded heap to temporary file
    heap_file = os.path.join(get_path(activity, 'instance'),
                             str(title) + '.txt')
    data_to_file(tw.lc.heap, heap_file)

    # Create a datastore object
    dsobject = datastore.create()

    # Write any metadata (specifically set the title of the file
    #                     and specify that this is a plain text file).
    dsobject.metadata['title'] = str(title)
    dsobject.metadata['icon-color'] = profile.get_color().to_string()
    dsobject.metadata['mime_type'] = 'text/plain'
    dsobject.set_file_path(heap_file)
    datastore.write(dsobject)
    dsobject.destroy()
开发者ID:sugarlabs,项目名称:activity-turtle-flags,代码行数:28,代码来源:save_heap_to_journal_entry.py

示例14: open_url

 def open_url(self, url):
     """Ask the journal to open an URL for us."""
     from sugar import profile
     from shutil import rmtree
     from sugar.datastore import datastore
     from sugar.activity.activity import show_object_in_journal
     from tempfile import mkdtemp
     tmpfolder = mkdtemp('.tmp', 'url', os.path.join(self.get_activity_root(), 'instance'))
     tmpfilepath = os.path.join(tmpfolder, 'url')
     try:
         tmpfile = open(tmpfilepath, 'w')
         tmpfile.write(url)
         tmpfile.close()
         os.chmod(tmpfolder, 0755)
         os.chmod(tmpfilepath, 0755)
         jobject = datastore.create()
         metadata = {
             'title': url,
             'title_set_by_user': '1',
             'buddies': '',
             'preview': '',
             'icon-color': profile.get_color().to_string(),
             'mime_type': 'text/uri-list',
         }
         for k, v in metadata.items():
             jobject.metadata[k] = v # the dict.update method is missing =(
         jobject.file_path = tmpfilepath
         datastore.write(jobject)
         show_object_in_journal(jobject.object_id)
         jobject.destroy()
     finally:
         rmtree(tmpfilepath, ignore_errors=True) # clean up!
开发者ID:sugarlabs,项目名称:Frotz,代码行数:32,代码来源:frotz.py

示例15: __init__

    def __init__(self, title, mimetype, evaluation='', can_check=True):
        gtk.HBox.__init__(self)

        if can_check:
            self._checkbutton = gtk.CheckButton()
            self._checkbutton.connect('toggled', self._toggled)
        label = gtk.Label("<b>%s</b>" % (title))
        label.set_use_markup(True)
        icon = Icon(pixel_size=52)
        icon.props.icon_name = mime.get_mime_icon(mimetype)
        icon.props.xo_color = profile.get_color()
        evaluation = gtk.Label(evaluation)
        button = gtk.ToolButton()
        button.connect('clicked', lambda w: self.emit('show-info'))
        icon_info = Icon(pixel_size=24)
        icon_info.props.icon_name = 'info-small'
        button.set_icon_widget(icon_info)
        if can_check:
            self.pack_start(self._checkbutton, False, True, 5)
        self.pack_start(icon, False, True, 5)
        self.pack_start(label, False, True, 5)
        self.pack_end(button, False, True, 5)
        self.pack_end(evaluation, False, True, 5)
        self.title = title
        self.mimetype = mimetype

        self.show_all()
开发者ID:aulavirtual,项目名称:explorador,代码行数:27,代码来源:documents.py


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