当前位置: 首页>>代码示例>>Python>>正文


Python JFileChooser.showSaveDialog方法代码示例

本文整理汇总了Python中javax.swing.JFileChooser.showSaveDialog方法的典型用法代码示例。如果您正苦于以下问题:Python JFileChooser.showSaveDialog方法的具体用法?Python JFileChooser.showSaveDialog怎么用?Python JFileChooser.showSaveDialog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JFileChooser的用法示例。


在下文中一共展示了JFileChooser.showSaveDialog方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: actionPerformed

# 需要导入模块: from javax.swing import JFileChooser [as 别名]
# 或者: from javax.swing.JFileChooser import showSaveDialog [as 别名]
 def actionPerformed(self, event):
     option = event.getActionCommand()
     if option == 'Close':
       self.dispose()
     elif option == 'SCI':
         chooser = JFileChooser()
         returnVal = chooser.showSaveDialog(self)
         if returnVal == JFileChooser.APPROVE_OPTION:
             fileName = chooser.getSelectedFile().getPath()
             f = open(fileName, 'w')
             f.write("\t".join(["Het", "Fst", "0.5(1-pval)quantile", "median", "0.5(1+pval)quantile"]) + "\n")
             for line in self.confLines:
                 f.write('\t'.join(map(lambda x: str(x), line)) + "\n")
             f.close()
     elif option == 'SLL':
         chooser = JFileChooser()
         returnVal = chooser.showSaveDialog(self)
         if returnVal == JFileChooser.APPROVE_OPTION:
             fileName = chooser.getSelectedFile().getPath()
             f = open(fileName, 'w')
             f.write("\t".join(["Locus", "Het", "Fst", "P(Simul Fst<sample Fst)"]) + "\n")
             for i in range(self.data.size()):
                 line = self.data.elementAt(i)
                 lineList = [str(line.elementAt(0))]
                 lineList.append(str(line.elementAt(1)))
                 lineList.append(str(line.elementAt(2)))
                 lineList.append(str(line.elementAt(3)))
                 f.write("\t".join(lineList) + "\n")
             f.close()
开发者ID:samitha,项目名称:lositan,代码行数:31,代码来源:SelPanel.py

示例2: save_pdf

# 需要导入模块: from javax.swing import JFileChooser [as 别名]
# 或者: from javax.swing.JFileChooser import showSaveDialog [as 别名]
    def save_pdf(self, event):
        from com.itextpdf.text.pdf import PdfWriter
        from com.itextpdf.text import Document

        fileChooser = JFileChooser()
        fileChooser.setSelectedFile(java.io.File('%s.pdf' % self.view.network.name))
        if fileChooser.showSaveDialog(self) == JFileChooser.APPROVE_OPTION:
            f = fileChooser.getSelectedFile()

            doc = Document()
            writer = PdfWriter.getInstance(doc, java.io.FileOutputStream(f))
            doc.open()
            cb = writer.getDirectContent()
            w = self.view.area.size.width
            h = self.view.area.size.height
            pw = 550
            ph = 800
            tp = cb.createTemplate(pw, ph)
            g2 = tp.createGraphicsShapes(pw, ph)
            at = java.awt.geom.AffineTransform()
            s = min(float(pw) / w, float(ph) / h)
            at.scale(s, s)
            g2.transform(at)
            self.view.area.pdftemplate = tp, s
            self.view.area.paint(g2)
            self.view.area.pdftemplate = None
            g2.dispose()

            cb.addTemplate(tp, 20, 0)
            doc.close()
开发者ID:Elhamahm,项目名称:nengo_1.4,代码行数:32,代码来源:timecontrol.py

示例3: exportToHTML

