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


Python Parameters.set方法代码示例

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


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

示例1: _change_path

# 需要导入模块: from parameters import Parameters [as 别名]
# 或者: from parameters.Parameters import set [as 别名]
	def _change_path(self, widget=None, new_tab=False):
		"""Change to selected path"""
		selection = self._history_list.get_selection()
		item_list, selected_iter = selection.get_selected()

		# if selection is valid, change to selected path
		if selected_iter is not None:
			path = item_list.get_value(selected_iter, Column.PATH)

			if not new_tab:
				# change path
				self._parent._handle_history_click(path=path)

			else:
				# create a new tab
				options = Parameters()
				options.set('path', path)

				self._application.create_tab(
								self._parent._notebook,
								self._parent.__class__,
								options
							)

			# close dialog
			self._close()
开发者ID:stefaniuk,项目名称:playground,代码行数:28,代码来源:history_list.py

示例2: __open_selected

# 需要导入模块: from parameters import Parameters [as 别名]
# 或者: from parameters.Parameters import set [as 别名]
	def __open_selected(self, widget, path):
		"""Open selected item in either active, or new tab"""
		# unquote path before giving it to handler
		if path is not None and '://' in path:
			data = path.split('://', 1)
			data[1] = urllib.unquote(data[1])
			path = '://'.join(data)

		# open selected item
		if self._open_in_new_tab:
			# create new tab
			options = Parameters()
			options.set('path', path)

			self._application.create_tab(
							self._object._notebook,
							self._object.__class__,
							options
						)

		elif hasattr(self._object, 'change_path'):
			self._object.change_path(path)

		# reset values
		self._open_in_new_tab = False

		return True
开发者ID:SmokeyCosmy,项目名称:Sunflower,代码行数:29,代码来源:bookmarks_menu.py

示例3: _create_file_list

# 需要导入模块: from parameters import Parameters [as 别名]
# 或者: from parameters.Parameters import set [as 别名]
	def _create_file_list(self, widget=None, data=None):
		"""Create file list in parent notebook"""
		self.__update_path_from_pid()
		DefaultList = self._parent.plugin_classes['file_list']
		options = Parameters()
		options.set('path', self.path)
		self._parent.create_tab(self._notebook, DefaultList, options)
		return True
开发者ID:Alwnikrotikz,项目名称:sunflower-fm,代码行数:10,代码来源:plugin.py

示例4: _close_tab

# 需要导入模块: from parameters import Parameters [as 别名]
# 或者: from parameters.Parameters import set [as 别名]
	def _close_tab(self, widget=None, data=None):
		"""Provide additional functionality"""
		if self._notebook.get_n_pages() == 1:
			DefaultList = self._parent.plugin_classes['file_list']
			options = Parameters()
			options.set('path', self.path)

			self._parent.create_tab(self._notebook, DefaultList, options)

		return Terminal._close_tab(self, widget, data)
开发者ID:stefaniuk,项目名称:playground,代码行数:12,代码来源:plugin.py

示例5: create_terminal

# 需要导入模块: from parameters import Parameters [as 别名]
# 或者: from parameters.Parameters import set [as 别名]
	def create_terminal(self, path, position=None):
		options = Parameters()
		options.set('path', path)

		if position == 'left':
			notebook = self._application.left_notebook
		elif position == 'right':
			notebook = self._application.right_notebook
		else:
			notebook = self._application.get_active_notebook()

		self._application.create_tab(notebook, self._application.plugin_classes['system_terminal'], options)
开发者ID:darkelement,项目名称:Sunflower,代码行数:14,代码来源:dbus_interface.py

示例6: edit_file

# 需要导入模块: from parameters import Parameters [as 别名]
# 或者: from parameters.Parameters import set [as 别名]
	def edit_file(self, selection):
		"""Edit selected filename"""
		section = self._application.options.section('editor')
		command = section.get('default_editor')

		exec_string = self.__format_command_string(selection, command)

		# open selected file(s)
		split_command = shlex.split(exec_string)
		test_command = split_command[0] if len(split_command) > 1 else exec_string

		if (section.get('terminal_command') and section.get('type') == 1) \
		or not is_x_app(test_command):
			active_object = self._application.get_active_object()

			options = Parameters()
			options.set('close_with_child', True)
			options.set('shell_command', split_command[0])
			options.set('arguments', split_command)
			options.set('path', os.path.dirname(selection[0]))

			self._application.create_terminal_tab(active_object._notebook, options)

		else:
			os.system('{0} &'.format(exec_string))
开发者ID:SmokeyCosmy,项目名称:Sunflower,代码行数:27,代码来源:associations.py

示例7: open_file

# 需要导入模块: from parameters import Parameters [as 别名]
# 或者: from parameters.Parameters import set [as 别名]
	def open_file(self, selection, application_info=None, exec_command=None):
		"""Open filename using config file or specified execute command"""
		if application_info is not None:
			# get command from config file
			command = application_info.command_line
			
		elif exec_command is not None:
			# use specified command
			command = exec_command
		
		else:
			# raise exception, we need at least one argument
			raise AttributeError('Error opening file. We need command or application to be specified.')
		
		exec_string = self.__format_command_string(selection, command)

		# open selected file(s)
		split_command = shlex.split(exec_string)
		test_command = split_command[0] if len(split_command) > 1 else exec_string

		if is_x_app(test_command):
			os.system('{0} &'.format(exec_string))

		else:
			active_object = self._application.get_active_object()

			options = Parameters()
			options.set('close_with_child', True)
			options.set('shell_command', split_command[0])
			options.set('arguments', split_command)
			options.set('path', os.path.dirname(selection[0]))

			self._application.create_terminal_tab(active_object._notebook, options)
