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


Python Gedit.commands_load_location方法代码示例

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


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

示例1: _on_row_activated

# 需要导入模块: from gi.repository import Gedit [as 别名]
# 或者: from gi.repository.Gedit import commands_load_location [as 别名]
 def _on_row_activated(self, tree, path, column):
     model = tree.get_model()
     i = model.get_iter(path)
     if model.iter_has_child(i):
         if tree.row_expanded(path):
             tree.collapse_row(path)
         else:
             tree.expand_row(path, False)
     else:
         info = model.get(i, 2, 3)
         if info[1] != Gio.FileType.DIRECTORY:
             Gedit.commands_load_location(self.window, 
                 info[0], None, -1, -1)
开发者ID:chuchiperriman,项目名称:gedit-stproject,代码行数:15,代码来源:panel.py

示例2: on_view_button_press_event

# 需要导入模块: from gi.repository import Gedit [as 别名]
# 或者: from gi.repository.Gedit import commands_load_location [as 别名]
    def on_view_button_press_event(self, view, event):
        if event.button != 1 or event.type != Gdk.BUTTON_PRESS or \
           event.window != view.get_window(Gtk.TextWindowType.TEXT):
            return False

        link = self.get_link_at_location(view, int(event.x), int(event.y))
        if link is None:
            return False

        gfile = self.file_lookup.lookup(link.path)

        if gfile:
            Gedit.commands_load_location(self.window, gfile, None, link.line_nr, -1)
            GObject.idle_add(self.idle_grab_focus)
开发者ID:Alberto-Beralix,项目名称:Beralix,代码行数:16,代码来源:outputpanel.py

示例3: _edit_command

# 需要导入模块: from gi.repository import Gedit [as 别名]
# 或者: from gi.repository.Gedit import commands_load_location [as 别名]
def _edit_command(view, mod, func=None):
    try:
        location = Gio.file_new_for_path(inspect.getsourcefile(mod))
    except:
        return False

    if not func:
        Gedit.commands_load_location(view.get_toplevel(), location, None, 0, 0)
    else:
        try:
            lines = inspect.getsourcelines(func)
            line = lines[-1]
        except:
            line = 0

        Gedit.commands_load_location(view.get_toplevel(), location, None, line, 0)

    return True
开发者ID:GNOME,项目名称:gedit-plugins,代码行数:20,代码来源:edit.py

示例4: _open_file

# 需要导入模块: from gi.repository import Gedit [as 别名]
# 或者: from gi.repository.Gedit import commands_load_location [as 别名]
 def _open_file( self, filename ):
     uri = self._rootdir + "/" + pathname2url(filename)
     openfile = Gio.file_new_for_uri(uri)
     Gedit.commands_load_location(self._window, openfile, self._encoding, -1, -1)
开发者ID:imaginabit,项目名称:gmate,代码行数:6,代码来源:fuzzyopen.py

示例5: on_activated

# 需要导入模块: from gi.repository import Gedit [as 别名]
# 或者: from gi.repository.Gedit import commands_load_location [as 别名]
 def on_activated(self, gfile, user_data=None):
     Gedit.commands_load_location(self.window, gfile, None, -1, -1)
     return True
开发者ID:AqibAhmedJ,项目名称:gedit,代码行数:5,代码来源:__init__.py

示例6: on_reopen_action_activate

# 需要导入模块: from gi.repository import Gedit [as 别名]
# 或者: from gi.repository.Gedit import commands_load_location [as 别名]
	def on_reopen_action_activate(self, action, window, summary):
		# line and column pos start from 1, for some reason
		Gedit.commands_load_location(
			window, summary['location'], summary['encoding'],
			summary['line_pos'] + 1, summary['column_pos'] + 1)
开发者ID:jefferyto,项目名称:gedit-necronomicon,代码行数:7,代码来源:__init__.py

示例7: open_uri

# 需要导入模块: from gi.repository import Gedit [as 别名]
# 或者: from gi.repository.Gedit import commands_load_location [as 别名]
 def open_uri(widget, row, cell):
     Gedit.commands_load_location(self._window,
         Gio.file_new_for_uri(widget.model[row][4].get_property("uri")),
             None, 0, 0)
开发者ID:autumnust,项目名称:gedit-plugins,代码行数:6,代码来源:dashboard.py

