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

Python nls._函数代码示例

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

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



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

示例1: __init__

    def __init__(self):
        '''
        init docs
        '''
        gtk.VBox.__init__(self)

        self.draw_title_background = self.draw_tab_title_background
        self.theme = None
        
        self.delete_view = DeleteView(padding_x=30, padding_y=ITEM_PADDING_Y)
        self.delete_view_sw = self.delete_view.get_scrolled_window()
        
        self.action_align = gtk.Alignment()
        self.action_align.set_padding(5, 5, 510, 5)
        self.action_box = gtk.HBox(spacing = 10)
        self.back_button = Button(_("Back"))
        self.back_button.set_size_request(80, WIDGET_HEIGHT)
        self.back_button.connect("clicked", self.__on_back)
        self.select_all_button = Button(_("Select all"))
        self.select_all_button.set_size_request(80, WIDGET_HEIGHT)
        self.select_all_button.connect("clicked", self.__on_select_all)
        self.delete_button = Button(_("Delete"))
        self.delete_button.set_size_request(80, WIDGET_HEIGHT)
        self.delete_button.connect("clicked", self.__on_delete)
        self.action_box.pack_start(self.select_all_button, False, False)
        self.action_box.pack_start(self.delete_button, False, False)
        self.action_box.pack_start(self.back_button, False, False)
        self.action_align.add(self.action_box)
        
        self.pack_start(self.delete_view_sw, True, True)
        self.pack_start(self.action_align, False, False)

        event_manager.add_callback("select-delete-wallpaper", self.__on_select_delete_wallpaper)
开发者ID:electricface,项目名称:deepin-system-settings,代码行数:33,代码来源:delete_page.py


示例2: get_add_menu

 def get_add_menu(self):    
     menu_items = [
         (None, _("File"), self.add_file),
         (None, _("Folder(include subdirectories)"), self.recursion_add_dir),
         (None, _("Folder"), self.add_dir),
         ]
     return Menu(menu_items)
开发者ID:electricface,项目名称:deepin-music-player,代码行数:7,代码来源:song_view.py


示例3: check_before_translate

 def check_before_translate(self):
     self.need_install_packages = get_install_packages(["sdcv", "stardict-xdict-ce-gb", "stardict-xdict-ec-gb"])
     if len(self.need_install_packages) > 0:
         show_message(_("Need install sdcv package to enable translate feature"), _("Cancel"), _("Install"), self.install_sdcv)
         return False
     else:
         return True
开发者ID:lihongwu,项目名称:deepin-translator,代码行数:7,代码来源:translate.py


示例4: __set_card_treeview_status

 def __set_card_treeview_status(self):
     card_list = []
     cards = pypulse.PULSE.get_cards()
     for idx in cards:
         active_profile = cards[idx]['active_profile']
         if active_profile:
             if active_profile['n_sinks'] > 1:
                 io_num = _("%d Outputs") % active_profile['n_sinks']
             else:
                 io_num = _("%d Output") % active_profile['n_sinks']
             if active_profile['n_sources'] > 1:
                 io_num += " / " + _("%d Inputs") % active_profile['n_sources']
             else:
                 io_num += " / " + _("%d Input") % active_profile['n_sources']
             if 'device.description' in cards[idx]['proplist']:
                 description = cards[idx]['proplist']['device.description'].strip('\x00')
             else:
                 description = ""
             card_info = "%s(%s)[%s]" % (description, io_num, active_profile['description'])
         else:
             if 'device.description' in cards[idx]['proplist']:
                 card_info = cards[idx]['proplist']['device.description']
             else:
                 card_info = " "
         card_list.append(TreeItem(self.image_widgets["device"], card_info, cards[idx]['name'], idx))
     self.view_widgets["ad_hardware"].add_items(card_list, clear_first=True)
     if card_list:
         self.view_widgets["ad_hardware"].set_select_rows([0])
开发者ID:electricface,项目名称:deepin-system-settings,代码行数:28,代码来源:main_full.py


