Example #1
0
def menu():
    try:
        while True:
            option = input(
                "\nLogger Config Menu:  \nChoose a Option (based on the corresponding number): "
                "\n1. General Settings\n2. Input Setup\n3. Save and Upload Config\n4. Save Config (Don't Upload)"
                "\n5. Import Stored Config\n6. Back\n\nOption Chosen: ")
            # Set Menu Names
            if option == "1":
                generalMenu()
            elif option == "2":
                inputSetup()
            elif option == "3":
                # Runs save function - and returns 'True' if the save failed for some reason
                # Used so it doesn't upload a file if the save was unsuccessful
                saveFailed = save()
                if saveFailed is True:
                    print("ERROR - Save Upload Failed")
                else:
                    upload()
            elif option == "4":
                save()
            elif option == "5":
                configImportSelect()
            elif option == "6":
                # Warn users that unsaved changes will be lost
                print("\nWARNING: Any unsaved changes will be lost on program close!\n")
                common.back()
            else:
                common.other()
    except StopIteration:
        pass
Example #2
0
def init():
    # Create instance of process class
    data = Process()
    # Only continue if valid data has been selected
    if data.valid is True:
        try:
            while True:
                # Print Current Data
                data.currentData()
                option = input(
                    "\nPost Process Menu: \nChoose a Option (based on the corresponding number): "
                    "\n1. Filter (Work in Progress)\n2. Compress\n3. Plot\n4. Save File"
                    "\n----------------\n5. Back\n\nOption Chosen: ")
                if option == "1":
                    data.filter()
                elif option == "2":
                    data.compress()
                elif option == "3":
                    data.plotSettings()
                elif option == "4":
                    data.pandasExit()
                elif option == "5":
                    common.back()
                else:
                    common.other()
        except StopIteration:
            pass
Example #3
0
    def plotSettings(self):
        # Menu for selecting options for user to choose what the grap1h Looks Like
        try:
            while True:
                # Print options and current settings
                option = input(
                    "\nPlot Options - Current Settings: \nChoose a Option to change a setting"
                    " (based on the corresponding number): "
                    "\n1. Select Data\n2. Plot Title: '{}'\n3. Primary Y Axis Title: '{}'"
                    "\n4. Secondary Y Axis Title: '{}'\n5. Plot "
                    "\n----------------\n6. Back\n\nOption Chosen: ".format(
                        self.plotTitle, self.plotYPrimaryTitle,
                        self.plotYSecondaryTitle))
                if option == "1":
                    self.plotSelectData()
                elif option == "2":
                    # Change Title of Graph
                    self.plotTitle = input("\nInput the Graph Title: ")
                elif option == "3":
                    # Change Primary Y Axis Title
                    self.plotYPrimaryTitle = input(
                        "\nInput the Primary Y Axis Title: ")
                elif option == "4":
                    # Change Secondary Y Axis Title
                    self.plotYSecondaryTitle = input(
                        "\nInput the Secondary Y Axis Title: ")

                elif option == "5":
                    self.plotGraph()
                elif option == "6":
                    common.back()
                else:
                    common.other()
        except StopIteration:
            pass
Example #4
0
def inputSetup():
    try:
        # Stay in input selection until user leaves pressing 'Enter'
        while True:
            try:
                # Current Settings Print Out
                inputCurrentSettings()
                userInput = input("\nType the number corresponding to the pin you wish to Edit "
                                  "or press 'Enter' to go back: ")
                if str(userInput) == '':
                    print("Going Back")
                    common.back()
                # Find on adcDict if number is in adcDict, else throw an error
                # If Found in adcDict, set the device to adcDict and continue
                elif int(userInput) > 0 and int(userInput) - 1 < len(adcDict):
                    chosenNum = int(userInput)
                    chosenPin = list(adcDict.items())[chosenNum - 1][0]
                    # Input Selection Menu
                    try:
                        while True:
                            print(
                                "\nCurrent Pin Settings for: {}"
                                "\nChoose a Option to edit a Setting (based on the corresponding number)"
                                "\n1. Pin Enabled: {}\n2. Friendly Name: {}\n3. Input Type: {}\n4. Gain: {}\n"
                                "5. Scale: {} - {}\n6. Unit: {}"
                                "\n----------------\n7. Back".format(
                                    chosenPin, adcDict[chosenPin].enabled, adcDict[chosenPin].friendlyName,
                                    adcDict[chosenPin].inputType, adcDict[chosenPin].gain,
                                    adcDict[chosenPin].scaleLow, adcDict[chosenPin].scaleHigh, adcDict[chosenPin].unit))
                            option = input("\nOption Chosen: ")
                            if option == "1":
                                adcDict[chosenPin].enabledEdit()
                            elif option == "2":
                                adcDict[chosenPin].friendlyNameEdit()
                            elif option == "3":
                                adcDict[chosenPin].inputTypeEdit()
                            elif option == "4":
                                adcDict[chosenPin].gainEdit()
                            elif option == "5":
                                adcDict[chosenPin].scaleEdit()
                            elif option == "6":
                                adcDict[chosenPin].unitEdit()
                            elif option == "7":
                                common.back()
                            else:
                                common.other()
                    except StopIteration:
                        pass
                else:
                    common.other()
            # If someone doesn't type in an integer or press Enter
            except ValueError:
                common.other()
    # Used to break the loop if someone selects a back option.
    except StopIteration:
        pass
