示例#1
0
    def __init__(self):
        QtGui.QDialog.__init__(self)
        self.ui = Ui_GenericCommandDialog()
        self.ui.setupUi(self)
        self.setWindowTitle(pageTitle)
        self.parser = HTMLDocsParser()

        self.ui.SendButton_1.clicked.connect(self.ProcessSendButton_1)
        self.ui.SendButton_2.clicked.connect(self.ProcessSendButton_2)
        self.ui.SendButton_3.clicked.connect(self.ProcessSendButton_3)
        self.ui.SendButton_4.clicked.connect(self.ProcessSendButton_4)
        self.ui.SendButton_5.clicked.connect(self.ProcessSendButton_5)
        self.ui.SendButton_6.clicked.connect(self.ProcessSendButton_6)
        self.ui.SendButton_7.clicked.connect(self.ProcessSendButton_7)
        self.ui.SendButton_8.clicked.connect(self.ProcessSendButton_8)
        self.ui.SendButton_9.clicked.connect(self.ProcessSendButton_9)
        self.ui.SendButton_10.clicked.connect(self.ProcessSendButton_10)
        self.ui.SendButton_11.clicked.connect(self.ProcessSendButton_11)
        self.ui.SendButton_12.clicked.connect(self.ProcessSendButton_12)
        self.ui.SendButton_13.clicked.connect(self.ProcessSendButton_13)
        self.ui.SendButton_14.clicked.connect(self.ProcessSendButton_14)
        self.ui.SendButton_15.clicked.connect(self.ProcessSendButton_15)
        self.ui.SendButton_16.clicked.connect(self.ProcessSendButton_16)
        self.ui.SendButton_17.clicked.connect(self.ProcessSendButton_17)
        self.ui.SendButton_18.clicked.connect(self.ProcessSendButton_18)
        self.ui.SendButton_19.clicked.connect(self.ProcessSendButton_19)
        self.ui.SendButton_20.clicked.connect(self.ProcessSendButton_20)
        self.ui.SendButton_21.clicked.connect(self.ProcessSendButton_21)
        self.ui.SendButton_22.clicked.connect(self.ProcessSendButton_22)
        self.ui.SendButton_23.clicked.connect(self.ProcessSendButton_23)
        self.ui.SendButton_24.clicked.connect(self.ProcessSendButton_24)
        self.ui.SendButton_25.clicked.connect(self.ProcessSendButton_25)
示例#2
0
    def __init__(self):
        QtGui.QDialog.__init__(self)
        self.ui = Ui_GenericCommandDialog()
        self.ui.setupUi(self)
        self.setWindowTitle(pageTitle)
        self.parser = HTMLDocsParser()

        self.ui.SendButton_1.clicked.connect(self.ProcessSendButton_1)
        self.ui.SendButton_2.clicked.connect(self.ProcessSendButton_2)
        self.ui.SendButton_3.clicked.connect(self.ProcessSendButton_3)
        self.ui.SendButton_4.clicked.connect(self.ProcessSendButton_4)
        self.ui.SendButton_5.clicked.connect(self.ProcessSendButton_5)
        self.ui.SendButton_6.clicked.connect(self.ProcessSendButton_6)
        self.ui.SendButton_7.clicked.connect(self.ProcessSendButton_7)
        self.ui.SendButton_8.clicked.connect(self.ProcessSendButton_8)
        self.ui.SendButton_9.clicked.connect(self.ProcessSendButton_9)
        self.ui.SendButton_10.clicked.connect(self.ProcessSendButton_10)
        self.ui.SendButton_11.clicked.connect(self.ProcessSendButton_11)
        self.ui.SendButton_12.clicked.connect(self.ProcessSendButton_12)
        self.ui.SendButton_13.clicked.connect(self.ProcessSendButton_13)
        self.ui.SendButton_14.clicked.connect(self.ProcessSendButton_14)
        self.ui.SendButton_15.clicked.connect(self.ProcessSendButton_15)
        self.ui.SendButton_16.clicked.connect(self.ProcessSendButton_16)
        self.ui.SendButton_17.clicked.connect(self.ProcessSendButton_17)
        self.ui.SendButton_18.clicked.connect(self.ProcessSendButton_18)
        self.ui.SendButton_19.clicked.connect(self.ProcessSendButton_19)
        self.ui.SendButton_20.clicked.connect(self.ProcessSendButton_20)
        self.ui.SendButton_21.clicked.connect(self.ProcessSendButton_21)
        self.ui.SendButton_22.clicked.connect(self.ProcessSendButton_22)
        self.ui.SendButton_23.clicked.connect(self.ProcessSendButton_23)
        self.ui.SendButton_24.clicked.connect(self.ProcessSendButton_24)
        self.ui.SendButton_25.clicked.connect(self.ProcessSendButton_25)
