Ejemplo n.º 1
0
 def OnLabelEditEnd(self, evt):
     """
             ファイル名変更の入力終了イベント
             入力中にリストが並び替えされると自動でキャンセル扱いになるのでインデックスによる処理でよい
     """
     self.isRenaming = False
     self.parent.SetShortcutEnabled(True)
     if evt.IsEditCancelled():  # ユーザによる編集キャンセル
         return
     e = self.hListCtrl.GetEditControl()
     f = self.listObject.GetElement(self.GetFocusedItem())
     if isinstance(f, browsableObjects.Folder):
         newName = os.path.join(f.directory, e.GetLineText(0))
         error = fileSystemManager.ValidationObjectName(
             newName, fileSystemManager.pathTypes.DIRECTORY, e.GetLineText(0))
     elif isinstance(f, browsableObjects.File):
         newName = os.path.join(f.directory, e.GetLineText(0))
         error = fileSystemManager.ValidationObjectName(
             newName, fileSystemManager.pathTypes.FILE, e.GetLineText(0))
     # end フォルダかファイルか
     if error:
         dialog(_("エラー"), error)
         evt.Veto()
         return
     inst = {"operation": "rename", "files": [f.fullpath], "to": [newName]}
     op = fileOperator.FileOperator(inst)
     ret = op.Execute()
     if op.CheckSucceeded() == 0:
         dialog(_("エラー"), _("名前が変更できません。"))
         evt.Veto()
         return
     # end fail
     f.basename = e.GetLineText(0)
Ejemplo n.º 2
0
 def OnLabelEditEnd(self, evt):
     self.isRenaming = False
     self.parent.SetShortcutEnabled(True)
     if evt.IsEditCancelled():  #ユーザによる編集キャンセル
         return
     e = self.hListCtrl.GetEditControl()
     f = self.listObject.GetElement(self.GetFocusedItem())
     if isinstance(f, browsableObjects.Folder):
         newName = f.directory + "\\" + e.GetLineText(0)
         error = fileSystemManager.ValidationObjectName(
             newName, fileSystemManager.pathTypes.DIRECTORY)
     elif isinstance(f, browsableObjects.File):
         newName = f.directory + "\\" + e.GetLineText(0)
         error = fileSystemManager.ValidationObjectName(
             newName, fileSystemManager.pathTypes.FILE)
     #end フォルダかファイルか
     if error:
         dialog(_("エラー"), error)
         evt.Veto()
         return
     inst = {"operation": "rename", "files": [f.fullpath], "to": [newName]}
     op = fileOperator.FileOperator(inst)
     ret = op.Execute()
     if op.CheckSucceeded() == 0:
         dialog(_("エラー"), _("名前が変更できません。"))
         evt.Veto()
         return
     #end fail
     f.basename = e.GetLineText(0)
     if isinstance(f, browsableObjects.File):
         f.fullpath = f.directory + "\\" + f.basename
     if isinstance(f, browsableObjects.Stream):
         f.fullpath = f.file + f.basename
Ejemplo n.º 3
0
 def MakeDirectory(self, newdir):
     dir = self.listObject.rootDirectory
     if fileSystemManager.ValidationObjectName(
             dir + "\\" + newdir, fileSystemManager.pathTypes.DIRECTORY):
         dialog(_("エラー"), fileSystemManager.ValidationObjectName(newdir))
         return
     dest = os.path.join(dir, newdir)
     inst = {"operation": "mkdir", "target": [dest]}
     op = fileOperator.FileOperator(inst)
     ret = op.Execute()
     if op.CheckSucceeded() == 0:
         dialog(_("エラー"), _("フォルダを作成できません。"))
         return
     #end error
     self.UpdateFilelist(silence=True, cursorTargetName=newdir)
Ejemplo n.º 4
0
 def getNewNameForPast(self, existingDirname, existingName):
     tp = fileSystemManager.pathTypes.DIRECTORY if os.path.isdir(os.path.join(existingDirname, existingName)) else fileSystemManager.pathTypes.FILE
     ret = ""
     input = existingName
     while(True):
         dlg = views.newNameForPast.Dialog()
         dlg.Initialize(input)
         r = dlg.Show()
         if r == wx.ID_CANCEL:
             break
         # end キャンセル
         input = dlg.GetData()
         if input == existingName:
             dialog(_("エラー"), _("新しい名前を入力してください。"))
             continue
         # end 同じファイル名
         error = fileSystemManager.ValidationObjectName(os.path.join(existingDirname, input), tp, input)
         if error:
             dialog(_("エラー"), error)
             continue
         # end バリデーションエラー
         ret = input
         break
     # end 有効なファイル名になるまで
     return ret
Ejemplo n.º 5
0
 def OnLabelEditEnd(self, evt):
     self.isRenaming = False
     self.parent.SetShortcutEnabled(True)
     if evt.IsEditCancelled():  # ユーザによる編集キャンセル
         return
     e = self.hListCtrl.GetEditControl()
     f = self.listObject.GetElement(self.GetFocusedItem())
     newName = e.GetLineText(0)
     error = fileSystemManager.ValidationObjectName(
         newName, fileSystemManager.pathTypes.VOLUME_LABEL, f.fullpath[0])
     if error:
         dialog(_("エラー"), error)
         evt.Veto()
         return
     inst = {
         "operation": "rename",
         "files": [f.fullpath[0:1]],
         "to": [newName]
     }
     op = fileOperator.FileOperator(inst)
     ret = op.Execute()
     if op.CheckSucceeded() == 0:
         dialog(_("エラー"), _("名前が変更できません。"))
         evt.Veto()
         return