コード例 #1
0
ファイル: Generator.py プロジェクト: jinjoh/SDR
	def write(self):
		#do throttle warning
		all_keys = ' '.join(map(lambda b: b.get_key(), self._flow_graph.get_enabled_blocks()))
		if ('usrp' not in all_keys) and ('audio' not in all_keys) and ('throttle' not in all_keys) and self._generate_options != 'hb':
			Messages.send_warning('''\
This flow graph may not have flow control: no audio or usrp blocks found. \
Add a Misc->Throttle block to your flow graph to avoid CPU congestion.''')
		#generate
		open(self.get_file_path(), 'w').write(str(self))
		if self._generate_options == 'hb':
			#convert hier block to xml wrapper
			convert_hier.convert_hier(self._flow_graph, self.get_file_path())
		os.chmod(self.get_file_path(), self._mode)
コード例 #2
0
ファイル: Generator.py プロジェクト: imushir/python_workspace
	def write(self):
		#do throttle warning
		throttled = any(map(lambda b: b.throttle(), self._flow_graph.get_enabled_blocks()))
		if not throttled and self._generate_options != 'hb':
			Messages.send_warning('''\
This flow graph may not have flow control: no audio or usrp blocks found. \
Add a Misc->Throttle block to your flow graph to avoid CPU congestion.''')
		#generate
		open(self.get_file_path(), 'w').write(str(self))
		if self._generate_options == 'hb':
			#convert hier block to xml wrapper
			convert_hier.convert_hier(self._flow_graph, self.get_file_path())
		os.chmod(self.get_file_path(), self._mode)
コード例 #3
0
    def write(self):
        #do throttle warning
        throttling_blocks = filter(lambda b: b.throttle(), self._flow_graph.get_enabled_blocks())
        if not throttling_blocks and self._generate_options != 'hb':
            Messages.send_warning('''\
This flow graph may not have flow control: no audio or RF hardware blocks found. \
Add a Misc->Throttle block to your flow graph to avoid CPU congestion.''')
        if len(throttling_blocks) > 1:
            keys = set(map(lambda b: b.get_key(), throttling_blocks))
            if len(keys) > 1 and 'blocks_throttle' in keys:
                Messages.send_warning('''\
This flow graph contains a throttle block and another rate limiting block, e.g. a hardware source or sink. \
This is usually undesired. Consider removing the throttle block.''')
        #generate
        open(self.get_file_path(), 'w').write(str(self))
        if self._generate_options == 'hb':
            #convert hier block to xml wrapper
            convert_hier.convert_hier(self._flow_graph, self.get_file_path())
        os.chmod(self.get_file_path(), self._mode)
コード例 #4
0
    def write(self):
        # do throttle warning
        all_keys = " ".join(map(lambda b: b.get_key(), self._flow_graph.get_enabled_blocks()))
        if (
            ("usrp" not in all_keys)
            and ("audio" not in all_keys)
            and ("throttle" not in all_keys)
            and self._generate_options != "hb"
        ):
            Messages.send_warning(
                """\
This flow graph may not have flow control: no audio or usrp blocks found. \
Add a Misc->Throttle block to your flow graph to avoid CPU congestion."""
            )
            # generate
        open(self.get_file_path(), "w").write(str(self))
        if self._generate_options == "hb":
            # convert hier block to xml wrapper
            convert_hier.convert_hier(self._flow_graph, self.get_file_path())
        os.chmod(self.get_file_path(), self._mode)