示例5: create_lyrics_dir_table

 def create_lyrics_dir_table(self):    
     main_table = gtk.Table(3, 2)
     main_table.set_row_spacings(CONTENT_ROW_SPACING)
     
     dir_title_label = Label(_("Lyrics directory"))
     dir_title_label.set_size_request(200, 12)
     label_align = gtk.Alignment()
     label_align.set_padding(0, 0, 0, 0)
     label_align.add(dir_title_label)
     
     self.dir_entry = InputEntry()
     self.dir_entry.set_text(os.path.expanduser(config.get("lyrics", "save_lrc_path", "~/.lyrics")))
     self.dir_entry.set_editable(False)        
     self.dir_entry.set_size(250, 25)
     
     modify_button = Button(_("Change"))
     modify_button.connect("clicked", self.change_lyrics_save_dir)
     hbox = gtk.HBox(spacing=5)
     hbox.pack_start(self.dir_entry, False, False)
     hbox.pack_start(modify_button, False, False)
     
     main_table.attach(label_align, 0, 2, 0, 1, yoptions=gtk.FILL, xpadding=8)
     main_table.attach(create_separator_box(), 0, 2, 1, 2, yoptions=gtk.FILL)
     main_table.attach(hbox, 0, 2, 2, 3, xpadding=10, xoptions=gtk.FILL)
     return main_table
开发者ID:electricface,项目名称:deepin-music-player,代码行数:25,代码来源:preference.py


示例6: get_favorite_menu_item

 def get_favorite_menu_item(self, item):        
     song = item.webcast        
     if song.get("collected", False):
         menu_name = _("Remove from Favorites")
     else:
         menu_name = _("Add to Favorites")
     return (None, menu_name, lambda : self.toggle_item_collected(item))    
开发者ID:WilliamRen,项目名称:deepin-music-player,代码行数:7,代码来源:webcast_view.py


示例7: create_source_update_frequency_table

    def create_source_update_frequency_table(self):
        main_table = gtk.Table(3, 2)
        main_table.set_row_spacings(CONTENT_ROW_SPACING)
        
        dir_title_label = Label(_("Update applications lists"))
        dir_title_label.set_size_request(200, 12)
        label_align = gtk.Alignment()
        label_align.set_padding(0, 0, 0, 0)
        label_align.add(dir_title_label)

        self.is_auto_update_button = CheckButton(label_text=_('Update automatically'))
        self.is_auto_update_button.connect('toggled', self.change_auto_update)
        
        self.update_label = Label(_("Time interval: "))
        self.update_spin = SpinBox(int(get_update_interval()), 0, 168, 1)
        self.update_spin.connect("value-changed", lambda w, v: set_update_interval(v))
        self.hour_lablel = Label(_(" hour"))
        self.hour_lablel.set_size_request(50, 12)
        spin_hbox = gtk.HBox(spacing=3)
        spin_hbox.pack_start(self.update_label, False, False)
        spin_hbox.pack_start(self.update_spin, False, False)
        spin_hbox.pack_start(self.hour_lablel, False, False)

        main_table.attach(label_align, 0, 2, 0, 1, yoptions=gtk.FILL, xpadding=8)
        main_table.attach(create_separator_box(), 0, 2, 1, 2, yoptions=gtk.FILL)
        main_table.attach(self.is_auto_update_button, 0, 1, 2, 3, xpadding=10, xoptions=gtk.FILL)
        main_table.attach(spin_hbox, 1, 2, 2, 3, xpadding=10, xoptions=gtk.FILL)

        if is_auto_update():
            self.is_auto_update_button.set_active(True)
        else:
            self.is_auto_update_button.toggled()

        return main_table
开发者ID:menghun3,项目名称:deepin-software-center-1,代码行数:34,代码来源:preference.py


示例8: RequestConfirmation

    def RequestConfirmation(self, device, passkey):
        print("RequestConfirmation (%s, %06d)" % (device, passkey))

        # def action_invoked(_id, _action):
        #     if _action == "pair_accept":
        #         pass
        #     elif _action == "pair_reject":
        #         raise Rejected("Passkey doesn't match")

        # noti = pynotify.Notification(_("Pair request"),
        #                              _("Device %s request for pair,\n please make sure the key is %s") % (device, passkey))
        # noti.add_action("pair_accept", _("Accept"), action_invoked)
        # noti.add_action("pair_reject", _("Reject"), action_invoked)
        # noti.show()

        result = []
        loop = None
        agent_d = AgentDialog(_("Please confirm %s pin match as below") % Device(device).get_alias(),
                              str(passkey),
                              confirm_button_text = _("Yes"),
                              cancel_button_text = _("No"),
                              confirm_callback = lambda : result.append("yes"),
                              cancel_callback = lambda : result.append(None)
                              )

        agent_d.connect("destroy", lambda widget : loop.quit())
        agent_d.show_all()

        loop = gobject.MainLoop(None, False)
        gtk.gdk.threads_leave()
        loop.run()
        gtk.gdk.threads_enter()
        
        if not result[0]:
            raise_rejected("Passkey doesn't match.")
开发者ID:electricface,项目名称:deepin-system-settings,代码行数:35,代码来源:agent.py


