def createTorrent(self):
if os.path.isfile(self.inputEdit.text()):
save_fn = os.path.splitext(
os.path.split(self.inputEdit.text())[1])[0] + '.torrent'
else:
save_fn = self.inputEdit.text().split(os.sep)[-1] + '.torrent'
if self.last_output_dir and os.path.exists(self.last_output_dir):
save_fn = os.path.join(self.last_output_dir, save_fn)
fn = QtWidgets.QFileDialog.getSaveFileName(
self.MainWindow, 'Save torrent', save_fn,
filter=('Torrent file (*.torrent)'))[0]
if fn:
self.last_output_dir = os.path.split(fn)[0]
self.creation_thread = CreateTorrentQThread(
self.torrent,
fn)
self.creation_thread.started.connect(
self.creation_started)
self.creation_thread.progress_update.connect(
self._progress_update)
self.creation_thread.finished.connect(
self.creation_finished)
self.creation_thread.onError.connect(
self._showError)
self.creation_thread.start()
评论列表
文章目录