本文整理汇总了Python中spyderlib.qt.compat.getopenfilename函数的典型用法代码示例。如果您正苦于以下问题:Python getopenfilename函数的具体用法?Python getopenfilename怎么用?Python getopenfilename使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getopenfilename函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: select_file
def select_file(self):
self.emit(SIGNAL('redirect_stdio(bool)'), False)
filename, _selfilter = getopenfilename(self, _("Select Python script"),
getcwd(), _("Python scripts")+" (*.py ; *.pyw)")
self.emit(SIGNAL('redirect_stdio(bool)'), False)
if filename:
self.analyze(filename)
示例2: select_file
def select_file(self):
self.redirect_stdio.emit(False)
filename, _selfilter = getopenfilename(self, _("Select Python file"),
getcwd(), _("Python files")+" (*.py ; *.pyw)")
self.redirect_stdio.emit(True)
if filename:
self.analyze(filename)
示例3: compare
def compare(self):
filename, _selfilter = getopenfilename(self, _("Select script to compare"),
getcwd(), _("Profiler result")+" (*.Result)")
if filename:
self.datatree.compare(filename)
self.show_data()
self.clear_button.setEnabled(True)
示例4: select_file
def select_file(self, edit, filters=None):
"""Select File"""
basedir = osp.dirname(to_text_string(edit.text()))
if not osp.isdir(basedir):
basedir = getcwd()
if filters is None:
filters = _("All files (*)")
title = _("Select file")
filename, _selfilter = getopenfilename(self, title, basedir, filters)
if filename:
edit.setText(filename)
示例5: run_script
def run_script(self, filename=None, silent=False, set_focus=False,
args=None):
"""Run a Python script"""
if filename is None:
self.shell.interpreter.restore_stds()
filename, _selfilter = getopenfilename(self, _("Run Python script"),
os.getcwdu(), _("Python scripts")+" (*.py ; *.pyw ; *.ipy)")
self.shell.interpreter.redirect_stds()
if filename:
os.chdir( os.path.dirname(filename) )
filename = os.path.basename(filename)
else:
return
command = "runfile(%s, args=%s)" % (repr(osp.abspath(filename)),
repr(args))
if set_focus:
self.shell.setFocus()
if self.dockwidget and not self.ismaximized:
self.dockwidget.setVisible(True)
self.dockwidget.raise_()
self.shell.write(command+'\n')
self.shell.run_command(command)
示例6: run_script
def run_script(self, filename=None, silent=False, set_focus=False,
args=None):
"""Run a Python script"""
if filename is None:
self.shell.interpreter.restore_stds()
filename, _selfilter = getopenfilename(self, _("Run Python script"),
getcwd(), _("Python scripts")+" (*.py ; *.pyw ; *.ipy)")
self.shell.interpreter.redirect_stds()
if filename:
os.chdir( osp.dirname(filename) )
filename = osp.basename(filename)
else:
return
debug_print(args)
filename = osp.abspath(filename)
rbs = remove_backslashes
command = "runfile('%s', args='%s')" % (rbs(filename), rbs(args))
if set_focus:
self.shell.setFocus()
if self.dockwidget and not self.ismaximized:
self.dockwidget.setVisible(True)
self.dockwidget.raise_()
self.shell.write(command+'\n')
self.shell.run_command(command)
示例7: select_ssh_key
def select_ssh_key(self):
kf = getopenfilename(self, _('Select ssh key'),
get_ipython_dir(), '*.pem;;*.*')[0]
self.kf.setText(kf)
示例8: select_connection_file
def select_connection_file(self):
cf = getopenfilename(self, _('Open IPython connection file'),
osp.join(get_ipython_dir(), 'profile_default', 'security'),
'*.json;;*.*')[0]
self.cf.setText(cf)