本文整理汇总了Python中javax.swing.JFileChooser.showDialog方法的典型用法代码示例。如果您正苦于以下问题:Python JFileChooser.showDialog方法的具体用法?Python JFileChooser.showDialog怎么用?Python JFileChooser.showDialog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JFileChooser
的用法示例。
在下文中一共展示了JFileChooser.showDialog方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: chooseFile
# 需要导入模块: from javax.swing import JFileChooser [as 别名]
# 或者: from javax.swing.JFileChooser import showDialog [as 别名]
def chooseFile(self, event):
chooseFile = JFileChooser()
filter = FileNameExtensionFilter("c files", ["c"])
chooseFile.addChoosableFileFilter(filter)
chooseFile.showDialog(self.uploadPanel, "Choose File")
chosenFile = chooseFile.getSelectedFile()
self.uploadTextField.text = str(chosenFile)
开发者ID:LucaBongiorni,项目名称:Directory-File-Listing-Parser-Importer,代码行数:9,代码来源:Directory-File-Listing-Parser-Importer.py
示例2: set_plugin_loc
# 需要导入模块: from javax.swing import JFileChooser [as 别名]
# 或者: from javax.swing.JFileChooser import showDialog [as 别名]
def set_plugin_loc(self, event):
"""Attempts to load plugins from a specified location"""
if self.config['Plugin Folder'] is not None:
choose_plugin_location = JFileChooser(self.config['Plugin Folder'])
else:
choose_plugin_location = JFileChooser()
choose_plugin_location.setFileSelectionMode(
JFileChooser.DIRECTORIES_ONLY)
choose_plugin_location.showDialog(self.tab, "Choose Folder")
chosen_folder = choose_plugin_location.getSelectedFile()
self.config['Plugin Folder'] = chosen_folder.getAbsolutePath()
self._load_plugins(self.config['Plugin Folder'])
示例3: get_source_input
# 需要导入模块: from javax.swing import JFileChooser [as 别名]
# 或者: from javax.swing.JFileChooser import showDialog [as 别名]
def get_source_input(self, event):
"""Sets the source dir/file for parsing"""
source_chooser = JFileChooser()
source_chooser.setFileSelectionMode(
JFileChooser.FILES_AND_DIRECTORIES)
source_chooser.showDialog(self.tab, "Choose Source Location")
chosen_source = source_chooser.getSelectedFile()
try:
self.source_input = chosen_source.getAbsolutePath()
except AttributeError:
pass
if self.source_input is not None:
self.update_scroll("[*] Source location: %s" % self.source_input)
self.curr_conf.setText(self.source_input)
示例4: getFilePath
# 需要导入模块: from javax.swing import JFileChooser [as 别名]
# 或者: from javax.swing.JFileChooser import showDialog [as 别名]
def getFilePath(self):
chooseFile = JFileChooser()
panel = JPanel()
ret = chooseFile.showDialog(panel, "Choose output file (*.msc)")
if ret == JFileChooser.APPROVE_OPTION:
file=chooseFile.getSelectedFile()
return file
示例5: openFile
# 需要导入模块: from javax.swing import JFileChooser [as 别名]
# 或者: from javax.swing.JFileChooser import showDialog [as 别名]
def openFile(self, event):
'''
1. Check if current file in text area has unsaved changes
1.1 Prompt user for file saving
1.1.1 Save file
2. Display browser for user to choose file
3. Load file in text area
'''
self.consoleController.addText("NammuController: Opening file...")
self.handleUnsaved()
fileChooser = JFileChooser()
filter = FileNameExtensionFilter("ATF files", ["atf"])
fileChooser.setFileFilter(filter)
status = fileChooser.showDialog(self.view, "Choose file")
if status == JFileChooser.APPROVE_OPTION:
atfFile = fileChooser.getSelectedFile()
filename = atfFile.getCanonicalPath()
atfText = self.readTextFile(filename)
self.currentFilename = atfFile.getCanonicalPath()
self.atfAreaController.setAtfAreaText(atfText)
#TODO: Else, prompt user to choose again before closing
self.consoleController.addText(" OK\n")
示例6: onOpenFolder
# 需要导入模块: from javax.swing import JFileChooser [as 别名]
# 或者: from javax.swing.JFileChooser import showDialog [as 别名]
def onOpenFolder(self, event):
chooseFile = JFileChooser()
chooseFile.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
ret = chooseFile.showDialog(self, "Choose folder")
if ret == JFileChooser.APPROVE_OPTION:
self.faile= chooseFile.getSelectedFile()
self.cbOutDir.addItem(self.faile.getPath())
self.cbOutDir.selectedItem= self.faile.getPath()
示例7: onClick
# 需要导入模块: from javax.swing import JFileChooser [as 别名]
# 或者: from javax.swing.JFileChooser import showDialog [as 别名]
def onClick(self, e):
chooseFile = JFileChooser()
filter = FileNameExtensionFilter("c files", ["c"])
chooseFile.addChoosableFileFilter(filter)
ret = chooseFile.showDialog(self.panel, "Choose file")
if ret == JFileChooser.APPROVE_OPTION:
file = chooseFile.getSelectedFile()
print file
示例8: onClick
# 需要导入模块: from javax.swing import JFileChooser [as 别名]
# 或者: from javax.swing.JFileChooser import showDialog [as 别名]
def onClick(self, e):
chooseFile = JFileChooser()
filter = FileNameExtensionFilter("SQLite", ["sqlite"])
chooseFile.addChoosableFileFilter(filter)
ret = chooseFile.showDialog(self.panel, "Select SQLite")
if ret == JFileChooser.APPROVE_OPTION:
file = chooseFile.getSelectedFile()
text = self.readPath(file)
self.area.setText(text)
示例9: onClick
# 需要导入模块: from javax.swing import JFileChooser [as 别名]
# 或者: from javax.swing.JFileChooser import showDialog [as 别名]
def onClick(self, e):
chooseFile = JFileChooser()
filter = FileNameExtensionFilter("SQLite", ["sqlite"])
chooseFile.addChoosableFileFilter(filter)
ret = chooseFile.showDialog(self.panel0, "Select SQLite")
if ret == JFileChooser.APPROVE_OPTION:
file = chooseFile.getSelectedFile()
Canonical_file = file.getCanonicalPath()
#text = self.readPath(file)
self.local_settings.setSetting('ExecFile', Canonical_file)
self.Program_Executable_TF.setText(Canonical_file)
示例10: Find_Plaso_File
# 需要导入模块: from javax.swing import JFileChooser [as 别名]
# 或者: from javax.swing.JFileChooser import showDialog [as 别名]
def Find_Plaso_File(self, e):
chooseFile = JFileChooser()
filter = FileNameExtensionFilter("All", ["*.*"])
chooseFile.addChoosableFileFilter(filter)
ret = chooseFile.showDialog(self.panel0, "Find Plaso Storage File")
if ret == JFileChooser.APPROVE_OPTION:
file = chooseFile.getSelectedFile()
Canonical_file = file.getCanonicalPath()
#text = self.readPath(file)
self.local_settings.setSetting('Plaso_Storage_File', Canonical_file)
self.Plaso_Storage_File_TF.setText(Canonical_file)
示例11: Find_Dir
# 需要导入模块: from javax.swing import JFileChooser [as 别名]
# 或者: from javax.swing.JFileChooser import showDialog [as 别名]
def Find_Dir(self, e):
chooseFile = JFileChooser()
filter = FileNameExtensionFilter("All", ["*.*"])
chooseFile.addChoosableFileFilter(filter)
#chooseFile.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY)
ret = chooseFile.showDialog(self.panel0, "Find Volatility Directory")
if ret == JFileChooser.APPROVE_OPTION:
file = chooseFile.getSelectedFile()
Canonical_file = file.getCanonicalPath()
#text = self.readPath(file)
self.local_settings.setSetting('Volatility_Directory', Canonical_file)
self.Program_Executable_TF.setText(Canonical_file)
示例12: onOpenFile
# 需要导入模块: from javax.swing import JFileChooser [as 别名]
# 或者: from javax.swing.JFileChooser import showDialog [as 别名]
def onOpenFile(self, event):
''' remember to change the path'''
chooseFile = JFileChooser()
chooseFile.setCurrentDirectory(File('C:\Users\fragom\PhD_CIM\Modelica\Models'))
filtro = FileNameExtensionFilter("mo files", ["mo"])
chooseFile.addChoosableFileFilter(filtro)
ret = chooseFile.showDialog(self, "Choose file")
if ret == JFileChooser.APPROVE_OPTION:
self.faile= chooseFile.getSelectedFile()
if event.getActionCommand() == "Load Model":
self.cbMoFile.addItem(self.faile.getPath())
self.cbMoFile.selectedItem= self.faile.getPath()
if event.getActionCommand() == "Load Library":
self.cbMoLib.addItem(self.faile.getPath())
self.cbMoLib.selectedItem= self.faile.getPath()
示例13: loadSimOut
# 需要导入模块: from javax.swing import JFileChooser [as 别名]
# 或者: from javax.swing.JFileChooser import showDialog [as 别名]
def loadSimOut(self, event):
chooseFile = JFileChooser()
filtro = FileNameExtensionFilter("Output files (.h5)", ['h5'])
chooseFile.addChoosableFileFilter(filtro)
ret = chooseFile.showDialog(self.frame, "Choose simulation result")
if ret == JFileChooser.APPROVE_OPTION:
faile= chooseFile.getSelectedFile()
self.cbfilesimOut.addItem(faile.getPath())
self.cbfilesimOut.selectedItem(faile.getPath())
h5pmu= PhasorMeasH5.PhasorMeasH5(faile)
h5pmu.open_h5()
h5pmu.load_h5('pwLine4', 'V')
# result: 2 vectors per variable, work with pwLine4.n.vr, pwLine4.n.vi
senyal= h5pmu.get_senyal()
print senyal
示例14: exportPy
# 需要导入模块: from javax.swing import JFileChooser [as 别名]
# 或者: from javax.swing.JFileChooser import showDialog [as 别名]
def exportPy(self,event):
chooseFile = JFileChooser()
ret = chooseFile.showDialog(self._mainpane, "Choose file")
filename = chooseFile.getSelectedFile().getCanonicalPath()
self._stdout.println("Export to : " + filename )
open(filename, 'w', 0).write( self._pyViewer.getText() )