示例#3
0
class SubsystemCommands(QtGui.QDialog):

    pktCount = 0

    #
    # Init the class
    #
    def __init__(self):
        QtGui.QDialog.__init__(self)
        self.ui = Ui_GenericCommandDialog()
        self.ui.setupUi(self)
        self.setWindowTitle(pageTitle)
        self.parser = HTMLDocsParser()

        self.ui.SendButton_1.clicked.connect(self.ProcessSendButton_1)
        self.ui.SendButton_2.clicked.connect(self.ProcessSendButton_2)
        self.ui.SendButton_3.clicked.connect(self.ProcessSendButton_3)
        self.ui.SendButton_4.clicked.connect(self.ProcessSendButton_4)
        self.ui.SendButton_5.clicked.connect(self.ProcessSendButton_5)
        self.ui.SendButton_6.clicked.connect(self.ProcessSendButton_6)
        self.ui.SendButton_7.clicked.connect(self.ProcessSendButton_7)
        self.ui.SendButton_8.clicked.connect(self.ProcessSendButton_8)
        self.ui.SendButton_9.clicked.connect(self.ProcessSendButton_9)
        self.ui.SendButton_10.clicked.connect(self.ProcessSendButton_10)
        self.ui.SendButton_11.clicked.connect(self.ProcessSendButton_11)
        self.ui.SendButton_12.clicked.connect(self.ProcessSendButton_12)
        self.ui.SendButton_13.clicked.connect(self.ProcessSendButton_13)
        self.ui.SendButton_14.clicked.connect(self.ProcessSendButton_14)
        self.ui.SendButton_15.clicked.connect(self.ProcessSendButton_15)
        self.ui.SendButton_16.clicked.connect(self.ProcessSendButton_16)
        self.ui.SendButton_17.clicked.connect(self.ProcessSendButton_17)
        self.ui.SendButton_18.clicked.connect(self.ProcessSendButton_18)
        self.ui.SendButton_19.clicked.connect(self.ProcessSendButton_19)
        self.ui.SendButton_20.clicked.connect(self.ProcessSendButton_20)
        self.ui.SendButton_21.clicked.connect(self.ProcessSendButton_21)
        self.ui.SendButton_22.clicked.connect(self.ProcessSendButton_22)
        self.ui.SendButton_23.clicked.connect(self.ProcessSendButton_23)
        self.ui.SendButton_24.clicked.connect(self.ProcessSendButton_24)
        self.ui.SendButton_25.clicked.connect(self.ProcessSendButton_25)

    #
    # Button press methods
    #
    def ProcessSendButton_1(self):
        self.ProcessSendButtonGeneric(0)

    def ProcessSendButton_2(self):
        self.ProcessSendButtonGeneric(1)

    def ProcessSendButton_3(self):
        self.ProcessSendButtonGeneric(2)

    def ProcessSendButton_4(self):
        self.ProcessSendButtonGeneric(3)

    def ProcessSendButton_5(self):
        self.ProcessSendButtonGeneric(4)

    def ProcessSendButton_6(self):
        self.ProcessSendButtonGeneric(5)

    def ProcessSendButton_7(self):
        self.ProcessSendButtonGeneric(6)

    def ProcessSendButton_8(self):
        self.ProcessSendButtonGeneric(7)

    def ProcessSendButton_9(self):
        self.ProcessSendButtonGeneric(8)

    def ProcessSendButton_10(self):
        self.ProcessSendButtonGeneric(9)

    def ProcessSendButton_11(self):
        self.ProcessSendButtonGeneric(10)

    def ProcessSendButton_12(self):
        self.ProcessSendButtonGeneric(11)

    def ProcessSendButton_13(self):
        self.ProcessSendButtonGeneric(12)

    def ProcessSendButton_14(self):
        self.ProcessSendButtonGeneric(13)

    def ProcessSendButton_15(self):
        self.ProcessSendButtonGeneric(14)

    def ProcessSendButton_16(self):
        self.ProcessSendButtonGeneric(15)

    def ProcessSendButton_17(self):
        self.ProcessSendButtonGeneric(16)

    def ProcessSendButton_18(self):
        self.ProcessSendButtonGeneric(17)

    def ProcessSendButton_19(self):
        self.ProcessSendButtonGeneric(18)

    def ProcessSendButton_20(self):
        self.ProcessSendButtonGeneric(19)

    def ProcessSendButton_21(self):
        self.ProcessSendButtonGeneric(20)

    def ProcessSendButton_22(self):
        self.ProcessSendButtonGeneric(21)

    def ProcessSendButton_23(self):
        self.ProcessSendButtonGeneric(22)

    def ProcessSendButton_24(self):
        self.ProcessSendButtonGeneric(23)

    def ProcessSendButton_25(self):
        self.ProcessSendButtonGeneric(24)

    #
    # Determines if command requires parameters
    #
    def checkParams(self, idx):
        pickle_file = 'ParameterFiles/' + param_files[idx]
        try:
            with open(pickle_file, 'rb') as pickle_obj:
                dataTypesOrig, paramNames, paramLen, paramDesc, dataTypesNew, stringLen = pickle.load(
                    pickle_obj)
                if len(paramNames) > 0:  # if has parameters
                    return True
                else:
                    return False
        except IOError:
            return False

    #
    # Generic button press method
    #
    def ProcessSendButtonGeneric(self, idx):
        if cmdItemIsValid[idx] == True:
            param_bool = self.checkParams(idx)
            address = str(Commands.ui.commandAddressLineEdit.text())

            # If parameters are required, launches Parameters page
            if param_bool == True:
                prog = 'python Parameter.py'
                launch_string = prog + ' --title=\"' + pageTitle + '\" --descrip=\"' + cmdDesc[
                    idx] + '\" --idx=' + str(
                        idx
                    ) + ' --host=\"' + address + '\" --port=' + str(
                        pagePort
                    ) + ' --pktid=' + str(
                        pagePktId
                    ) + ' --endian=' + pageEndian + ' --cmdcode=' + cmdCodes[
                        idx] + ' --file=' + param_files[idx]

            # If parameters not required, directly calls cmdUtil to send command
            else:
                prog = '../cmdUtil/cmdUtil '
                launch_string = prog + ' --host=' + address + ' --port=' + str(
                    pagePort
                ) + ' --pktid=' + str(
                    pagePktId
                ) + ' --endian=' + pageEndian + ' --cmdcode=' + cmdCodes[idx]

            cmd_args = shlex.split(launch_string)
            subprocess.Popen(cmd_args)
