Beispiel #1
0
 def open_files(self, checked):
     args = [
         self,
         self.tr('Open files'),
         self.app.config_store.get('paths', 'images', ''),
         self.tr("Images ({0});;Videos ({1});;All files (*)").format(
             ' '.join(['*.' + x for x in image_types()]),
             ' '.join(['*.' + x for x in video_types()]))
     ]
     if eval(self.app.config_store.get('pyqt', 'native_dialog', 'True')):
         pass
     elif qt_version_info >= (5, 0):
         args += [None, QtWidgets.QFileDialog.DontUseNativeDialog]
     else:
         args += [QtWidgets.QFileDialog.DontUseNativeDialog]
     path_list = QtWidgets.QFileDialog.getOpenFileNames(*args)
     if qt_version_info >= (5, 0):
         path_list = path_list[0]
     if not path_list:
         return
     # work around for Qt bug 33992
     # https://bugreports.qt-project.org/browse/QTBUG-33992
     if qt_version_info in ((4, 8, 4), (4, 8, 5)):
         path_list = list(map(unquote, path_list))
     self.open_file_list(path_list)
Beispiel #2
0
 def open_files(self):
     path_list = QtWidgets.QFileDialog.getOpenFileNames(
         self, "Open files", self.app.config_store.get('paths', 'images', ''),
         self.tr("Images ({0});;Videos ({1});;All files (*)").format(
             ' '.join(['*.' + x for x in image_types()]),
             ' '.join(['*.' + x for x in video_types()])))
     if qt_version_info >= (5, 0):
         path_list = path_list[0]
     if not path_list:
         return
     # work around for Qt bug 33992
     # https://bugreports.qt-project.org/browse/QTBUG-33992
     if qt_version_info in ((4, 8, 4), (4, 8, 5)):
         path_list = list(map(unquote, path_list))
     self.open_file_list(path_list)
Beispiel #3
0
 def open_files(self):
     path_list = QtWidgets.QFileDialog.getOpenFileNames(
         self, "Open files", self.app.config_store.get('paths', 'images', ''),
         self.tr("Images ({0});;Videos ({1});;All files (*)").format(
             ' '.join(['*.' + x for x in image_types()]),
             ' '.join(['*.' + x for x in video_types()])))
     if qt_version_info >= (5, 0):
         path_list = path_list[0]
     if not path_list:
         return
     # work around for Qt bug 33992
     # https://bugreports.qt-project.org/browse/QTBUG-33992
     if qt_version_info in ((4, 8, 4), (4, 8, 5)):
         path_list = list(map(unquote, path_list))
     self.open_file_list(path_list)
Beispiel #4
0
 def open_files(self, checked=False):
     args = [
         self,
         self.tr('Open files'),
         self.app.config_store.get('paths', 'images', ''),
         self.tr("Images ({0});;Videos ({1});;All files (*)").format(
             ' '.join(['*.' + x for x in image_types()]),
             ' '.join(['*.' + x for x in video_types()]))
     ]
     if not self.app.config_store.get('pyqt', 'native_dialog', True):
         args += [None, QtWidgets.QFileDialog.DontUseNativeDialog]
     path_list = QtWidgets.QFileDialog.getOpenFileNames(*args)
     path_list = path_list[0]
     if not path_list:
         return
     self.open_file_list(path_list)
Beispiel #5
0
 def __init__(self, root):
     self.root = root
     self.image_types = ['.' + x for x in image_types() + video_types()]
     if not os.path.isdir(self.root):
         raise RuntimeError('Folder not readable')