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


Python utils.filename_to_unicode函数代码示例

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


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

示例1: adjustContent

    def adjustContent(self, videoWindow, animate):
        if videoWindow.is_fullscreen:
            self.popInOutButton.setHidden_(YES)
            self.popInOutLabel.setHidden_(YES)
            image_path = resources.path("images/fullscreen_exit.png")
            self.fsButton.setImage_(NSImage.alloc().initWithContentsOfFile_(filename_to_unicode(image_path)))
        else:
            if app.playback_manager.detached_window is None:
                image_path = resources.path("images/popout.png")
                label = _("Pop Out")
            else:
                image_path = resources.path("images/popin.png")
                label = _("Pop In")
            self.popInOutButton.setImage_(NSImage.alloc().initWithContentsOfFile_(filename_to_unicode(image_path)))
            self.popInOutButton.setHidden_(NO)
            self.popInOutLabel.setHidden_(NO)
            self.popInOutLabel.setStringValue_(label)
            image_path = resources.path("images/fullscreen_enter.png")
            self.fsButton.setImage_(NSImage.alloc().initWithContentsOfFile_(filename_to_unicode(image_path)))

        newFrame = self.window().frame()
        if videoWindow.is_fullscreen or app.playback_manager.detached_window is not None:
            self.titleLabel.setHidden_(NO)
            self.feedLabel.setHidden_(NO)
            newFrame.size.height = 198
        else:
            self.titleLabel.setHidden_(YES)
            self.feedLabel.setHidden_(YES)
            newFrame.size.height = 144
        newFrame.origin.x = self.getHorizontalPosition(videoWindow, newFrame.size.width)
        self.window().setFrame_display_animate_(newFrame, YES, animate)
        self.playbackControls.setNeedsDisplay_(YES)
开发者ID:nicolasembleton,项目名称:miro,代码行数:32,代码来源:overlay.py

示例2: awakeFromNib

    def awakeFromNib(self):
        image_path = resources.path('images/subtitles_down.png')
        self.subtitlesButton.setImage_(NSImage.alloc().initWithContentsOfFile_(filename_to_unicode(image_path)))
        self.subtitlesLabel.setTitleWithMnemonic_(_("Subtitles"))
        self.fsLabel.setTitleWithMnemonic_(_("Fullscreen"))
        self.shareButton.setImage_(getOverlayButtonImage(self.shareButton.bounds().size))
        self.shareButton.setAlternateImage_(getOverlayButtonAlternateImage(self.shareButton.bounds().size))
        self.shareButton.setTitle_(_("Share"))

        self.keepButton.setImage_(getOverlayButtonImage(self.keepButton.bounds().size))
        self.keepButton.setAlternateImage_(getOverlayButtonAlternateImage(self.keepButton.bounds().size))
        self.keepButton.setTitle_(_("Keep"))

        self.deleteButton.setImage_(getOverlayButtonImage(self.deleteButton.bounds().size))
        self.deleteButton.setAlternateImage_(getOverlayButtonAlternateImage(self.deleteButton.bounds().size))
        self.deleteButton.setTitle_(_("Delete"))

        self.seekForwardButton.setCell_(SkipSeekButtonCell.cellFromButtonCell_direction_delay_(self.seekForwardButton.cell(), 1, 0.0))
        self.seekForwardButton.cell().setAllowsSkipping(False)
        self.seekBackwardButton.setCell_(SkipSeekButtonCell.cellFromButtonCell_direction_delay_(self.seekBackwardButton.cell(), -1, 0.0))
        self.seekBackwardButton.cell().setAllowsSkipping(False)

        self.progressSlider.cursor = NSImage.imageNamed_(u'fs-progress-slider')
        self.progressSlider.sliderWasClicked = self.progressSliderWasClicked
        self.progressSlider.sliderWasDragged = self.progressSliderWasDragged
        self.progressSlider.sliderWasReleased = self.progressSliderWasReleased
        self.progressSlider.setShowCursor_(True)

        self.volumeSlider.cursor = NSImage.imageNamed_(u'fs-volume-slider')
        self.volumeSlider.sliderWasClicked = self.volumeSliderWasClicked
        self.volumeSlider.sliderWasDragged = self.volumeSliderWasDragged
        self.volumeSlider.sliderWasReleased = self.volumeSliderWasReleased
        self.volumeSlider.setShowCursor_(True)
