def remove_from_blacklist(self):
        if os.path.isfile(self.file_path):
            with open(self.file_path) as data_file:
                data = json.load(data_file)

                data['Devices']['Banned Interfaces'].remove(
                    self.selected_config.get())
                interfaces_id = int(
                    self.interfaces.index(self.selected_config.get()))
                interfaces_id = (interfaces_id + 1)
                interfaces_id = str(interfaces_id)
                data['Devices']['Banned Ids'].remove(interfaces_id)

                self.banned_ids = data['Devices']['Banned Ids']

                with open(self.file_path, 'w') as outfile:
                    json.dump(data,
                              outfile,
                              sort_keys=True,
                              indent=4,
                              separators=(',', ': '))

                self.update_flag()

        RemoveFields(self.root)
        DynamicView.MakeView(self.root, self.base_dir, self.plugin_name,
                             self.config_file_name)

        self.top.destroy()
    def remove_configuration(self):
        if os.path.isfile(self.file_path):
            with open(self.file_path) as data_file:
                data = json.load(data_file)

                if self.selected_config.get() in data['General']:
                    del data['General'][self.selected_config.get()]
                else:
                    del data['Archiving'][self.selected_config.get()]

                with open(self.file_path, 'w') as outfile:
                    json.dump(data, outfile, sort_keys=True, indent=4, separators=(',', ': '))

        RemoveFields(self.root)
        DynamicView.MakeView(self.root, self.base_dir, self.plugin_name, self.config_file_name)

        self.top.destroy()
Esempio n. 3
0
    def add_configuration(self):
        if os.path.isfile(self.file_path):
            with open(self.file_path) as data_file:
                data = json.load(data_file)

                data[self.default_setting_type.get()][self.entry_key.get()] = {
                    "Values": self.entry_value.get().split(', '),
                    "Selected": self.entry_value.get().split(', ')[0],
                    "Field Type": "Option"
                }

                with open(self.file_path, 'w') as outfile:
                    json.dump(data, outfile, sort_keys=True, indent=4, separators=(',', ': '))

            RemoveFields(self.root)
            DynamicView.MakeView(self.root, self.base_dir, self.config_file_name)

            self.top.destroy()
Esempio n. 4
0
    def add_configuration(self):
        if os.path.isfile(self.file_path):
            with open(self.file_path) as data_file:
                data = json.load(data_file)

                data[self.default_setting_type.get()][self.entry_key.get()] = {
                    'Value': self.entry_value.get(),
                    'Is Path Type': bool(self.default_path_type.get()),
                    'Field Type': 'Entry'
                }

                with open(self.file_path, 'w') as outfile:
                    json.dump(data, outfile, sort_keys=True, indent=4, separators=(',', ': '))

        RemoveFields(self.root)
        DynamicView.MakeView(self.root, self.base_dir, self.plugin_name, self.config_file_name)

        self.top.destroy()
Esempio n. 5
0
    def add_to_blacklist(self):
        if os.path.isfile(self.file_path):
            with open(self.file_path) as data_file:
                data = json.load(data_file)

                data['Devices']['Banned Ids'].append(self.ids[self.interfaces.index(self.selected_config.get())])
                data['Devices']['Banned Interfaces'].append(self.selected_config.get())

                flag = data['General']['Flags']['Value']
                flag = flag.replace(self.ids[self.interfaces.index(self.selected_config.get())], "  ")
                flag = re.sub(' +', ' ', flag)
                data['General']['Flags']['Value'] = flag

                with open(self.file_path, 'w') as outfile:
                    json.dump(data, outfile, sort_keys=True, indent=4, separators=(',', ': '))

        RemoveFields(self.root)
        DynamicView.MakeView(self.root, self.base_dir, self.plugin_name, self.config_file_name)

        self.top.destroy()
Esempio n. 6
0
 def select_plugin(val):
     RemoveFields(root)
     DynamicView.MakeView(root, base_dir, val, config_file_name)