當前位置: 首頁>>代碼示例>>Python>>正文


Python FileSystemObject.linemode_dict方法代碼示例

本文整理匯總了Python中ranger.container.fsobject.FileSystemObject.linemode_dict方法的典型用法代碼示例。如果您正苦於以下問題:Python FileSystemObject.linemode_dict方法的具體用法?Python FileSystemObject.linemode_dict怎麽用?Python FileSystemObject.linemode_dict使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ranger.container.fsobject.FileSystemObject的用法示例。


在下文中一共展示了FileSystemObject.linemode_dict方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: execute

# 需要導入模塊: from ranger.container.fsobject import FileSystemObject [as 別名]
# 或者: from ranger.container.fsobject.FileSystemObject import linemode_dict [as 別名]
def execute(self):
        import re
        from ranger.container.fsobject import FileSystemObject

        if len(self.args) < 2:
            self.fm.notify("Usage: default_linemode [path=<regexp> | tag=<tag(s)>] <linemode>", bad=True)

        # Extract options like "path=..." or "tag=..." from the command line
        arg1 = self.arg(1)
        method = "always"
        argument = None
        if arg1.startswith("path="):
            method = "path"
            argument = re.compile(arg1[5:])
            self.shift()
        elif arg1.startswith("tag="):
            method = "tag"
            argument = arg1[4:]
            self.shift()

        # Extract and validate the line mode from the command line
        linemode = self.rest(1)
        if linemode not in FileSystemObject.linemode_dict:
            self.fm.notify("Invalid linemode: %s; should be %s" %
                    (linemode, "/".join(FileSystemObject.linemode_dict)), bad=True)

        # Add the prepared entry to the fm.default_linemodes
        entry = [method, argument, linemode]
        self.fm.default_linemodes.appendleft(entry)

        # Redraw the columns
        if hasattr(self.fm.ui, "browser"):
            for col in self.fm.ui.browser.columns:
                col.need_redraw = True 
開發者ID:GuidoFe,項目名稱:myDotFiles,代碼行數:36,代碼來源:commands_full.py

示例2: tab

# 需要導入模塊: from ranger.container.fsobject import FileSystemObject [as 別名]
# 或者: from ranger.container.fsobject.FileSystemObject import linemode_dict [as 別名]
def tab(self, tabnum):
        mode = self.arg(1)
        return (self.arg(0) + " " + linemode
                for linemode in self.fm.thisfile.linemode_dict.keys()
                if linemode.startswith(self.arg(1))) 
開發者ID:GuidoFe,項目名稱:myDotFiles,代碼行數:7,代碼來源:commands_full.py

示例3: tab

# 需要導入模塊: from ranger.container.fsobject import FileSystemObject [as 別名]
# 或者: from ranger.container.fsobject.FileSystemObject import linemode_dict [as 別名]
def tab(self):
        mode = self.arg(1)
        return (self.arg(0) + " " + linemode
                for linemode in self.fm.thisfile.linemode_dict.keys()
                if linemode.startswith(self.arg(1))) 
開發者ID:quanttyo,項目名稱:dotfiles,代碼行數:7,代碼來源:commands_full.py


注:本文中的ranger.container.fsobject.FileSystemObject.linemode_dict方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。