示例8: open

# 需要导入模块: from gi.repository import Gedit [as 别名]
# 或者: from gi.repository.Gedit import commands_load_location [as 别名]
 def open(self, item):
     Gedit.commands_load_location(self._window,
         item._file_object, None, -1, -1)
开发者ID:autumnust,项目名称:gedit-plugins,代码行数:5,代码来源:dashboard.py

示例9: on_editproject_action_activate

# 需要导入模块: from gi.repository import Gedit [as 别名]
# 或者: from gi.repository.Gedit import commands_load_location [as 别名]
 def on_editproject_action_activate(self, action, data=None):
     Gedit.commands_load_location(self.window, 
         Gio.File.new_for_path(self._project.get_path()), None, -1, -1)
开发者ID:chuchiperriman,项目名称:gedit-stproject,代码行数:5,代码来源:panel.py

示例10: action_handler

# 需要导入模块: from gi.repository import Gedit [as 别名]
# 或者: from gi.repository.Gedit import commands_load_location [as 别名]

#.........这里部分代码省略.........
                if not vi:
                    return
                vi.delete_selection()
            elif curr_action == "select_all":
                vi = self.view
                if not vi:
                    return
                vi.select_all()
            elif curr_action == "sentence_end":
                self.inserttext('. ')
            elif curr_action == "line_end":
                self.inserttext('\n')
            elif curr_action == "delete_line":
                doc = self.document
                if not doc:
                    return
                for _ in range(num):
                    doc.begin_user_action()
                    ei = self.get_cursor_position(doc)
                    si = self.get_cursor_position(doc)
                    si.set_line(ei.get_line())
                    ei.forward_to_line_end()
                    doc.delete(si, ei)
                    doc.end_user_action()
            elif curr_action == "delete_sentence":
                doc = self.document
                if not doc:
                    return
                for _ in range(num):
                    doc.begin_user_action()
                    ei = self.get_cursor_position(doc)
                    si = self.get_cursor_position(doc)
                    if not si.starts_sentence():
                        si.backward_sentence_start()
                    si.backward_char()
                    ei.forward_sentence_end()
                    doc.delete(si, ei)
                    doc.end_user_action()
            elif curr_action == "delete_word":
                doc = self.document
                if not doc:
                    return
                for _ in range(num):
                    doc.begin_user_action()
                    ei = self.get_cursor_position(doc)
                    si = self.get_cursor_position(doc)
                    si.backward_word_start()
                    si.backward_char()
                    ei.forward_word_end()
                    doc.delete(si, ei)
                    doc.end_user_action()
            elif curr_action == "clear_document":
                doc = self.document
                if not doc:
                    return
                doc.begin_user_action()
                doc.set_text('')
                doc.end_user_action()
            elif curr_action == "new_document":
                self.window.create_tab(True)
            elif curr_action == "save_document":
                doc = self.document
                if not doc:
                    return
                Gedit.commands_save_document(self.window, doc)
            elif curr_action == "save_as_document":
                # get complete text from current document
                doc = self.document
                txt = doc.get_text(doc.get_start_iter(), doc.get_end_iter(), False)
                gfile_path = FileSaveAsDialog(self.window).file_dialog_handler(txt)
                if gfile_path is not None:
                    # the file has been created by above function and we load it
                    Gedit.commands_load_location(self.window, gfile_path, None, 0, 0)
            elif curr_action == "close_document":
                doc = self.document
                if not doc:
                    return
                tab = self.tab
                if not tab:
                    return
                u_docs = self.window.get_unsaved_documents()
                if self.document not in u_docs:
                    self.window.close_tab(tab)
                else:
                    # to prevent data loss
                    self.bottom_bar_text_set("You might want to save this document before closing it.")
            elif curr_action == "force_close_document":
                tab = self.tab
                if not tab:
                    return
                self.window.close_tab(tab)
            elif curr_action == "exit":
                u_docs = self.window.get_unsaved_documents()
                if len(u_docs) == 0:
                    sys.exit()
                else:
                    self.bottom_bar_text_set("You might want to save all documents before quitting.")
            else:
                self.bottom_bar_text_set("WEIRD STATE! How did you reach this state? O_O")
        return
开发者ID:bossjones,项目名称:Dict-O-nator,代码行数:104,代码来源:actionhandler.py


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