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


Python swing.JFileChooser方法代码示例

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


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

示例1: loadFile

# 需要导入模块: from javax import swing [as 别名]
# 或者: from javax.swing import JFileChooser [as 别名]
def loadFile(self, e):
        chooseFile = swing.JFileChooser()
        fileDialog = chooseFile.showDialog(self.tab, "Choose file")

        if fileDialog == swing.JFileChooser.APPROVE_OPTION:
            file = chooseFile.getSelectedFile()
            filename = file.getCanonicalPath()
            fileExtension = os.path.splitext(filename)[1]

            try:
                loadedFile = open(filename, "r")
            except IOError as e:
                print "Error reading file.\n" + str(e)
                self.logArea.append('\nError reading File: %s' % filename)

            if fileExtension == '.gnmap':
                self.nmap(loadedFile)
            elif fileExtension == '.nessus':
                self.nessus(loadedFile)
            elif fileExtension == '.txt':
                self.plaintext(loadedFile)
            else:
                print '\nFile %s was read but does not have the correct extension (.gnmap, .nessus, .txt).' % filename
                self.logArea.append('\nFile %s was read but does not have the correct extension (.gnmap, .nessus, .txt).' % filename) 
开发者ID:SmeegeSec,项目名称:Burp-Importer,代码行数:26,代码来源:BurpImporter.py

示例2: load

# 需要导入模块: from javax import swing [as 别名]
# 或者: from javax.swing import JFileChooser [as 别名]
def load(self, e):
        chooseFile = swing.JFileChooser()
        ret = chooseFile.showDialog(self.tab, "Choose file")

        if ret == swing.JFileChooser.APPROVE_OPTION:
            file = chooseFile.getSelectedFile()
            filename = file.getCanonicalPath()
            try:
                f = open(filename, "r")
                text = f.readlines()
        
                if text:
                    text = [line for line in text if not line.isspace()]
                    text = [line.rstrip('\n') for line in text]
                    self.boringHeadersList.setListData(text)
            except IOError as e:
                print "Error reading file.\n" + str(e) 
开发者ID:Dionach,项目名称:HeadersAnalyzer,代码行数:19,代码来源:HeadersAnalyzer.py

示例3: setAPI

# 需要导入模块: from javax import swing [as 别名]
# 或者: from javax.swing import JFileChooser [as 别名]
def setAPI(self, e):
    selectFile = swing.JFileChooser()
    filter = swing.filechooser.FileNameExtensionFilter("python files", ["py"])
    selectFile.addChoosableFileFilter(filter)

    returnedFile = selectFile.showDialog(self._jPanel, "SQLMap API")

    if returnedFile == swing.JFileChooser.APPROVE_OPTION:
      file = selectFile.getSelectedFile()
      self.apifile = file.getPath()
      print 'Selected API at ' + file.getPath()
      self._jLabelAPI.setText('API set to: ' + file.getPath()) 
开发者ID:codewatchorg,项目名称:sqlipy,代码行数:14,代码来源:SQLiPy.py

示例4: setPython

# 需要导入模块: from javax import swing [as 别名]
# 或者: from javax.swing import JFileChooser [as 别名]
def setPython(self, e):
    selectFile = swing.JFileChooser()

    returnedFile = selectFile.showDialog(self._jPanel, "Python EXE")

    if returnedFile == swing.JFileChooser.APPROVE_OPTION:
      file = selectFile.getSelectedFile()
      self.pythonfile = file.getPath()
      print 'Selected Python at ' + file.getPath()
      self._jLabelPython.setText('Python set to: ' + file.getPath()) 
开发者ID:codewatchorg,项目名称:sqlipy,代码行数:12,代码来源:SQLiPy.py

示例5: _tomcatLoadUsersFunc

# 需要导入模块: from javax import swing [as 别名]
# 或者: from javax.swing import JFileChooser [as 别名]
def _tomcatLoadUsersFunc(self, event):
        chooser = swing.JFileChooser()
        chooser.showOpenDialog(self._tomcatMainPanel)
        filePathName = ''
        try:
            if(chooser.getSelectedFile()) is not None:
                filePathName += (str(chooser.getSelectedFile()).replace('\\', '/'))
                self._tomcatMainUname.setText(filePathName.strip())
        except:
            print 'Open User File Error' 