# 需要导入模块: from javax.swing import JFileChooser [as 别名]
# 或者: from javax.swing.JFileChooser import showSaveDialog [as 别名]
    def exportToHTML(self, event):
        parentFrame = JFrame()
        fileChooser = JFileChooser()
        fileChooser.setSelectedFile(File("AutorizeReprort.html"));
        fileChooser.setDialogTitle("Save Autorize Report")
        userSelection = fileChooser.showSaveDialog(parentFrame)
        if userSelection == JFileChooser.APPROVE_OPTION:
            fileToSave = fileChooser.getSelectedFile()

        enforcementStatusFilter = self.exportES.getSelectedItem()
        htmlContent = """<html><title>Autorize Report by Barak Tawily</title>
        <style>
        .datagrid table { border-collapse: collapse; text-align: left; width: 100%; }
         .datagrid {font: normal 12px/150% Arial, Helvetica, sans-serif; background: #fff; overflow: hidden; border: 1px solid #006699; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; }
         .datagrid table td, .datagrid table th { padding: 3px 10px; }
         .datagrid table thead th {background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #006699), color-stop(1, #00557F) );background:-moz-linear-gradient( center top, #006699 5%, #00557F 100% );filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#006699', endColorstr='#00557F');background-color:#006699; color:#FFFFFF; font-size: 15px; font-weight: bold; border-left: 1px solid #0070A8; } .datagrid table thead th:first-child { border: none; }.datagrid table tbody td { color: #00496B; border-left: 1px solid #E1EEF4;font-size: 12px;font-weight: normal; }.datagrid table tbody .alt td { background: #E1EEF4; color: #00496B; }.datagrid table tbody td:first-child { border-left: none; }.datagrid table tbody tr:last-child td { border-bottom: none; }.datagrid table tfoot td div { border-top: 1px solid #006699;background: #E1EEF4;} .datagrid table tfoot td { padding: 0; font-size: 12px } .datagrid table tfoot td div{ padding: 2px; }.datagrid table tfoot td ul { margin: 0; padding:0; list-style: none; text-align: right; }.datagrid table tfoot  li { display: inline; }.datagrid table tfoot li a { text-decoration: none; display: inline-block;  padding: 2px 8px; margin: 1px;color: #FFFFFF;border: 1px solid #006699;-webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #006699), color-stop(1, #00557F) );background:-moz-linear-gradient( center top, #006699 5%, #00557F 100% );filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#006699', endColorstr='#00557F');background-color:#006699; }.datagrid table tfoot ul.active, .datagrid table tfoot ul a:hover { text-decoration: none;border-color: #006699; color: #FFFFFF; background: none; background-color:#00557F;}div.dhtmlx_window_active, div.dhx_modal_cover_dv { position: fixed !important; }
        table {
        width: 100%;
        table-layout: fixed;
        }
        td {
            border: 1px solid #35f;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        td.a {
            width: 13%;
            white-space: nowrap;
        }
        td.b {
            width: 9%;
            word-wrap: break-word;
        }
        </style>
        <body>
        <h1>Autorize Report<h1>
        <div class="datagrid"><table>
        <thead><tr><th>URL</th><th>Authorization Enforcement Status</th></tr></thead>
        <tbody>"""

        for i in range(0,self._log.size()):
            color = ""
            if self._log.get(i)._enfocementStatus == self._enfocementStatuses[0]:
                color = "red"
            if self._log.get(i)._enfocementStatus == self._enfocementStatuses[1]:
                color = "yellow"
            if self._log.get(i)._enfocementStatus == self._enfocementStatuses[2]:
                color = "LawnGreen"

            if enforcementStatusFilter == "All Statuses":
                htmlContent += "<tr bgcolor=\"%s\"><td><a href=\"%s\">%s</a></td><td>%s</td></tr>" % (color,self._log.get(i)._url,self._log.get(i)._url, self._log.get(i)._enfocementStatus)
            else:
                if enforcementStatusFilter == self._log.get(i)._enfocementStatus:
                    htmlContent += "<tr bgcolor=\"%s\"><td><a href=\"%s\">%s</a></td><td>%s</td></tr>" % (color,self._log.get(i)._url,self._log.get(i)._url, self._log.get(i)._enfocementStatus)

        htmlContent += "</tbody></table></div></body></html>"
        f = open(fileToSave.getAbsolutePath(), 'w')
        f.writelines(htmlContent)
        f.close()
开发者ID:MiauWuffMiau,项目名称:Autorize,代码行数:61,代码来源:Autorize.py

示例4: FileManager

# 需要导入模块: from javax.swing import JFileChooser [as 别名]
# 或者: from javax.swing.JFileChooser import showSaveDialog [as 别名]
class FileManager(object):
    
    def __init__(self, pywin):
        self.fc = JFileChooser()
        self.fc.fileFilter = FileNameExtensionFilter("Python Files", ["py"])
        self.pywin = pywin
        self.load_path = None
        self.script_path = None

    @property
    def script_area(self):
        return self.pywin.script_pane.script_area
    
    def show_open_dialog(self, title):
        self.fc.dialogTitle = title
        res = self.fc.showOpenDialog(self.pywin.frame)
        if res == JFileChooser.APPROVE_OPTION:
            return self.fc.selectedFile
    
    def show_save_dialog(self, title):
        self.fc.dialogTitle = title
        res = self.fc.showSaveDialog(self.pywin.frame)
        if res == JFileChooser.APPROVE_OPTION:
            return self.fc.selectedFile
    
    def save_script(self):
        if self.script_path is None:
            return
        with codecs.open(self.script_path, "wb", "utf-8") as stream:
            stream.write(self.script_area.input)
    
    def open_script(self):
        f = self.show_open_dialog("Select script file to open")
        if f is None:
            return
        self.script_path = f.absolutePath
        with codecs.open(self.script_path, "rb", "utf-8") as stream:
            self.script_area.input = stream.read()
    
    def save_script_as(self):
        f = self.show_save_dialog("Select file to write script to")
        if f is None:
            return
        self.script_path = f.absolutePath
        self.save_script()
    
    def load_script(self):
        f = self.show_open_dialog("Select script file to load")
        if f is None:
            return
        self.load_path = f.absolutePath
        self.reload_script()
    
    def reload_script(self):
        print "*** Loading", self.load_path, "***"
        try:
            self.pywin.execfile(self.load_path)
        except Exception, e:
            self.pywin.outputpane.addtext(str(e) + '\n', 'error')
开发者ID:aeriksson,项目名称:geogebra,代码行数:61,代码来源:gui.py

示例5: actionPerformed

# 需要导入模块: from javax.swing import JFileChooser [as 别名]
# 或者: from javax.swing.JFileChooser import showSaveDialog [as 别名]
	def actionPerformed(self, e):
	
		fc = JFileChooser()
		
		returnValue = fc.showSaveDialog(self.pi.mainWindow.frame)
		
		if returnValue == JFileChooser.APPROVE_OPTION:
			fileName = fc.selectedFile.absolutePath
			createIdcFile(fileName, self.module)
			MessageBox.showInformation(self.pi.mainWindow.frame, "Module information was successfully written to the selected IDC file. Please run the IDC file in IDA Pro now.")
开发者ID:0x90erator,项目名称:binnavi,代码行数:12,代码来源:ida_backporter.py

示例6: selectFile

# 需要导入模块: from javax.swing import JFileChooser [as 别名]
# 或者: from javax.swing.JFileChooser import showSaveDialog [as 别名]
	def selectFile(self, event):
		'''
		Action handler to select a file to save to
		'''
		
		chooser = JFileChooser()
		retVal = chooser.showSaveDialog(None)

		#if reVal == JFileChooser.APPROVE_OPTION:
		self.saveFile = chooser.selectedFile.path
开发者ID:Yaeger,项目名称:Burp,代码行数:12,代码来源:logme.py

示例7: menuItemClicked

# 需要导入模块: from javax.swing import JFileChooser [as 别名]
# 或者: from javax.swing.JFileChooser import showSaveDialog [as 别名]
    def menuItemClicked(self, menuItemCaption, messageInfo):
        if menuItemCaption == 'Save PoC':

            if self.dir:
                fc = JFileChooser(self.dir)
            else:
                fc = JFileChooser()

            returnVal = fc.showSaveDialog(None)

            if returnVal == JFileChooser.APPROVE_OPTION:
                file = fc.getSelectedFile()

                try:
                    mode = 'w'
                    if file.exists():
                        res = JOptionPane.showConfirmDialog(None, 
                                "File exists. Append?")
                        mode = {
                                JOptionPane.YES_OPTION : 'a',
                                JOptionPane.NO_OPTION : 'w',
                                JOptionPane.CANCEL_OPTION : None,
                                }[res]

                    if not mode:
                        return
                    fp = open(str(file.getAbsolutePath()), mode)
                    for req_resp in messageInfo:
                        req = req_resp.getRequest()
                        resp = req_resp.getResponse()
                        fp.write(req.tostring())
                        fp.write('\r\n\r\n')
                        fp.write(resp.tostring())
                        fp.write('\r\n\r\n')
                    fp.close()
                except Exception, e:
                    JOptionPane.showMessageDialog(None, 
                            "Error during save: " + str(e), "Error",  
                            JOptionPane.ERROR_MESSAGE)
                    raise

                JOptionPane.showMessageDialog(None, 
                            "File was successfully saved", "Ok",  
                            JOptionPane.INFORMATION_MESSAGE)
                self.dir = fc.getCurrentDirectory()
开发者ID:bluec0re,项目名称:pyBurp,代码行数:47,代码来源:PoCPlugin.py

