Python PyQt5.QtWidgets.QFileDialog 模块,getSaveFileName() 实例源码

我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用PyQt5.QtWidgets.QFileDialog.getSaveFileName()

项目:VIRTUAL-PHONE    作者:SumanKanrar-IEM    | 项目源码 | 文件源码
def Backup_Contacts(self):

        print("backup button clicked")
        path = QFileDialog.getSaveFileName(self, 'Backup Contacts', os.getenv('HOME'), 'CSV(*.csv)')
        if path[0] != '':
            with open(path[0], 'w', newline='') as csv_file:
                writer = csv.writer(csv_file, dialect='excel')
                for row in range(self.table_contacts.rowCount()):
                    row_data = []
                    for column in range(self.table_contacts.columnCount()):
                        item = self.table_contacts.item(row, column)
                        if item is not None:
                            row_data.append(item.text())
                        else:
                            row_data.append('')
                    writer.writerow(row_data)


        print("all operations successful")
项目:VIRTUAL-PHONE    作者:SumanKanrar-IEM    | 项目源码 | 文件源码
def Backup_Contacts(self):

        print("backup button clicked")
        path = QFileDialog.getSaveFileName(self, 'Backup Contacts', os.getenv('HOME'), 'CSV(*.csv)')
        if path[0] != '':
            with open(path[0], 'w', newline='') as csv_file:
                writer = csv.writer(csv_file, dialect='excel')
                for row in range(self.table_contacts.rowCount()):
                    row_data = []
                    for column in range(self.table_contacts.columnCount()):
                        item = self.table_contacts.item(row, column)
                        if item is not None:
                            row_data.append(item.text())
                        else:
                            row_data.append('')
                    writer.writerow(row_data)


        print("all operations successful")
项目:dxf2gcode    作者:cnc-club    | 项目源码 | 文件源码
def showSaveDialog(self, title, MyFormats):
        """
        This function is called by the menu "Export/Export Shapes" of the main toolbar.
        It creates the selection dialog for the exporter
        @return: Returns the filename of the selected file.
        """

        (beg, ende) = os.path.split(self.filename)
        (fileBaseName, fileExtension) = os.path.splitext(ende)

        default_name = os.path.join(g.config.vars.Paths['output_dir'], fileBaseName)

        selected_filter = self.MyPostProcessor.output_format[0]
        filename = getSaveFileName(self,
                                   title, default_name,
                                   MyFormats, selected_filter)

        logger.info(self.tr("File: %s selected") % filename[0])
        logger.info("<a href='%s'>%s</a>" %(filename[0],filename[0]))
        return filename
项目:hacked_cnc    作者:hackerspace    | 项目源码 | 文件源码
def save_gcode_dialog(self):
        fname, mask = QFileDialog.getSaveFileName(None, "Save G-Code", "",
                "GCode (*.ngc *.gcode);;All files (*.*)")

        if not fname:
            return
        try:
            if self.gl.postgcode.orig:
                self.gl.postgcode.save_gcode(name)
                self.info('Saved post-processed g-code to {}'.format(name))
            elif self.gl.gcode.orig:
                self.gl.gcode.save_gcode(name)
                self.info('Saved original g-code to {}'.format(name))
            else:
                self.info('Nothing to save')

        except IOError as e:
            self.info('Unable to save to {}'.format(name))
            self.info(str(e))
项目:hacked_cnc    作者:hackerspace    | 项目源码 | 文件源码
def on_save_clicked(self):
        root = self.comtree.invisibleRootItem()
        {'name': 'Visible', 'type': 'bool', 'value': 1},
        count = root.childCount()

        parts = []
        for i in range(count):
            item = root.child(i)
            time = item.text(0)
            cmd = item.text(1)
            resp = item.text(2)
            parts.append((time, cmd, resp))

        fname, sel = QFileDialog.getSaveFileName(
            self,
            'Save Log',)
            #'/path/to/default/directory', FIXME: lastused
            #selectedFilter='*.txt')

        if fname:
            with open(fname, 'w') as f:
                for time, cmd, resp in parts:
                    f.write('{}\t{}\t{}\n'.format(time, cmd, resp))
