コード例 #1
0
ファイル: makehosts.py プロジェクト: 100Mbps/huhamhire-hosts
    def get_hosts(self, make_cfg):
        """
        Make the new hosts file by the configuration defined by `make_cfg`
        from function list on the main dialog.

        :param make_cfg: Module settings in byte word format.
        :type make_cfg: dict

        .. seealso:: :attr:`make_cfg` in :class:`~tui.curses_d.CursesDaemon`
            class.
        """
        for part_id in sorted(make_cfg.keys()):
            mod_cfg = make_cfg[part_id]
            if not RetrieveData.chk_mutex(part_id, mod_cfg):
                return
            mods = RetrieveData.get_ids(mod_cfg)
            for mod_id in mods:
                self.mod_num += 1
                hosts, mod_name = RetrieveData.get_host(part_id, mod_id)
                if part_id == 0x02:
                    self.write_localhost_mod(hosts)
                elif part_id == 0x04:
                    self.write_customized()
                else:
                    self.write_common_mod(hosts, mod_name)
コード例 #2
0
    def get_hosts(self, make_cfg):
        """
        Make the new hosts file by the configuration defined by `make_cfg`
        from function list on the main dialog.

        :param make_cfg: Module settings in byte word format.
        :type make_cfg: dict

        .. seealso:: :attr:`make_cfg` in :class:`~tui.curses_d.CursesDaemon`
            class.
        """
        for part_id in sorted(make_cfg.keys()):
            mod_cfg = make_cfg[part_id]
            if not RetrieveData.chk_mutex(part_id, mod_cfg):
                return
            mods = RetrieveData.get_ids(mod_cfg)
            for mod_id in mods:
                self.mod_num += 1
                hosts, mod_name = RetrieveData.get_host(part_id, mod_id)
                if part_id == 0x02:
                    self.write_localhost_mod(hosts)
                elif part_id == 0x04:
                    self.write_customized()
                else:
                    self.write_common_mod(hosts, mod_name)