def delete_friend(self): buttonlist = [("Delete", self.delete_friend_afterask), ("Cancel", lambda: None)] msg = 'Really delete friend: "{}"?'.format(self.text) dia = DeleteDialog(message=msg, buttons=buttonlist) PopupNew(title="Confirm Deletion", content=dia, size_hint=(0.9, 0.5)).open()
def remove(self, instance): buttonlist = [("Delete", self.remove_afterask), ("Cancel", lambda: None)] msg = 'Really delete download offer for file: "{}"?'.format( self.indict.get("name")) dia = DeleteDialog(message=msg, buttons=buttonlist) PopupNew(title="Confirm Deletion", content=dia, size_hint=(0.9, 0.5)).open()
def open_dia(self): root = App.get_running_app().root ret = root.requester.requester.do_request("/client/listhashes", {"name": self.entry[0]}, {}) if not logcheck(ret): return hashes = map(lambda x: (x[0], (0, 0, 0, 1)), ret[2].get("items")) buttons = [("Select", self.load_selected), ("Clear", self.clear_chats), ("Close", lambda sel: None)] dia = ListDialog(entries=hashes, buttons=buttons) PopupNew(title="Select hash", content=dia).open()
def load_server(self): root = App.get_running_app().root ret = root.requester.requester.do_request("/client/listhashes", { "name": self.text, "filter": "client" }, {}) if not logcheck(ret): return if len(ret[2]["items"]) <= 1: self.load_server_direct() return newlist = map( lambda entry: (entry[0], (1, 0, 0, 1) if entry[4] == "valid" else (0, 0, 0, 1)), ret[2]["items"]) buttons = [("Load", self.load_server_direct)] dia = ListDialog(entries=newlist, buttons=buttons) PopupNew(title="Hashes", content=dia).open()
def load_friend(self): self.closebubble() root = App.get_running_app().root ret = root.requester.requester.do_request("/client/listhashes", { "name": self.text, "filter": "client" }, {}) if not logcheck(ret): return buttons = [("Load", self.load_hash), \ ("Add", self.add_hash), ("Reload", self.reload_hashes), \ ("Close", lambda x: None)] newlist = map( lambda entry: (entry[0], (1, 0, 0, 1) if entry[4] == "valid" else (1, 1, 1, 1)), ret[2]["items"]) dia = ListDialog(entries=newlist, buttons=buttons) PopupNew(title="Hashes", content=dia).open()
def download(self, instance): buttons = [("Download", self.download_afterask), ("Cancel", lambda x, y: None)] dia = FileDialog(buttons=buttons, dirselect=True) PopupNew(title="Download", content=dia).open()
def add_friend(self): dia = NameDialog.create(self.add_friend_after, nameproposal=self.entry[0]) if not dia: return PopupNew(title="Rename", content=dia).open()
def add_hash(self, selection): dia = DialogAdd(func=self.add_hash_afterask, check_func=check_hash) PopupNew(title="Add new", content=dia, size_hint=(0.9, 0.5)).open() return True
def rename(self): self.closebubble() dia = NameDialog.create(self.rename_call) if not dia: return PopupNew(title="Rename", content=dia).open()