示例8: saveFile

# 需要导入模块: from javax.swing import JFileChooser [as 别名]
# 或者: from javax.swing.JFileChooser import showSaveDialog [as 别名]
    def saveFile(self, event):
        '''
        1. Check if current file has a filename
        2. Save current file in destination given by user
        '''

        self.consoleController.addText("NammuController: Saving file...")

        fileChooser = JFileChooser()
        status = fileChooser.showSaveDialog(self.view)

        if status == JFileChooser.APPROVE_OPTION:
            atfFile = fileChooser.getSelectedFile()
            filename = atfFile.getCanonicalPath()
            atfText = self.atfAreaController.getAtfAreaText()
            self.writeTextFile(filename, atfText)
            #TODO check returned status?

        self.consoleController.addText(" OK\n")
开发者ID:jenshnielsen,项目名称:nammu,代码行数:21,代码来源:NammuController.py

示例9: save

# 需要导入模块: from javax.swing import JFileChooser [as 别名]
# 或者: from javax.swing.JFileChooser import showSaveDialog [as 别名]
 def save(self, parent, format):
     chooser = JFileChooser()
     #filter = FileNameExtensionFilter(
     #    format + " files",
     #    array([format, format.lower()], String))
     #chooser.setFileFilter(filter);
     returnVal = chooser.showSaveDialog(parent)
     if returnVal == JFileChooser.APPROVE_OPTION:
         fileName = chooser.getSelectedFile().getPath()
         if not fileName.upper().endswith('.' + format):
             fileName += '.' + format.lower()
         file = File(fileName)
     else:
         return
     if format == 'PNG':
         ChartUtilities.saveChartAsPNG(file, self.chart, self.exportX, self.exportY)
     elif format == 'SVG':
         domImpl = GenericDOMImplementation.getDOMImplementation()
         doc = domImpl.createDocument(None, "svg", None)
         svgGen = SVGGraphics2D(doc)
         svgGen.getGeneratorContext().setPrecision(6)
         self.chart.draw(svgGen,
            Rectangle2D.Double(0, 0, self.exportX, self.exportY), None)
         out = OutputStreamWriter(FileOutputStream(file), "UTF-8")
         svgGen.stream(out, True) #True is for useCSS
         out.close()
     elif format == 'PDF':
         mapper = DefaultFontMapper()
         pageSize = Rectangle(self.exportX, self.exportY)
         doc = TextDocument(pageSize, 50, 50, 50, 50)
         out = BufferedOutputStream(FileOutputStream(file))
         writer = PdfWriter.getInstance(doc, out)
         doc.open()
         cb = writer.getDirectContent()
         tp = cb.createTemplate(self.exportX, self.exportY)
         g2 = tp.createGraphics(self.exportX, self.exportY, mapper)
         r2D = Rectangle2D.Double(0, 0, self.exportX, self.exportY)
         self.chart.draw(g2, r2D)
         g2.dispose()
         cb.addTemplate(tp, 0, 0)
         doc.close()
开发者ID:samitha,项目名称:lositan,代码行数:43,代码来源:Chart.py

示例10: savePopNames

# 需要导入模块: from javax.swing import JFileChooser [as 别名]
# 或者: from javax.swing.JFileChooser import showSaveDialog [as 别名]
def savePopNames():
    global frame
    global popNames, remPops
    fc = JFileChooser(dataPath)
    retVal = fc.showSaveDialog(frame)
    if retVal == JFileChooser.APPROVE_OPTION:
        file = fc.getSelectedFile().getAbsolutePath()
        try:
            f = open(file)
        except IOError:
            exists = False
        else:
            exists = True
            f.close()
        if exists:
            if not yesNo(frame, "File exists, overwrite?"):
                return
        f = open(file, 'w')
        for popName in popNames:
            f.write(popName + '\n')
        f.close()
开发者ID:tiagoantao,项目名称:lositan,代码行数:23,代码来源:Main.py

示例11: go

