Added ability to open the export folder. Makes it easier when testing instead of browsing like a sucker.
This commit is contained in:
parent
7bb701ebf5
commit
7a3e98b769
3 changed files with 24 additions and 1 deletions
BIN
files/images/folder_open.png
Normal file
BIN
files/images/folder_open.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 855 B |
15
main.py
15
main.py
|
|
@ -1,4 +1,4 @@
|
||||||
from utils import zip_files, join_files, log, get_temp_dir
|
from utils import zip_files, join_files, log, get_temp_dir, open_folder_in_explorer
|
||||||
|
|
||||||
import urllib2, re
|
import urllib2, re
|
||||||
import sys, os, glob, json, re, shutil, stat, tarfile
|
import sys, os, glob, json, re, shutil, stat, tarfile
|
||||||
|
|
@ -320,6 +320,9 @@ class MainWindow(QtGui.QWidget):
|
||||||
self.get_files_to_download()
|
self.get_files_to_download()
|
||||||
self.try_to_download_files()
|
self.try_to_download_files()
|
||||||
|
|
||||||
|
def open_export(self, open_export_button):
|
||||||
|
open_folder_in_explorer(self.outputDir())
|
||||||
|
|
||||||
def delete_files_if_forced(self):
|
def delete_files_if_forced(self):
|
||||||
forced = self.getSetting('force_download').value
|
forced = self.getSetting('force_download').value
|
||||||
|
|
||||||
|
|
@ -439,10 +442,18 @@ class MainWindow(QtGui.QWidget):
|
||||||
cancel_button = QtGui.QPushButton('Cancel Download')
|
cancel_button = QtGui.QPushButton('Cancel Download')
|
||||||
cancel_button.setEnabled(False)
|
cancel_button.setEnabled(False)
|
||||||
|
|
||||||
|
open_export_button = QtGui.QPushButton()
|
||||||
|
open_export_button.setEnabled(False)
|
||||||
|
open_export_button.setIcon(QtGui.QIcon(os.path.join('files','images','folder_open.png')))
|
||||||
|
open_export_button.setToolTip('Open Export Folder')
|
||||||
|
open_export_button.setMaximumWidth(30)
|
||||||
|
|
||||||
ex_button.clicked.connect(self.callWithObject('export', ex_button, cancel_button))
|
ex_button.clicked.connect(self.callWithObject('export', ex_button, cancel_button))
|
||||||
cancel_button.clicked.connect(self.cancelDownload)
|
cancel_button.clicked.connect(self.cancelDownload)
|
||||||
|
open_export_button.clicked.connect(self.callWithObject('open_export', open_export_button))
|
||||||
|
|
||||||
buttonBox = QtGui.QDialogButtonBox()
|
buttonBox = QtGui.QDialogButtonBox()
|
||||||
|
buttonBox.addButton(open_export_button, QtGui.QDialogButtonBox.NoRole)
|
||||||
buttonBox.addButton(cancel_button, QtGui.QDialogButtonBox.RejectRole)
|
buttonBox.addButton(cancel_button, QtGui.QDialogButtonBox.RejectRole)
|
||||||
buttonBox.addButton(ex_button, QtGui.QDialogButtonBox.AcceptRole)
|
buttonBox.addButton(ex_button, QtGui.QDialogButtonBox.AcceptRole)
|
||||||
|
|
||||||
|
|
@ -452,6 +463,7 @@ class MainWindow(QtGui.QWidget):
|
||||||
self.progress_label = progress_label
|
self.progress_label = progress_label
|
||||||
self.progress_bar = progress_bar
|
self.progress_bar = progress_bar
|
||||||
self.cancel_button = cancel_button
|
self.cancel_button = cancel_button
|
||||||
|
self.open_export_button = open_export_button
|
||||||
|
|
||||||
http = QHttp(self)
|
http = QHttp(self)
|
||||||
http.requestFinished.connect(self.httpRequestFinished)
|
http.requestFinished.connect(self.httpRequestFinished)
|
||||||
|
|
@ -754,6 +766,7 @@ class MainWindow(QtGui.QWidget):
|
||||||
title_input.setText(proj_name)
|
title_input.setText(proj_name)
|
||||||
|
|
||||||
self.loadPackageJson()
|
self.loadPackageJson()
|
||||||
|
self.open_export_button.setEnabled(True)
|
||||||
self.update_json = True
|
self.update_json = True
|
||||||
|
|
||||||
def browseOutDir(self):
|
def browseOutDir(self):
|
||||||
|
|
|
||||||
10
utils.py
10
utils.py
|
|
@ -1,6 +1,7 @@
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import os, zipfile, io, platform
|
import os, zipfile, io, platform
|
||||||
import sys, tempfile
|
import sys, tempfile
|
||||||
|
import subprocess
|
||||||
|
|
||||||
DEBUG = False
|
DEBUG = False
|
||||||
|
|
||||||
|
|
@ -14,6 +15,15 @@ def log(*args):
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
print(*args)
|
print(*args)
|
||||||
|
|
||||||
|
|
||||||
|
def open_folder_in_explorer(path):
|
||||||
|
if platform.system() == "Windows":
|
||||||
|
os.startfile(path)
|
||||||
|
elif platform.system() == "Darwin":
|
||||||
|
subprocess.Popen(["open", path])
|
||||||
|
else:
|
||||||
|
subprocess.Popen(["xdg-open", path])
|
||||||
|
|
||||||
def zip_files(zip_file_name, *args, **kwargs):
|
def zip_files(zip_file_name, *args, **kwargs):
|
||||||
zip_file = zipfile.ZipFile(zip_file_name, 'w')
|
zip_file = zipfile.ZipFile(zip_file_name, 'w')
|
||||||
verbose = kwargs.pop('verbose', False)
|
verbose = kwargs.pop('verbose', False)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue