当前位置: 首页>>代码示例>>Python>>正文


Python Actions.get_all_actions方法代码示例

本文整理汇总了Python中Actions.get_all_actions方法的典型用法代码示例。如果您正苦于以下问题:Python Actions.get_all_actions方法的具体用法?Python Actions.get_all_actions怎么用?Python Actions.get_all_actions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Actions的用法示例。


在下文中一共展示了Actions.get_all_actions方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: import Actions [as 别名]
# 或者: from Actions import get_all_actions [as 别名]
	def __init__(self, file_paths, platform):
		"""
		ActionHandler constructor.
		Create the main window, setup the message handler, import the preferences,
		and connect all of the action handlers. Finally, enter the gtk main loop and block.
		@param file_paths a list of flow graph file passed from command line
		@param platform platform module
		"""
		self.clipboard = None
		for action in Actions.get_all_actions(): action.connect('activate', self._handle_action)
		#setup the main window
		self.main_window = MainWindow(platform)
		self.main_window.connect('delete-event', self._quit)
		self.main_window.connect('key-press-event', self._handle_key_press)
		self.get_page = self.main_window.get_page
		self.get_flow_graph = self.main_window.get_flow_graph
		self.get_focus_flag = self.main_window.get_focus_flag
		#setup the messages
		Messages.register_messenger(self.main_window.add_report_line)
		Messages.send_init(platform)
		#initialize
		self.init_file_paths = file_paths
		Actions.APPLICATION_INITIALIZE()
		#enter the mainloop
		gtk.main()
开发者ID:jinjoh,项目名称:SDR,代码行数:27,代码来源:ActionHandler.py

示例2: _handle_action

# 需要导入模块: import Actions [as 别名]
# 或者: from Actions import get_all_actions [as 别名]
	def _handle_action(self, action):
		#print action
		##################################################
		# Initalize/Quit
		##################################################
		if action == Actions.APPLICATION_INITIALIZE:
			for action in Actions.get_all_actions(): action.set_sensitive(False) #set all actions disabled
			#enable a select few actions
			for action in (
				Actions.APPLICATION_QUIT, Actions.FLOW_GRAPH_NEW,
				Actions.FLOW_GRAPH_OPEN, Actions.FLOW_GRAPH_SAVE_AS,
				Actions.FLOW_GRAPH_CLOSE, Actions.ABOUT_WINDOW_DISPLAY,
				Actions.FLOW_GRAPH_SCREEN_CAPTURE, Actions.HELP_WINDOW_DISPLAY,
				Actions.TYPES_WINDOW_DISPLAY,
			): action.set_sensitive(True)
			if not self.init_file_paths:
				self.init_file_paths = Preferences.files_open()
			if not self.init_file_paths: self.init_file_paths = ['']
			for file_path in self.init_file_paths:
				if file_path: self.main_window.new_page(file_path) #load pages from file paths
			if Preferences.file_open() in self.init_file_paths:
				self.main_window.new_page(Preferences.file_open(), show=True)
			if not self.get_page():	self.main_window.new_page() #ensure that at least a blank page exists
		elif action == Actions.APPLICATION_QUIT:
			if self.main_window.close_pages():
				gtk.main_quit()
				exit(0)
		##################################################
		# Selections
		##################################################
		elif action == Actions.ELEMENT_SELECT:
			pass #do nothing, update routines below
		elif action == Actions.NOTHING_SELECT:
			self.get_flow_graph().unselect()
		##################################################
		# Enable/Disable
		##################################################
		elif action == Actions.BLOCK_ENABLE:
			if self.get_flow_graph().enable_selected(True):
				self.get_flow_graph().update()
				self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data())
				self.get_page().set_saved(False)
		elif action == Actions.BLOCK_DISABLE:
			if self.get_flow_graph().enable_selected(False):
				self.get_flow_graph().update()
				self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data())
				self.get_page().set_saved(False)
		##################################################
		# Cut/Copy/Paste
		##################################################
		elif action == Actions.BLOCK_CUT:
			Actions.BLOCK_COPY()
			Actions.ELEMENT_DELETE()
		elif action == Actions.BLOCK_COPY:
			self.clipboard = self.get_flow_graph().copy_to_clipboard()
		elif action == Actions.BLOCK_PASTE:
			if self.clipboard:
				self.get_flow_graph().paste_from_clipboard(self.clipboard)
				self.get_flow_graph().update()
				self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data())
				self.get_page().set_saved(False)
		##################################################
		# Move/Rotate/Delete/Create
		##################################################
		elif action == Actions.BLOCK_MOVE:
			self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data())
			self.get_page().set_saved(False)
		elif action == Actions.BLOCK_ROTATE_CCW:
			if self.get_flow_graph().rotate_selected(90):
				self.get_flow_graph().update()
				self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data())
				self.get_page().set_saved(False)
		elif action == Actions.BLOCK_ROTATE_CW:
			if self.get_flow_graph().rotate_selected(-90):
				self.get_flow_graph().update()
				self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data())
				self.get_page().set_saved(False)
		elif action == Actions.ELEMENT_DELETE:
			if self.get_flow_graph().remove_selected():
				self.get_flow_graph().update()
				self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data())
				Actions.NOTHING_SELECT()
				self.get_page().set_saved(False)
		elif action == Actions.ELEMENT_CREATE:
			self.get_flow_graph().update()
			self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data())
			Actions.NOTHING_SELECT()
			self.get_page().set_saved(False)
		elif action == Actions.BLOCK_INC_TYPE:
			if self.get_flow_graph().type_controller_modify_selected(1):
				self.get_flow_graph().update()
				self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data())
				self.get_page().set_saved(False)
		elif action == Actions.BLOCK_DEC_TYPE:
			if self.get_flow_graph().type_controller_modify_selected(-1):
				self.get_flow_graph().update()
				self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data())
				self.get_page().set_saved(False)
		elif action == Actions.PORT_CONTROLLER_INC:
			if self.get_flow_graph().port_controller_modify_selected(1):
