Esempio n. 1
0
    def Clear(self, hints):
        ## Clear the printed options
        Display.ClearPreviousLine()
        Display.ClearPreviousLine()

        ## Clear hints
        if hints: self._ClearHints()
Esempio n. 2
0
	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))
Esempio n. 3
0
    def Clear(self, hints):
        ## Clear hints
        if hints: self._ClearHints()

        ## Clear the previously displayed options
        Display.ClearPreviousLine()

        for i in range(0, len(self.opts)):
            Display.ClearPreviousLine()
Esempio n. 4
0
    def __DisplayMenu(self, numbered, hints):
        ## Declare the selected option index
        selected = 0

        ## Infinite loop broken by return
        while True:
            for ind, opt in enumerate(self.opts):
                if numbered:
                    op = "%i - %s" % (ind + 1, opt[0])
                else:
                    op = opt[0]

                if ind == selected:
                    print("\033[0;32m{}\033[0m".format(op), end="\n")
                else:
                    print(op, end="\n")

            # Forcing options to show (would be delayed until after keypress in Python 3)
            sys.stdout.flush()

            print("")

            ## Display Hints
            if hints: self._DisplayHints()

            ## Catch pressed key and option
            opt = None
            key_pressed = None
            while key_pressed == None:
                ## Get key preset input index from user
                key_pressed = self.keyPreset.Input()

                if key_pressed == 1 and selected < len(self.opts) - 1:
                    selected += 1
                elif key_pressed == 0 and selected > 0:
                    selected -= 1
                elif key_pressed == 2:
                    opt = self.opts[len(self.opts) - 1]
                elif key_pressed == 3:
                    opt = self.opts[selected]
                elif key_pressed == 4:
                    ## Clear the text
                    self.Clear(hints)

                    Display.ClearPreviousLine()

                    ## Call the last option
                    return self.opts[len(self.opts) - 1]

            ## Clear the text
            self.Clear(hints)

            ## Return if anything was selected
            if opt:
                Display.ClearPreviousLine()
                return opt
Esempio n. 5
0
	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))
Esempio n. 6
0
    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 __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 +
            '############################################################')
Esempio n. 8
0
    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()))
Esempio n. 9
0
    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 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 __DisplayTitle(self):
        Display.Print(
            Fore.GREEN +
            '############################################################')

        for title in self.titleList:
            Display.Print(Fore.GREEN + '##' + Fore.YELLOW + ' %s' % title)

        Display.Print(
            Fore.GREEN +
            '############################################################')
Esempio n. 12
0
    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=" | ")
Esempio n. 13
0
    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()
Esempio n. 14
0
    def succeed(self):
        ## Reference the last message from the spinner list
        self.spinner = self.spinnerList[len(self.spinnerList) - 1]
        self.spinner[0].succeed(self.spinner[1])

        ## Change the count
        Display.Change(1)
Esempio n. 15
0
    def stop(self, clearTime=0):
        ## Set last message as successful
        self.succeed()

        ## Wait for some time before clearing
        time.sleep(clearTime)

        ## Clear the display
        Display.ClearDisplay()
Esempio n. 16
0
    def Run(self):
        ## Make a space to divide
        Display.Print("")

        ## Display table list of account
        self.ListAccounts()

        ## Display the previous page
        self.Previous()
Esempio n. 17
0
	def __DisplayProgressBar(self, maxLength):
		Display.Print(
			ProgressBar.CreateProgressBar(
				self.CurrentProgressIndex,
				self.MaxProgress,
				prefix = 'Progress:',
				suffix = 'Complete',
				length = maxLength - 27
			)
		)
    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("")
Esempio n. 19
0
    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
Esempio n. 20
0
    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 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)
Esempio n. 22
0
    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)
Esempio n. 23
0
	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)
		
Esempio n. 24
0
	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)
Esempio n. 25
0
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()
Esempio n. 26
0
	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)
		

		
		
Esempio n. 27
0
	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)
Esempio n. 28
0
	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)
Esempio n. 29
0
    def __call__(self, message, postMessage):
        ## Check if theres any messages in the spinner list
        if len(self.spinnerList) > 0:
            ## Reference the message from the spinner list
            self.spinner = self.spinnerList[len(self.spinnerList) - 1]

            ## Set the message as successful with the post message
            self.spinner[0].succeed(self.spinner[1])

        ## Create the spinner message
        spinner = Halo(text=message, spinner='dots')

        ## Display the message
        spinner.start()

        ## Add the message to the spinner list
        self.spinnerList.append([spinner, postMessage])

        ## Change the count
        Display.Change(1)
Esempio n. 30
0
    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()