Python PyQt5.QtWidgets.QFileDialog.Options() Examples

The following are 16 code examples of PyQt5.QtWidgets.QFileDialog.Options(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module PyQt5.QtWidgets.QFileDialog , or try the search function .
Example #1
Source File: finder.py    From guiscrcpy with GNU General Public License v3.0 6 votes vote down vote up
def open_exe_name_dialog(parent, appname):
    options = QFileDialog.Options()
    options |= QFileDialog.DontUseNativeDialog
    file_name, _ = \
        QFileDialog.getOpenFileName(
            parent,
            "{} could not be found. Please locate it manually".format(appname),
            "",
            "Valid {} executable (*);;".format(appname),
            options=options
        )
    if file_name:
        print(file_name)
        return file_name
    else:
        print("No file is selected. guiscrcpy is likely to fail") 
Example #2
Source File: utils.py    From restatic with GNU General Public License v3.0 5 votes vote down vote up
def choose_folder_dialog(parent, title):
    options = QFileDialog.Options()
    options |= QFileDialog.ShowDirsOnly
    dialog = QFileDialog(parent, title, os.path.expanduser("~"), options=options)
    dialog.setFileMode(QFileDialog.Directory)
    dialog.setParent(parent, QtCore.Qt.Sheet)
    return dialog 
Example #3
Source File: start.py    From Camelishing with MIT License 5 votes vote down vote up
def AgentIco(self):

        try:

            options = QFileDialog.Options()
            options |= QFileDialog.DontUseNativeDialog
            fileName, _ = QFileDialog.getOpenFileName(self, options=options)

            icodir = fileName.replace('/',"\\\\")

            self.fileico.setText(icodir)
        except Exception as f:

            t, o, tb = sys.exc_info()
            print(f, tb.tb_lineno) 
Example #4
Source File: start.py    From Camelishing with MIT License 5 votes vote down vote up
def selectPrivate(self):

        try:

            options = QFileDialog.Options()
            options |= QFileDialog.DontUseNativeDialog
            fileName, _ = QFileDialog.getOpenFileName(self, options=options)

            icodir = fileName.replace('/',"\\\\")

            self.privatekey.setText(icodir)
        except Exception as f:

            t, o, tb = sys.exc_info()
            print(f, tb.tb_lineno) 
Example #5
Source File: start.py    From Camelishing with MIT License 5 votes vote down vote up
def attach(self):

        try:

            options = QFileDialog.Options()
            options |= QFileDialog.DontUseNativeDialog
            fileName, _ = QFileDialog.getOpenFileName(self, options=options)
            osrep = fileName.replace("/","\\\\")
            self.attachment.setText(osrep)
        except Exception as f:
            t, o, tb = sys.exc_info()
            print(f,tb.tb_lineno) 
Example #6
Source File: utils.py    From vorta with GNU General Public License v3.0 5 votes vote down vote up
def choose_file_dialog(parent, title, want_folder=True):
    options = QFileDialog.Options()
    if want_folder:
        options |= QFileDialog.ShowDirsOnly
    dialog = QFileDialog(parent, title, os.path.expanduser('~'), options=options)
    dialog.setFileMode(QFileDialog.Directory if want_folder else QFileDialog.AnyFile)
    dialog.setParent(parent, QtCore.Qt.Sheet)
    return dialog 
Example #7
Source File: sparrowdialogs.py    From sparrow-wifi with GNU General Public License v3.0 5 votes vote down vote up
def openFileDialog(fileSpec="CSV Files (*.csv);;All Files (*)"):    
    options = QFileDialog.Options()
    options |= QFileDialog.DontUseNativeDialog
    fileName, _ = QFileDialog.getOpenFileName(None,"QFileDialog.getOpenFileName()", "",fileSpec, options=options)
    if fileName:
        return fileName
    else:
        return None 
Example #8
Source File: sparrowdialogs.py    From sparrow-wifi with GNU General Public License v3.0 5 votes vote down vote up
def saveFileDialog(fileSpec="CSV Files (*.csv);;All Files (*)"):    
    options = QFileDialog.Options()
    options |= QFileDialog.DontUseNativeDialog
    fileName, _ = QFileDialog.getSaveFileName(None,"QFileDialog.getSaveFileName()","",fileSpec, options=options)
    if fileName:
        return fileName
    else:
        return None


# ------------------  Global functions for agent HTTP requests ------------------------------ 
Example #9
Source File: sparrowdialogs.py    From sparrow-wifi with GNU General Public License v3.0 5 votes vote down vote up
def saveFileDialog(self):    
        options = QFileDialog.Options()
        options |= QFileDialog.DontUseNativeDialog
        fileName, _ = QFileDialog.getSaveFileName(self,"QFileDialog.getSaveFileName()","","SQLite3 Files (*.sqlite3);;All Files (*)", options=options)
        if fileName:
            return fileName
        else:
            return None 
Example #10
Source File: sparrowdialogs.py    From sparrow-wifi with GNU General Public License v3.0 5 votes vote down vote up
def saveFileDialog(self):    
        options = QFileDialog.Options()
        options |= QFileDialog.DontUseNativeDialog
        fileName, _ = QFileDialog.getSaveFileName(self,"QFileDialog.getSaveFileName()","","HTML Files (*.html);;All Files (*)", options=options)
        if fileName:
            return fileName
        else:
            return None 
Example #11
Source File: sparrowdialogs.py    From sparrow-wifi with GNU General Public License v3.0 5 votes vote down vote up
def openFileDialog(self):    
        options = QFileDialog.Options()
        options |= QFileDialog.DontUseNativeDialog
        fileName, _ = QFileDialog.getOpenFileName(self,"QFileDialog.getOpenFileName()", "","CSV Files (*.csv);;All Files (*)", options=options)
        if fileName:
            return fileName
        else:
            return None 
Example #12
Source File: mostrarImagen.py    From PyQt5 with MIT License 5 votes vote down vote up
def seleccionarImagen(self):
        imagen, extension = QFileDialog.getOpenFileName(self, "Seleccionar imagen", getcwd(),
                                                        "Archivos de imagen (*.png *.jpg)",
                                                        options=QFileDialog.Options())
          
        if imagen:
            # Adaptar imagen
            pixmapImagen = QPixmap(imagen).scaled(112, 128, Qt.KeepAspectRatio,
                                                  Qt.SmoothTransformation)

            # Mostrar imagen
            self.labelImagen.setPixmap(pixmapImagen)


# ================================================================ 
Example #13
Source File: main.py    From xqemu-manager with GNU General Public License v2.0 5 votes vote down vote up
def setSaveFileName(self, obj):
		options = QFileDialog.Options()
		fileName, _ = QFileDialog.getOpenFileName(self,
				"Select File",
				obj.text(),
				"All Files (*)", options=options)
		if fileName:
			obj.setText(fileName) 
Example #14
Source File: spmtApp.py    From PIVX-SPMT with MIT License 5 votes vote down vote up
def loadMNConf(self):
        options = QFileDialog.Options()
        fileName, _ = QFileDialog.getOpenFileName(self, 'Open masternode.conf', 'masternode.conf', 'Text Files (*.conf)', options=options)

        if fileName:
            self.mainWindow.loadMNConf(fileName) 
Example #15
Source File: window.py    From visma with GNU General Public License v3.0 4 votes vote down vote up
def loadEquations(self):
        options = QFileDialog.Options()
        options |= QFileDialog.DontUseNativeDialog
        fileName, _ = QFileDialog.getOpenFileName(self, "Add Custom Equations", "", "All Files (*);;Visma Files (*.vis)", options=options)
        if os.path.isfile(fileName):
            if os.path.getsize(fileName) == 0:
                return self.workSpace.warning("Input equations file is empty!")
            if self.workSpace.equations[0][0] == "No equations stored":
                self.workSpace.equations.pop(0)
            with open(fileName) as fileobj:
                for line in fileobj:
                    line = line.replace(' ', '').replace('\n', '')
                    if not any(line in item for item in self.workSpace.equations) and not (line.isspace() or line == ''):
                        self.workSpace.equations.insert(0, ('Equation No.' + str(len(self.workSpace.equations) + 1), line))
                self.workSpace.addEquation() 
Example #16
Source File: start.py    From Camelishing with MIT License 4 votes vote down vote up
def openmail(self):

        try:

            self.mail = list()

            options = QFileDialog.Options()
            options |= QFileDialog.DontUseNativeDialog
            fileName, _ = QFileDialog.getOpenFileName(self, options=options)

            say = 0
            nagato = ""
            notlist = list()
            yeslist = list()

            with open(fileName, 'r') as g:

                for k999 in g:
                    notlist.append(k999)

            with open(fileName, 'r') as f:

                if not fileName.endswith(".txt"):
                    self.ThreadMessage("Mail List Error", "Please Select '.txt' File" , "Info")

                else:
                    self.maillist.setText(fileName)
                    for _ in f:
                        mailReg = re.search(r"(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)", _)


                        if mailReg:

                            yeslist.append(_)
                            itemsTextList = [str(self.maillistWidget.item(i).text()) for i in
                                             range(self.maillistWidget.count())]
                            say += 1

                            if _ in itemsTextList:
                                pass
                            else:
                                self.maillistWidget.addItem(_)
                                self.mailliststatus.setText(" " * 21 + str(say) + " Email Added")

                                self.mail.append(_)

                    else:

                        ka = list(set(notlist)-set(yeslist))
                        count = 0

                        for ningendo in ka:
                            count += 1
                            nagato += "{}".format(count)+"- "+ningendo+"\n"

                        self.ThreadMessage("Mail Attach Error", "Not Email Adress;\n\n {}".format(nagato), "Info")
        except:

            pass