项目:opcua-modeler    作者:FreeOpcUa    | 项目源码 | 文件源码
def _save_as(self):
        path, ok = QFileDialog.getSaveFileName(self.modeler, caption="Save OPC UA XML", filter="XML Files (*.xml *.XML)")
        if ok:
            if os.path.isfile(path):
                reply = QMessageBox.question(
                    self.modeler,
                    "OPC UA Modeler",
                    "File already exit, do you really want to save to this file?",
                    QMessageBox.Yes | QMessageBox.No | QMessageBox.Cancel
                )
                if reply != QMessageBox.Yes:
                    return
            if self._last_model_dir != os.path.dirname(path):
                self._last_model_dir = os.path.dirname(path)
                self.settings.setValue("last_model_dir", self._last_model_dir)
            self._model_mgr.save_model(path)
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def save_cadImages(self):

        status = self.resultObj['Bolt']['status']
        if status is True:

            files_types = "PNG (*.png);;JPEG (*.jpeg);;TIFF (*.tiff);;BMP(*.bmp)"
            fileName, _ = QFileDialog.getSaveFileName(self, 'Export', os.path.join(str(self.folder), "untitled.png"),
                                                      files_types)
            fName = str(fileName)
            file_extension = fName.split(".")[-1]

            if file_extension == 'png' or file_extension == 'jpeg' or file_extension == 'bmp' or file_extension == 'tiff':
                self.display.ExportToImage(fName)
                QMessageBox.about(self, 'Information', "File saved")
        else:
            self.ui.action_save_CAD_image.setEnabled(False)
            QMessageBox.about(self,'Information', 'Design Unsafe: CAD image cannot be saved')
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def save_design_inputs(self):

        fileName, _ = QFileDialog.getSaveFileName(self,
                                                  "Save Design", os.path.join(str(self.folder), "untitled.osi"),
                                                  "Input Files(*.osi)")

        if not fileName:
            return

        try:
            out_file = open(str(fileName), 'wb')

        except IOError:
            QMessageBox.information(self, "Unable to open file",
                                    "There was an error opening \"%s\"" % fileName)
            return

        # yaml.dump(self.uiObj,out_file,allow_unicode=True, default_flow_style=False)
        json.dump(self.uiObj, out_file)

        out_file.close()

        pass
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def save_cadImages(self):
        """Save CAD Model in image formats(PNG,JPEG,BMP,TIFF)

        Returns:

        """
        status = self.resultObj['Bolt']['status']
        if status is True:

            files_types = "PNG (*.png);;JPEG (*.jpeg);;TIFF (*.tiff);;BMP(*.bmp)"
            fileName, _ = QFileDialog.getSaveFileName(self, 'Export', os.path.join(str(self.folder), "untitled.png"),
                                                      files_types)
            fName = str(fileName)
            file_extension = fName.split(".")[-1]

            if file_extension == 'png' or file_extension == 'jpeg' or file_extension == 'bmp' or file_extension == 'tiff':
                self.display.ExportToImage(fName)
                QMessageBox.about(self, 'Information', "File saved")
        else:
            self.ui.actionSave_current_image.setEnabled(False)
            QMessageBox.about(self,'Information', 'Design Unsafe: CAD image cannot be saved')
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def saveDesign_inputs(self):

        fileName, _ = QFileDialog.getSaveFileName(self,
                                                  "Save Design", os.path.join(str(self.folder), "untitled.osi"),
                                                  "Input Files(*.osi)")

        if not fileName:
            return

        try:
            out_file = open(str(fileName), 'wb')

        except IOError:
            QMessageBox.information(self, "Unable to open file",
                                    "There was an error opening \"%s\"" % fileName)
            return

        # yaml.dump(self.uiObj,out_file,allow_unicode=True, default_flow_style=False)
        json.dump(self.uiObj, out_file)

        out_file.close()

        pass
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def saveDesign_inputs(self):

        fileName,_ = QFileDialog.getSaveFileName(self,"Save Design", os.path.join(str(self.folder), "untitled.osi"),"Input Files(*.osi)")
        if not fileName:
            return

        try:
            out_file = open(str(fileName), 'wb')

        except IOError:
            QMessageBox.information(self, "Unable to open file",
                                          "There was an error opening \"%s\"" % fileName)
            return

        # yaml.dump(self.uiObj,out_file,allow_unicode=True, default_flow_style=False)
        json.dump(self.uiobj, out_file)

        out_file.close()
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def saveDesign_inputs(self):

        fileName, _ = QFileDialog.getSaveFileName(self,
                                                  "Save Design", os.path.join(str(self.folder), "untitled.osi"),
                                                  "Input Files(*.osi)")

        if not fileName:
            return

        try:
            out_file = open(str(fileName), 'wb')

        except IOError:
            QMessageBox.information(self, "Unable to open file",
                                    "There was an error opening \"%s\"" % fileName)
            return

        # yaml.dump(self.uiObj,out_file,allow_unicode=True, default_flow_style=False)
        json.dump(self.uiObj, out_file)

        out_file.close()

        pass
