本文整理汇总了Python中spyderlib.qt.compat.getexistingdirectory函数的典型用法代码示例。如果您正苦于以下问题:Python getexistingdirectory函数的具体用法?Python getexistingdirectory怎么用?Python getexistingdirectory使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getexistingdirectory函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: move
def move(self, fnames=None):
"""Move files/directories"""
if fnames is None:
fnames = self.get_selected_filenames()
orig = fixpath(osp.dirname(fnames[0]))
while True:
self.parent_widget.redirect_stdio.emit(False)
folder = getexistingdirectory(self, _("Select directory"), orig)
self.parent_widget.redirect_stdio.emit(True)
if folder:
folder = fixpath(folder)
if folder != orig:
break
else:
return
for fname in fnames:
basename = osp.basename(fname)
try:
misc.move_file(fname, osp.join(folder, basename))
except EnvironmentError as error:
QMessageBox.critical(
self,
_("Error"),
_("<b>Unable to move <i>%s</i></b>" "<br><br>Error message:<br>%s")
% (basename, to_text_string(error)),
)
示例2: select_directory
def select_directory(self):
"""Select directory"""
self.redirect_stdio.emit(False)
directory = getexistingdirectory(self.main, _("Select directory"), getcwd())
if directory:
self.chdir(directory)
self.redirect_stdio.emit(True)
示例3: set_current_working_directory
def set_current_working_directory(self):
"""Set current working directory"""
cwd = self.shell.get_cwd()
self.redirect_stdio.emit(False)
directory = getexistingdirectory(self, _("Select directory"), cwd)
if directory:
self.shell.set_cwd(directory)
self.redirect_stdio.emit(True)
示例4: select_directory
def select_directory(self):
"""Select directory"""
self.parent().redirect_stdio.emit(False)
directory = getexistingdirectory(self, _("Select directory"),
self.dir_combo.currentText())
if directory:
self.set_directory(directory)
self.parent().redirect_stdio.emit(True)
示例5: select_directory
def select_directory(self):
"""Select directory"""
self.emit(SIGNAL('redirect_stdio(bool)'), False)
directory = getexistingdirectory(self.main, _("Select directory"),
getcwd())
if directory:
self.chdir(directory)
self.emit(SIGNAL('redirect_stdio(bool)'), True)
示例6: select_directory
def select_directory(self):
"""Select directory"""
self.parent().emit(SIGNAL('redirect_stdio(bool)'), False)
directory = getexistingdirectory(self, _("Select directory"),
self.dir_combo.currentText())
if directory:
self.set_directory(directory)
self.parent().emit(SIGNAL('redirect_stdio(bool)'), True)
示例7: select_directory
def select_directory(self):
"""Select directory"""
basedir = to_text_string(self.wd_edit.text())
if not osp.isdir(basedir):
basedir = getcwd()
directory = getexistingdirectory(self, _("Select directory"), basedir)
if directory:
self.wd_edit.setText(directory)
self.wd_cb.setChecked(True)
示例8: select_directory
def select_directory(self, edit):
"""Select directory"""
basedir = to_text_string(edit.text())
if not osp.isdir(basedir):
basedir = getcwd()
title = _("Select directory")
directory = getexistingdirectory(self, title, basedir)
if directory:
edit.setText(directory)
示例9: select_directory
def select_directory(self, edit):
"""Select directory"""
basedir = unicode(edit.text())
if not osp.isdir(basedir):
basedir = os.getcwdu()
title = _("Select directory")
directory = getexistingdirectory(self, title, basedir)
if directory:
edit.setText(directory)
示例10: add_path
def add_path(self):
self.emit(SIGNAL('redirect_stdio(bool)'), False)
directory = getexistingdirectory(self, _("Select directory"),
self.last_path)
self.emit(SIGNAL('redirect_stdio(bool)'), True)
if directory:
directory = osp.abspath(directory)
self.last_path = directory
if directory in self.pathlist:
answer = QMessageBox.question(self, _("Add path"),
_("This directory is already included in Spyder path "
"list.<br>Do you want to move it to the top of "
"the list?"),
QMessageBox.Yes | QMessageBox.No)
if answer == QMessageBox.Yes:
self.pathlist.remove(directory)
else:
return
self.pathlist.insert(0, directory)
self.update_list()