# 需要导入模块: from javax.swing import JFileChooser [as 别名]
# 或者: from javax.swing.JFileChooser import showSaveDialog [as 别名]
 def go(self, fileTypes=None, default=None, directoryAllowed=False):
     fileChooser = JFileChooser()
     if self.title:
         fileChooser.setDialogTitle(self.title)
     if default:
         fileChooser.setSelectedFile(java.io.File(default))
     fileChooser.setCurrentDirectory(java.io.File("."))
     if fileTypes:
         for extension, description in fileTypes:
            fileChooser.addChoosableFileFilter(FileFilterForExtension(extension, description))            
     if self.loadOrSave == "load":
         result = fileChooser.showOpenDialog(self.parent)
     else:
         result = fileChooser.showSaveDialog(self.parent)
     if (result == JFileChooser.APPROVE_OPTION):
         fileResult = None
         fileAndMaybeDir = fileChooser.getSelectedFile().getAbsoluteFile()
         if directoryAllowed or not fileAndMaybeDir.isDirectory():
             fileResult = str(fileAndMaybeDir)
         return fileResult
     else:
         return None
开发者ID:pdfernhout,项目名称:openvirgle,代码行数:24,代码来源:browser.py

示例12: exportToCSV

# 需要导入模块: from javax.swing import JFileChooser [as 别名]
# 或者: from javax.swing.JFileChooser import showSaveDialog [as 别名]
    def exportToCSV(self):
        parentFrame = JFrame()
        fileChooser = JFileChooser()
        fileChooser.setSelectedFile(File("AutorizeReprort.csv"));
        fileChooser.setDialogTitle("Save Autorize Report")
        userSelection = fileChooser.showSaveDialog(parentFrame)
        if userSelection == JFileChooser.APPROVE_OPTION:
            fileToSave = fileChooser.getSelectedFile()

        enforcementStatusFilter = self.exportES.getSelectedItem()
        csvContent = "id\tURL\tOriginal length\tModified length\tUnauthorized length\tAuthorization Enforcement Status\tAuthorization Unauthenticated Status\n"

        for i in range(0,self._log.size()):

            if enforcementStatusFilter == "All Statuses":
                csvContent += "%d\t%s\t%d\t%d\t%d\t%s\t%s\n" % (self._log.get(i)._id,self._log.get(i)._url, len(self._log.get(i)._originalrequestResponse.getResponse()) if self._log.get(i)._originalrequestResponse != None else 0, len(self._log.get(i)._requestResponse.getResponse()) if self._log.get(i)._requestResponse != None else 0, len(self._log.get(i)._unauthorizedRequestResponse.getResponse()) if self._log.get(i)._unauthorizedRequestResponse != None else 0, self._log.get(i)._enfocementStatus, self._log.get(i)._enfocementStatusUnauthorized)
                
            else:
                if (enforcementStatusFilter == self._log.get(i)._enfocementStatus) or (enforcementStatusFilter == self._log.get(i)._enfocementStatusUnauthorized):
                    csvContent += "%d\t%s\t%d\t%d\t%d\t%s\t%s\n" % (self._log.get(i)._id,self._log.get(i)._url, len(self._log.get(i)._originalrequestResponse.getResponse()) if self._log.get(i)._originalrequestResponse != None else 0, len(self._log.get(i)._requestResponse.getResponse()) if self._log.get(i)._requestResponse != None else 0, len(self._log.get(i)._unauthorizedRequestResponse.getResponse()) if self._log.get(i)._unauthorizedRequestResponse != None else 0, self._log.get(i)._enfocementStatus, self._log.get(i)._enfocementStatusUnauthorized)
        
        f = open(fileToSave.getAbsolutePath(), 'w')
        f.writelines(csvContent)
        f.close()
开发者ID:federicodotta,项目名称:Autorize,代码行数:26,代码来源:Autorize.py

示例13: DataPanel

# 需要导入模块: from javax.swing import JFileChooser [as 别名]
# 或者: from javax.swing.JFileChooser import showSaveDialog [as 别名]

