本文整理汇总了Python中gi.repository.Gedit.encoding_get_from_index方法的典型用法代码示例。如果您正苦于以下问题:Python Gedit.encoding_get_from_index方法的具体用法?Python Gedit.encoding_get_from_index怎么用?Python Gedit.encoding_get_from_index使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.Gedit
的用法示例。
在下文中一共展示了Gedit.encoding_get_from_index方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: while
# 需要导入模块: from gi.repository import Gedit [as 别名]
# 或者: from gi.repository.Gedit import encoding_get_from_index [as 别名]
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# version 1.3
from gi.repository import GObject, Gtk, Gedit, Gio
import functools
import gettext
gettext.install('mencode', unicode=True)
#all codepage list
encs = []
i = 0
enc = Gedit.encoding_get_from_index(i)
while(enc != None):
encs.append(enc)
i = i + 1
enc = Gedit.encoding_get_from_index(i)
#print encs
# list code page name
enclist = []
for enc in encs:
enclist.append(enc.get_charset())
#print enclist
示例2: to_koi8r
# 需要导入模块: from gi.repository import Gedit [as 别名]
# 或者: from gi.repository.Gedit import encoding_get_from_index [as 别名]
def to_koi8r(self, action):
doc = self.window.get_active_document()
if not doc:
return
doc.load(Gio.file_new_for_commandline_arg(doc.get_uri_for_display()), Gedit.encoding_get_from_index(intkoi8r), 0, 0, False)
示例3: enclist_func
# 需要导入模块: from gi.repository import Gedit [as 别名]
# 或者: from gi.repository.Gedit import encoding_get_from_index [as 别名]
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330,
# Boston, MA 02111-1307, USA.
# 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