def __DisplayTitle(self, length, fillChar='-'): ## Display the header of the table Display.Print(Fore.GREEN + ''.ljust(length, fillChar)) ## Display the title Display.Print(Fore.GREEN + ''.ljust(2, fillChar) + ' ' + Fore.YELLOW + self.Title.center(length - 6) + ' ' + Fore.GREEN + ''.ljust(2, fillChar)) ## Display the footer of the table Display.Print(Fore.GREEN + ''.ljust(length, fillChar))
def ProcessCreditCardsWarnings(self): ccAvailCount = self.GetAvailableCreditCardCount() if ccAvailCount <= 0: Display.Print(Fore.RED + "CRITICAL: " + Fore.GREEN + "No Credit Cards available") elif ccAvailCount <= self.Configuration.Management.ManagementConfiguration.LowCreditCardsAmount: Display.Print(Fore.YELLOW + "WARNING: " + Fore.GREEN + "Low Credit Cards amount (%i/%i)" % (ccAvailCount, self.Configuration.Payments.Count()))
def __DisplayProgressList(self, action): for idx in range(len(self.progressList)): if not idx + 1 == self.currentProgress: Display.Print(Fore.YELLOW + '## %s' % self.progressList[idx]) else: Display.Print(Fore.GREEN + '## %s' % self.progressList[idx]) Display.Print( Fore.GREEN + '############################################################')
def __DisplayProgressList(self, length, fillChar='-'): ## Iterate for all the progress in list for idx in range(len(self.ProgressList)): if not idx + 1 == self.CurrentProgressIndex: Display.Print(Fore.YELLOW + ''.ljust(length, fillChar) + ' ' + self.ProgressList[idx]) else: Display.Print(Fore.GREEN + ''.ljust(length, fillChar) + ' ' + self.ProgressList[idx]) ## Display the footer Display.Print(Fore.GREEN + ''.ljust(length, fillChar))
def ProcessAccountWarnings(self): accAvailCount = self.GetAvailableAccountCount() if accAvailCount <= 0: Display.Print(Fore.RED + "CRITICAL: " + Fore.GREEN + "No Email Accounts available") elif accAvailCount <= self.Configuration.Management.ManagementConfiguration.LowAccountsAmount: Display.Print(Fore.YELLOW + "WARNING: " + Fore.GREEN + "Low Email Accounts amount (%i/%i)" % (accAvailCount, self.Configuration.Accounts.Count()))
def ProcessDiscordNitroURLs(self): discorIntroURLAvail = self.GetAvailableDiscordURLCount() if discorIntroURLAvail <= 0: Display.Print(Fore.RED + "CRITICAL: " + Fore.GREEN + "No Discord Nitro URLs available") elif discorIntroURLAvail <= self.Configuration.Management.ManagementConfiguration.LowDiscorNitroURLsAmount: Display.Print(Fore.YELLOW + "WARNING: " + Fore.GREEN + "Low Discord Nitro URL's available (%i)" % discorIntroURLAvail)
def __DisplayTitle(self): Display.Print( Fore.GREEN + '############################################################') for title in self.titleList: Display.Print(Fore.GREEN + '##' + Fore.YELLOW + ' %s' % title) Display.Print( Fore.GREEN + '############################################################')
def ShowTable(self): ## Reference the data count dataCount = len(self.Data) ## Check if there is any data to show if dataCount < 1: Display.Print("There isn't any data to show") return ## Calculate the page amount pageCount = max(dataCount / self.showAmount, 1) idx = 0 ## Initial index startIdx = self.showAmount * self.page ## Starting index startIdx = startIdx if startIdx < dataCount else 0 ## Starting index endIdx = startIdx + self.showAmount ## Ending index endIdx = endIdx if dataCount > endIdx else dataCount ## Ending index localSelectedIndex = ((self.selectedIndex - 1) % self.showAmount) + 1 ## Create the data table item list dataTableItemList = [] for i in range(int(startIdx), int(endIdx)): ## Reference the data item by index dataItem = self.Data[i] ## Create the data item list dataItemList = [] ## Increase the local index idx += 1 ## Append the index selection status dataItemList.append("x" if idx == localSelectedIndex else "") ## Append the data items for the selection and fill the data list for item in dataItem: dataItemList.append(item) dataTableItemList.append(dataItemList) ## Generate the data table by list self.table = table = termtables.to_string( dataTableItemList, header=self.Header, style=termtables.styles.ascii_thin_double, ) ## Print the accounts data table Display.Print(table) ## Show the table details self.ShowNavigationLabel(self.page, self.selectedIndex)
def ShowLabel(self): for idx in range(0, len(self.optionsList)): label = self.optionsList[idx] key = label[0] txt = label[1] if idx + 1 >= len(self.optionsList): Display.Print(Fore.YELLOW + txt + ": " + Fore.RED + key.keyname()) else: Display.Print(Fore.YELLOW + txt + ": " + Fore.GREEN + key.keyname(), e=" | ")
def ListAccounts(self): ## Create Accounts navigation table self.CreateTable() ## Create the menu list tableOptionsList = [ [KeyCodes.UP, 'Next Page', lambda: self.ChangePage(1)], [KeyCodes.DOWN, 'Previous Page', lambda: self.ChangePage(-1)], [ KeyCodes.LEFT, 'Previous Account', lambda: self.ChangeSession(-1) ], [KeyCodes.RIGHT, 'Next Account', lambda: self.ChangeSession(1)], [KeyCodes.BACKSPACE, 'Delete Account', self.DeleteSession], ] ## Create the interactive menu self.interactiveKeys = InteractiveKeys(tableOptionsList, False) ## Display the table self.Refresh() ## Print the labeled keys Display.Print("") ## Show interactive keys self.interactiveKeys()
def Run(self): ## Make a space to divide Display.Print("") ## Display table list of account self.ListAccounts() ## Display the previous page self.Previous()
def __DisplayProgressBar(self, maxLength): Display.Print( ProgressBar.CreateProgressBar( self.CurrentProgressIndex, self.MaxProgress, prefix = 'Progress:', suffix = 'Complete', length = maxLength - 27 ) )
def Refresh(self): ## Refresh the page super().Refresh() ## Make a space to divide Display.Print("") ## Show the title Display.Print("Sessions Data Table".center(85, " ")) ## Make a space to divide Display.Print("") ## Show the table self.accountNavigationTable.ShowTable() ## Show the label again self.interactiveKeys.ShowLabel() return True
def ShowNavigationLabel(self, page, selectedIndex): ## Display the status of the table navigation if page <= 1: Display.Print( '{:^94s}'.format("Page %u/%u : Selected %u/%u | %u >>" % (page, self.__GetPageCount(), selectedIndex, self.__GetItemCount(), page + 1))) elif page >= self.__GetPageCount(): Display.Print('{:^94s}'.format( "<< %u | Page %u/%u : Selected %u/%u" % (page - 1, page, self.__GetPageCount(), selectedIndex, self.__GetItemCount()))) else: Display.Print('{:^94s}'.format( "<< %u | Page %u/%u : Selected %u/%u | %u >>" % (page - 1, page, self.__GetPageCount(), selectedIndex, self.__GetItemCount(), page + 1))) ## Make a space to divide Display.Print("")
def DisplayManagerNavigationLabel(cls): ## Display a empty navigation if empty pages list and return if len(cls.Pages) < 1: Display.Print("") return ## Create the label label = Fore.YELLOW + "Navigation: " + Fore.WHITE ## Reference the index idx = 0 ## Add each page name by succession for i in range(len(cls.Pages) - 1): label += cls.Pages[i].Name + " > " ## Add the last page name with color label += Fore.GREEN + cls.Pages[len(cls.Pages) - 1].Name ## Print the label Display.Print(label)
def DisplayStatus(self): ## Display base content #self.BaseRun(True) ## Make a space to divide #Display.Print("") ## Display the progress report #self.ProgressReporter.Display() ## Make a space to divide Display.Print("")
def Run(self): ## Make a space to divide Display.Print("") ## Create the menu list menuOptionsDict = [ ['Manage Accounts', Accounts.Run], ['Manage Payments', Payments.Run], ['Show Warnings', self.Previous], ['Go back', self.Previous], ] ## Display the default menu self.DisplayMenu(menuOptionsDict)
def Run(self): ## Make a space to divide Display.Print("") ## Create the menu list menuOptionsDict = [ ['List Credit Cards', self.Previous], ['Add Credit Card', self.Previous], ['Remove Credit Card', self.Previous], ['Go back', self.Previous], ] ## Display the default menu self.DisplayMenu(menuOptionsDict)
def Run(self): ## Make a space to divide Display.Print("") ## Create the menu list menuOptionsDict = [ ['Automation', Automation.Run], ['Actions', Actions.Run], ['Management', Management.Run], #['Configuration', Configuration.Run], ['Quit', app.rtn] ] ## Display the default menu self.DisplayMenu(menuOptionsDict)
def Run(self): ## Make a space to divide Display.Print("") ## Create the menu list menuOptionsDict = [ ['Login', self.Previous], ['Register', self.Previous], ['Create Profile', self.Previous], ['Buy Game Pass', self.Previous], ['Redeem Discord Nitro', self.Previous], ['Go back', self.Previous] ] ## Display the default menu self.DisplayMenu(menuOptionsDict)
def Run(self): ## Make a space to divide Display.Print("") ## Create the menu list menuOptionsDict = [ ['List Accounts', ListAccounts.Run], ['Add Accounts', self.Previous], ['Remove Account', self.Previous], ['Generate Account', self.Previous], ['Get Available URL', self.Previous], ['Go back', self.Previous], ] ## Display the default menu self.DisplayMenu(menuOptionsDict)
def Run(self): ## Make a space to divide Display.Print("") ## Create the menu list menuOptionsDict = [ ['Xbox Game Pass Generator(Nitro)', XGP.Run], ['Go back', self.Previous] ] ## Display the default menu self.DisplayMenu(menuOptionsDict)
def Run(self): ## Make a space to divide Display.Print("") ## Create the menu list self.MenuOptionsDict = [['Stop Automation', self.StopAutomation], ['Go back', self.Previous]] ## Start the automation self.StartAutomation() ## Create the progress reporter length = len(Management.Automation.XGPAutomation.RoutineList[ Management.Automation.XGPAutomation.CurrentRoutineIndex]. RoutineActions.RoutinePath) self.ProgressReporter = ProgressReporter("XGPGBot Automation", length) ## Change routine automation = Management.Automation.XGPAutomation currentRoutine = automation.RoutineList[automation.CurrentRoutineIndex] currentRoutine.ChangeRoutineAction += self.OnRoutineChange ## Display the status self.DisplayStatus()
def Main(): ## Initialize the display Display.Initialize() ## Display the title Information.DisplayTitle(r'app/interface/titles/title.txt') ## Create a multi loading report loadingReport = MultiLoadingReport() ## Check if Python version is compatible loadingReport("Checking python compatibility", "Python compatible") if not Compatibility.IsPythonCompatible(): loadingReport.stop("Incompatible python version") Display.Print("Please upgrade python for any version after %s" % Compatibility.MIN_VERSION) sys.exit() ## Initialize the configuration loadingReport("Loading configuration", "Configuration loaded") configuration = Configuration() ## Stop the loading report messages loadingReport.stop(1.5) ## Display the manager information Information.DisplayStartInformation() ## Initialize management Management.Init(configuration) ## Run the Home manager Home.Run() ## Display end of application information Information.DisplayEndInformation()
def __DisplayProgress(self, action, length, fillChar='-'): Display.Print(Fore.GREEN + '##' + Fore.YELLOW + ' %s (%s of %s)' % (action, self.currentProgress, self.maxProgress)) ## Display the footer Display.Print(Fore.GREEN + ''.ljust(length, fillChar))
def __DisplayProgress(self, action): Display.Print(Fore.GREEN + '##' + Fore.YELLOW + ' %s (%s of %s)' % (action, self.currentProgress, self.maxProgress)) Display.Print( Fore.GREEN + '############################################################')
def ProcessWarnings(self): Display.Print("") self.ProcessAccountWarnings() self.ProcessCreditCardsWarnings() self.ProcessDiscordNitroURLs()