开发者ID:CodeforEvolution,项目名称:miro,代码行数:33,代码来源:overlay.py

示例3: handle_watched_folder_list

 def handle_watched_folder_list(self, info_list):
     """Handle the WatchedFolderList message."""
     for info in info_list:
         iter = self.model.append(info.id, filename_to_unicode(info.path),
                 info.visible)
         self._iter_map[info.id] = iter
     self.emit('changed')
开发者ID:cool-RR,项目名称:Miro,代码行数:7,代码来源:watchedfolders.py

示例4: _makeSearchIcon

def _makeSearchIcon(engine):
    popupRectangle = NSImage.imageNamed_(u'search_popup_triangle')
    popupRectangleSize = popupRectangle.size()

    engineIconPath = resources.path('images/search_icon_%s.png' % engine.name)
    if not os.path.exists(engineIconPath):
        return nil
    engineIcon = NSImage.alloc().initByReferencingFile_(
      filename_to_unicode(engineIconPath))
    engineIconSize = engineIcon.size()

    searchIconSize = (engineIconSize.width + popupRectangleSize.width + 2, engineIconSize.height)
    searchIcon = NSImage.alloc().initWithSize_(searchIconSize)
    
    searchIcon.lockFocus()
    try:
        engineIcon.drawAtPoint_fromRect_operation_fraction_(
          (0,0), NSZeroRect, NSCompositeSourceOver, 1.0)
        popupRectangleX = engineIconSize.width + 2
        popupRectangleY = (engineIconSize.height - popupRectangleSize.height) / 2
        popupRectangle.drawAtPoint_fromRect_operation_fraction_(
          (popupRectangleX, popupRectangleY), NSZeroRect,
          NSCompositeSourceOver, 1.0)
    finally:
        searchIcon.unlockFocus()

    return searchIcon
开发者ID:CodeforEvolution,项目名称:miro,代码行数:27,代码来源:control.py

示例5: add_device_item

 def add_device_item(self, file_type, path, old_item, metadata_manager):
     """Insert a device_item row for an old item."""
     values = []
     # copy data from old_item so that we don't modify it
     old_data = dict(old_item)
     if path in self.paths_in_metadata_table:
         # This item comes from a 5.x database, so there's data in the
         # metadata tables for it.
         metadata_dict = metadata_manager.get_metadata(path)
         for key, value in metadata_dict.items():
             old_data[key] = value
     for name, field in schema.DeviceItemSchema.fields:
         # get value from the old item
         if name == 'id':
             value = self.id_counter.next()
         elif name == 'filename':
             value = filename_to_unicode(path)
         elif name == 'file_type':
             value = file_type
         elif name == 'net_lookup_enabled':
             value = False
         else:
             value = old_data.get(name)
         # convert value
         if value is not None:
             if isinstance(field, schema.SchemaDateTime):
                 value = datetime.datetime.fromtimestamp(value)
         values.append(value)
     self.cursor.execute(self.device_item_insert_sql, values)
开发者ID:CodeforEvolution,项目名称:miro,代码行数:29,代码来源:devicedatabaseupgrade.py

示例6: item_matches

def item_matches(item, search_text):
    """Test if a single ItemInfo matches a search

    :param item: Item to test
    :param search_text: search_text to search with

    :returns: True if the item matches the search string
    """
    parsed_search = _get_boolean_search(search_text)

    match_against = [item.title, item.description, item.entry_description]
    match_against.append(item.artist)
    match_against.append(item.album)
    match_against.append(item.genre)
    match_against.append(item.get_source_for_search())
    if item.filename:
        filename = os.path.basename(item.filename)
        match_against.append(filename_to_unicode(filename))
    match_against_text = " ".join(term.lower() for term in match_against if term is not None)

    for term in parsed_search.positive_terms:
        if term not in match_against_text:
            return False
    for term in parsed_search.negative_terms:
        if term in match_against_text:
            return False
    return True
开发者ID:ktan2020,项目名称:miro,代码行数:27,代码来源:search.py

