本文整理汇总了Python中pyface.api.information函数的典型用法代码示例。如果您正苦于以下问题:Python information函数的具体用法?Python information怎么用?Python information使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了information函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_mne_root
def get_mne_root():
"""Get the MNE_ROOT directory
Returns
-------
mne_root : None | str
The MNE_ROOT path or None if the user cancels.
Notes
-----
If MNE_ROOT can't be found, the user is prompted with a file dialog.
If specified successfully, the resulting path is stored with
mne.set_config().
"""
mne_root = get_config('MNE_ROOT')
problem = _mne_root_problem(mne_root)
while problem:
info = ("Please select the MNE_ROOT directory. This is the root "
"directory of the MNE installation.")
msg = '\n\n'.join((problem, info))
information(None, msg, "Select the MNE_ROOT Directory")
msg = "Please select the MNE_ROOT Directory"
dlg = DirectoryDialog(message=msg, new_directory=False)
if dlg.open() == OK:
mne_root = dlg.path
problem = _mne_root_problem(mne_root)
if problem is None:
set_config('MNE_ROOT', mne_root)
else:
return None
return mne_root
示例2: display_message
def display_message(self, msg, title=None, is_error=False):
"""
Display the specified message to the user.
"""
# Ensure we record any reasons this method doesn't work. Especially
# since it's critical in displaying errors to users!
try:
# Attempt to identify the current application window.
parent_window = None
workbench = self.application.get_service('envisage.'
'workbench.IWorkbench')
if workbench is not None:
parent_window = workbench.active_window.control
# Display the requested message
if is_error:
error(parent_window, msg, title=title)
else:
information(parent_window, msg, title=title)
except:
logger.exception('Unable to display pop-up message')
return
示例3: get_fs_home
def get_fs_home():
"""Get the FREESURFER_HOME directory
Returns
-------
fs_home : None | str
The FREESURFER_HOME path or None if the user cancels.
Notes
-----
If FREESURFER_HOME can't be found, the user is prompted with a file dialog.
If specified successfully, the resulting path is stored with
mne.set_config().
"""
fs_home = get_config('FREESURFER_HOME')
problem = _fs_home_problem(fs_home)
while problem:
info = ("Please select the FREESURFER_HOME directory. This is the "
"root directory of the freesurfer installation.")
msg = '\n\n'.join((problem, info))
information(None, msg, "Select the FREESURFER_HOME Directory")
msg = "Please select the FREESURFER_HOME Directory"
dlg = DirectoryDialog(message=msg, new_directory=False)
if dlg.open() == OK:
fs_home = dlg.path
problem = _fs_home_problem(fs_home)
if problem is None:
set_config('FREESURFER_HOME', fs_home)
else:
return None
return fs_home
示例4: _get_hsp_raw
def _get_hsp_raw(self):
fname = self.hsp_file
if not fname:
return
try:
pts = read_hsp(fname)
n_pts = len(pts)
if n_pts > KIT.DIG_POINTS:
msg = ("The selected head shape contains {n_in} points, "
"which is more than the recommended maximum ({n_rec}). "
"The file will be automatically downsampled, which "
"might take a while. A better way to downsample is "
"using FastScan.")
msg = msg.format(n_in=n_pts, n_rec=KIT.DIG_POINTS)
information(None, msg, "Too Many Head Shape Points")
pts = _decimate_points(pts, 5)
except Exception as err:
error(None, str(err), "Error Reading Head Shape")
self.reset_traits(['hsp_file'])
raise
else:
return pts
示例5: _subjects_dir_changed
def _subjects_dir_changed(self, old, new):
if new and self.subjects == ['']:
information(None, "The directory selected as subjects-directory "
"(%s) does not contain any valid MRI subjects. MRI "
"subjects need to contain head surface models which "
"can be created by running:\n\n $ mne "
"make_scalp_surfaces" % self.subjects_dir,
"No Subjects Found")
示例6: close
def close(self, info, is_ok):
if info.object.kit2fiff_panel.queue.unfinished_tasks:
msg = ("Can not close the window while saving is still in "
"progress. Please wait until all files are processed.")
title = "Saving Still in Progress"
information(None, msg, title)
return False
else:
return True
示例7: _subjects_dir_changed
def _subjects_dir_changed(self, old, new):
if new and self.subjects == ['']:
information(None, "The directory selected as subjects-directory "
"(%s) does not contain any valid MRI subjects. If "
"this is not expected make sure all MRI subjects have "
"head surface model files which "
"can be created by running:\n\n $ mne "
"make_scalp_surfaces" % self.subjects_dir,
"No Subjects Found")
示例8: close
def close(self, info, is_ok):
if info.object.queue.unfinished_tasks:
information(
None,
"Can not close the window while saving is still "
"in progress. Please wait until all MRIs are "
"processed.",
"Saving Still in Progress",
)
return False
else:
return True
示例9: cite
def cite(self):
from pyface.api import information
import os
try:
basedir = os.path.dirname(os.path.realpath(__file__)) + '/'
except NameError: #__file__ not defined if this is main script
basedir = ''
fname = basedir + 'data/cite.txt'
citations = open(fname, 'r').read()
msg = u'You are encouraged to cite in your papers one (or all) of the following:\n\n\n' + \
unicode(citations, 'utf-8').replace(u'\ufeff', '')
information(None, msg, title = "Citing ffnet/ffnetui")
示例10: _on_exit
def _on_exit(self):
""" Called when the exit action is invoked. """
parent = self.control
print(choose_one(parent, "Make a choice", ['one', 'two', 'three']))
information(parent, 'Going...')
warning(parent, 'Going......')
error(parent, 'Gone!')
if confirm(parent, 'Should I exit?') == YES:
self.close()
示例11: _on_exit
def _on_exit(self):
""" Called when the exit action is invoked. """
parent = self.control
information(parent, 'Going...')
warning(parent, 'Going......')
error(parent, 'Gone!')
if confirm(parent, 'Should I exit?') == YES:
self.close()
return
示例12: _save
def _save(self, project, parent_window, prompt_for_location=False):
"""
Save the specified project. If *prompt_for_location* is True,
or the project has no known location, then the user is prompted to
provide a location to save to.
Returns True if the project was saved successfully, False if not.
"""
location = project.location.strip()
# If the project's existing location is valid, check if there are any
# autosaved versions.
autosave_loc = ''
if location is not None and os.path.exists(location):
autosave_loc = self._get_autosave_location(location)
# Ask the user to provide a location if we were told to do so or
# if the project has no existing location.
if prompt_for_location or location is None or len(location) < 1:
location = self._get_user_location(project, parent_window)
# Rename any existing autosaved versions to the new project
# location.
if location is not None and len(location) > 0:
self._clean_autosave_location(location)
new_autosave_loc = self._get_autosave_location(location)
if os.path.exists(autosave_loc):
shutil.move(autosave_loc, new_autosave_loc)
# If we have a location to save to, try saving the project.
if location is not None and len(location) > 0:
try:
project.save(location)
saved = True
msg = '"%s" saved to %s' % (project.name, project.location)
information(parent_window, msg, 'Project Saved')
logger.debug(msg)
except Exception as e:
saved = False
logger.exception('Error saving project [%s]', project)
error(parent_window, str(e), title='Save Error')
else:
saved = False
# If the save operation was successful, delete any autosaved files that
# exist.
if saved:
self._clean_autosave_location(location)
return saved
示例13: close
def close(self, info, is_ok): # noqa: D102
if info.object.kit2fiff_panel.queue.unfinished_tasks:
msg = ("Can not close the window while saving is still in "
"progress. Please wait until all files are processed.")
title = "Saving Still in Progress"
information(None, msg, title)
return False
else:
# store configuration, but don't prevent from closing on error
try:
info.object.save_config()
except Exception as exc:
warn("Error saving GUI configuration:\n%s" % (exc,))
return True
示例14: on_export
def on_export(self):
"""
Shows a dialog to export a file
"""
information(None, "This will save exactly what you see on the screen "
"to a file. Choose the file type via the file "
"extension (ie .png, .pdf, .jpg)", "Export")
dialog = FileDialog(parent = self.window.control,
action = 'save as')
if dialog.open() == OK:
self.view.export(dialog.path)
示例15: scanning_step
def scanning_step(self):
if self.icCamera.init_active:
information(parent=None, title="please wait",
message="The initialization of the camera is running. " + \
"Please wait until the initialization is finished.")
return False
#self.icCryo.cryo_refresh=False
self.finished=False
self.x_koords=[]
self.y_koords=[]
self.spectra=[]
self.used_centerwvl=[]
self.used_grating=[]
self.apd_counts=[]
if self.x1>self.x2:
self.x2,self.x1 = self.x1,self.x2
if self.y1>self.y2:
self.y1,self.y2=self.y2,self.y1
if self.ivSpectro.exit_mirror=='front (CCD)': #ueberprueft ob spiegel umgeklappt bzw falls nicht klappt er ihn um
self.ivSpectro.exit_mirror='side (APDs)'#self.ivSpectro.exit_mirror_value[1
self.icCryo.waiting() #wartet bis cryo bereit
#TODO das hier gehört nach cryo
# [x,y] = self.icCryo.get_numeric_position()
#x,y=self.icCryo.convert_output(self.icCryo.position())
x_pos,y_pos = self.calc_snake_xy_pos()
for i in range(len(x_pos)):
if self.finished:
break # abort condition
self.icCryo.move(x_pos[i],y_pos[i])
self.icCryo.waiting()
# get actuall position, maybe x_pos[i] != x
x,y=self.icCryo.pos()
if self.threshold_counts < self.icVoltage.measure()/self.VoltPerCount: # vergleicht schwellenspannung mit aktueller
self.take_spectrum(x,y)
self.plot_map(x,y)
self.finished = True
print 'searching finish'