项目:pygogapi    作者:Yepoleb    | 项目源码 | 文件源码
def handle_url_change(self, url):
        log.debug("Handling url change to %s", url.toString())
        url_path = url.path()
        url_query = url.query()
        if not url_path.startswith("/on_login_success"):
            return

        log.debug("Detected on_login_success")
        query_match = LOGIN_CODE_RE.search(url_query)
        if query_match is not None:
            login_code = query_match.group(1)
            log.debug("Got login code %s", login_code)
            token = Token.from_code(login_code)
            filename, _ = QFileDialog.getSaveFileName(
                self.webview,
                caption="Save Login Token",
                filter="JSON (*.json)")
            if filename:
                if not filename.endswith(".json"):
                    filename += ".json"
                token.save(filename)
        else:
            log.error("Could not parse code from query: %s", url_query)

        self.webview.close()
项目:coliform-project    作者:uprm-research-resto    | 项目源码 | 文件源码
def saveImage(self):
        filename = QFileDialog.getSaveFileName(self, 'Save Image As', os.sep.join((os.path.expanduser('~'), 'Desktop')), 'Image Files (*.png *.jpg *.jpeg)')
        RPiCamera.saveImage(self.rgb_array, filename[0])
项目:FaceSwapper    作者:QuantumLiu    | 项目源码 | 文件源码
def save_result(self):
        '''
        ????
        '''
        output_path,_=QFileDialog.getSaveFileName(self,'??????','./','Image Files(*.png *.jpg *.bmp)')
        if not output_path:
            self.statu_text.append('????,?????')
            return
        self.swapper.save(output_path,self.img_swapped)
        self.statu_text.append('??????'+output_path)
项目:FaceSwapper    作者:QuantumLiu    | 项目源码 | 文件源码
def save_compare(self):
        '''
        ?????
        '''
        self.compare=np.concatenate([self.img_ori,self.img_swapped],1)
        cv2.imshow('Compare',self.compare)
        output_path,_=QFileDialog.getSaveFileName(self,'??????','./','Image Files(*.png *.jpg *.bmp)')
        if not output_path:
            self.statu_text.append('????,?????')
            return
        self.swapper.save(output_path,self.compare)
        self.statu_text.append('?????????'+output_path)
项目:VIRTUAL-PHONE    作者:SumanKanrar-IEM    | 项目源码 | 文件源码
def saveFileDialog(self):    
        options = QFileDialog.Options()
        options |= QFileDialog.DontUseNativeDialog
        fileName, _ = QFileDialog.getSaveFileName(self,"QFileDialog.getSaveFileName()","","All Files (*);;Text Files (*.txt)", options=options)
        if fileName:
            print(fileName)
