def getContacts(client): data = client.listFriends() table = Table(show_footer=False) table.add_column("Name", no_wrap=True) table.add_column("JID", no_wrap=True) table.add_column("Subscription", no_wrap=True) table.add_column("Status", no_wrap=True) table.add_column("Extra", no_wrap=True) table.title = ( "[not italic]:girl_light_skin_tone: Users In Rooster [not italic]:boy_light_skin_tone:" ) for row in data: table.add_row(*row) table.columns[4].header_style = "bold red" table.columns[3].header_style = "bold green" table.columns[2].header_style = "bold blue" table.columns[1].header_style = "red" table.columns[0].header_style = "cyan" table.row_styles = ["none", "dim"] table.border_style = "bright_yellow" for x in [ box.SQUARE, box.MINIMAL, box.SIMPLE, box.SIMPLE_HEAD, ]: table.box = x console.print(table, justify="left")
def getInfoUser(client): questions = [{ 'type': 'input', 'message': 'Enter username to get info', 'name': 'username' }] answers = prompt(questions, style=custom_style_2) data = client.getUserInfo(answers['username']) table = Table(show_footer=False) table.add_column("Email", no_wrap=True) table.add_column("JID", no_wrap=True) table.add_column("Username", no_wrap=True) table.add_column("Name", no_wrap=True) table.title = ( "[not italic]:girl_light_skin_tone: Username Information [not italic]:boy_light_skin_tone:" ) for row in data: table.add_row(*row) table.columns[3].header_style = "bold red" table.columns[2].header_style = "bold green" table.columns[1].header_style = "bold blue" table.columns[0].header_style = "cyan" table.row_styles = ["none", "dim"] table.border_style = "bright_yellow" for x in [ box.SQUARE, box.MINIMAL, box.SIMPLE, box.SIMPLE_HEAD, ]: table.box = x console.print(table, justify="left")
def user_isonline(self, presence): if presence['from'].bare != self.boundjid.bare: table = Table() table.add_column("Conected User Notification", no_wrap=True) table.columns[0].header_style = "cyan" table.border_style = "yellow" msg = presence['from'].bare + " is online" table.add_row(msg) console = Console() console.print(table, justify="center") print('\n')
def remove_to_roster_notifcation(self, presence): if presence['from'].bare != self.boundjid.bare: table = Table() table.add_column("Remove from Roster Notification", no_wrap=True) table.columns[0].header_style = "cyan" table.border_style = "yellow" msg = presence['from'].bare + " removed you from their roster" table.add_row(msg) console = Console() console.print(table, justify="center") print('\n')
def wait_for_presences(self, pres): """ Track how many roster entries have received presence updates. """ if pres['show'] != "" and pres['from'].bare != self.boundjid.bare: table = Table() table.add_column("Change Status Notification", no_wrap=True) table.columns[0].header_style = "cyan" table.border_style = "yellow" msg = pres['from'].bare + " changed status to: " + pres['show'] table.add_row(msg) console = Console() console.print(table, justify="center") print('\n') self.received.add(pres['from'].bare) if len(self.received) >= len(self.client_roster.keys()): self.presences_received.set() else: self.presences_received.clear()
table.columns[4].footer_style = "bright_blue" with beat(10): console.print(table, justify="center") table.row_styles = ["none", "dim"] with beat(10): console.print(table, justify="center") for color in [ "deep_pink4", "dark_khaki", "medium_purple2", "thistle3", "orange1", ]: table.border_style = color with beat(10): console.print(table, justify="center") for box in [ box.ASCII, box.ASCII2, box.DOUBLE, box.DOUBLE_EDGE, box.HEAVY_EDGE, box.MINIMAL_HEAVY_HEAD, box.MINIMAL_DOUBLE_HEAD, box.SIMPLE, box.SIMPLE_HEAD, ]: table.box = box
with beat(10): console.print(table, justify="center") table.columns[3].footer_style = "bright_green" with beat(10): console.print(table, justify="center") table.columns[4].footer_style = "bright_blue" with beat(10): console.print(table, justify="center") table.row_styles = ["none", "dim"] with beat(10): console.print(table, justify="center") table.border_style = "bright_yellow" with beat(10): console.print(table, justify="center") for box in [ box.SQUARE, box.MINIMAL, box.SIMPLE, box.SIMPLE_HEAD, ]: table.box = box with beat(10): console.print(table, justify="center") table.pad_edge = False with beat(10):