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


Python Timeline.delete_event方法代码示例

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


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

示例1: ExperimentSettings

# 需要导入模块: from timeline import Timeline [as 别名]
# 或者: from timeline.Timeline import delete_event [as 别名]

#.........这里部分代码省略.........
	event.Veto()
	dlg = wx.MessageDialog(None, 'Can not delete instance', 'Deleting..', wx.OK| wx.ICON_STOP)
	dlg.ShowModal()
	return    
        
    def get_timeline(self):
        return self.timeline
    
    def does_tag_exists(self, tag_prefix, instnace=None):
	for tag in self.global_settings:
	    if ((tag_prefix is None or tag.startswith(tag_prefix)) and (instnace is None or get_tag_instance(tag) == instnace)):
		return True  
	    else:
		return False	
	
	    
    def is_supp_protocol_filled(self, tag_prefix, instance=None):
	'''tag_prefix is always type|event e.g. AddProcess|Wash
	'''
	for tag in self.global_settings:
	    if ((tag_prefix is None or tag.startswith(tag_prefix)) and (instance is None or get_tag_instance(tag) == instance)):
		if (self.get_field(tag_prefix+'|ProtocolName|%s'%instance) is None) or (self.get_field(tag_prefix+'|Step1|%s'%instance) == ['', '', '']):
		    return False
		else:
		    return True
		

    def update_timeline(self, welltag):
        '''Updates the experiment metadata timeline event associated with the
        action and wells in welltag (eg: 'ExpNum|AddProcess|Spin|Wells|1|1')
        '''
        platewell_ids = self.get_field(welltag, [])
        if platewell_ids == []:
            self.timeline.delete_event(welltag)
        else:
            event = self.timeline.get_event(welltag)
            if event is not None:
                event.set_well_ids(platewell_ids)
            else:
                self.timeline.add_event(welltag, platewell_ids)

    def save_to_file(self, file):
        f = open(file, 'w')
        for field, value in sorted(self.global_settings.items()):
            f.write('%s = %s\n'%(field, repr(value)))
        f.close()
    
	
    def save_settings(self, file, protocol):
	'''
	saves settings in text file. the settings may include instrument settings, supp protocol, stock flask
	Format:    attr = value          where value may be text, int, list, etc.
	'''
	instance = get_tag_attribute(protocol)
	tag_stump = get_tag_stump(protocol, 2)
	setting_type = get_tag_event(protocol)
	f = open(file,'w')
	f.write(setting_type+'\n')
	attributes = self.get_attribute_list_by_instance(tag_stump, instance)
	for attr in attributes:
	    info = self.get_field(tag_stump+'|%s|%s' %(attr, instance))
	    print info
	    f.write('%s = %s\n'%(attr, repr(info)))
	f.close()	    	
	
    
开发者ID:LeeKamentsky,项目名称:CellProfiler-Analyst,代码行数:68,代码来源:experimentsettings.py

示例2: ExperimentSettings

# 需要导入模块: from timeline import Timeline [as 别名]
# 或者: from timeline.Timeline import delete_event [as 别名]

#.........这里部分代码省略.........
	event.Veto()
	dlg = wx.MessageDialog(None, 'Can not delete instance', 'Deleting..', wx.OK| wx.ICON_STOP)
	dlg.ShowModal()
	return    
        
    def get_timeline(self):
        return self.timeline
    
    def does_tag_exists(self, tag_prefix, instnace=None):
	for tag in self.global_settings:
	    if ((tag_prefix is None or tag.startswith(tag_prefix)) and (instnace is None or get_tag_instance(tag) == instnace)):
		return True  
	    else:
		return False	
	
	    
    def is_supp_protocol_filled(self, tag_prefix, instance=None):
	'''tag_prefix is always type|event e.g. AddProcess|Wash
	'''
	for tag in self.global_settings:
	    if ((tag_prefix is None or tag.startswith(tag_prefix)) and (instance is None or get_tag_instance(tag) == instance)):
		if (self.get_field(tag_prefix+'|ProtocolName|%s'%instance) is None) or (self.get_field(tag_prefix+'|Step1|%s'%instance) == ['', '', '']):
		    return False
		else:
		    return True
		

    def update_timeline(self, welltag):
        '''Updates the experiment metadata timeline event associated with the
        action and wells in welltag (eg: 'ExpNum|AddProcess|Spin|Wells|1|1')
        '''
        platewell_ids = self.get_field(welltag, [])
        if platewell_ids == []:
            self.timeline.delete_event(welltag)
        else:
            event = self.timeline.get_event(welltag)
            if event is not None:
                event.set_well_ids(platewell_ids)
            else:
                self.timeline.add_event(welltag, platewell_ids)
		
    def save_file_dialogue(self):
	exp_date = self.get_field('Overview|Project|ExptDate')
	exp_num = self.get_field('Overview|Project|ExptNum')
	exp_title = self.get_field('Overview|Project|Title')
	if self.save_file_path:
	    self.save_to_file()
	    #import ntpath
	    #filename = os.path.splitext(ntpath.basename(self.save_file_path))[0]
	else:
	    filename = 'new_experiment.txt'
	    if None not in [exp_date, exp_num, exp_title]:
		day, month, year = exp_date.split('/')
		filename = '%s%s%s_%s_%s.txt'%(year, month, day , exp_num, exp_title)
	    dlg = wx.FileDialog(None, message='Saving experimental protocol...', 
	                        defaultDir=os.getcwd(), defaultFile=filename, 
	                        wildcard='.txt', 
	                        style=wx.SAVE|wx.FD_OVERWRITE_PROMPT)
	    if dlg.ShowModal() == wx.ID_OK:
		self.save_file_path = dlg.GetPath()
		self.save_to_file()
	
    def save_as_file_dialogue(self):
	exp_date = self.get_field('Overview|Project|ExptDate')
	exp_num = self.get_field('Overview|Project|ExptNum')
	exp_title = self.get_field('Overview|Project|Title')
开发者ID:imtiazKHAN,项目名称:phenotype-data-model,代码行数:70,代码来源:experimentsettings.py


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