项目:VIRTUAL-PHONE    作者:SumanKanrar-IEM    | 项目源码 | 文件源码
def save_text(self):
        filename = QFileDialog.getSaveFileName(self, 'Save File', os.getenv('HOME'))
        with open(filename[0], 'w') as f:
            my_text = self.text.toPlainText()
            f.write(my_text)
项目:VIRTUAL-PHONE    作者:SumanKanrar-IEM    | 项目源码 | 文件源码
def save_sheet(self):
        path = QFileDialog.getSaveFileName(self, 'Save CSV', os.getenv('HOME'), 'CSV(*.csv)')
        if path[0] != '':
            with open(path[0], 'w') as csv_file:
                writer = csv.writer(csv_file, dialect='excel')
                for row in range(self.rowCount()):
                    row_data = []
                    for column in range(self.columnCount()):
                        item = self.item(row, column)
                        if item is not None:
                            row_data.append(item.text())
                        else:
                            row_data.append('')
                    writer.writerow(row_data)
项目:VIRTUAL-PHONE    作者:SumanKanrar-IEM    | 项目源码 | 文件源码
def save_text(self):
        filename = QFileDialog.getSaveFileName(self, 'Save File', os.getenv('HOME'))
        with open(filename[0], 'w') as f:
            my_text = self.text.toPlainText()
            f.write(my_text)
项目:VIRTUAL-PHONE    作者:SumanKanrar-IEM    | 项目源码 | 文件源码
def save_text(self):
        filename = QFileDialog.getSaveFileName(self, 'Save File', os.getenv('HOME'))
        with open(filename[0], 'w') as f:
            my_text = self.text.toPlainText()
            f.write(my_text)
项目:hacked_cnc    作者:hackerspace    | 项目源码 | 文件源码
def save_probe_data_dialog(self):
        if not self.gl.result.data:
            # err not much to save
            return

        fname, sel = QFileDialog.getSaveFileName(
            self,
            'Save Log',)
            #'/path/to/default/directory', FIXME: lastused
            #selectedFilter='*.txt')

        if fname:
            self.save_probe_data(fname)
项目:hacked_cnc    作者:hackerspace    | 项目源码 | 文件源码
def save_log_dialog(self):
        fname, sel = QFileDialog.getSaveFileName(
            self,
            'Save Log',)
            #'/path/to/default/directory', FIXME: lastused
            #selectedFilter='*.txt')

        if fname:
            with open(fname, 'w') as f:
                f.write(self.text.toPlainText())
项目:hacked_cnc    作者:hackerspace    | 项目源码 | 文件源码
def save_probe_gcode_dialog(self):
        fname, sel = QFileDialog.getSaveFileName(
            self,
            'Save probe G-code',)
            #'/path/to/default/directory', FIXME: lastused
            #selectedFilter='*.txt')

        if fname:
            with open(fname, 'w') as f:
                for code in self.gen_probe_gcode(self.get_probe_points()):
                    f.write(code + '\n')
项目:pysport    作者:sportorg    | 项目源码 | 文件源码
def get_save_file_name(caption='', filter_text='', file_name=''):
    result = QFileDialog.getSaveFileName(None, caption, os.path.join(get_default_dir(), file_name), filter_text)[0]
    if result:
        set_default_dir(os.path.dirname(os.path.abspath(result)))
    return result
项目:climate    作者:FIDS-UWO    | 项目源码 | 文件源码
def knn_set_output_folder(self):
        path, k = QFileDialog.getSaveFileName(None, "Save Output", "", ".csv")
        self.ui.knnOutputLineEdit.setText(path + k)
