コード例 #1
0
ファイル: pathcompleter.py プロジェクト: hlamer/completer
    def _formatPath(self, path, isDir):
        """Format file or directory for show it in the list of completions
        """
        path = os.path.basename(path)
        if isDir:
            path += '/'

        typedLen = self._lastTypedSegmentLength()
        inline = self.inline()
        typedLenPlusInline = typedLen + len(self.inline())
        return '<b>%s</b><u>%s</u>%s' % \
            (htmlEscape(path[:typedLen]),
             htmlEscape(path[typedLen:typedLenPlusInline]),
             htmlEscape(path[typedLenPlusInline:]))
コード例 #2
0
ファイル: pathcompleter.py プロジェクト: hlamer/completer
 def text(self, row, column):
     """Item text in the list of completions
     """
     rowType, index = self._classifyRowIndex(row)
     if rowType == self._ERROR:
         return '<font color=red>%s</font>' % htmlEscape(self._error)
     elif rowType == self._HEADER:
         return self._formatHeader(self._headerText())
     elif rowType == self._STATUS:
         return '<i>%s</i>' % htmlEscape(self._status)
     elif rowType == self._DIRECTORY:
         return self._formatPath(self._dirs[index], True)
     elif rowType == self._FILE:
         return self._formatPath(self._files[index], False)
コード例 #3
0
ファイル: pathcompleter.py プロジェクト: hlamer/completer
 def _formatHeader(self, text):
     """Format current directory for show it in the list of completions
     """
     return '<font style="background-color: %s; color: %s">%s</font>' % \
             (qApp.palette().color(QPalette.Window).name(),
              qApp.palette().color(QPalette.WindowText).name(),
              htmlEscape(text))