本文整理汇总了Python中gi.repository.Gedit.encoding_get_utf8方法的典型用法代码示例。如果您正苦于以下问题:Python Gedit.encoding_get_utf8方法的具体用法?Python Gedit.encoding_get_utf8怎么用?Python Gedit.encoding_get_utf8使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.Gedit
的用法示例。
在下文中一共展示了Gedit.encoding_get_utf8方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ex_OpenInTab
# 需要导入模块: from gi.repository import Gedit [as 别名]
# 或者: from gi.repository.Gedit import encoding_get_utf8 [as 别名]
def ex_OpenInTab(act, command, result):
fileName = "%s/%s" % (act.fileOps.getCurrentFolder(act), result.group(1))
if not act.vigtk.window.get_active_document().get_uri():
act.vigtk.window.close_tab(act.vigtk.window.get_active_tab())
act.vigtk.window.create_tab_from_uri(fileName, gedit.encoding_get_utf8(), 1, True, True)
示例2: enclist_func
# 需要导入模块: from gi.repository import Gedit [as 别名]
# 或者: from gi.repository.Gedit import encoding_get_utf8 [as 别名]
# TODO:
# fix document_loaded: assertion `(tab->priv->state == GEDIT_TAB_STATE_LOADING) || (tab->priv->state == GEDIT_TAB_STATE_REVERTING)' failed
from gettext import gettext as _
from gi.repository import GObject, Gtk, Gio, Gedit
import functools
# All encodings names
enclist_func = lambda i=0: [Gedit.encoding_get_from_index(i)] + enclist_func(i+1) if Gedit.encoding_get_from_index(i) else []
shown_enc = Gio.Settings.new("org.gnome.gedit.preferences.encodings").get_strv("shown-in-menu")
# show the full list of encodings if not they not configured in the Open/Save Dialog
enclist = sorted(([Gedit.encoding_get_from_charset(encname) for encname in shown_enc]
if shown_enc else enclist_func())
+ [Gedit.encoding_get_utf8()], key=lambda enc: enc.to_string())
ui_str = """<ui>
<menubar name="MenuBar">
<menu name="FileMenu" action="File">
<placeholder name="FileOps_2">
<menu name="FileEncodingMenu" action="FileEncoding">
<placeholder name="EncodingListHolder"/>
<separator/>
%s
</menu>
</placeholder>
</menu>
</menubar>
</ui>
""" % "\n".join(["<menuitem name=\"Encoding%i\" action=\"Encoding%i\"/>" % (i, i) for i in range(len(enclist))])