示例9: __init__

 def __init__(self):
     DialogBox.__init__(self, _("Task Manager"), 350, 450, DIALOG_MASK_SINGLE_PAGE,
                        modal=False, close_callback=self.hide_all)
     
     self.is_changed = False
     scrolled_window = ScrolledWindow(0, 0)
     scrolled_window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
     
     scrolled_align = gtk.Alignment()
     scrolled_align.set(1, 1, 1, 1)
     scrolled_align.set_padding(10, 0, 0, 0)
     scrolled_align.add(scrolled_window)
     
     self.jobs_view = JobsView()
     self.jobs_view.draw_mask = self.get_mask_func(self.jobs_view)
     scrolled_window.add_child(self.jobs_view)
     
     pause_button = Button(_("Pause"))
     pause_button.connect("clicked", self.pause_job)
     stop_button = Button(_("Close"))
     stop_button.connect("clicked", lambda w: self.hide_all())
     
     self.body_box.add(scrolled_align)
     self.right_button_box.set_buttons([pause_button, stop_button])
     
     Dispatcher.connect("transfor-job", self.add_new_job)
开发者ID:electricface,项目名称:deepin-music-player,代码行数:26,代码来源:converter.py


示例10: check_before_voice

def check_before_voice():
    need_install_packages = get_install_packages(["libttspico-utils"])
    if len(need_install_packages) > 0:
        show_message(_("Package svox is required to enable pronunciation"), _("Cancel"), _("Install"), lambda : install_packages(need_install_packages))
        return False
    else:
        return True
开发者ID:PeterDaveHello,项目名称:deepin-translator,代码行数:7,代码来源:tts.py


示例11: update_power_icon

    def update_power_icon(self, percentage):
        if self.online_value:
            return
        self.check_for_warning(percentage)
        if percentage >= 91 and percentage <= 100:
            self.tray_icon.set_icon_theme("battery91-100")
        elif percentage >= 81 and percentage <= 90:
            self.tray_icon.set_icon_theme("battery81-90")
        elif percentage >= 71 and percentage <= 80:
            self.tray_icon.set_icon_theme("battery71-80")
        elif percentage >= 61 and percentage <= 70:
            self.tray_icon.set_icon_theme("battery61-70")
        elif percentage >= 51 and percentage <= 60:
            self.tray_icon.set_icon_theme("battery51-60")
        elif percentage >= 31 and percentage <= 50:
            self.tray_icon.set_icon_theme("battery31-50")
        elif percentage >= 21 and percentage <= 30:
            self.tray_icon.set_icon_theme("battery21-30")
        elif percentage >= 0 and percentage <= 20:
            self.tray_icon.set_icon_theme("battery0-10-20")
        #
        string = _("%s remaining") % (str(int(percentage)) + '%')
        if int(percentage) == 100:
            string = _("Fully charged")

        self.tray_icon.set_tooltip_text(string)
开发者ID:electricface,项目名称:deepin-system-settings,代码行数:26,代码来源:tray_power_plugin.py


示例12: get_phonetic_symbol

def get_phonetic_symbol(text):
    data = { "keyfrom" : "deskdict.mini", "q" : text, "doctype" : "xml", "xmlVersion" : 8.2,
             "client" : "deskdict", "id" : "cee84504d9984f1b2", "vendor": "unknown", 
             "in" : "YoudaoDict", "appVer" : "5.4.46.5554", "appZengqiang" : 0, "le" : "eng", "LTH" : 40}
    ret = requests.get("http://dict.youdao.com/search", params=data).text
    if isinstance(ret, unicode):
        ret = ret.encode('utf-8')
    pq = PyQuery(ret, parser="xml")
    
    phonetic_symbol = pq.find('usphone').text()
    phonetic_type = _("US")
    
    try:    
        if phonetic_symbol == '':
            phonetic_symbol = pq.find('ukphone').text()
            phonetic_type = _("UK")
    except: 
        pass
    
    if phonetic_symbol == '' or phonetic_symbol == None or phonetic_symbol.isspace():
        return ""
    else:
        if isinstance(phonetic_type, unicode):
            phonetic_type = phonetic_type.encode('utf-8')

        if isinstance(phonetic_symbol, unicode):
            phonetic_symbol = phonetic_symbol.encode('utf-8')
        
        return "[%s] %s" % (phonetic_type, phonetic_symbol)
开发者ID:PeterDaveHello,项目名称:deepin-translator,代码行数:29,代码来源:tts.py


