56 if self.EnableDragNDrop: |
56 if self.EnableDragNDrop: |
57 self.Bind(wx.EVT_TREE_BEGIN_DRAG, self.OnTreeBeginDrag, managed_treectrl) |
57 self.Bind(wx.EVT_TREE_BEGIN_DRAG, self.OnTreeBeginDrag, managed_treectrl) |
58 |
58 |
59 button_sizer = wx.BoxSizer(wx.VERTICAL) |
59 button_sizer = wx.BoxSizer(wx.VERTICAL) |
60 main_sizer.AddSizer(button_sizer, border=5, |
60 main_sizer.AddSizer(button_sizer, border=5, |
61 flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL) |
61 flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL) |
62 |
62 |
63 for idx, (name, bitmap, help) in enumerate([ |
63 for idx, (name, bitmap, help) in enumerate([ |
64 ("DeleteButton", "remove_element", _("Remove file from left folder")), |
64 ("DeleteButton", "remove_element", _("Remove file from left folder")), |
65 ("LeftCopyButton", "LeftCopy", _("Copy file from right folder to left")), |
65 ("LeftCopyButton", "LeftCopy", _("Copy file from right folder to left")), |
66 ("RightCopyButton", "RightCopy", _("Copy file from left folder to right")), |
66 ("RightCopyButton", "RightCopy", _("Copy file from left folder to right")), |
67 ("EditButton", "edit", _("Edit file"))]): |
67 ("EditButton", "edit", _("Edit file"))]): |
68 button = wx.lib.buttons.GenBitmapButton(self.Editor, |
68 button = wx.lib.buttons.GenBitmapButton( |
69 bitmap=GetBitmap(bitmap), |
69 self.Editor, |
70 size=wx.Size(28, 28), style=wx.NO_BORDER) |
70 bitmap=GetBitmap(bitmap), |
|
71 size=wx.Size(28, 28), style=wx.NO_BORDER) |
71 button.SetToolTipString(help) |
72 button.SetToolTipString(help) |
72 setattr(self, name, button) |
73 setattr(self, name, button) |
73 if idx > 0: |
74 if idx > 0: |
74 flag = wx.TOP |
75 flag = wx.TOP |
75 else: |
76 else: |
148 filepath = self.ManagedDir.GetPath() |
149 filepath = self.ManagedDir.GetPath() |
149 if os.path.isfile(filepath): |
150 if os.path.isfile(filepath): |
150 folder, filename = os.path.split(filepath) |
151 folder, filename = os.path.split(filepath) |
151 |
152 |
152 dialog = wx.MessageDialog(self, |
153 dialog = wx.MessageDialog(self, |
153 _("Do you really want to delete the file '%s'?") % filename, |
154 _("Do you really want to delete the file '%s'?") % filename, |
154 _("Delete File"), wx.YES_NO | wx.ICON_QUESTION) |
155 _("Delete File"), |
|
156 wx.YES_NO | wx.ICON_QUESTION) |
155 remove = dialog.ShowModal() == wx.ID_YES |
157 remove = dialog.ShowModal() == wx.ID_YES |
156 dialog.Destroy() |
158 dialog.Destroy() |
157 |
159 |
158 if remove: |
160 if remove: |
159 os.remove(filepath) |
161 os.remove(filepath) |
175 else: |
177 else: |
176 dst_folder = dst |
178 dst_folder = dst |
177 |
179 |
178 dst_filepath = os.path.join(dst_folder, src_filename) |
180 dst_filepath = os.path.join(dst_folder, src_filename) |
179 if os.path.isfile(dst_filepath): |
181 if os.path.isfile(dst_filepath): |
180 dialog = wx.MessageDialog(self, |
182 dialog = wx.MessageDialog( |
181 _("The file '%s' already exist.\nDo you want to replace it?") % src_filename, |
183 self, |
182 _("Replace File"), wx.YES_NO | wx.ICON_QUESTION) |
184 _("The file '%s' already exist.\nDo you want to replace it?") % src_filename, |
|
185 _("Replace File"), wx.YES_NO | wx.ICON_QUESTION) |
183 copy = dialog.ShowModal() == wx.ID_YES |
186 copy = dialog.ShowModal() == wx.ID_YES |
184 dialog.Destroy() |
187 dialog.Destroy() |
185 else: |
188 else: |
186 copy = True |
189 copy = True |
187 |
190 |