def fileContextMenu(self):
        '''
        创建右键菜单
        '''
        # 必须将ContextMenuPolicy设置为Qt.CustomContextMenu
        # 否则无法使用customContextMenuRequested信号
        self.treeWidget_2.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.treeWidget_2.customContextMenuRequested.connect(
            self.showContextMenu)

        # 创建QMenu
        self.contextMenu = QtWidgets.QMenu(self)
        self.file_update = self.contextMenu.addAction(u'更新')
        self.file_upload = self.contextMenu.addAction(u'上传')
        self.file_download = self.contextMenu.addAction(u'下载')
        self.file_delete = self.contextMenu.addAction(u'删除')
        self.file_rename = self.contextMenu.addAction(u'重命名')

        # 将动作与处理函数相关联
        # 这里为了简单,将所有action与同一个处理函数相关联,
        # 当然也可以将他们分别与不同函数关联,实现不同的功能
        self.file_update.triggered.connect(self.File_update)
        self.file_upload.triggered.connect(self.File_upload)
        self.file_download.triggered.connect(self.File_download)
        self.file_delete.triggered.connect(self.File_delete)
    def createContextMenu(self):
        # 创建右键菜单
        # 必须将ContextMenuPolicy设置为Qt.CustomContextMenu
        # 否则无法使用customContextMenuRequested信号

        self.listWidget.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.listWidget.customContextMenuRequested.connect(
            self.showContextMenu)
        # 创建QMenu
        self.contextMenu = QtWidgets.QMenu(self)
        self.connect_shell_button = self.contextMenu.addAction(u'连接')
        self.add_shell_button = self.contextMenu.addAction(u'添加')
        self.modify_shell_button = self.contextMenu.addAction(u'编辑')
        self.delete_shell_button = self.contextMenu.addAction(u'删除')
        self.delete_all_shell_button = self.contextMenu.addAction(u'清空')

        # 将动作与处理函数相关联,
        # 将他们分别与不同函数关联,实现不同的功能
        self.connect_shell_button.triggered.connect(self.Connect_shell)
        self.add_shell_button.triggered.connect(self.Add_shell_show)
        self.modify_shell_button.triggered.connect(self.Modify_shell)
        self.delete_shell_button.triggered.connect(self.Delete_shell)
        self.delete_all_shell_button.triggered.connect(self.Delete_all_shell)