def _getHTMLTemplatePath(self): """ Returns the path of the customized template at config/execution.summary.html or the standard scipion HTML template""" # Try if there is a customized template template = getConfigPath('execution.summary.html') if not os.path.exists(template): template = getTemplatePath('execution.summary.template.html') else: print("Customized HTML template found at %s." % template) return template
def __init__(self, protocol, ctfMonitor, sysMonitor, publishCmd=None, **kwargs): # The CTF protocol to monitor self.protocol = protocol self.provider = SummaryProvider(protocol) self.ctfMonitor = ctfMonitor self.sysMonitor = sysMonitor # Get the html template to be used, by default use the one # in scipion/config/templates defaultTemplate = getTemplatePath('execution.summary.template.html') self.template = kwargs.get('template', defaultTemplate) self.publishCmd = publishCmd self.refreshSecs = kwargs.get('refreshSecs', 60)
def __init__(self, protocol, ctfMonitor, sysMonitor, movieGainMonitor, publishCmd=None, **kwargs): # The CTF protocol to monitor self.protocol = protocol self.ctfProtocol = protocol._getCtfProtocol() self.alignProtocol = protocol._getAlignProtocol() self.micThumbSymlinks = False self.reportPath = protocol.reportPath self.reportDir = protocol.reportDir self.provider = SummaryProvider(protocol) self.ctfMonitor = ctfMonitor self.sysMonitor = sysMonitor self.movieGainMonitor = movieGainMonitor self.lastThumbIndex = 0 self.thumbsReady = 0 self.thumbPaths = { MIC_THUMBS: [], PSD_THUMBS: [], SHIFT_THUMBS: [], MIC_PATH: [], SHIFT_PATH: [], PSD_PATH: [], MIC_ID: [] } # Get the html template to be used, by default use the one # in scipion/config/templates defaultTemplate = getTemplatePath('execution.summary.template.html') self.template = kwargs.get('template', defaultTemplate) self.publishCmd = publishCmd self.refreshSecs = kwargs.get('refreshSecs', 60)
def getTemplate(root): # Check if there is any .json.template in the template folder # get the template folder templateFolder = pw.getTemplatePath() # Get all ".json.template" there templates = [] for file in glob.glob1(templateFolder, "*.json.template"): templates.append(String(file)) if len(templates): if len(templates) == 1: chosen = templates[0].get() else: provider = ListTreeProviderString(templates) dlg = dialog.ListDialog(root, "Workflow templates", provider, "Select one of the templates.") chosen = dlg.values[0].get() chosen = os.path.join(templateFolder, chosen) print("Template to use: %s" % chosen) with open(chosen, 'r') as myfile: template = myfile.read() # Replace environment variables template = template % os.environ return template else: raise Exception("There isn't any *.json.template at %s" % templates)