本文整理汇总了Python中pyface.message_dialog.warning函数的典型用法代码示例。如果您正苦于以下问题:Python warning函数的具体用法?Python warning怎么用?Python warning使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了warning函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: check_dependencies
def check_dependencies():
"""
check the dependencies and
"""
from pyface.api import warning
try:
mod = __import__('uncertainties',
fromlist=['__version__']
)
__version__ = mod.__version__
except ImportError:
warning(None, 'Install "{}" package. required version>={} '.format('uncertainties', '2.1'))
return
vargs = __version__.split('.')
maj = vargs[0]
if int(maj) < 2:
warning(None, 'Update "{}" package. your version={}. required version>={} '.format('uncertainties',
__version__,
'2.1'
))
return
return True
示例2: __init__
def __init__(self, *args, **kw):
p = os.path.join(paths.setup_dir, 'initialization.xml')
if os.path.isfile(p):
super(InitializationParser, self).__init__(p, *args, **kw)
else:
warning(None, 'No initialization file')
sys.exit()
示例3: build_globals
def build_globals(debug):
try:
from pychron.envisage.initialization.initialization_parser import InitializationParser
except ImportError, e:
from pyface.message_dialog import warning
warning(None, str(e))
示例4: _get_runner
def _get_runner(self, event):
app = event.task.application
runner = app.get_service(IPyScriptRunner)
if not runner:
warning(None, 'No runner available')
return runner
示例5: save
def save(self, ans, db):
append = False
if not self.name:
warning(None, 'Please specify a name for the analysis group')
return
if not self.project:
warning(None, 'Please specify an associated project for the analysis group')
return
gdb = db.get_analysis_groups_by_name(self.name, self.project)
ok = True
if gdb:
gdb = gdb[-1]
if db.confirmation_dialog('"{}" already exists? Would you like to append your selection'.format(gdb.name)):
append = True
else:
ok = False
if append:
db.append_analysis_group(gdb, ans)
elif ok:
db.add_analysis_group(ans, self.name, self.project)
return True
示例6: _run
def _run(self):
p = os.path.join(self.root, self.name)
if not os.path.exists(p):
warning(None, 'Invalid Clovera path {}'.format(self.root))
return
# n = 5
# pd = MProgressDialog(max=n, size=(550, 15))
# do_later(pd.open)
# do_later(pd.change_message, '{} process started'.format(self.name))
try:
p = subprocess.Popen([p],
shell=False,
bufsize=1024,
stdout=subprocess.PIPE
)
self._process = p
while p.poll() == None:
if self.queue:
self.queue.put(p.stdout.readline())
time.sleep(1e-6)
self.success = True
# do_later(pd.change_message, '{} process complete'.format(self.name))
return True
except OSError, e:
self.warning_dialog('Clovera programs are not executable. Check Default Clovera Directory.\n{}'.format(e))
import traceback
traceback.print_exc()
示例7: submit
def submit(self, info):
if not self.model.title:
warning(None, 'Please enter a Title for this issue')
return
self.submit_issue_github()
info.ui.dispose()
示例8: git_post
def git_post(cmd, return_json=True, **kw):
usr = os.environ.get('GITHUB_USER')
pwd = os.environ.get('GITHUB_PASSWORD')
if not pwd:
warning(None, 'No password set for "{}". Contact Developer.\n'
'Pychron will quit when this window is closed'.format(usr))
sys.exit()
kw['auth'] = (usr, pwd)
if globalv.cert_file:
kw['verify'] = globalv.cert_file
r = requests.post(cmd, **kw)
if r.status_code == 401:
warning(None, 'Failed to submit issue. Username/Password incorrect.')
elif r.status_code == 403:
print('asf', r.json())
if r.status_code in (201, 422):
ret = True
if return_json:
ret = r.json()
return ret
示例9: start
def start(self):
try:
import xlwt
except ImportError:
warning(None, '''"xlwt" package not installed.
Install to enable MS Excel export''')
示例10: get_plugin
def get_plugin(pname):
klass = None
if not pname.endswith('Plugin'):
pname = '{}Plugin'.format(pname)
if pname in PACKAGE_DICT:
package = PACKAGE_DICT[pname]
klass = get_klass(package, pname)
else:
logger.warning('****** {} not a valid plugin name******'.format(pname),
extra={'threadName_': 'Launcher'})
if klass is not None:
plugin = klass()
if isinstance(plugin, BasePlugin):
check = plugin.check()
if check is True:
return plugin
else:
logger.warning('****** {} not available {}******'.format(klass, check),
extra={'threadName_': 'Launcher'})
warning(None, 'Failed loading plugin.\n {}'.format(plugin.name))
else:
logger.warning('***** Invalid {} needs to be a subclass of Plugin ******'.format(klass),
extra={'threadName_': 'Launcher'})
示例11: _handle
def _handle(*args, **kw):
try:
return func(*args, **kw)
except Exception, e:
import traceback
traceback.print_exc()
warning(None, 'There is a problem in your initialization file {}'.format(e))
sys.exit()
示例12: perform
def perform(self, event):
if os.path.isfile(paths.last_experiment):
with open(paths.last_experiment, 'r') as fp:
path = fp.readline()
if os.path.isfile(path):
self._open_experiment(event, path)
else:
warning(None, 'No last experiment available')
示例13: _load_analyses
def _load_analyses(self):
from pychron.core.csv.csv_parser import CSVColumnParser
par = CSVColumnParser(delimiter=',')
par.load(self.path)
if par.check(('runid', 'age', 'age_err')):
return self._get_items_from_file(par)
else:
warning(None, 'Invalid file format. Minimum columns required are "runid", "age", "age_err"')
示例14: _add_root_button_fired
def _add_root_button_fired(self):
dlg = DirectoryDialog(default_path=paths.mdd_data_dir)
if dlg.open() == OK and dlg.path:
name = os.path.basename(dlg.path)
if os.path.isfile(os.path.join(dlg.path, '{}.in'.format(name))):
self.roots.append(dlg.path)
else:
warning(None, 'Invalid MDD directory. {}. Directory must contain file '
'named {}.in'.format(dlg.path, name))
示例15: _check_refit
def _check_refit(self, ai):
for k in self._keys:
num, dem = k.split('/')
i = ai.get_isotope(detector=dem)
if i is not None:
if not i.ic_factor_reviewed:
return True
else:
from pyface.message_dialog import warning
warning(None, 'Data for detector {} is missing from {}'.format(dem, ai.record_id))
raise RefitException()