项目:alignment_calculator    作者:andersas    | 项目源码 | 文件源码
def saveTrace(self,checked):
        #diag = QFileDialog.getSaveFileName(self, "Select destination", "./", "Comma Separated Values (*.csv)");
        diag = QFileDialog(self);
        diag.setAcceptMode(QFileDialog.AcceptSave) #Save file, not open one
        diag.setNameFilter("Comma Separated Values (*.csv);;Space separated Values (*.csv)");
        diag.setDefaultSuffix("csv"); # Make sure selected files end in .csv
        diag.exec();
        try:
            filename = diag.selectedFiles()[0];
        except IndexError:
            filename = '';
        user_filter = diag.selectedNameFilter();
        if (user_filter == "Space separated Values (*.csv)"):
            delimiter = " ";
        else:
            delimiter = ",";

        if (filename != '' and not os.path.isdir(filename)):

            npzfile = self.last_result;
            t = npzfile["t"];
            cos2 = npzfile["cos2"];
            cos2d = npzfile["cos2d"];

            extra_header = [];
            extra_columns = [];
            if ('Javg' in npzfile.keys()):
                Javg = npzfile["Javg"];
                std = npzfile["std"];
                percentile_999 = npzfile["percentile_999"];
                extra_header = ["<J>","std(J)","J_99.9%"];
                extra_columns = [Javg,std,percentile_999];

            utils.save_to_csv(filename,t,cos2,cos2d,extra_header,extra_columns,delimiter);
项目:RTT-Console    作者:dudulung    | 项目源码 | 文件源码
def onBtnSaveClicked(self):
        fname, ftype = QFileDialog.getSaveFileName(self, u"???????", ".", "LOG Files(*.log)")
        if fname:
            with open(fname, 'w') as logfile:
                logfile.write(str(self.ui.plainTextEdit.toPlainText()))
项目:PPPLCalibrationFramework    作者:timothyhollabaugh    | 项目源码 | 文件源码
def _on_save_axis(self):
        """
        Save an axis to a file
        """
        data = {}

        data['name'] = self._axis_list.get_currentrow_value()[0]

        data['hw_type'] = self._axis_hw_type.value

        data['min'] = {}
        self._min.save_form(data['min'])

        data['max'] = {}
        self._max.save_form(data['max'])

        data['norm_min'] = {}
        self._norm_min.save_form(data['norm_min'])

        data['norm_max'] = {}
        self._norm_max.save_form(data['norm_max'])

        data['special_axis'] = {}
        self._special_axis.value.save_form(data['special_axis'])

        if self._axis_custom.value is not None:
            data['axis-specific'] = {}
            self._axis_custom.value.save_form(data['axis-specific'])

        print(data)

        filename = QFileDialog.getSaveFileName(
            self, 'Save Axis', filter='JSON Files (*.json)')
        if filename[0] is not None and filename[0] != '':
            with open(filename[0], 'w') as output_file:
                json.dump(data, output_file, indent=2)
项目:PPPLCalibrationFramework    作者:timothyhollabaugh    | 项目源码 | 文件源码
def _on_save_file(self):
        points_file = QFileDialog.getSaveFileName(caption = "Save Points", filter = 'CSV Files (*.csv)')

        if points_file[0] is not None and points_file[0] != '':

            out_points = []
            for name, value in self._saved_points.items():
                out_points.append([name, value])

            with open(points_file[0], 'w', newline='') as csvfile:
                csvwriter = csv.writer(csvfile, quoting=csv.QUOTE_MINIMAL)
                csvwriter.writerows(out_points)
项目:PPPLCalibrationFramework    作者:timothyhollabaugh    | 项目源码 | 文件源码
def _save_points(self):
        points_file = QFileDialog.getSaveFileName(
            caption="Save Points", filter='CSV Files (*.csv)')

        if points_file[0] is not None and points_file[0] != '':
            out_points = []

            headers = []
            for axis in self._axis:
                headers.append(axis.get_name())

            out_points.append(headers)

            length = self._max_axis_len()
            for i in range(0, length):
                point = []
                for axis in self._axis:
                    assert isinstance(axis, ControlAxis)

                    # Add enough extra points to the axis so it matches the rest of the axis if it is missing points
                    if len(axis.points) <= i:
                        for j in range(len(axis.points) - 1, i):
                            axis.points.append(str(axis.get_min()))

                    point.append(str(axis.points[i]))
                out_points.append(point)

            with open(points_file[0], 'w', newline='') as csvfile:
                csvwriter = csv.writer(csvfile, quoting=csv.QUOTE_MINIMAL)
                csvwriter.writerows(out_points)

            self._open_file.value = points_file[0]
项目:ITC110    作者:SeattleCentral    | 项目源码 | 文件源码
def saveFileDialog(self):    
        options = QFileDialog.Options()
        options |= QFileDialog.DontUseNativeDialog
        fileName, _ = QFileDialog.getSaveFileName(self,"QFileDialog.getSaveFileName()","","All Files (*);;Text Files (*.txt)", options=options)
        if fileName:
            print(fileName)
项目:RigIt    作者:the4chancup    | 项目源码 | 文件源码
def getSaveFileName(parent=None, dir=None, filter=None, caption=None):
    if (dir == None):
        dir = QDir.currentPath()
    if (filter == None):
        filter = 'File (*)'
    filename = QFileDialog.getSaveFileName(parent, caption, dir, filter)
    if (filename == ('', '')): # two null strings for cancel
        return None
    return filename[0]
项目:Frida    作者:Alejandro-Valdes    | 项目源码 | 文件源码
def Save(self):
        filename = QFileDialog.getSaveFileName(self, 'Save File')
        f = open(filename, 'w')
        filedata = self.text.getTextEdit().toPlainText()
        f.write(filedata)
        f.close()
项目:ClassifyHub    作者:Top-Ranger    | 项目源码 | 文件源码
def save_results(self):
        if not self._save_ready:
            return

        target = QFileDialog.getSaveFileName(None, 'Save results', './', 'Text (*.txt);All files')[0]
        if target != '':
            processor.result_to_file(self._results, target)

    ##
    # \brief Returns the path of an existing directory
    #
    # If no directory is chosen by the user an empty string will be returned
    #
    # \param title Title of the selection window
    # \return String containing directory or empty string if no directory is chosen
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def saveUserProfile(self):
        inputData = self.get_report_summary()
        filename, _ = QFileDialog.getSaveFileName(self, 'Save Files',
                                                  os.path.join(str(self.mainController.folder), "Profile"), '*.txt')
        if filename == '':
            flag = False
            return flag
        else:
            infile = open(filename, 'w')
            pickle.dump(inputData, infile)
            infile.close()
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def save_design(self, report_summary):
        status = self.resultObj['Bolt']['status']
        if status is True:
            self.call_3DModel("white_bg")
            data = os.path.join(str(self.folder), "images_html", "3D_Model.png")
            self.display.ExportToImage(data)
            self.display.FitAll()
        else:
            pass

        filename = os.path.join(str(self.folder), "images_html", "Html_Report.html")
        file_name = str(filename)

        self.commLogicObj.call_designReport(file_name, report_summary)

        # Creates PDF
        config = ConfigParser.ConfigParser()
        config.readfp(open(r'Osdag.config'))
        wkhtmltopdf_path = config.get('wkhtml_path', 'path1')

        config = pdfkit.configuration(wkhtmltopdf=wkhtmltopdf_path )

        options = {
            'margin-bottom': '10mm',
            'footer-right': '[page]'
        }
        file_type = "PDF(*.pdf)"
        fname, _ = QFileDialog.getSaveFileName(self, "Save File As", self.folder + "/", file_type)
        fname = str(fname)
        flag = True
        if fname == '':
            flag = False
            return flag
        else:
            pdfkit.from_file(filename, fname, configuration=config, options=options)
            QMessageBox.about(self, 'Information', "Report Saved")
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def save_log(self):

        fileName, pat = QFileDialog.getSaveFileName(self, "Save File As", os.path.join(str(self.folder), "LogMessages"),
                                                    "Text files (*.txt)")
        return self.save_file(fileName + ".txt")
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def saveUserProfile(self):

        flag = True
        inputData = self.getPopUpInputs()
        filename, _ = QFileDialog.getSaveFileName(self, 'Save Files',
                                                  os.path.join(str(self.mainController.folder), "Profile"), '*.txt')
        if filename =='':
            flag =False
            return flag
        else:
            infile = open(filename, 'w')
            pickle.dump(inputData, infile)
            infile.close()
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def save_design(self, popup_summary):
        status = self.resultObj['Bolt']['status']
        if status is True:
            self.call_3DModel("white_bg")
            data = os.path.join(str(self.folder), "images_html", "3D_Model.png")
            self.display.ExportToImage(data)
            self.display.FitAll()
        else:
            pass

        fileName = os.path.join(self.folder, "images_html", "Html_Report.html")
        fileName = str(fileName)
        self.commLogicObj.call_designReport(fileName, popup_summary)

        config = ConfigParser.ConfigParser()
        config.readfp(open(r'Osdag.config'))
        wkhtmltopdf_path = config.get('wkhtml_path', 'path1')
        # Creates pdf

        config = pdfkit.configuration(wkhtmltopdf=wkhtmltopdf_path )

        options = {
            'margin-bottom': '10mm',
            'footer-right': '[page]'
        }
        file_type = "PDF (*.pdf)"
        fname, _ = QFileDialog.getSaveFileName(self, "Save File As", self.folder + "/", file_type)
        fname = str(fname)
        flag = True
        if fname == '':
            flag = False
            return flag
        else:
            pdfkit.from_file(fileName, fname, configuration=config, options=options)
            QMessageBox.about(self, 'Information', "Report Saved")
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def save_log(self):

        fileName, pat = QFileDialog.getSaveFileName(self, "Save File As",
                                                    os.path.join(str(self.folder), "LogMessages"),
                                                    "Text files (*.txt)")
        return self.save_file(fileName + ".txt")
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def save_user_profile(self):
        input_data = self.get_design_report_inputs()
        filename, _ = QFileDialog.getSaveFileName(self, 'Save Files', os.path.join(str(self.mainController.folder), "Profile"), '*.txt')
        if filename =='':
            flag =False
            return flag
        else:
            infile = open(filename, 'w')
            pickle.dump(input_data, infile)
            infile.close()
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def save_cadImages(self):
        status = self.resultObj['Bolt']['status']
        if status is True:

            files_types = "PNG (*.png);;JPEG (*.jpeg);;TIFF (*.tiff);;BMP(*.bmp)"
            fileName,_ = QFileDialog.getSaveFileName(self, 'Export', os.path.join(str(self.folder), "untitled.png"), files_types)
            fName = str(fileName)
            file_extension = fName.split(".")[-1]

            if file_extension == 'png' or file_extension == 'jpeg' or file_extension == 'bmp'or file_extension == 'tiff' :
                self.display.ExportToImage(fName)
                QMessageBox.about(self, 'Information', "File saved")
        else:
            self.ui.actionSave_CAD_image.setEnabled(False)
            QMessageBox.about(self,'Information', 'Design Unsafe: CAD image cannot be saved')
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def save_design(self, popup_summary):
        status = self.resultObj['Bolt']['status']
        if status is True:
            self.call_3d_model("white_bg")
            data = os.path.join(str(self.folder), "images_html", "3D_Model.png")
            self.display.ExportToImage(data)
            self.display.FitAll()
        else:
            pass

        filename = os.path.join(self.folder, "images_html", "Html_Report.html")
        filename = str(filename)
        self.commLogicObj.call_designReport(filename, popup_summary)

        config = ConfigParser.ConfigParser()
        config.readfp(open(r'Osdag.config'))
        wkhtmltopdf_path = config.get('wkhtml_path', 'path1')

        config = pdfkit.configuration(wkhtmltopdf=wkhtmltopdf_path )

        options = {
                   'margin-bottom': '10mm',
                   'footer-right': '[page]'
        }
        file_type = "PDF (*.pdf)"
        fname, _ = QFileDialog.getSaveFileName(self, "Save File As", self.folder + "/", file_type)
        fname = str(fname)
        flag = True
        if fname =='':
            flag = False
            return flag
        else:
            pdfkit.from_file(filename, fname, configuration=config, options=options)
            QMessageBox.about(self, 'Information', "Report Saved")
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def save_log(self):

        fileName, pat = QFileDialog.getSaveFileName(self, "Save File As",
                                                    os.path.join(str(self.folder), "LogMessages"),
                                                    "Text files (*.txt)")
        return self.save_file(fileName + ".txt")

        if filename == "":
            return
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def save_user_profile(self):
        input_data = self.get_design_report_inputs()

        filename, _ = QFileDialog.getSaveFileName(self, 'Save Files', os.path.join(str(self.mainController.folder), "Profile"), '*.txt')

        if filename == '':
            flag = False
            return flag
        else:
            infile = open(filename, 'w')
            pickle.dump(input_data, infile)
            infile.close()
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def save_cadImages(self):
        status = self.resultObj['Bolt']['status']
        if status is True:

            files_types = "PNG (*.png);;JPEG (*.jpeg);;TIFF (*.tiff);;BMP(*.bmp)"
            fileName,_ = QFileDialog.getSaveFileName(self, 'Export', os.path.join(str(self.folder), "untitled.png"), files_types)
            fName = str(fileName)
            file_extension = fName.split(".")[-1]

            if file_extension == 'png' or file_extension == 'jpeg' or file_extension == 'bmp'or file_extension == 'tiff' :
                self.display.ExportToImage(fName)
                QMessageBox.about(self, 'Information', "File saved")
        else:
            self.ui.actionSave_CAD_image.setEnabled(False)
            QMessageBox.about(self,'Information', 'Design Unsafe: CAD image cannot be saved')
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def save_design(self, popup_summary):

        status = self.resultObj['Bolt']['status']
        if status is True:
            self.call_3d_model("white_bg")
            data = os.path.join(str(self.folder), "images_html", "3D_Model.png")
            self.display.ExportToImage(data)
            self.display.FitAll()
        else:
            pass

        fileName = os.path.join(self.folder, "images_html","Html_Report.html")
        fileName = str(fileName)
        self.commLogicObj.call_designReport(fileName, popup_summary)
        # Creates pdf

        config = ConfigParser.ConfigParser()
        config.readfp(open(r'Osdag.config'))
        wkhtmltopdf_path = config.get('wkhtml_path', 'path1')

        config = pdfkit.configuration(wkhtmltopdf=wkhtmltopdf_path )

        options = {
            'margin-bottom': '10mm',
            'footer-right': '[page]'
        }
        file_type = "PDF (*.pdf)"
        fname, _ = QFileDialog.getSaveFileName(self, "Save File As", self.folder + "/", file_type)
        fname = str(fname)
        flag = True
        if fname == '':
            flag = False
            return flag
        else:
            pdfkit.from_file(fileName, fname, configuration=config, options=options)
            QMessageBox.about(self, 'Information', "Report Saved")
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def save_log(self):
        """
        Save log messages in user prefered text file at user prefered location.
        Returns: (File) save_file

        """
        filename, pat = QFileDialog.getSaveFileName(self, "Save File As", os.path.join(str(self.folder),  "Logmessages"), "Text files (*.txt)")
        return self.save_file(filename + ".txt")
项目:RRPam-WDS    作者:asselapathirana    | 项目源码 | 文件源码
def _getSaveFileName(self, *args, **kwargs):
        # why this function and _getSaveFileName2? for tests to mock this method easily.
        self.logger.info("proxy calling QFileDialog.getSaveFileName ")
        return QFileDialog.getSaveFileName(*args, **kwargs)