示例#4
0
class SubsystemCommands(QtGui.QDialog):

    pktCount = 0

    #
    # Init the class
    #
    def __init__(self):
        QtGui.QDialog.__init__(self)
        self.ui = Ui_GenericCommandDialog()
        self.ui.setupUi(self)
        self.setWindowTitle(pageTitle)

        self.ui.SendButton_1.clicked.connect(self.ProcessSendButton_1)
        self.ui.SendButton_2.clicked.connect(self.ProcessSendButton_2)
        self.ui.SendButton_3.clicked.connect(self.ProcessSendButton_3)
        self.ui.SendButton_4.clicked.connect(self.ProcessSendButton_4)
        self.ui.SendButton_5.clicked.connect(self.ProcessSendButton_5)
        self.ui.SendButton_6.clicked.connect(self.ProcessSendButton_6)
        self.ui.SendButton_7.clicked.connect(self.ProcessSendButton_7)
        self.ui.SendButton_8.clicked.connect(self.ProcessSendButton_8)
        self.ui.SendButton_9.clicked.connect(self.ProcessSendButton_9)
        self.ui.SendButton_10.clicked.connect(self.ProcessSendButton_10)
        self.ui.SendButton_11.clicked.connect(self.ProcessSendButton_11)
        self.ui.SendButton_12.clicked.connect(self.ProcessSendButton_12)
        self.ui.SendButton_13.clicked.connect(self.ProcessSendButton_13)
        self.ui.SendButton_14.clicked.connect(self.ProcessSendButton_14)
        self.ui.SendButton_15.clicked.connect(self.ProcessSendButton_15)
        self.ui.SendButton_16.clicked.connect(self.ProcessSendButton_16)
        self.ui.SendButton_17.clicked.connect(self.ProcessSendButton_17)
        self.ui.SendButton_18.clicked.connect(self.ProcessSendButton_18)
        self.ui.SendButton_19.clicked.connect(self.ProcessSendButton_19)
        self.ui.SendButton_20.clicked.connect(self.ProcessSendButton_20)

        self.ui.paramsButton_1.clicked.connect(self.ProcessParamsButton_1)
        self.ui.paramsButton_2.clicked.connect(self.ProcessParamsButton_2)
        self.ui.paramsButton_3.clicked.connect(self.ProcessParamsButton_3)
        self.ui.paramsButton_4.clicked.connect(self.ProcessParamsButton_4)
        self.ui.paramsButton_5.clicked.connect(self.ProcessParamsButton_5)
        self.ui.paramsButton_6.clicked.connect(self.ProcessParamsButton_6)
        self.ui.paramsButton_7.clicked.connect(self.ProcessParamsButton_7)
        self.ui.paramsButton_8.clicked.connect(self.ProcessParamsButton_8)
        self.ui.paramsButton_9.clicked.connect(self.ProcessParamsButton_9)
        self.ui.paramsButton_10.clicked.connect(self.ProcessParamsButton_10)
        self.ui.paramsButton_11.clicked.connect(self.ProcessParamsButton_11)
        self.ui.paramsButton_12.clicked.connect(self.ProcessParamsButton_12)
        self.ui.paramsButton_13.clicked.connect(self.ProcessParamsButton_13)
        self.ui.paramsButton_14.clicked.connect(self.ProcessParamsButton_14)
        self.ui.paramsButton_15.clicked.connect(self.ProcessParamsButton_15)
        self.ui.paramsButton_16.clicked.connect(self.ProcessParamsButton_16)
        self.ui.paramsButton_17.clicked.connect(self.ProcessParamsButton_17)
        self.ui.paramsButton_18.clicked.connect(self.ProcessParamsButton_18)
        self.ui.paramsButton_19.clicked.connect(self.ProcessParamsButton_19)
        self.ui.paramsButton_20.clicked.connect(self.ProcessParamsButton_20)

    #
    # Button press methods
    #
    def ProcessSendButton_1(self):
        self.ProcessSendButtonGeneric(0)

    def ProcessSendButton_2(self):
        self.ProcessSendButtonGeneric(1)

    def ProcessSendButton_3(self):
        self.ProcessSendButtonGeneric(2)

    def ProcessSendButton_4(self):
        self.ProcessSendButtonGeneric(3)

    def ProcessSendButton_5(self):
        self.ProcessSendButtonGeneric(4)

    def ProcessSendButton_6(self):
        self.ProcessSendButtonGeneric(5)

    def ProcessSendButton_7(self):
        self.ProcessSendButtonGeneric(6)

    def ProcessSendButton_8(self):
        self.ProcessSendButtonGeneric(7)

    def ProcessSendButton_9(self):
        self.ProcessSendButtonGeneric(8)

    def ProcessSendButton_10(self):
        self.ProcessSendButtonGeneric(9)

    def ProcessSendButton_11(self):
        self.ProcessSendButtonGeneric(10)

    def ProcessSendButton_12(self):
        self.ProcessSendButtonGeneric(11)

    def ProcessSendButton_13(self):
        self.ProcessSendButtonGeneric(12)

    def ProcessSendButton_14(self):
        self.ProcessSendButtonGeneric(13)

    def ProcessSendButton_15(self):
        self.ProcessSendButtonGeneric(14)

    def ProcessSendButton_16(self):
        self.ProcessSendButtonGeneric(15)

    def ProcessSendButton_17(self):
        self.ProcessSendButtonGeneric(16)

    def ProcessSendButton_18(self):
        self.ProcessSendButtonGeneric(17)

    def ProcessSendButton_19(self):
        self.ProcessSendButtonGeneric(18)

    def ProcessSendButton_20(self):
        self.ProcessSendButtonGeneric(19)

    #
    # Generic button press method
    def ProcessSendButtonGeneric(self, idx):
        if cmdItemIsValid[idx] == True:
            launch_string = '../cmdUtil/cmdUtil ' + ' --host=' + pageAddress + ' --port=' + pagePort + ' --pktid=' + pagePktId + ' --endian=' + pageEndian + ' --cmdcode=' + cmdCmdCode[
                idx]
            if cmdArg1[idx] != "NULL":
                launch_string = launch_string + ' ' + cmdArg1[idx]
            if cmdArg2[idx] != "NULL":
                launch_string = launch_string + ' ' + cmdArg2[idx]
            if cmdArg3[idx] != "NULL":
                launch_string = launch_string + ' ' + cmdArg3[idx]
            if cmdArg4[idx] != "NULL":
                launch_string = launch_string + ' ' + cmdArg4[idx]
            if cmdArg5[idx] != "NULL":
                launch_string = launch_string + ' ' + cmdArg5[idx]
            if cmdArg6[idx] != "NULL":
                launch_string = launch_string + ' ' + cmdArg6[idx]
            cmd_args = shlex.split(launch_string)
            # print launch_string
            subprocess.Popen(cmd_args)

    #
    # Parameter button wrappers
    #
    def ProcessParamsButton_1(self):
        self.ProcessParameterButtonGeneric(0)

    def ProcessParamsButton_2(self):
        self.ProcessParameterButtonGeneric(1)

    def ProcessParamsButton_3(self):
        self.ProcessParameterButtonGeneric(2)

    def ProcessParamsButton_4(self):
        self.ProcessParameterButtonGeneric(3)

    def ProcessParamsButton_5(self):
        self.ProcessParameterButtonGeneric(4)

    def ProcessParamsButton_6(self):
        self.ProcessParameterButtonGeneric(5)

    def ProcessParamsButton_7(self):
        self.ProcessParameterButtonGeneric(6)

    def ProcessParamsButton_8(self):
        self.ProcessParameterButtonGeneric(7)

    def ProcessParamsButton_9(self):
        self.ProcessParameterButtonGeneric(8)

    def ProcessParamsButton_10(self):
        self.ProcessParameterButtonGeneric(9)

    def ProcessParamsButton_11(self):
        self.ProcessParameterButtonGeneric(10)

    def ProcessParamsButton_12(self):
        self.ProcessParameterButtonGeneric(11)

    def ProcessParamsButton_13(self):
        self.ProcessParameterButtonGeneric(12)

    def ProcessParamsButton_14(self):
        self.ProcessParameterButtonGeneric(13)

    def ProcessParamsButton_15(self):
        self.ProcessParameterButtonGeneric(14)

    def ProcessParamsButton_16(self):
        self.ProcessParameterButtonGeneric(15)

    def ProcessParamsButton_17(self):
        self.ProcessParameterButtonGeneric(16)

    def ProcessParamsButton_18(self):
        self.ProcessParameterButtonGeneric(17)

    def ProcessParamsButton_19(self):
        self.ProcessParameterButtonGeneric(18)

    def ProcessParamsButton_20(self):
        self.ProcessParameterButtonGeneric(19)

    #
    # Parameter dialog button press method
    #
    def ProcessParameterButtonGeneric(self, idx):
        parameter_string = cmdArg1[idx] + '\n' + cmdArg2[idx] + '\n' + cmdArg3[
            idx] + '\n'
        parameter_string += cmdArg4[idx] + '\n' + cmdArg5[
            idx] + '\n' + cmdArg6[idx]
        QtGui.QMessageBox.information(self, "Parameters", parameter_string)
