def on_delete_from_disk(self, event): obj = self.GetPyData(self.current) lib_name = obj.getname() # delete only files avilable in the file list, files that are not # in this list are supossed read-only root_lib_name = self.GetItemText(self.get_root_library(self.current)) if self.files.has_key(root_lib_name): position = self.__get_cursor_position() dlg_result = cjr.confirm_yes_no_at_position( self, "Are you sure?", position) if dlg_result == wx.ID_YES: parent = obj.getparent() dir_to_expand = parent.getfullname() os.remove(self.files[lib_name][0]) # delete file from disk! self.files.pop(lib_name) pynebula.delete(obj.getfullname()) self.expand_tree(dir_to_expand.replace('/editor/', '')) else: cjr.show_warning_message("Element is read-only")
def delete (self, library, type='dir'): element_name = self.GetItemText(library) if self.is_valid(library): if 'lib' == type: msg1 = "This will unload the %s library from memory.\n\n"\ "Are you sure?" % (element_name) elif 'dir' == type: msg1 = "This will delete the %s directory.\n\n"\ "Are you sure?" % (element_name) position = self.__get_cursor_position() dlg_result = cjr.confirm_yes_no_at_position( self, msg1, position ) if dlg_result == wx.ID_YES: # get full nebula path library_data = self.GetPyData(library) full_path = library_data.getfullname() # the same with the parent for expand the tree after delete parent = library_data.getparent() parent_name = parent.getfullname() pynebula.delete(full_path) # delete nebula object self.Delete(self.current) # delete object from tree # update state if 'lib' == type: self.files.pop(element_name) elif 'dir' == type: self.dirt_file(self.get_root_library(self.current)) # expand the parent self.expand_tree(parent_name.replace('/editor/', '')) else: cjr.show_warning_message("Element is read-only")
def on_delete_from_disk (self, event): obj = self.GetPyData(self.current) lib_name = obj.getname() # delete only files avilable in the file list, files that are not # in this list are supossed read-only root_lib_name = self.GetItemText(self.get_root_library(self.current)) if self.files.has_key(root_lib_name): position = self.__get_cursor_position() dlg_result = cjr.confirm_yes_no_at_position( self, "Are you sure?", position ) if dlg_result == wx.ID_YES: parent = obj.getparent() dir_to_expand = parent.getfullname() os.remove(self.files[lib_name][0]) # delete file from disk! self.files.pop(lib_name) pynebula.delete(obj.getfullname()) self.expand_tree(dir_to_expand.replace('/editor/', '') ) else: cjr.show_warning_message("Element is read-only")
def delete(self, library, type='dir'): element_name = self.GetItemText(library) if self.is_valid(library): if 'lib' == type: msg1 = "This will unload the %s library from memory.\n\n"\ "Are you sure?" % (element_name) elif 'dir' == type: msg1 = "This will delete the %s directory.\n\n"\ "Are you sure?" % (element_name) position = self.__get_cursor_position() dlg_result = cjr.confirm_yes_no_at_position(self, msg1, position) if dlg_result == wx.ID_YES: # get full nebula path library_data = self.GetPyData(library) full_path = library_data.getfullname() # the same with the parent for expand the tree after delete parent = library_data.getparent() parent_name = parent.getfullname() pynebula.delete(full_path) # delete nebula object self.Delete(self.current) # delete object from tree # update state if 'lib' == type: self.files.pop(element_name) elif 'dir' == type: self.dirt_file(self.get_root_library(self.current)) # expand the parent self.expand_tree(parent_name.replace('/editor/', '')) else: cjr.show_warning_message("Element is read-only")