|
# -*- coding: utf-8 -*- |
|
""" |
|
----------------------------------------------------------------------------- |
|
Copyright (C) 2020 Glencoe Software, Inc. All rights reserved. |
|
This program is free software; you can redistribute it and/or modify |
|
it under the terms of the GNU General Public License as published by |
|
the Free Software Foundation; either version 2 of the License, or |
|
(at your option) any later version. |
|
This program is distributed in the hope that it will be useful, |
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
GNU General Public License for more details. |
|
You should have received a copy of the GNU General Public License along |
|
with this program; if not, write to the Free Software Foundation, Inc., |
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
|
------------------------------------------------------------------------------ |
|
""" |
|
|
|
import omero |
|
import omero.clients |
|
from omero.rtypes import rstring, rlong |
|
import omero.scripts as scripts |
|
from omero.util.temp_files import manager |
|
|
|
|
|
def run_as_omero_script(): |
|
client = scripts.client( |
|
'Create_URL_Link_Button.py', |
|
""" |
|
This creates button with URL link |
|
""", |
|
scripts.String( |
|
"URL_Link", optional=False, grouping="1", |
|
description="Choose URL Link", |
|
default="https://www.openmicroscopy.org/"), |
|
version="0.1", |
|
authors=["Emil Rozbicki"], |
|
institutions=["Glencoe Software Inc."], |
|
contact="[email protected]", |
|
) |
|
|
|
try: |
|
http_link = client.getInput("URL_Link", unwrap=True) |
|
client.setOutput( |
|
"Message", |
|
rstring("Created button with link to: {}".format(http_link))) |
|
url = omero.rtypes.wrap({ |
|
"type": "URL", |
|
"href": "https://www.openmicroscopy.org", |
|
"title": "Open URL link to OME's website.", |
|
}) |
|
client.setOutput("URL", url) |
|
finally: |
|
client.closeSession() |
|
|
|
|
|
def main(): |
|
''' |
|
|
|
OMERO.scripts are executed as ./script so will take advatage of that to |
|
make the code usable as OMERO.script and standalone. |
|
|
|
''' |
|
run_as_omero_script() |
|
|
|
|
|
if __name__ == "__main__": |
|
main() |