#.........这里部分代码省略.........
开发者ID:jinjoh,项目名称:SDR,代码行数:103,代码来源:ActionHandler.py

示例3: _handle_action

# 需要导入模块: import Actions [as 别名]
# 或者: from Actions import get_all_actions [as 别名]
    def _handle_action(self, action):
        #print action
        ##################################################
        # Initalize/Quit
        ##################################################
        if action == Actions.APPLICATION_INITIALIZE:
            for action in Actions.get_all_actions(): action.set_sensitive(False) #set all actions disabled
            #enable a select few actions
            for action in (
                Actions.APPLICATION_QUIT, Actions.FLOW_GRAPH_NEW,
                Actions.FLOW_GRAPH_OPEN, Actions.FLOW_GRAPH_SAVE_AS,
                Actions.FLOW_GRAPH_CLOSE, Actions.ABOUT_WINDOW_DISPLAY,
                Actions.FLOW_GRAPH_SCREEN_CAPTURE, Actions.HELP_WINDOW_DISPLAY,
                Actions.TYPES_WINDOW_DISPLAY, Actions.TOGGLE_BLOCKS_WINDOW,
                Actions.TOGGLE_REPORTS_WINDOW,
            ): action.set_sensitive(True)
            if ParseXML.xml_failures:
                Messages.send_xml_errors_if_any(ParseXML.xml_failures)
                Actions.XML_PARSER_ERRORS_DISPLAY.set_sensitive(True)

            if not self.init_file_paths:
                self.init_file_paths = Preferences.files_open()
            if not self.init_file_paths: self.init_file_paths = ['']
            for file_path in self.init_file_paths:
                if file_path: self.main_window.new_page(file_path) #load pages from file paths
            if Preferences.file_open() in self.init_file_paths:
                self.main_window.new_page(Preferences.file_open(), show=True)
            if not self.get_page(): self.main_window.new_page() #ensure that at least a blank page exists

            self.main_window.btwin.search_entry.hide()
            Actions.TOGGLE_REPORTS_WINDOW.set_active(Preferences.reports_window_visibility())
            Actions.TOGGLE_BLOCKS_WINDOW.set_active(Preferences.blocks_window_visibility())
        elif action == Actions.APPLICATION_QUIT:
            if self.main_window.close_pages():
                gtk.main_quit()
                exit(0)
        ##################################################
        # Selections
        ##################################################
        elif action == Actions.ELEMENT_SELECT:
            pass #do nothing, update routines below
        elif action == Actions.NOTHING_SELECT:
            self.get_flow_graph().unselect()
        ##################################################
        # Enable/Disable
        ##################################################
        elif action == Actions.BLOCK_ENABLE:
            if self.get_flow_graph().enable_selected(True):
                self.get_flow_graph().update()
                self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data())
                self.get_page().set_saved(False)
        elif action == Actions.BLOCK_DISABLE:
            if self.get_flow_graph().enable_selected(False):
                self.get_flow_graph().update()
                self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data())
                self.get_page().set_saved(False)
        ##################################################
        # Cut/Copy/Paste
        ##################################################
        elif action == Actions.BLOCK_CUT:
            Actions.BLOCK_COPY()
            Actions.ELEMENT_DELETE()
        elif action == Actions.BLOCK_COPY:
            self.clipboard = self.get_flow_graph().copy_to_clipboard()
        elif action == Actions.BLOCK_PASTE:
            if self.clipboard:
                self.get_flow_graph().paste_from_clipboard(self.clipboard)
                self.get_flow_graph().update()
                self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data())
                self.get_page().set_saved(False)
                ##################################################
                # Create heir block 
                ##################################################
        elif action == Actions.BLOCK_CREATE_HIER:

                        # keeping track of coordinates for pasting later
                        coords = self.get_flow_graph().get_selected_blocks()[0].get_coordinate()
                        x,y = coords
                        x_min = x 
                        y_min = y

                        pads = [];
                        params = [];

                        # Save the state of the leaf blocks
                        for block in self.get_flow_graph().get_selected_blocks():

                            # Check for string variables within the blocks
                            for param in block.get_params():
                                for variable in self.get_flow_graph().get_variables():
                                    # If a block parameter exists that is a variable, create a parameter for it
                                    if param.get_value() == variable.get_id():
                                        params.append(param.get_value())
                                for flow_param in self.get_flow_graph().get_parameters():
                                    # If a block parameter exists that is a parameter, create a parameter for it
                                    if param.get_value() == flow_param.get_id():
                                        params.append(param.get_value())
           
                          
                            # keep track of x,y mins for pasting later 
#.........这里部分代码省略.........
开发者ID:36V3mA21Hz,项目名称:gnuradio,代码行数:103,代码来源:ActionHandler.py


注:本文中的Actions.get_all_actions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。