示例#1
0
文件: data.py 项目: engla/dragbox
    def _handle_new_item(self, data, type):
        """
		Add a new item to the store

		Print it to stdout if needed
		"""
        item = make_item(data, type)
        self.store.append(item)
        self.emit("item-added", item)
示例#2
0
文件: main.py 项目: engla/dragbox
	def try_get_data(self):
		"""
		Send get_data method to another instance and try to get its data
		"""
		from shelfitem import make_item
		if not self.dbus_connection:
			# dbus is not available or the requested name
			# is simply not there
			name = self.identifier and self.identifier or "Default"
			print_error("Shelf %s not found" % name)
			self.get_dbus_names()
			return False
		datas, types = self.dbus_connection.get_interface().get_data()
		writer = self.make_writer()
		for data, type in zip(datas, types):
			writer.print_item(None, make_item(data, type))
		return True