示例7: _convert_status_to_sql

 def _convert_status_to_sql(self, status_dict):
     to_save = status_dict.copy()
     filename_fields = schema.SchemaStatusContainer.filename_fields
     for key in filename_fields:
         value = to_save.get(key)
         if value is not None:
             to_save[key] = filename_to_unicode(value)
     return repr(to_save)
开发者ID:kmshi,项目名称:miro,代码行数:8,代码来源:storedatabase.py

示例8: init

 def init(self):
     self = super(MiroSearchTextField, self).init()
     imagepath = filename_to_unicode(
                 resources.path('images/search_icon_all.png'))
     image = NSImage.alloc().initByReferencingFile_(imagepath)
     self.cell().searchButtonCell().setImage_(image)
     self.cell().searchButtonCell().setAlternateImage_(image)
     return self
开发者ID:CodeforEvolution,项目名称:miro,代码行数:8,代码来源:control.py

示例9: _item_exists_for_path

def _item_exists_for_path(path):
    # in SQLite, LIKE is case insensitive, so we can use it to only look at
    # filenames that possibly will match
    for item_ in item.Item.make_view('filename LIKE ?',
            (filename_to_unicode(path),)):
        if samefile(item_.filename, path):
            return item_
    return False
开发者ID:nxmirrors,项目名称:miro,代码行数:8,代码来源:commandline.py

示例10: item_matches_search

def item_matches_search(item_info, search_text):
    """Check if an item matches search text."""
    if search_text == '':
        return True
    match_against = [item_info.name, item_info.description]
    if item_info.video_path is not None:
        match_against.append(filename_to_unicode(item_info.video_path))
    return search.match(search_text, match_against)
开发者ID:cool-RR,项目名称:Miro,代码行数:8,代码来源:itemlist.py

示例11: __init__

 def __init__(self, path):
     Widget.__init__(self)
     self.nsimage = NSImage.alloc().initByReferencingFile_(
       filename_to_unicode(path))
     self.view = MiroImageView.alloc().init()
     self.view.setImage_(self.nsimage)
     # enabled when viewWillMoveToWindow:aWindow invoked
     self.view.setAnimates_(NO)
开发者ID:CodeforEvolution,项目名称:miro,代码行数:8,代码来源:simple.py

示例12: to_dict

 def to_dict(self):
     data = {}
     for k, v in self.__dict__.items():
         if v is not None and k not in (u'device', u'file_type', u'id',
                                        u'video_path', u'_deferred_update'):
             if ((k == u'screenshot' or k == u'cover_art')):
                 v = filename_to_unicode(v)
             data[k] = v
     return data
开发者ID:kmshi,项目名称:miro,代码行数:9,代码来源:devices.py

示例13: handle_change_clicked

 def handle_change_clicked(widget):
     dir_ = dialogs.ask_for_directory(
         _("Choose directory to search for media files"),
         initial_directory=_get_user_media_directory(),
         transient_for=self)
     if dir_:
         search_entry.set_text(filename_to_unicode(dir_))
         self.search_directory = dir_
     else:
         self.search_directory = _get_user_media_directory()
开发者ID:cool-RR,项目名称:Miro,代码行数:10,代码来源:firsttimedialog.py

示例14: handle_watched_folders_changed

 def handle_watched_folders_changed(self, added, changed, removed):
     """Handle the WatchedFoldersChanged message."""
     self.handle_watched_folder_list(added)
     for info in changed:
         iter = self._iter_map[info.id]
         self.model.update_value(iter, 1, filename_to_unicode(info.path))
         self.model.update_value(iter, 2, info.visible)
     for id in removed:
         iter = self._iter_map.pop(id)
         self.model.remove(iter)
     self.emit('changed')
开发者ID:cool-RR,项目名称:Miro,代码行数:11,代码来源:watchedfolders.py

示例15: handle_change_clicked

 def handle_change_clicked(widget):
     dir_ = dialogs.ask_for_directory(
         _("Choose directory to search for media files"),
         initial_directory=get_default_search_dir(),
         transient_for=self)
     if dir_:
         search_entry.set_text(filename_to_unicode(dir_))
         self.search_directory = dir_
     else:
         self.search_directory = get_default_search_dir()
     # reset the search results if they change the directory
     self.gathered_media_files = None
开发者ID:codito,项目名称:miro,代码行数:12,代码来源:firsttimedialog.py


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