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


Python Gedit.encoding_get_current方法代码示例

本文整理汇总了Python中gi.repository.Gedit.encoding_get_current方法的典型用法代码示例。如果您正苦于以下问题:Python Gedit.encoding_get_current方法的具体用法?Python Gedit.encoding_get_current怎么用?Python Gedit.encoding_get_current使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gi.repository.Gedit的用法示例。


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

示例1: on_navigation_request

# 需要导入模块: from gi.repository import Gedit [as 别名]
# 或者: from gi.repository.Gedit import encoding_get_current [as 别名]
 def on_navigation_request(self, page, frame, request):
     file_uri = None
     uri = request.get_uri()
     gp = self.mt.search(uri)
     if gp:
         file_uri = "file://%s" % gp.group("file")
         line_number = gp.group("line")
         if file_uri:
             # Test if document is already open
             for doc in self.window.get_documents():
                 doc_uri = "file://%s" % doc.get_uri_for_display()
                 if doc_uri == file_uri:
                     tab = Gedit.Tab.get_from_document(doc)
                     view = tab.get_view()
                     self.window.set_active_tab(tab)
                     doc.goto_line(int(line_number))
                     view.scroll_to_cursor()
                     self.todo_window.hide()
                     return 1
             # Document isn't open, create a new tab from uri
             file_uri = Gio.file_new_for_uri(file_uri)
             self.window.create_tab_from_location(
                 file_uri, Gedit.encoding_get_current(), int(line_number), 0, False, True
             )
             self.todo_window.hide()
             return 1
     else:
         # self.todo_window.hide()
         return 0
开发者ID:niftylettuce,项目名称:gedit-todo,代码行数:31,代码来源:__init__.py

示例2: __init__

# 需要导入模块: from gi.repository import Gedit [as 别名]
# 或者: from gi.repository.Gedit import encoding_get_current [as 别名]
    def __init__(self, plugin, window):
        self.window = window
        self.plugin = plugin

        self.document_list = []

        self.ui_id = None

        self.action_toggle_orientation = Gtk.Action(name="ToggleSplitViewOrientation",
            label="Toggle Split View Orientation",
            tooltip="Switch between horizontal and vertical splits", 
            stock_id=Gtk.STOCK_REFRESH)

        self.action_toggle_orientation.connect("activate", self.toggle_orientation)
        self.action_toggle_orientation.set_visible(False)

        # Add a "toggle split view" item to the View menu
        self.insert_menu_item(window)

        # We're going to keep track of each tab's split view. We'll
        # index each dictionary via the tab objects.
        self.split_views = {}

        self.tabs_already_using_splitview = []

        self.current_orientation = "horizontal"

        # I hardly even know how this works, but it gets our encoding.
        try: self.encoding = Gedit.encoding_get_current()
        except: self.encoding = Gedit.gedit_encoding_get_current()
开发者ID:JacekPliszka,项目名称:GeditSplitView,代码行数:32,代码来源:SplitView.py

示例3: click

# 需要导入模块: from gi.repository import Gedit [as 别名]
# 或者: from gi.repository.Gedit import encoding_get_current [as 别名]
 def click(self, eventbox, event):
   for doc in self.window.get_documents():
     if 'file://'+doc.get_uri_for_display() == self.file:
       tab = Gedit.Tab.get_from_document(doc)
       view = tab.get_view()
       self.window.set_active_tab(tab)
       doc.goto_line(self.line)
       view.scroll_to_cursor()
       return
   file_uri = Gio.file_new_for_uri(self.file)
   self.window.create_tab_from_location(file_uri,
                                        Gedit.encoding_get_current(),
                                        self.line, 0, False, True)
开发者ID:andy29485,项目名称:todo-panel,代码行数:15,代码来源:widget.py

示例4: __init__

# 需要导入模块: from gi.repository import Gedit [as 别名]
# 或者: from gi.repository.Gedit import encoding_get_current [as 别名]
 def __init__(self, plugin):
     self._window = plugin.window
     self._plugin = plugin
     self._encoding = Gedit.encoding_get_current()
     self._rootpath = os.getcwd()
     self._rootdir = "file://" + self._rootpath
     self._show_hidden = False
     self._suggestion = None
     self._git = True
     self._liststore = None
     self._last_pattern = ""
     self._init_glade()
     self._insert_menu()
     self.connect_to_fb_bus()
开发者ID:imaginabit,项目名称:gmate,代码行数:16,代码来源:fuzzyopen.py

示例5: activate_tab

# 需要导入模块: from gi.repository import Gedit [as 别名]
# 或者: from gi.repository.Gedit import encoding_get_current [as 别名]
    def activate_tab(self, file):
        """
        Activate the GeditTab containing the given File or open a new
        tab for it (this is called by the WindowContext)

        @param file: a File object
        """
        for tab, tab_decorator in self._tab_decorators.iteritems():
            if tab_decorator.file and tab_decorator.file == file:
                self.window.set_active_tab(tab)
                return

        # not found, open file in a new tab...

        uri = file.uri
        gfile = Gio.file_new_for_uri(uri)

        if Gedit.utils_is_valid_location(gfile):
            LOG.debug("GeditWindow.create_tab_from_uri(%s)" % uri)
            self.window.create_tab_from_location(
                            gfile, Gedit.encoding_get_current(),
                            1, 1, False, True)
        else:
            LOG.error("Gedit.utils.uri_is_valid(%s) = False" % uri)
