本文整理汇总了Python中pyface.file_dialog.FileDialog类的典型用法代码示例。如果您正苦于以下问题:Python FileDialog类的具体用法?Python FileDialog怎么用?Python FileDialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FileDialog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _open_logfiles_fired
def _open_logfiles_fired(self):
dlg = FileDialog()
dlg.action = 'open files'
if dlg.open() == OK:
paths = dlg.paths
for filePath in paths:
self.log_files.append(filePath)
示例2: get_file_path
def get_file_path(root, action='open'):
dlg = FileDialog(action=action,
wildcard=FileDialog.create_wildcard('YAML', '*.yaml *.yml'),
default_directory=root)
if dlg.open():
if dlg.path:
return dlg.path
示例3: make_gosub
def make_gosub(self):
selection = self.control.code.textCursor().selectedText()
dlg = FileDialog(action='save as',
default_directory=os.path.dirname(self.path))
p = None
# root = os.path.dirname(self.path)
# p = os.path.join(root, 'common', 'test_gosub.py')
if dlg.open():
p = dlg.path
if p:
p = add_extension(p, '.py')
# p='/Users/ross/Desktop/foosub.py'
with open(p, 'w') as wfile:
wfile.write('# Extracted Gosub\n')
wfile.write('# Source: from {}\n'.format(self.path))
wfile.write('# Date: {}\n'.format(datetime.now().strftime('%m-%d-%Y %H:%M')))
wfile.write('def main():\n')
for li in selection.split(u'\u2029'):
wfile.write(u' {}\n'.format(li.lstrip()))
p = remove_extension(p)
rp = os.path.relpath(p, self.path)
rp = rp.replace('/', ':')
self.control.code.replace_selection("gosub('{}')".format(rp[3:]))
示例4: configure
def configure(self, pre_run=False, **kw):
if not pre_run:
self._manual_configured = True
if not self.path or not os.path.isfile(self.path):
msg = '''CSV File Format
Create/select a file with a column header as the first line.
The following columns are required:
runid, age, age_err
Optional columns are:
group, aliquot
e.x.
runid, age, age_error
SampleA, 10, 0.24
SampleB, 11, 0.32
SampleC, 10, 0.40'''
information(None, msg)
dlg = FileDialog()
if dlg.open() == OK:
self.path = dlg.path
return bool(self.path)
示例5: save_as
def save_as(self):
dlg = FileDialog(action='save as',
default_directory=paths.extraction_dir)
if dlg.open() == OK:
p = dlg.path
if p:
self._save(p)
示例6: _open_button_fired
def _open_button_fired(self):
self.data_selectors = []
# p = '/Users/ross/Sandbox/csvdata.txt'
# self._path = p
# self._path=os.path.join(paths.data_dir,'spectrometer_scans','scan007.txt')
dlg = FileDialog(action='open', default_directory=paths.data_dir)
if dlg.open() == OK:
self._path = dlg.path
with open(self._path, 'U') as fp:
reader = csv.reader(fp, delimiter=self.delimiter)
self.column_names = names = reader.next()
try:
cs = DataSelector(column_names=names,
index=names[0],
value=names[1],
removable=False,
parent=self,
)
self.data_selectors.append(cs)
except IndexError:
self.warning_dialog('Invalid delimiter {} for {}'.format(DELIMITERS[self.delimiter],
os.path.basename(self._path)
))
示例7: _open_esffiles_fired
def _open_esffiles_fired(self):
dlg = FileDialog()
dlg.wildcard = "*.esf"
dlg.action = 'open files'
if dlg.open() == OK:
paths = dlg.paths
for filePath in paths:
self.esf_files.append(filePath)
示例8: _get_save_path
def _get_save_path(self, path, ext='.pdf'):
if path is None:
dlg = FileDialog(action='save as', default_directory=paths.processed_dir)
if dlg.open():
if dlg.path:
path = add_extension(dlg.path, ext)
return path
示例9: get_path
def get_path():
return '/Users/ross/Sandbox/exporttest2.db'
dlg = FileDialog(action='open',
default_directory=paths.data_dir,
wildcard='*.db')
if dlg.open():
if dlg.path:
return dlg.path
示例10: _open_fired
def _open_fired(self):
dlg = FileDialog(action='open')
if dlg.open() == OK:
with open(dlg.path, 'rb') as fp:
self.viewer.set_image(fp)
self.hierarchy.files.append(os.path.basename(dlg.path))
self.client.cache(dlg.path)
示例11: open_file
def open_file(self, p=''):
if not os.path.isfile(p):
dlg = FileDialog(action='open', default_directory=paths.extraction_dir)
if dlg.open() == OK and dlg.path:
p = dlg.path
if p:
self._open_file(p)
return True
示例12: save_as
def save_as(self):
if self._validate_sequence():
dialog = FileDialog(action='save as', default_directory=paths.hops_dir)
if dialog.open() == OK:
p = dialog.path
p = add_extension(p, '.txt')
self._save_file(p)
self.path = p
示例13: _getFilePath
def _getFilePath(self, defFileName):
dlg = FileDialog()
dlg.action = 'save as'
dlg.default_filename = defFileName
if dlg.open() == OK:
return dlg.path
else:
return None
示例14: _exportCSV_changed
def _exportCSV_changed(self):
dlg = FileDialog()
dlg.action = 'save as'
dlg.default_filename = self.groupAddress.replace("/", "-") + '_' + self.name + '.csv'
if dlg.open() != OK:
return
if self._exportCSV_hock != None:
self._exportCSV_hock(self, dlg.path)
示例15: _add_tray_button_fired
def _add_tray_button_fired(self):
dlg = FileDialog(action='open', default_directory=paths.irradiation_tray_maps_dir)
if dlg.open() == OK:
if dlg.path:
# verify this is a valid irradiation map file
if parse_irradiation_tray_map(dlg.path) is not None:
db = self.db
load_irradiation_map(db, dlg.path,
os.path.basename(dlg.path), overwrite_geometry=True)