#.........这里部分代码省略.........
        filter.maximumSize=filter.preferredSize
        panel.add(filter)

        decimals=JPanel(layout=BorderLayout(),opaque=False)
        self.decimals = JSpinner(SpinnerNumberModel(3,0,10,1),stateChanged=self.refresh)
        decimals.add(self.decimals)
        decimals.add(JLabel('decimal places'),BorderLayout.NORTH)
        decimals.maximumSize=decimals.preferredSize
        panel.add(decimals)

        panel.add(JButton(Icon.save,actionPerformed=self.save,rolloverIcon=ShadedIcon.save,toolTipText='save',borderPainted=False,focusPainted=False,contentAreaFilled=False))

        return panel

    def extract_data(self):
        pause_state=self.view.paused
        self.view.paused=True

        while self.view.simulating:
            java.lang.Thread.sleep(10)

        tau=float(self.filter.value)
        dt=self.view.dt
        if tau<dt: dt_tau=None
        else: dt_tau=dt/tau

        decimals=int(self.decimals.value)
        format='%%1.%df'%decimals

        start_index=max(0,self.view.timelog.tick_count-self.view.timelog.tick_limit+1)
        count=min(self.view.timelog.tick_limit,self.view.timelog.tick_count)
        start_time=start_index*self.view.dt

        data=None
        title=['t']
        keys = self.view.watcher.active.keys()
        keys.sort()
        for key in keys:
            watch = self.view.watcher.active[key]
            name,func,args=key

            code='%s.%s%s'%(name,func.__name__,args)
            if code not in self.popup_items:
                state=True
                if 'spike' in func.__name__: state=False
                if 'voltage' in func.__name__: state=False
                self.popup_items[code]=JCheckBoxMenuItem(code,state,stateChanged=self.refresh)
                self.popup.add(self.popup_items[code])

            if self.popup_items[code].state is False: continue

            d=watch.get(dt_tau=dt_tau,start=start_index,count=count)
            n=len(watch.get_first())
            if data is None:
                data=[]
                while len(data)<len(d):
                    data.append(['%0.4f'%(start_time+(len(data)+0)*self.view.dt)])


            for i in range(n):
                title.append('%s[%d]'%(code,i))
                for j in range(len(data)):
                    dd=d[j]
                    if dd is None: data[j].append('')
                    else: data[j].append(format%dd[i])

        self.view.paused=pause_state
        return data,title


    def save(self,event=None):
        if self.fileChooser.showSaveDialog(self)==JFileChooser.APPROVE_OPTION:
            f=self.fileChooser.getSelectedFile()
            writer=BufferedWriter(FileWriter(f))

            data,title=self.extract_data()
            title=[t.replace(',',' ') for t in title]
            writer.write(','.join(title)+'\n')
            for row in data:
                writer.write(','.join(row)+'\n')
            writer.close()

    def refresh(self,event=None):
        data,title=self.extract_data()
        self.table.model.setDataVector(data,title)

        
    def mouseClicked(self, event):     
        if event.button==MouseEvent.BUTTON3 or (event.button==MouseEvent.BUTTON1 and event.isControlDown()):
            if self.popup is not None:
                self.popup.show(event.source,event.x-5,event.y-5)
            
    def mouseEntered(self, event):
        pass
    def mouseExited(self, event):        
        pass
    def mousePressed(self, event):
        pass
    def mouseReleased(self, event):        
        pass
开发者ID:Elhamahm,项目名称:nengo_1.4,代码行数:104,代码来源:data.py

示例14: JFileChooser

# 需要导入模块: from javax.swing import JFileChooser [as 别名]
# 或者: from javax.swing.JFileChooser import showSaveDialog [as 别名]
            csvFile.write("Off")

        # Notify the writer of the end of this detail record
        csvFile.endRecord()
        csvFile.flush()
        print "Entry", entry.getId(), "written"

# Now do the actual work here

# Create output file.
# Unless modified here, this will create the output file in the same
# location as the roster itself.
# Default behaviour is for this to be in the user preferences directory
fc = JFileChooser()
fc.setSelectedFile(java.io.File(outFile))
ret = fc.showSaveDialog(None)
if ret == JFileChooser.APPROVE_OPTION:
    # We've got a valid filename
    outFile = fc.getSelectedFile().toString()
    print "Output file:", outFile
    csvFile = com.csvreader.CsvWriter(java.io.BufferedOutputStream(java.io.FileOutputStream(outFile)),',',java.nio.charset.Charset.defaultCharset())

    # Output the header if required
    if outputHeader==True:
        writeHeader(csvFile)

    # Output details
    writeDetails(csvFile)

    # Flush the write buffer and close the file
    csvFile.flush()
开发者ID:RCFlyer25,项目名称:JMRI,代码行数:33,代码来源:RosterCsvExport.py

示例15: selectFile

# 需要导入模块: from javax.swing import JFileChooser [as 别名]
# 或者: from javax.swing.JFileChooser import showSaveDialog [as 别名]
 def selectFile(self, event):
   chooser = JFileChooser()
   retVal = chooser.showSaveDialog(None)
   self.saveFile = chooser.selectedFile.path
开发者ID:WeiEast,项目名称:burpSaveUrlList,代码行数:6,代码来源:burpSaveUrlList.py


注:本文中的javax.swing.JFileChooser.showSaveDialog方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。