示例#1
0
文件: project.py 项目: merbst/QIdle
    def _on_tv_activated(self, index):
        def is_binary_string(path):
            textchars = (bytearray([7, 8, 9, 10, 12, 13, 27]) +
                         bytearray(range(0x20, 0x100)))
            check_if_binary = lambda bytes: bool(
                bytes.translate(None, textchars))
            with open(path, 'rb') as f:
                return check_if_binary(f.read())

        path = self.ui.fsTree.filePath(index)
        if os.path.isfile(path):
            if is_binary_string(path):
                QtWidgets.QDesktopServices.openUrl(QtCore.QUrl(path))
            else:
                self._open_document(path)
示例#2
0
 def _show_python_docs(self):
     _logger(self).info('opening python docs in the default browser')
     QtGui.QDesktopServices.openUrl(
         QtCore.QUrl('https://docs.python.org/3/'))
示例#3
0
 def show_help_contents(self):
     """
     Opens help_url in the default browser
     """
     QtGui.QDesktopServices.openUrl(QtCore.QUrl(self.help_url))