Esempio n. 1
0
    def __init__(self, mod_file, command="None"):
        self.root = et.parse(mod_file)  # 'ps_man_final.xml'
        self.root2 = self.root.getroot()
        i = 0
        self.dict = []
        mod = {}
        self.mod = mod
        self.pass_arg = None
        self.mod_list = []
        self.command = command
        self.names = [[]]  # psg list (GUI)
        self.detail_descriptions = [[]]
        self.descriptions = [[]]
        self.syntaxes = [[]]
        self.layout = [[]]
        self.dropdown_list = []
        self.layout_finals = []

        for tag in self.root2.iter('helpItems'):

            # DETAILS
            for commands in tag.iter('command'):
                i = i + 1
                self.details = commands.find('details')
                # NAME
                self.name = self.details.find('name')
                # print(name.text)
                # DETAILS DESCRIPTION
                self.detail_description = self.details.find('description')
                # print(detail_description.text)
                # DESCRIPTION
                self.description = commands.find('description')
                # print(description.text)
                # EXAMPLES
                self.examples = commands.findall('examples/example/code')
                self.example_list = []
                for example_items in self.examples:
                    ex_list = []
                    ex_list.append(example_items.text)
                    self.example_list.append(ex_list)

                # SYNTAX
                self.syntax = commands.findall(
                    'syntax/syntaxItem/parameter/name')
                self.syntax_list = []
                for syntax_param in self.syntax:
                    # print(syntax_list.append(syntax_param.text))
                    self.syntax_list.append(syntax_param.text)
                components = []
                # dict.append(name.text)
                self.modlist = []
                self.modlist.append(self.detail_description.text)
                self.modlist.append(self.description.text)
                self.modlist.append(self.syntax_list)
                self.modlist.append(self.example_list)

                self.example_format_list = [[]]

                self.mods = {self.name.text: self.modlist}
                self.mod.update(self.mods)

                syns_list = []
                self.dropdown_list.append(self.name.text)

            self.layout_final = [[
                Sg.DropDown(self.dropdown_list, enable_events=True)
            ]]

            print("Total Modules: {}".format(i))
            print(self.mod)
    [sg.Text('Edit actual entries', font=("Helvetica", 25))],
    [
        sg.Text(
            'Select PLC IP address to get configured data aliases, then choose one to get all parameters connected with it'
        )
    ]
]

plc_list = []
alias_list = []
plc_list = get_actual_plcs()
column1 = [[sg.Text('PLC IP address\t\t\tData alias')],
           [
               sg.DropDown(values=tuple(plc_list),
                           size=(15, 1),
                           key='PLC',
                           tooltip='select PLC to find information',
                           readonly=True,
                           default_value=plc_list[0]),
               sg.Button('Find aliases'),
               sg.DropDown(values=tuple(),
                           size=(15, 1),
                           key='ALIAS',
                           tooltip='select alias to find information'),
               sg.Button('Find data')
           ]]

# add row to enable editing row associated with the selected alias
data_row = [
    sg.Drop(values=areas,
            auto_size_text=True,
            key='AREA_EDIT',
Esempio n. 3
0
        test = launch.mod.get("{}".format(element[0]))

        print(launch.mod.get("Add-Computer")[1])

        input_list = []
        for x in test[2]:
            input_list.append(x)
            launch.layout.append(
                [Sg.InputText("{}".format(str(x)), key="{}".format(x))])

        launch.layout_finals = [
            [
                Sg.Column([[
                    Sg.DropDown(launch.dropdown_list,
                                enable_events=True,
                                default_value=v[0])
                ], [Sg.Button("Execute", size=(25, 1))]])
            ], [Sg.Column(launch.layout_final)],
            [
                Sg.DropDown(launch.mod.get("{}".format(element[0]))[3],
                            key="dd_ex")
            ],
            [
                Sg.Column(launch.layout),
                Sg.Column([[
                    Sg.Text(launch.mod.get("{}".format(element[0]))[1],
                            size=(800, 200),
                            key="{}".format(element[0]),
                            auto_size_text=True)
                ]])