示例#5
0
class SubsystemCommands(QtGui.QDialog):

    pktCount = 0

    #
    # Init the class
    #
    def __init__(self):
        QtGui.QDialog.__init__(self)
        self.ui = Ui_GenericCommandDialog()
        self.ui.setupUi(self)
        self.setWindowTitle(pageTitle)

        self.ui.SendButton_1.clicked.connect(self.ProcessSendButton_1)
        self.ui.SendButton_2.clicked.connect(self.ProcessSendButton_2)
        self.ui.SendButton_3.clicked.connect(self.ProcessSendButton_3)
        self.ui.SendButton_4.clicked.connect(self.ProcessSendButton_4)
        self.ui.SendButton_5.clicked.connect(self.ProcessSendButton_5)
        self.ui.SendButton_6.clicked.connect(self.ProcessSendButton_6)
        self.ui.SendButton_7.clicked.connect(self.ProcessSendButton_7)
        self.ui.SendButton_8.clicked.connect(self.ProcessSendButton_8)
        self.ui.SendButton_9.clicked.connect(self.ProcessSendButton_9)
        self.ui.SendButton_10.clicked.connect(self.ProcessSendButton_10)
        self.ui.SendButton_11.clicked.connect(self.ProcessSendButton_11)
        self.ui.SendButton_12.clicked.connect(self.ProcessSendButton_12)
        self.ui.SendButton_13.clicked.connect(self.ProcessSendButton_13)
        self.ui.SendButton_14.clicked.connect(self.ProcessSendButton_14)
        self.ui.SendButton_15.clicked.connect(self.ProcessSendButton_15)
        self.ui.SendButton_16.clicked.connect(self.ProcessSendButton_16)
        self.ui.SendButton_17.clicked.connect(self.ProcessSendButton_17)
        self.ui.SendButton_18.clicked.connect(self.ProcessSendButton_18)
        self.ui.SendButton_19.clicked.connect(self.ProcessSendButton_19)
        self.ui.SendButton_20.clicked.connect(self.ProcessSendButton_20)

        self.ui.paramsButton_1.clicked.connect(self.ProcessParamsButton_1)
        self.ui.paramsButton_2.clicked.connect(self.ProcessParamsButton_2)
        self.ui.paramsButton_3.clicked.connect(self.ProcessParamsButton_3)
        self.ui.paramsButton_4.clicked.connect(self.ProcessParamsButton_4)
        self.ui.paramsButton_5.clicked.connect(self.ProcessParamsButton_5)
        self.ui.paramsButton_6.clicked.connect(self.ProcessParamsButton_6)
        self.ui.paramsButton_7.clicked.connect(self.ProcessParamsButton_7)
        self.ui.paramsButton_8.clicked.connect(self.ProcessParamsButton_8)
        self.ui.paramsButton_9.clicked.connect(self.ProcessParamsButton_9)
        self.ui.paramsButton_10.clicked.connect(self.ProcessParamsButton_10)
        self.ui.paramsButton_11.clicked.connect(self.ProcessParamsButton_11)
        self.ui.paramsButton_12.clicked.connect(self.ProcessParamsButton_12)
        self.ui.paramsButton_13.clicked.connect(self.ProcessParamsButton_13)
        self.ui.paramsButton_14.clicked.connect(self.ProcessParamsButton_14)
        self.ui.paramsButton_15.clicked.connect(self.ProcessParamsButton_15)
        self.ui.paramsButton_16.clicked.connect(self.ProcessParamsButton_16)
        self.ui.paramsButton_17.clicked.connect(self.ProcessParamsButton_17)
        self.ui.paramsButton_18.clicked.connect(self.ProcessParamsButton_18)
        self.ui.paramsButton_19.clicked.connect(self.ProcessParamsButton_19)
        self.ui.paramsButton_20.clicked.connect(self.ProcessParamsButton_20)
    #
    # Button press methods
    #  
    def ProcessSendButton_1(self):
	self.ProcessSendButtonGeneric(0)
    def ProcessSendButton_2(self):
	self.ProcessSendButtonGeneric(1)
    def ProcessSendButton_3(self):
	self.ProcessSendButtonGeneric(2)
    def ProcessSendButton_4(self):
	self.ProcessSendButtonGeneric(3)
    def ProcessSendButton_5(self):
	self.ProcessSendButtonGeneric(4)
    def ProcessSendButton_6(self):
	self.ProcessSendButtonGeneric(5)
    def ProcessSendButton_7(self):
	self.ProcessSendButtonGeneric(6)
    def ProcessSendButton_8(self):
	self.ProcessSendButtonGeneric(7)
    def ProcessSendButton_9(self):
	self.ProcessSendButtonGeneric(8)
    def ProcessSendButton_10(self):
	self.ProcessSendButtonGeneric(9)
    def ProcessSendButton_11(self):
	self.ProcessSendButtonGeneric(10)
    def ProcessSendButton_12(self):
	self.ProcessSendButtonGeneric(11)
    def ProcessSendButton_13(self):
	self.ProcessSendButtonGeneric(12)
    def ProcessSendButton_14(self):
	self.ProcessSendButtonGeneric(13)
    def ProcessSendButton_15(self):
	self.ProcessSendButtonGeneric(14)
    def ProcessSendButton_16(self):
	self.ProcessSendButtonGeneric(15)
    def ProcessSendButton_17(self):
	self.ProcessSendButtonGeneric(16)
    def ProcessSendButton_18(self):
	self.ProcessSendButtonGeneric(17)
    def ProcessSendButton_19(self):
	self.ProcessSendButtonGeneric(18)
    def ProcessSendButton_20(self):
	self.ProcessSendButtonGeneric(19)

    #
    # Generic button press method
    def ProcessSendButtonGeneric(self, idx):
        if cmdItemIsValid[idx] == True:
           launch_string = '../cmdUtil/cmdUtil ' + ' --host=' + pageAddress + ' --port=' + pagePort + ' --pktid=' + pagePktId + ' --endian=' + pageEndian + ' --cmdcode=' + cmdCmdCode[idx]
           if cmdArg1[idx] != "NULL":
              launch_string = launch_string + ' ' + cmdArg1[idx]
           if cmdArg2[idx] != "NULL":
              launch_string = launch_string + ' ' + cmdArg2[idx]
           if cmdArg3[idx] != "NULL":
              launch_string = launch_string + ' ' + cmdArg3[idx]
           if cmdArg4[idx] != "NULL":
              launch_string = launch_string + ' ' + cmdArg4[idx]
           if cmdArg5[idx] != "NULL":
              launch_string = launch_string + ' ' + cmdArg5[idx]
           if cmdArg6[idx] != "NULL":
              launch_string = launch_string + ' ' + cmdArg6[idx]
           cmd_args = shlex.split(launch_string)
	   # print launch_string
           subprocess.Popen(cmd_args)

    # 
    # Parameter button wrappers
    #
    def ProcessParamsButton_1(self):
	self.ProcessParameterButtonGeneric(0)
    def ProcessParamsButton_2(self):
	self.ProcessParameterButtonGeneric(1)
    def ProcessParamsButton_3(self):
	self.ProcessParameterButtonGeneric(2)
    def ProcessParamsButton_4(self):
	self.ProcessParameterButtonGeneric(3)
    def ProcessParamsButton_5(self):
	self.ProcessParameterButtonGeneric(4)
    def ProcessParamsButton_6(self):
	self.ProcessParameterButtonGeneric(5)
    def ProcessParamsButton_7(self):
	self.ProcessParameterButtonGeneric(6)
    def ProcessParamsButton_8(self):
	self.ProcessParameterButtonGeneric(7)
    def ProcessParamsButton_9(self):
	self.ProcessParameterButtonGeneric(8)
    def ProcessParamsButton_10(self):
	self.ProcessParameterButtonGeneric(9)
    def ProcessParamsButton_11(self):
	self.ProcessParameterButtonGeneric(10)
    def ProcessParamsButton_12(self):
	self.ProcessParameterButtonGeneric(11)
    def ProcessParamsButton_13(self):
	self.ProcessParameterButtonGeneric(12)
    def ProcessParamsButton_14(self):
	self.ProcessParameterButtonGeneric(13)
    def ProcessParamsButton_15(self):
	self.ProcessParameterButtonGeneric(14)
    def ProcessParamsButton_16(self):
	self.ProcessParameterButtonGeneric(15)
    def ProcessParamsButton_17(self):
	self.ProcessParameterButtonGeneric(16)
    def ProcessParamsButton_18(self):
	self.ProcessParameterButtonGeneric(17)
    def ProcessParamsButton_19(self):
	self.ProcessParameterButtonGeneric(18)
    def ProcessParamsButton_20(self):
	self.ProcessParameterButtonGeneric(19)

    # 
    # Parameter dialog button press method
    #
    def ProcessParameterButtonGeneric(self,idx):
       parameter_string = cmdArg1[idx] + '\n' + cmdArg2[idx] + '\n' + cmdArg3[idx] + '\n'
       parameter_string += cmdArg4[idx] + '\n' + cmdArg5[idx] + '\n' + cmdArg6[idx]
       QtGui.QMessageBox.information(self,"Parameters", parameter_string)