开发者ID:stefaniuk,项目名称:playground,代码行数:35,代码来源:associations.py

示例8: create_tab

# 需要导入模块: from parameters import Parameters [as 别名]
# 或者: from parameters.Parameters import set [as 别名]
	def create_tab(self, path, position=None):
		"""Expose method for creating standard tab."""
		options = Parameters()
		options.set('path', path)

		if position == 'left':
			notebook = self._application.left_notebook

		elif position == 'right':
			notebook = self._application.right_notebook

		else:
			notebook = self._application.get_active_notebook()

		self._application.create_tab(notebook, self._application.plugin_classes['file_list'], options)
开发者ID:SmokeyCosmy,项目名称:Sunflower,代码行数:17,代码来源:dbus_interface.py

示例9: create_terminal

# 需要导入模块: from parameters import Parameters [as 别名]
# 或者: from parameters.Parameters import set [as 别名]
    def create_terminal(self, path, position=None):
        """Expose method for creating terminal tab."""
        options = Parameters()
        options.set("path", path)

        if position == "left":
            notebook = self._application.left_notebook

        elif position == "right":
            notebook = self._application.right_notebook

        else:
            notebook = self._application.get_active_notebook()

        self._application.create_tab(notebook, self._application.plugin_classes["system_terminal"], options)
开发者ID:Alwnikrotikz,项目名称:sunflower-fm,代码行数:17,代码来源:dbus_interface.py

示例10: _open_selected

# 需要导入模块: from parameters import Parameters [as 别名]
# 或者: from parameters.Parameters import set [as 别名]
	def _open_selected(self, widget, in_new_tab=False):
		"""Open selected mount"""
		selection = self._list.get_selection()
		item_list, selected_iter = selection.get_selected()

		if selected_iter is not None:
			uri = item_list.get_value(selected_iter, MountsColumn.URI)
			active_object = self._application.get_active_object()
			
			if not in_new_tab and hasattr(active_object, 'change_path'):
				active_object.change_path(uri)

			else:
				# create new tab
				options = Parameters()
				options.set('path', uri)

				self._application.create_tab(
								active_object._notebook,
								active_object.__class__,
								options
							)
		return True
开发者ID:stefaniuk,项目名称:playground,代码行数:25,代码来源:mounts_manager_window.py

示例11: execute_file

# 需要导入模块: from parameters import Parameters [as 别名]
# 或者: from parameters.Parameters import set [as 别名]
	def execute_file(self, path, provider=None):
		"""Execute specified item properly."""
		mime_type = self.get_mime_type(path)
		terminal_type = self._application.options.section('terminal').get('type')
		should_execute = False

		if provider is not None and provider.is_local:
			# only allow local files which have execute
			# bit set to be executed locally
			should_execute = os.access(path, os.X_OK)

			# if we still don't know content type, try to guess
			if self.is_mime_type_unknown(mime_type):
				data = self.get_sample_data(path, provider)
				mime_type = self.get_mime_type(data=data)

		if gio.content_type_can_be_executable(mime_type) and should_execute:
			# file type is executable
			if is_x_app(path):
				subprocess.Popen(
							(path, '&'),
							cwd=os.path.dirname(path)
						)

			else:
				# command is console based, create terminal tab and fork it
				if terminal_type != TerminalType.EXTERNAL:
					active_object = self._application.get_active_object()

					options = Parameters()
					options.set('close_with_child', False)
					options.set('shell_command', path)
					options.set('path', os.path.dirname(path))

					tab = self._application.create_terminal_tab(active_object._notebook, options)

		else:
			# file type is not executable, try to open with default associated application
			default_application = self.get_default_application_for_type(mime_type)

			if default_application is not None:
				self.open_file((path,), default_application)

			else:
				# no default application selected, show application selection dialog
				dialog = ApplicationSelectDialog(self._application, path)
				result = dialog.get_response()

				if result[0] == gtk.RESPONSE_OK:
					self.open_file(selection=(path,), exec_command=result[2])
开发者ID:stefaniuk,项目名称:playground,代码行数:52,代码来源:associations.py

示例12: open_file

# 需要导入模块: from parameters import Parameters [as 别名]
# 或者: from parameters.Parameters import set [as 别名]
	def open_file(self, selection, application_info=None, exec_command=None):
		"""Open filename using config file or specified execute command"""
		if application_info is not None:
			# launch application using GIO API
			application = self.get_gio_application_by_id(application_info.id)

			if application is not None:
				if application.supports_uris():
					application.launch_uris(selection)
				else:
					application.launch([gio.File(path=path) for path in selection])
			
		elif exec_command is not None:
			# use specified command
			command = exec_command
		
			selection = map(lambda item: item.replace('"', '\\"'), selection)
			exec_string = self.__format_command_string(selection, command)

			# open selected file(s)
			split_command = shlex.split(exec_string, posix=False)
			test_command = split_command[0] if len(split_command) > 1 else exec_string

			if is_x_app(test_command):
				os.system('{0} &'.format(exec_string))

			else:
				active_object = self._application.get_active_object()

				options = Parameters()
				options.set('close_with_child', True)
				options.set('shell_command', split_command[0])
				options.set('arguments', split_command)
				options.set('path', os.path.dirname(selection[0]))

				self._application.create_terminal_tab(active_object._notebook, options)
开发者ID:SmokeyCosmy,项目名称:Sunflower,代码行数:38,代码来源:associations.py


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