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


Python Task.name方法代码示例

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


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

示例1: retrieve_data

# 需要导入模块: from task import Task [as 别名]
# 或者: from task.Task import name [as 别名]
def retrieve_data(uuid_value=None, attr=None, size=0):
	if uuid_value != None:
		reg = store.get(uuid_value);
		if reg == None:
			return None
		task = Task()
		task.unique_id = uuid_value
		task.name = reg["name"]
		task.date = reg["date"]
		task.value = reg["value"]
		task.attributes = reg["attributes"]
		return task
	else:
		registros = []
		counter = 0
		for key in store:
			reg = store.get(key)
			if attr != None and reg["attributes"] != attr:
				continue
			task = Task()
			task.unique_id = key
			task.name = reg["name"]
			task.date = reg["date"]
			task.value = reg["value"]
			task.attributes = reg["attributes"]
			registros.append(task)
			if size != 0 and counter >= 5:
				break;
			counter+=1

		registros.reverse()
		return registros
开发者ID:lifedotark,项目名称:TaskApp,代码行数:34,代码来源:data.py

示例2: onApply

# 需要导入模块: from task import Task [as 别名]
# 或者: from task.Task import name [as 别名]
    def onApply(self, data):
        """Reads the information from the dialog and saves the task."""
        # Get the information from the dialog and save it to the database
        t = Task()

        # Make sure that there was text in the text box
        if len(self.widgets.get_widget('TaskEntry').get_text()) > 1:
            # Set the task name to the value of the text box
            t.name = self.widgets.get_widget('TaskEntry').get_text()

            # Set the priority to the value of the combo box
            t.priority = self.widgets.get_widget('PriorityEntry').get_active()

            # Set the status to not completed
            t.status = self.widgets.get_widget('StatusEntry').get_active()

            # Set the id of the task
            t.id = self.taskid

            # Set the due date of the task
            t.duedate = self.widgets.get_widget('DateEntry').get_date()

            # Save the task in the database
            self.db.saveTask(t)

        # Close the dialog
        self.dialog.destroy()
开发者ID:Alwnikrotikz,项目名称:tuxedo,代码行数:29,代码来源:editdialog.py

示例3: start_shakecast

# 需要导入模块: from task import Task [as 别名]
# 或者: from task.Task import name [as 别名]
 def start_shakecast(self):
     try:
         status = ''
         message = ''
         task_names = [task.name for task in self.queue]
         if 'geo_json' not in task_names:
             task = Task()
             task.id = int(time.time() * 1000000)
             task.func = geo_json
             task.loop = True
             task.interval = 60
             task.db_use = True
             task.name = 'geo_json'
         
             self.queue += [task]
             message += 'Started monitoring earthquake feed \n'
         else:
             pass
         
         if 'check_new' not in task_names:
             task = Task()
             task.id = int(time.time() * 1000000)
             task.func = check_new
             task.loop = True
             task.interval = 3
             task.db_use = True
             task.name = 'check_new'
             
             self.queue += [task]
             message += "Waiting for new events"
         else:
             pass
         status = 'finished'
     except:
         status = 'failed'
     
     
     return {'status': status,
             'message': message}
开发者ID:LTurner-CT,项目名称:shakecast,代码行数:41,代码来源:server.py

示例4: start_shakecast

# 需要导入模块: from task import Task [as 别名]
# 或者: from task.Task import name [as 别名]
    def start_shakecast(self):
        logging.info('Starting ShakeCast Server... ')
        try:
            status = ''
            message = ''
            task_names = [task.name for task in self.queue]

            if 'fast_geo_json' not in task_names:
                task = Task()
                task.id = int(time.time() * 1000000)
                task.func = f.geo_json
                task.loop = True
                task.interval = 60
                task.db_use = True
                task.name = 'fast_geo_json'
                task.args_in = {'query_period': 'hour'}
            
                self.queue += [task]
                message += 'Started monitoring earthquake feed \n'
            
            if 'check_new' not in task_names:
                task = Task()
                task.id = int(time.time() * 1000000)
                task.func = f.check_new
                task.loop = True
                task.interval = 3
                task.db_use = True
                task.name = 'check_new'
                
                self.queue += [task]
                message += "Waiting for new events"

            if 'check_for_updates' not in task_names:
                task = Task()
                task.id = int(time.time() * 1000000)
                task.func = f.check_for_updates
                task.loop = True
                task.interval = 60
                task.name = 'check_for_updates'
                
                self.queue += [task]
                message += "Looking for updates"

            if 'record_messages' not in task_names:
                task = Task()
                task.id = int(time.time() * 1000000)
                task.func = self.record_messages
                task.loop = True
                task.interval = 5
                task.name = 'record_messages'

                self.queue += [task]
                message += "Recording messages"

            status = 'finished'
        except:
            status = 'failed'
        
        
        return {'status': status,
                'message': message}
开发者ID:dslosky-usgs,项目名称:shakecast,代码行数:63,代码来源:server.py

示例5: Task

# 需要导入模块: from task import Task [as 别名]
# 或者: from task.Task import name [as 别名]
            cursor.execute('SELECT * FROM tasks WHERE id=?;', data)

        # If there was an error, display an error dialog 
        except sqlite.Error, message:
            errordialog = gtk.MessageDialog(None, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, 'Error in reading a task from database:\n\n' + message.message)
            errordialog.run()
            errordialog.destroy()

        # Fetch one result and store it
        result = cursor.fetchone()

        # Create a Task object to store the information in
        t = Task()

        # Set the values from the database results
        t.name = result[0]
        t.priority = result[1]
        t.status = result[2]
        t.id = result[3]
        t.duedate = (result[4], result[5], result[6])

        # Return the task object
        return t

    def readTasks(self):
        """Reads all of the tasks from the database and returns them in a list"""
        # Create a cursor for the database
        cursor = sqlite.connect(DBPATH).cursor()

        # Create a tuple with the constant for completed tasks for the query
        data = task.TASK_COMPLETED,
开发者ID:Alwnikrotikz,项目名称:tuxedo,代码行数:33,代码来源:database.py


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