示例#6
0
class SubsystemCommands(QtGui.QDialog):

    pktCount = 0

    #
    # Init the class
    #
    def __init__(self):
        QtGui.QDialog.__init__(self)
        self.ui = Ui_GenericCommandDialog()
        self.ui.setupUi(self)
        self.setWindowTitle(pageTitle)
        self.parser = HTMLDocsParser()

        self.ui.SendButton_1.clicked.connect(self.ProcessSendButton_1)
        self.ui.SendButton_2.clicked.connect(self.ProcessSendButton_2)
        self.ui.SendButton_3.clicked.connect(self.ProcessSendButton_3)
        self.ui.SendButton_4.clicked.connect(self.ProcessSendButton_4)
        self.ui.SendButton_5.clicked.connect(self.ProcessSendButton_5)
        self.ui.SendButton_6.clicked.connect(self.ProcessSendButton_6)
        self.ui.SendButton_7.clicked.connect(self.ProcessSendButton_7)
        self.ui.SendButton_8.clicked.connect(self.ProcessSendButton_8)
        self.ui.SendButton_9.clicked.connect(self.ProcessSendButton_9)
        self.ui.SendButton_10.clicked.connect(self.ProcessSendButton_10)
        self.ui.SendButton_11.clicked.connect(self.ProcessSendButton_11)
        self.ui.SendButton_12.clicked.connect(self.ProcessSendButton_12)
        self.ui.SendButton_13.clicked.connect(self.ProcessSendButton_13)
        self.ui.SendButton_14.clicked.connect(self.ProcessSendButton_14)
        self.ui.SendButton_15.clicked.connect(self.ProcessSendButton_15)
        self.ui.SendButton_16.clicked.connect(self.ProcessSendButton_16)
        self.ui.SendButton_17.clicked.connect(self.ProcessSendButton_17)
        self.ui.SendButton_18.clicked.connect(self.ProcessSendButton_18)
        self.ui.SendButton_19.clicked.connect(self.ProcessSendButton_19)
        self.ui.SendButton_20.clicked.connect(self.ProcessSendButton_20)
        self.ui.SendButton_21.clicked.connect(self.ProcessSendButton_21)
        self.ui.SendButton_22.clicked.connect(self.ProcessSendButton_22)
        self.ui.SendButton_23.clicked.connect(self.ProcessSendButton_23)
        self.ui.SendButton_24.clicked.connect(self.ProcessSendButton_24)
        self.ui.SendButton_25.clicked.connect(self.ProcessSendButton_25)

    #
    # Button press methods
    #  
    def ProcessSendButton_1(self):
        self.ProcessSendButtonGeneric(0)
    def ProcessSendButton_2(self):
        self.ProcessSendButtonGeneric(1)
    def ProcessSendButton_3(self):
        self.ProcessSendButtonGeneric(2)
    def ProcessSendButton_4(self):
        self.ProcessSendButtonGeneric(3)
    def ProcessSendButton_5(self):
        self.ProcessSendButtonGeneric(4)
    def ProcessSendButton_6(self):
        self.ProcessSendButtonGeneric(5)
    def ProcessSendButton_7(self):
        self.ProcessSendButtonGeneric(6)
    def ProcessSendButton_8(self):
        self.ProcessSendButtonGeneric(7)
    def ProcessSendButton_9(self):
        self.ProcessSendButtonGeneric(8)
    def ProcessSendButton_10(self):
        self.ProcessSendButtonGeneric(9)
    def ProcessSendButton_11(self):
        self.ProcessSendButtonGeneric(10)
    def ProcessSendButton_12(self):
        self.ProcessSendButtonGeneric(11)
    def ProcessSendButton_13(self):
        self.ProcessSendButtonGeneric(12)
    def ProcessSendButton_14(self):
        self.ProcessSendButtonGeneric(13)
    def ProcessSendButton_15(self):
        self.ProcessSendButtonGeneric(14)
    def ProcessSendButton_16(self):
        self.ProcessSendButtonGeneric(15)
    def ProcessSendButton_17(self):
        self.ProcessSendButtonGeneric(16)
    def ProcessSendButton_18(self):
        self.ProcessSendButtonGeneric(17)
    def ProcessSendButton_19(self):
        self.ProcessSendButtonGeneric(18)
    def ProcessSendButton_20(self):
        self.ProcessSendButtonGeneric(19)
    def ProcessSendButton_21(self):
        self.ProcessSendButtonGeneric(20)
    def ProcessSendButton_22(self):
        self.ProcessSendButtonGeneric(21)
    def ProcessSendButton_23(self):
        self.ProcessSendButtonGeneric(22)
    def ProcessSendButton_24(self):
        self.ProcessSendButtonGeneric(23)
    def ProcessSendButton_25(self):
        self.ProcessSendButtonGeneric(24)


    #
    # Determines if command requires parameters
    #
    def checkParams(self, idx):
        pickle_file = 'ParameterFiles/' + param_files[idx]
        try:
            with open(pickle_file,'rb') as pickle_obj:
                dataTypesOrig, paramNames, paramLen, paramDesc, dataTypesNew, stringLen = pickle.load(pickle_obj)
                if len(paramNames) > 0: # if has parameters
                   return True
                else:
                   return False
        except IOError:
            return False


    #
    # Generic button press method
    #
    def ProcessSendButtonGeneric(self, idx):
        if cmdItemIsValid[idx] == True: 
            param_bool = self.checkParams(idx)
            address = str(Commands.ui.commandAddressLineEdit.text())

            
            # If parameters are required, launches Parameters page
            if param_bool == True:
                prog = 'python Parameter.py'
                launch_string = prog+' --title=\"'+pageTitle+'\" --descrip=\"'+cmdDesc[idx]+'\" --idx='+str(idx)+' --host=\"'+address+'\" --port='+str(pagePort)+' --pktid='+str(pagePktId)+' --endian='+pageEndian+' --cmdcode='+cmdCodes[idx]+' --file='+param_files[idx]

            # If parameters not required, directly calls cmdUtil to send command
            else:
                prog = '../cmdUtil/cmdUtil '
                launch_string = prog + ' --host=' + address + ' --port=' + str(pagePort) + ' --pktid=' + str(pagePktId) + ' --endian=' + pageEndian + ' --cmdcode=' + cmdCodes[idx]

            cmd_args = shlex.split(launch_string)
            subprocess.Popen(cmd_args)