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


Python Gedit.utils_location_has_file_scheme方法代码示例

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


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

示例1: on_open_dev_file

# 需要导入模块: from gi.repository import Gedit [as 别名]
# 或者: from gi.repository.Gedit import utils_location_has_file_scheme [as 别名]
 def on_open_dev_file(self, action):
     doc = self.window.get_active_document()
     if doc is None:
         return None
     location = doc.get_location()
     if location is not None and Gedit.utils_location_has_file_scheme(location):
         self.__lang.evaluate("thisProcess.platform.devLoc(\""+location.get_path()+"\").openTextFile", silent=True)
开发者ID:2mc,项目名称:supercollider,代码行数:9,代码来源:supercollider.py

示例2: env_get_documents_path

# 需要导入模块: from gi.repository import Gedit [as 别名]
# 或者: from gi.repository.Gedit import utils_location_has_file_scheme [as 别名]
        def env_get_documents_path(self, buf):
                toplevel = self.view.get_toplevel()

                if isinstance(toplevel, Gedit.Window):
                        documents_location = [doc.get_location()
                                              for doc in toplevel.get_documents()
                                              if doc.get_location() is not None]

                        documents_path = [location.get_path()
                                          for location in documents_location
                                          if Gedit.utils_location_has_file_scheme(location)]
                else:
                        documents_path = []

                return ' '.join(documents_path)
开发者ID:Alberto-Beralix,项目名称:Beralix,代码行数:17,代码来源:document.py

示例3: import_snippets

# 需要导入模块: from gi.repository import Gedit [as 别名]
# 或者: from gi.repository.Gedit import utils_location_has_file_scheme [as 别名]
        def import_snippets(self, files):
                success = True

                for gfile in files:
                        if not Gedit.utils_location_has_file_scheme(gfile):
                                continue

                        # Remove file://
                        filename = gfile.get_path()

                        importer = Importer(filename)
                        error = importer.run()

                        if error:
                                message = _('The following error occurred while importing: %s') % error
                                success = False
                                message_dialog(self.get_toplevel(), Gtk.MessageType.ERROR, message)

                self.build_model(True)

                if success:
                        message = _('Import successfully completed')
                        message_dialog(self.get_toplevel(), Gtk.MessageType.INFO, message)
开发者ID:Alberto-Beralix,项目名称:Beralix,代码行数:25,代码来源:manager.py

示例4: apply_uri_snippet

# 需要导入模块: from gi.repository import Gedit [as 别名]
# 或者: from gi.repository.Gedit import utils_location_has_file_scheme [as 别名]
        def apply_uri_snippet(self, snippet, mime, uri):
                # Remove file scheme
                gfile = Gio.file_new_for_uri(uri)
                pathname = ''
                dirname = ''
                ruri = ''

                if Gedit.utils_location_has_file_scheme(gfile):
                        pathname = gfile.get_path()
                        dirname = gfile.get_parent().get_path()

                name = gfile.get_basename()
                scheme = gfile.get_uri_scheme()

                os.environ['GEDIT_DROP_DOCUMENT_URI'] = uri
                os.environ['GEDIT_DROP_DOCUMENT_NAME'] = name
                os.environ['GEDIT_DROP_DOCUMENT_SCHEME'] = scheme
                os.environ['GEDIT_DROP_DOCUMENT_PATH'] = pathname
                os.environ['GEDIT_DROP_DOCUMENT_DIR'] = dirname
                os.environ['GEDIT_DROP_DOCUMENT_TYPE'] = mime

                buf = self.view.get_buffer()
                location = buf.get_location()
                if location:
                        ruri = location.get_uri()

                relpath = self.relative_path(ruri, uri, mime)

                os.environ['GEDIT_DROP_DOCUMENT_RELATIVE_PATH'] = relpath

                mark = buf.get_mark('gtk_drag_target')

                if not mark:
                        mark = buf.get_insert()

                piter = buf.get_iter_at_mark(mark)
                self.apply_snippet(snippet, piter, piter)
开发者ID:Alberto-Beralix,项目名称:Beralix,代码行数:39,代码来源:document.py


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