def create_download_bar(self):
hlayout = QtGui.QHBoxLayout()
vlayout = QtGui.QVBoxLayout()
vlayout.setContentsMargins(5, 5, 5, 5)
vlayout.setSpacing(5)
hlayout.setSpacing(5)
hlayout.setContentsMargins(5, 5, 5, 5)
progress_label = QtGui.QLabel('')
progress_bar = QtGui.QProgressBar()
progress_bar.setVisible(False)
progress_bar.setContentsMargins(5, 5, 5, 5)
vlayout.addWidget(progress_label)
vlayout.addWidget(progress_bar)
vlayout.addWidget(QtGui.QLabel(''))
ex_button = QtGui.QPushButton('Export')
ex_button.setEnabled(False)
cancel_button = QtGui.QPushButton('Cancel Download')
cancel_button.setEnabled(False)
open_export_button = QtGui.QPushButton()
open_export_button.setEnabled(False)
open_export_button.setIcon(QtGui.QIcon(get_file('files/images/folder_open.png')))
open_export_button.setToolTip('Open Export Folder')
open_export_button.setStatusTip('Open Export Folder')
open_export_button.setMaximumWidth(30)
open_export_button.setMaximumHeight(30)
ex_button.clicked.connect(self.call_with_object('export', ex_button, cancel_button))
cancel_button.clicked.connect(self.cancel_download)
open_export_button.clicked.connect(self.call_with_object('open_export', open_export_button))
button_box = QtGui.QDialogButtonBox()
button_box.addButton(open_export_button, QtGui.QDialogButtonBox.NoRole)
button_box.addButton(cancel_button, QtGui.QDialogButtonBox.RejectRole)
button_box.addButton(ex_button, QtGui.QDialogButtonBox.AcceptRole)
hlayout.addLayout(vlayout)
hlayout.addWidget(button_box)
self.progress_label = progress_label
self.progress_bar = progress_bar
self.cancel_button = cancel_button
self.open_export_button = open_export_button
http = QHttp(self)
http.sslErrors.connect(self.https_error)
http.requestFinished.connect(self.http_request_finished)
http.dataReadProgress.connect(self.update_progress_bar)
http.responseHeaderReceived.connect(self.read_response_header)
self.http = http
self.ex_button = ex_button
return hlayout
评论列表
文章目录