コード例 #1
0
ファイル: explorer.py プロジェクト: sonofeft/spyder
 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
0
ファイル: explorer.py プロジェクト: mikofski/spyder
 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)))