Skip to content

Commit

Permalink
Merge pull request #1 from will-moore/repr_html
Browse files Browse the repository at this point in the history
Show Image, Dataset and Project in a table
  • Loading branch information
jo-mueller authored Feb 1, 2024
2 parents 1e40b2a + 48d4de4 commit b945fdb
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/omero/gateway/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10451,18 +10451,21 @@ def _repr_html_(self):
</head>
"""

def obj_html(obj, otype):
return f"""<tr>
<td><b>{otype}</b></td>
<td class=text-right>{obj.id if obj else ""}</td>
<td class=text-right>{obj.name if obj else ""}</td>
</tr>
"""

# create a sub-table for image information
table_imageinfo = f"""
<table>\n
<tr>\n
<td><b>Image name: </b></td> <td class=text-right>{self.getName()}</td>\n
</tr>\n
<tr>\n
<td><b>Image ID: </b></td> <td class=text-right>{self.getId()}</td>\n
</tr>\n
<tr>\n
<td><b>Project ID: </b></td> <td class=text-right>{self.getProject().getId()}</td>\n
</tr>\n
<table>
<tr><th></th><th>ID</th><th>Name</th></tr>
{obj_html(self, 'Image')}
{obj_html(self.getParent(), 'Dataset')}
{obj_html(self.getProject(), 'Project')}
</table>
"""

Expand Down

0 comments on commit b945fdb

Please sign in to comment.