def init():
    try:
        while True:
            option = input(
                "\nGeneral Settings: \nChoose a Option (based on the corresponding number):"
                "\n1. Change Language\n2. Back\n3. Quit"
                "\n\nOption Chosen: ")
            if option == "1":
                language()
            elif option == "2":
                common.back()
            elif option == "3":
                common.quit()
            else:
                print("\nInvalid Option. Please Try Again")
    except StopIteration:
        pass
Example #6
0
def init():
    try:
        while True:
            # Set Menu Names
            option = input(
                "\nLogger Control Menu: \nChoose a Option (based on the corresponding number): "
                "\n1. Change Logger Configuration"
                "\n2. Back\n3. Quit"
                "\n\nOption Chosen: ")
            if option == "1":
                config.init()
            elif option == "2":
                common.back()
            elif option == "3":
                common.quit()
            else:
                common.other()
    except StopIteration:
        pass
Example #7
0
def generalMenu():
    try:
        while True:
            print("\nConfig: General Settings: \nChoose a Option to edit a Setting (based on the corresponding number)")
            x = 0
            for key in generalSettings:
                x += 1
                print("{}. {}: {}".format(x, key.title(), generalSettings[key]))
            print("----------------\n{}. Back".format(x + 1))
            option = input("\nOption Chosen: ")
            if option == "1":
                generalTime()
            elif option == "2":
                generalName()
            elif option == "3":
                common.back()
            else:
                common.other()
    except StopIteration:
        pass
Example #8
0
def init():
    try:
        while True:
            option = input("\nProcess Data Menu: \nChoose a Option (based on the corresponding number): "
                           "\n1. Download Data\n2. Convert Data\n3. Post Process Data"
                           "\n4. Back\n5. Quit \n\nOption Chosen: ")
            # Set Menu Names
            if option == "1":
                download.init()
            elif option == "2":
                process.init()
            elif option == "3":
                postProcess.init()
            elif option == "4":
                common.back()
            elif option == "5":
                common.quit()
            else:
                common.other()
    except StopIteration:
        pass
Example #9
0
    def plotSelectData(self):
        # Choose Primary Y axis Data
        try:
            while True:
                print("\nPrimary Y Axis: Columns Selected for Plotting ")
                # Counter used for options
                x = 1
                # Print Output in nice format
                for item in self.yDataPrimary:
                    print("{}. {:>24} : {}".format(x, item,
                                                   self.yDataPrimary[item]))
                    x += 1
                print("{} \n{}. Save & Next".format("-" * 35, x))
                # User Selection
                option = int(input("Choose a number to toggle selection: "))
                # If number is in list index
                if 0 < option <= len(self.yDataPrimary):
                    # Get name of column and toggle visibility on graph
                    colName = self.df.columns[option - 1]
                    self.yDataPrimary[colName] = not self.yDataPrimary[colName]
                # End loop if next option is selected
                elif option == x:
                    common.back()
                # If a number is typed in out of range
                else:
                    common.other()
        except StopIteration:
            pass
        # If someone does not put in an integer
        except ValueError:
            common.other()

        # Choose Secondary Y axis Data
        try:
            while True:
                print("\nSecondary Y Axis: Columns Selected for Plotting ")
                # Counter used for options
                x = 1
                # Print Output in nice format
                for item in self.yDataSecondary:
                    print("{}. {:>24} : {}".format(x, item,
                                                   self.yDataSecondary[item]))
                    x += 1
                print("{} \n{}. Save & Next".format("-" * 35, x))
                # User Selection
                option = int(input("Choose a number to toggle selection: "))
                # If number is in list index
                if 0 < option <= len(self.yDataSecondary):
                    # Get name of column and toggle visibility on graph
                    colName = self.df.columns[option - 1]
                    self.yDataSecondary[
                        colName] = not self.yDataSecondary[colName]
                # End loop if next option is selected
                elif option == x:
                    common.back()
                # If a number is typed in out of range
                else:
                    common.other()
        except StopIteration:
            pass
        # If someone does not put in an integer
        except ValueError:
            common.other()

        # X Axis Selection
        try:
            while True:
                print("\nX Axis: Currently Selected: {} ".format(self.xData))
                # Counter used for options
                x = 1
                # Print Output in nice format
                for item in self.yDataPrimary:
                    print("{}. {}".format(x, item))
                    x += 1
                print("{} \n{}. Save & Finish".format("-" * 30, x))
                # User Selection
                option = int(input("Choose a number to select column: "))
                # If valid number on the list then toggle it
                # Get name of column
                if 0 < option <= len(self.yDataPrimary):
                    colName = self.df.columns[option - 1]
                    self.xData = colName
                # End loop if next option is selected
                elif option == x:
                    print("Success! - Plot Settings Updated")
                    common.back()
                # If a number is typed in out of range
                else:
                    common.other()
        except StopIteration:
            pass
        # If someone does not put in an integer
        except ValueError:
            common.other()