mirror of
https://github.com/Kilian/Trimage.git
synced 2026-01-26 10:08:40 -05:00
save file dialog state, directory, and set app info for settings
This commit is contained in:
parent
de35d5967e
commit
2596905266
1 changed files with 11 additions and 3 deletions
|
|
@ -34,8 +34,11 @@ class StartQT4(QMainWindow):
|
||||||
self.verbose = True
|
self.verbose = True
|
||||||
self.imagelist = []
|
self.imagelist = []
|
||||||
|
|
||||||
self.settings = QSettings("Kilian Valkhof", "Trimage");
|
QCoreApplication.setOrganizationName("Kilian Valkhof")
|
||||||
self.restoreGeometry(self.settings.value("geometry").toByteArray());
|
QCoreApplication.setOrganizationDomain("trimage.org")
|
||||||
|
QCoreApplication.setApplicationName("Trimage")
|
||||||
|
self.settings = QSettings()
|
||||||
|
self.restoreGeometry(self.settings.value("geometry").toByteArray())
|
||||||
|
|
||||||
# check if apps are installed
|
# check if apps are installed
|
||||||
if self.checkapps():
|
if self.checkapps():
|
||||||
|
|
@ -131,7 +134,9 @@ class StartQT4(QMainWindow):
|
||||||
def file_dialog(self):
|
def file_dialog(self):
|
||||||
"""Open a file dialog and send the selected images to compress_file."""
|
"""Open a file dialog and send the selected images to compress_file."""
|
||||||
fd = QFileDialog(self)
|
fd = QFileDialog(self)
|
||||||
directory = ""
|
fd.restoreState(self.settings.value("fdstate").toByteArray())
|
||||||
|
directory = self.settings.value("directory", "").toString()
|
||||||
|
fd.setDirectory(directory)
|
||||||
|
|
||||||
images = fd.getOpenFileNames(self,
|
images = fd.getOpenFileNames(self,
|
||||||
"Select one or more image files to compress",
|
"Select one or more image files to compress",
|
||||||
|
|
@ -139,6 +144,9 @@ class StartQT4(QMainWindow):
|
||||||
# this is a fix for file dialog differentiating between cases
|
# this is a fix for file dialog differentiating between cases
|
||||||
"Image files (*.png *.jpg *.jpeg *.PNG *.JPG *.JPEG)")
|
"Image files (*.png *.jpg *.jpeg *.PNG *.JPG *.JPEG)")
|
||||||
|
|
||||||
|
self.settings.setValue("fdstate", fd.saveState())
|
||||||
|
if images:
|
||||||
|
self.settings.setValue("directory", path.dirname(unicode(images[0])))
|
||||||
self.delegator([unicode(fullpath) for fullpath in images])
|
self.delegator([unicode(fullpath) for fullpath in images])
|
||||||
|
|
||||||
def recompress_files(self):
|
def recompress_files(self):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue