def path(self, which: DefaultItems): """ Copies the path of currently selected item to the clipboard. Useful for use in open and save dialog boxes """ if len(which) == 1: copy_to_clipboard(which[0].full_path) else: input("One item required to be selected")
def copycontents(self, *args): """ Copy contents to the clipboard ... only works with text files (duh) The lines are combined with spaces instead of return characters Workflow is this: Add information to files with append and copy them with copycontents to paste into Word or other documents """ if not args: item = self.cntrl.get_default() else: item = self.cntrl.get_item(args[0]) with open(item.full_path) as f: lines = f.readlines() copy_to_clipboard(" ".join([l.strip('\n') for l in lines]))