示例13: __init__

 def __init__(self):
     gtk.VBox.__init__(self)
     
     self.set_spacing(5)
     self.plugins = utils.get_main_window().plugins
     self.plugins_view = TreeView()
     self.plugins_view.add_items = self.plugins_view_add_items
     self.plugins_view.set_expand_column(0)
     self.plugins_view.draw_mask = self.plugins_view_draw_mask
     self.plugins_view.set_size_request(420, 330)        
     self.plugins_view.connect("single-click-item", self.on_plugins_view_single_click)
     self.plugins_view.connect("press-return", self.on_plugins_view_press_return)
             
     self.plugins_view.set_column_titles([_("Name"), _("Version"), _("Enable"), ""],
                                         (self.sort_by_title, self.sort_by_title,
                                          self.sort_by_title, self.sort_by_title))
     plugins_view_align = set_widget_gravity(self.plugins_view, gravity=(1, 1, 1, 1),
                                             paddings=(10, 0, 0, 0))
     
     self.plugin_infos = PluginInfos()
     self.plugin_infos.set_size_request(420, 90)
     
     # plugin info
     self.pack_start(plugins_view_align, False, True)
     self.pack_start(self.plugin_infos, False, True)
开发者ID:electricface,项目名称:deepin-music-player,代码行数:25,代码来源:plugins_view.py


示例14: __on_select_all

 def __on_select_all(self, widget):
     self.delete_view.select_all()
     if self.delete_view.is_select_all():
         self.select_all_button.set_label(_("Clear all"))
     else:
         self.select_all_button.set_label(_("Select all"))
     self.select_all_button.set_size_request(80, WIDGET_HEIGHT)
开发者ID:electricface,项目名称:deepin-system-settings,代码行数:7,代码来源:delete_page.py


示例15: create_play_box

 def create_play_box(self):
     main_table = gtk.Table(4, 2)
     main_table.set_row_spacings(10)
     
     play_title_label = Label(_("Playing"))
     play_title_label.set_size_request(350, 12)
     
     fade_check_hbox = gtk.HBox()
     self.fade_check_button = CheckButton(_("Crossfade"))        
     fade_check_hbox.pack_start(self.fade_check_button, False, False)
     fade_check_hbox.pack_start(create_right_align(), True, True)
     self.album_check_button = CheckButton(_("Crossfade gapless album"))
     
     fade_label = Label(_("Fade timeout:"))
     self.fade_spin = SpinBox(300, 1, 1000, 100)
     millisecond_lablel = Label(_(" ms"))        
     millisecond_lablel.set_size_request(50, 12)
     spin_hbox = gtk.HBox(spacing=3)
     spin_hbox.pack_start(fade_label, False, False)
     spin_hbox.pack_start(self.fade_spin, False, False)
     spin_hbox.pack_start(millisecond_lablel, False, False)
     
     main_table.attach(play_title_label, 0, 2, 0, 1, yoptions=gtk.FILL, xpadding=8)
     main_table.attach(create_separator_box(), 0, 2, 1, 2, yoptions=gtk.FILL)
     main_table.attach(fade_check_hbox, 0, 1, 2, 3, yoptions=gtk.FILL)
     main_table.attach(self.album_check_button, 1, 2, 2, 3, yoptions=gtk.FILL)
     main_table.attach(spin_hbox, 0, 1, 3, 4, yoptions=gtk.FILL, xpadding=8)
     return main_table
开发者ID:andy071001,项目名称:deepin-music-player,代码行数:28,代码来源:preference.py


示例16: pause_job

 def pause_job(self, widget):    
     value = self.jobs_view.playpause_jobs()
     if value:
         if widget.label == _("Pause"):
             widget.label = (_("Continue"))
         else:    
             widget.label = (_("Pause"))
开发者ID:electricface,项目名称:deepin-music-player,代码行数:7,代码来源:converter.py


示例17: draw_lyrics

    def draw_lyrics(self, widget, event):
        cr = widget.window.cairo_create()
        rect = widget.allocation
        font_height = self.render_lyrics.get_font_height()
        xpos = rect.x + 5
        ypos = rect.y + 5
        cr.save()
        cr.rectangle(xpos, ypos, rect.width, rect.height)
        cr.clip()
        cr.set_operator(cairo.OPERATOR_OVER)
        
        # draw_active
        cr.save()
        cr.rectangle(xpos, ypos, rect.width * 0.5, rect.height)
        cr.clip()
        active_surface = self.draw_lyric_surface(_("Deepin Music Player"), True)
        if active_surface:
            cr.set_source_surface(active_surface, xpos, ypos)
            cr.paint()
        cr.restore()    
        
        # draw_inactive
        cr.save()
        cr.rectangle(xpos + rect.width * 0.5, ypos, rect.width*0.5, rect.height)
        cr.clip()
        inactive_surface = self.draw_lyric_surface(_("Deepin Music Player"))
        if inactive_surface:
            cr.set_source_surface(inactive_surface, xpos, ypos)
            cr.paint()
        cr.restore()    
        
        cr.restore()

        return False
