def get_template_loader(self, sobject, context=None): from pyasm.flash import FlashLoad loader = TemplateLoaderCmd() if context == None: context = self.context loader.set_loader_context(self) flash_load = FlashLoad(sobject) template = flash_load.get_template() tmpl_fla_link, tmpl_fla = flash_load._get_file_info(template) default_template = "flash-shot_default.fla" if sobject.get_base_search_type() == 'flash/asset': "flash-asset_default.fla" if not tmpl_fla_link: tmpl_fla_link, tmpl_fla = flash_load.get_default_template(default_template) loader.file_path = tmpl_fla_link else: snapshot = Snapshot.get_latest_by_sobject(template) loader.set_snapshot(snapshot) return loader
def get_template_loader(self, sobject, context=None): from pyasm.flash import FlashLoad loader = TemplateLoaderCmd() if context == None: context = self.context loader.set_loader_context(self) flash_load = FlashLoad(sobject) template = flash_load.get_template() tmpl_fla_link, tmpl_fla = flash_load._get_file_info(template) default_template = "flash-shot_default.fla" if sobject.get_base_search_type() == 'flash/asset': "flash-asset_default.fla" if not tmpl_fla_link: tmpl_fla_link, tmpl_fla = flash_load.get_default_template( default_template) loader.file_path = tmpl_fla_link else: snapshot = Snapshot.get_latest_by_sobject(template) loader.set_snapshot(snapshot) return loader
def get_display(my): # load msg load = SpanWdg("", css='small') load.set_style("font-size: 8px") load.set_id("load_progress_%s" %my.flash_sobj.get_id()) flash_load = FlashLoad(my.flash_sobj, my.flash_snapshot) if my.load_mode: flash_load.set_load_mode(my.load_mode) flash_load.set_load_msg_id(load.get_id()) load_script = flash_load.get_script() button = IconButtonWdg("load", IconWdg.LOAD) # set up event event_name = "%s_%s" %(my.flash_sobj.get_search_key(), FlashActionWdg.LOAD_ACTION) #button.add_event_caller("onclick", event_name) #event = WebContainer.get_event_container() behavior = { 'type': 'click_up', 'cb_fire_named_event': event_name } button.add_behavior(event_name) # always replace the last callback #event.add_listener( event_name, load_script, True ) behavior = { 'type': 'listen', 'event_name': event_name, 'cbjs_action': load_script } button.add_behavior(behavior) my.main_div.add(button) my.main_div.add(load) hidden = HiddenWdg('skey_FlashLoadWdg_%s' %my.flash_sobj.get_id(),\ my.flash_sobj.get_search_key()) my.main_div.add(hidden) return my.main_div