Esempio n. 1
0
 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.emit(SIGNAL('redirect_stdio(bool)'), False)
         folder = getexistingdirectory(self, _("Select directory"), orig)
         self.parent_widget.emit(SIGNAL('redirect_stdio(bool)'), 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, error:
             QMessageBox.critical(
                 self, _("Error"),
                 _("<b>Unable to move <i>%s</i></b>"
                   "<br><br>Error message:<br>%s") %
                 (basename, unicode(error)))
Esempio n. 2
0
 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.emit(SIGNAL("redirect_stdio(bool)"), False)
         folder = getexistingdirectory(self, _("Select directory"), orig)
         self.parent_widget.emit(SIGNAL("redirect_stdio(bool)"), 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, error:
             QMessageBox.critical(
                 self,
                 _("Error"),
                 _("<b>Unable to move <i>%s</i></b>" "<br><br>Error message:<br>%s") % (basename, unicode(error)),
             )
Esempio n. 3
0
 def set_current_working_directory(self):
     """Set current working directory"""
     cwd = self.shell.get_cwd()
     self.emit(SIGNAL('redirect_stdio(bool)'), False)
     directory = getexistingdirectory(self, _("Select directory"), cwd)
     if directory:
         self.shell.set_cwd(directory)
     self.emit(SIGNAL('redirect_stdio(bool)'), True)
Esempio n. 4
0
 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)
Esempio n. 5
0
 def set_current_working_directory(self):
     """Set current working directory"""
     cwd = self.shell.get_cwd()
     self.emit(SIGNAL('redirect_stdio(bool)'), False)
     directory = getexistingdirectory(self, _("Select directory"), cwd)
     if directory:
         self.shell.set_cwd(directory)
     self.emit(SIGNAL('redirect_stdio(bool)'), True)
Esempio n. 6
0
 def select_directory(self):
     """Select directory"""
     self.emit(SIGNAL('redirect_stdio(bool)'), False)
     directory = getexistingdirectory(self.main, _("Select directory"),
                                      os.getcwdu())
     if directory:
         self.chdir(directory)
     self.emit(SIGNAL('redirect_stdio(bool)'), True)
Esempio n. 7
0
 def select_directory(self):
     """Select directory"""
     self.emit(SIGNAL('redirect_stdio(bool)'), False)
     directory = getexistingdirectory(self.main, _("Select directory"),
                                      os.getcwdu())
     if directory:
         self.chdir(directory)
     self.emit(SIGNAL('redirect_stdio(bool)'), True)
Esempio n. 8
0
 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)
Esempio n. 9
0
 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()
Esempio n. 10
0
 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()