开发者ID:Sbte,项目名称:gedit-latex,代码行数:26,代码来源:windowactivatable.py

示例6: to_utf8

# 需要导入模块: from gi.repository import Gedit [as 别名]
# 或者: from gi.repository.Gedit import encoding_get_current [as 别名]
 def to_utf8(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_current(), 0, 0, False)
开发者ID:xxcombat,项目名称:linux,代码行数:7,代码来源:mencode.py

示例7: __init__

# 需要导入模块: from gi.repository import Gedit [as 别名]
# 或者: from gi.repository.Gedit import encoding_get_current [as 别名]
    def __init__(self, geditwindow):
        GObject.GObject.__init__(self)

        # We have to use .geditwindow specifically here
        #(self.window won't work)
        self.window = geditwindow

        # Save the document's encoding in a variable for later use
        #(when opening new tabs)
        try:
            self.encoding = Gedit.encoding_get_current()
        except:
            self.encoding = Gedit.gedit_encoding_get_current()

        # Preferences (we'll control them with toggled checkboxes)
        self.ignore_comments = False
        self.case_sensitive = False
        self.scan_logs = False

        # We save the grep search result data in a ListStore
        # Format:  ID (COUNT)  |  FILE (without path)
        # |  LINE  |  FILE (with path)
        #    Note: We use the full-path version when opening new tabs
        #(when necessary)
        self.search_data = Gtk.ListStore(str, str, str, str)

        # Create a list (a "tree view" without children) to display the results
        self.results_list = Gtk.TreeView(self.search_data)

        # Get the selection attribute of the results_list and assign
        # a couple of properties
        tree_selection = self.results_list.get_selection()

        # Properties...
        tree_selection.set_mode(Gtk.SelectionMode.SINGLE)
        tree_selection.connect("changed", self.view_result)

        # Create the cells for our results list treeview
        #   Note:  We don't need to create a cell or text renderer
        #          for the full-path filename variable because we
        #          won't actually be displaying that information.
        cell_id = Gtk.TreeViewColumn("#")
        cell_line_number = Gtk.TreeViewColumn("Line")
        cell_filename = Gtk.TreeViewColumn("File")

        # Now add the cell objects to the results_list treeview object
        self.results_list.append_column(cell_id)
        self.results_list.append_column(cell_line_number)
        self.results_list.append_column(cell_filename)

        # Create text-rendering objects so that we can actually
        # see the data that we'll put into the objects
        text_renderer_id = Gtk.CellRendererText()
        text_renderer_filename = Gtk.CellRendererText()
        text_renderer_line_number = Gtk.CellRendererText()

        # Pack the text renderer objects into the cell objects we created
        cell_id.pack_start(text_renderer_id, True)
        cell_filename.pack_start(text_renderer_filename, True)
        cell_line_number.pack_start(text_renderer_line_number, True)

        # Now set the IDs to each of the text renderer objects and
        # set them to "text" mode
        cell_id.add_attribute(text_renderer_id, "text", 0)
        cell_filename.add_attribute(text_renderer_filename, "text", 1)
        cell_line_number.add_attribute(text_renderer_line_number, "text", 2)

        # Create a scrolling window object and add
        # our results_list treeview object to it
        scrolled_window = Gtk.ScrolledWindow()
        scrolled_window.add(self.results_list)

        # Pack in the scrolled window object
        self.pack_start(scrolled_window, True, True, 0)

        # Create a "Find" button; we'll pack it into an HBox in a moment...
        button_find = Gtk.Button("Find")
        button_find.connect("clicked", self.button_press)
        # Create a "search bar" to type the search string into; we'll pack it
        # into the HBox as well...
        self.search_form = Gtk.Entry()
        self.search_form.connect("activate", self.button_press)

        # Here's the HBox I mentioned...
        search_box = Gtk.HBox(False, 0)
        search_box.pack_start(self.search_form, False, False, 0)
        search_box.pack_start(button_find, False, False, 0)

        # Pack the search box (search bar + Find button) into the side panel
        self.pack_start(search_box, False, False, 0)

        # Create a check box to decide whether or not to ignore comments
        self.check_ignore = Gtk.CheckButton("Ignore comments")
        self.check_ignore.connect("toggled", self.toggle_ignore)
        # Pack it in...
        self.pack_start(self.check_ignore, False, False, 0)

        # Create a check box to determine whether to pay attention to case
        self.check_case = Gtk.CheckButton("Case Sensitive")
        self.check_case.connect("toggled", self.toggle_case)
#.........这里部分代码省略.........
开发者ID:ShaunaGordon,项目名称:gmate,代码行数:103,代码来源:FindInFiles.py


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