def on_release(self): app = App.get_running_app() content = ConfirmPopup(text='Delete The Tag "' + self.to_remove + '"?', yes_text='Delete', no_text="Don't Delete", warn_yes=True) content.bind(on_answer=self.on_answer) self.owner.popup = NormalPopup(title='Confirm Delete', content=content, size_hint=(None, None), size=(app.popup_x, app.button_scale * 4), auto_dismiss=False) self.owner.popup.open()
def delete_item(self, photoListRecyclerView): """Starts the delete folder process, creates the confirmation popup.""" text = "Delete tag " + self.item.name + "\nThe Contained Files Will Not Be Deleted." content = ConfirmPopup(text=text, yes_text='Delete', no_text="Don't Delete", warn_yes=True) app = App.get_running_app() self.photoListRecyclerView = photoListRecyclerView content.bind(on_answer=self.delete_item_answer) self.popup = NormalPopup(title='Confirm Delete', content=content, size_hint=(None, None), size=(app.popup_x, app.button_scale * 4), auto_dismiss=False) self.popup.open()
def delete_folder(self): """Starts the delete folder process, creates the confirmation popup.""" app = App.get_running_app() if not os.listdir(self.path): text = "Delete The Selected Folder?" content = ConfirmPopup(text=text, yes_text='Delete', no_text="Don't Delete", warn_yes=True) content.bind(on_answer=self.delete_folder_answer) self.popup = NormalPopup(title='Confirm Delete', content=content, size_hint=(None, None), size=(app.popup_x, app.button_scale * 4), auto_dismiss=False) self.popup.open() else: app.popup_message(text='Could not delete, Folder is not empty', title='Warning')
def save_theme_check(self, *_): path = self.popup.content.path file = self.popup.content.file self.dismiss_popup() self.filename = os.path.join(path, file) if os.path.isfile(self.filename): app = App.get_running_app() content = ConfirmPopup(text='Overwrite the file "' + self.filename + '"?', yes_text='Overwrite', no_text="Cancel", warn_yes=True) content.bind(on_answer=self.save_theme_finish) self.popup = NormalPopup(title='Confirm Overwrite', content=content, size_hint=(None, None), size=(app.popup_x, app.button_scale * 4), auto_dismiss=False) self.popup.open() else: self.save_theme_finish()
def drop_widget(self, fullpath, position, dropped_type, aspect=1): """Called when a widget is dropped after being dragged. Determines what to do with the widget based on where it is dropped. Arguments: fullpath: String, file location of the object being dragged. position: List of X,Y window coordinates that the widget is dropped on. dropped_type: String, describes the object's screenDatabase origin directory """ app = App.get_running_app() transfer_from = dropped_type left_database_holder = self.ids['leftDatabaseHolder'] left_database_area = self.ids['leftDatabaseArea'] right_database_holder = self.ids['rightDatabaseHolder'] right_database_area = self.ids['rightDatabaseArea'] transfer_to = None folders = [] if left_database_holder.collide_point(position[0], position[1]): if transfer_from != self.left_database: selects = right_database_area.selects for select in selects: folders.append(local_path(select['fullpath'])) transfer_to = self.left_database elif right_database_holder.collide_point(position[0], position[1]): if transfer_from != self.right_database: selects = left_database_area.selects for select in selects: folders.append(local_path(select['fullpath'])) transfer_to = self.right_database if transfer_to: if fullpath not in folders: folders.append(fullpath) #remove subfolders removes = [] for folder in folders: for fold in folders: if folder.startswith(fold + os.path.sep): removes.append(folder) break reduced_folders = [] for folder in folders: if folder not in removes: reduced_folders.append(folder) content = ConfirmPopup(text='Move These Folders From "' + transfer_from + '" to "' + transfer_to + '"?', yes_text='Move', no_text="Don't Move", warn_yes=True) content.bind(on_answer=self.move_folders) self.transfer_to = transfer_to self.transfer_from = transfer_from self.folders = reduced_folders self.popup = MoveConfirmPopup(title='Confirm Move', content=content, size_hint=(None, None), size=(app.popup_x, app.button_scale * 4), auto_dismiss=False) self.popup.open()