开发者ID:andy071001,项目名称:deepin-music-player,代码行数:34,代码来源:preference.py


示例18: init

    def init(self, connection):
        if connection == None:
            self.connection_type = None
        else:
            self.connection = connection
            mobile_type = connection.get_setting("connection").type
            self.connection_type = mobile_type
        Dispatcher.send_submodule_crumb(_("Region"), 2)

        from mm.provider import ServiceProviders
        self.__sp = ServiceProviders()
        self.country_list = self.__sp.get_country_name_list()
        self.country_tree.delete_all_items()
        self.country_tree.add_items([CountryItem(_(country)) for country in self.country_list])
        # add a bottom line for last item

        code = self.__sp.get_country_from_timezone()

        self.country_codes = self.__sp.get_country_list()
        try:
            selected_country = self.country_tree.visible_items[self.country_codes.index(code)]
            self.country_tree.select_items([selected_country])
            self.auto_scroll_to()
            self.country_tree.emit("button-press-item", selected_country, 0, 1, 1)
        except:
            pass
开发者ID:electricface,项目名称:deepin-system-settings,代码行数:26,代码来源:regions.py


示例19: __toggled

    def __toggled(self, widget, argv):
        if argv == "auto_time_toggle":
            is_auto_set_time = widget.get_active()
            self.datetime_settings.set_boolean("is-auto-set", is_auto_set_time)
            if is_auto_set_time:
                self.__send_message("status", ("date_time", _("Time will be synchronized with an Internet time server")))
                self.set_time_spin_align.set_child_visible(False)
                gobject.timeout_add_seconds(3, self.__set_using_ntp, True)
            else:
                self.__send_message("status", ("date_time", _("Time will not be synchronized with an Internet time server")))
                self.set_time_spin_align.set_child_visible(True)
                if self.__toggle_id:
                    gobject.source_remove(self.__toggle_id)
                self.__toggle_id = gobject.timeout_add_seconds(3, self.__set_using_ntp, False)
            return

        if argv == "time_display_toggle":
            self.is_24hour = widget.get_active()
            if self.is_24hour:
                self.__send_message("status", ("date_time", _("Time will be shown in 24 hour format")))
            else:
                self.__send_message("status", ("date_time", _("Time will be shown in 12 hour format")))
            self.datetime_settings.set_boolean("is-24hour", self.is_24hour)
            self.datetime_widget.set_is_24hour(self.is_24hour)
            self.set_time_spin.set_24hour(self.is_24hour)
开发者ID:electricface,项目名称:deepin-system-settings,代码行数:25,代码来源:date_time_view.py


示例20: __init_navigatebar

 def __init_navigatebar(self):
     self.navigatebar = TreeView(enable_drag_drop=False, enable_multiple_select=False)
     self.navigatebar.connect("single-click-item", self.on_navigatebar_single_click)
     self.navigatebar.set_size_request(132, -1)
     self.navigatebar.draw_mask = self.on_navigatebar_draw_mask
     
     local_expand_item = ExpandItem(_("Library"))
     network_expand_item = ExpandItem(_("Internet"))
     self.navigatebar.add_items([local_expand_item, 
                                 network_expand_item, 
                                ])
     local_expand_item.add_childs([
         (FavoritesTitle, self.favorites_page),
         (LocalWallpapersTitle, self.pictures_page),
         ],
         expand=True)
     network_expand_item.add_childs([(_("360 Wallpaper"), self.bizhi360_cache_page), 
                                     (_("LoveWallpaper"), self.aibizhi_cache_page),
                                    ], expand=True)        
     
     if get_favorite_number() == 0:
         self.navigatebar.set_highlight_item(self.navigatebar.get_items()[2])
         self.switch_page.add(self.pictures_page)
     else:
         self.navigatebar.set_highlight_item(self.navigatebar.get_items()[1])
         self.switch_page.add(self.favorites_page)
开发者ID:electricface,项目名称:deepin-system-settings,代码行数:26,代码来源:local_page.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python nltk.batch_ne_chunk函数代码示例发布时间:2022-05-27
下一篇:
Python taggers.load_network函数代码示例发布时间: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