开发者ID:WallbreakerTeam,项目名称:TomcatBrute,代码行数:12,代码来源:TomcatBrute.py

示例6: _tomcatLoadPwdsDicts

# 需要导入模块: from javax import swing [as 别名]
# 或者: from javax.swing import JFileChooser [as 别名]
def _tomcatLoadPwdsDicts(self, event):
        chooser = swing.JFileChooser()
        chooser.showOpenDialog(self._tomcatMainPanel)
        filePathName = ''
        try:
            if(chooser.getSelectedFile()) is not None:
                filePathName += (str(chooser.getSelectedFile()).replace('\\', '/'))
                self._tomcatMainPwd.setText(filePathName.strip())
        except:
            print 'Open Pwd File Error' 
开发者ID:WallbreakerTeam,项目名称:TomcatBrute,代码行数:12,代码来源:TomcatBrute.py

示例7: choose_file

# 需要导入模块: from javax import swing [as 别名]
# 或者: from javax.swing import JFileChooser [as 别名]
def choose_file(self, event):
        chooseFile = JFileChooser()
        chooseFile.showOpenDialog(None)
        chosenFile = chooseFile.getSelectedFile()
        return str(chosenFile) 
开发者ID:EnableSecurity,项目名称:Identity-Crisis,代码行数:7,代码来源:identitycrisis.py

示例8: exportLog

# 需要导入模块: from javax import swing [as 别名]
# 或者: from javax.swing import JFileChooser [as 别名]
def exportLog(self, event):
        chooseFile = JFileChooser()
        ret = chooseFile.showDialog(self.logPane, "Choose file")
        filename = chooseFile.getSelectedFile().getCanonicalPath()
        print("\n" + "Export to : " + filename)
        open(filename, 'w', 0).write(self.outputTxtArea.text) 
开发者ID:InitRoot,项目名称:BurpJSLinkFinder,代码行数:8,代码来源:FransLinkfinder.py

示例9: initUI

# 需要导入模块: from javax import swing [as 别名]
# 或者: from javax.swing import JFileChooser [as 别名]
def initUI(self):
        self.tab = swing.JPanel()

        # UI for Output
        self.outputLabel = swing.JLabel("LinkFinder Log:")
        self.outputLabel.setFont(Font("Tahoma", Font.BOLD, 14))
        self.outputLabel.setForeground(Color(255,102,52))
        self.logPane = swing.JScrollPane()
        self.outputTxtArea = swing.JTextArea()
        self.outputTxtArea.setFont(Font("Consolas", Font.PLAIN, 12))
        self.outputTxtArea.setLineWrap(True)
        self.logPane.setViewportView(self.outputTxtArea)
        self.clearBtn = swing.JButton("Clear Log", actionPerformed=self.clearLog)
        self.exportBtn = swing.JButton("Export Log", actionPerformed=self.exportLog)
        self.parentFrm = swing.JFileChooser()



        # Layout
        layout = swing.GroupLayout(self.tab)
        layout.setAutoCreateGaps(True)
        layout.setAutoCreateContainerGaps(True)
        self.tab.setLayout(layout)
      
        layout.setHorizontalGroup(
            layout.createParallelGroup()
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup()
                    .addComponent(self.outputLabel)
                    .addComponent(self.logPane)
                    .addComponent(self.clearBtn)
                    .addComponent(self.exportBtn)
                )
            )
        )
        
        layout.setVerticalGroup(
            layout.createParallelGroup()
            .addGroup(layout.createParallelGroup()
                .addGroup(layout.createSequentialGroup()
                    .addComponent(self.outputLabel)
                    .addComponent(self.logPane)
                    .addComponent(self.clearBtn)
                    .addComponent(self.exportBtn)
                )
            )
        ) 
开发者ID:InitRoot,项目名称:BurpJSLinkFinder,代码行数:49,代码来源:FransLinkfinder.py


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