Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions components/tools/OmeroPy/src/omero/gateway/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@
logger = logging.getLogger(__name__)

try:
import Image, ImageDraw, ImageFont
from PIL import Image, ImageDraw, ImageFont # see ticket:2597
except: #pragma: nocover
try:
from PIL import Image, ImageDraw, ImageFont
import Image, ImageDraw, ImageFont # see ticket:2597
except:
logger.error('No PIL installed, line plots and split channel will fail!')
from cStringIO import StringIO
Expand Down
4 changes: 2 additions & 2 deletions components/tools/OmeroPy/src/omero/util/script_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -766,9 +766,9 @@ def split_image(client, imageId, dir, unformattedImageName = "tubulin_P037_T%05d
pixelsService = session.getPixelsService()

try:
from PIL import Image
from PIL import Image # see ticket:2597
except:
import Image
import Image # see ticket:2597

query_string = "select p from Pixels p join fetch p.image as i join fetch p.pixelsType where i.id='%s'" % imageId
pixels = queryService.findByQuery(query_string, None)
Expand Down
9 changes: 8 additions & 1 deletion components/tools/OmeroPy/test/integration/bigImages.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@
import integration.library as lib
from omero.rtypes import *

try:
from PIL import Image, ImageDraw, ImageFont # see ticket:2597
except: #pragma: nocover
try:
import Image, ImageDraw, ImageFont # see ticket:2597
except:
logger.error('No PIL installed')

try:
import hashlib
hash_sha1 = hashlib.sha1
Expand Down Expand Up @@ -77,7 +85,6 @@ def testRenderRegion(self):
planeDef.z = long(0)
planeDef.t = long(0)

from PIL import Image
import StringIO

# First, get the full rendered plane...
Expand Down

This file was deleted.

Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,14 @@ var handle_tree_selection = function(data) {
}
selected.each(function(){
var oid = $(this).attr('id');
// after copy & paste, node will have id E.g. copy_dataset-123
if (oid.substring(0,5) == "copy_") oid = oid.substring(5, oid.length);
var selected_obj = {"id":oid, "rel":$(this).attr('rel')}
selected_obj["class"] = $(this).attr('class');
if (share_id) selected_obj["share"] = share_id;
selected_objs.push(selected_obj);
if (typeof oid !== "undefined") {
// after copy & paste, node will have id E.g. copy_dataset-123
if (oid.substring(0,5) == "copy_") oid = oid.substring(5, oid.length);
var selected_obj = {"id":oid, "rel":$(this).attr('rel')}
selected_obj["class"] = $(this).attr('class');
if (share_id) selected_obj["share"] = share_id;
selected_objs.push(selected_obj);
};
});
}
$("body")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
{% for j in jobs %}
<!-- Chgrp jobs -->
{% ifequal j.job_type "chgrp" %}
<tr id="{{ j.id }}" {% if j.new %}class="new_result"{% endif %}>
<tr id="{{ j.id }}" class="{% if j.new %}new_result{% endif %}{% ifequal j.status 'in progress' %} in_progress{% endifequal %}" >
<td width="25px">
{% ifequal j.status "in progress" %}<img class="icon" src="{% static "webgateway/img/spinner.gif" %}" />
{% else %} <img class="icon" src="{% static "webgateway/img/success.png" %}" />
Expand Down Expand Up @@ -85,7 +85,7 @@

<!-- Delete jobs -->
{% ifequal j.job_type "delete" %}
<tr id="{{ j.id }}" {% if j.new %}class="new_result"{% endif %}>
<tr id="{{ j.id }}" class="{% if j.new %}new_result{% endif %}{% ifequal j.status 'in progress' %} in_progress{% endifequal %}">
<td class="activities_state">
{% ifequal j.status "in progress" %}
<img alt="Deleting" src="{% static "webgateway/img/spinner.gif" %}" />
Expand Down Expand Up @@ -138,7 +138,7 @@

<!-- Status -->
{% ifequal j.job_type "script" %}
<tr class="script{% if j.new %} new_result{% endif %}" id="{{ j.id }}">
<tr id="{{ j.id }}" class="script{% if j.new %} new_result{% endif %}{% ifequal j.status 'in progress' %} in_progress{% endifequal %}">

<!-- State -->
<td class="activities_state">
Expand Down Expand Up @@ -219,7 +219,7 @@

<!-- Download -->
<li class="btn_download">
<a href="#" onClick="window.location.href='{% url download_annotation 'download' v.id %}'" title="Download File">Download</a>
<a href="{% url download_annotation v.id %}" title="Download File">Download</a>
</li>

{% if v.fileId %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

{% if fileann.getFileName %}
<li class="file_ann_wrapper" id="file_ann-{{ fileann.id }}">
<a class='tooltip' href="#" onClick="document.location.href='{% url download_annotation "download" fileann.id %}';">
<a class='tooltip' href="{% url download_annotation fileann.id %}">
{{ fileann.getFileName|shortening:40 }}
<span>{% if fileann.getFileSize %}({{ fileann.getFileSize|default:0|filesizeformat }}){% endif %}</span>
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ <h1 class="can-collapse defclose">{% trans "Companion Files" %}</h1>
<div>
{% for fileann in manager.companion_files %}
<p>
<a href="#" onClick="document.location.href='{% url download_annotation "download" fileann.id %}';">
<a href="{% url download_annotation fileann.id %}">
{{ fileann.getFileName|shortening:40 }}
</a>
({{ fileann.getFileSize|default:0|filesizeformat }})
Expand All @@ -101,7 +101,7 @@ <h1 class="can-collapse defclose">{% trans "Companion Files" %}</h1>
<h1 class="can-collapse defclose">{% trans "Original Metadata" %}</h1>
<div>
<input type="button" value="Download" style="padding: 1px 15px; position:absolute; right:3px"
onClick="document.location.href='{% url download_annotation "download" manager.original_metadata.id %}';"/>
onClick="document.location.href='{% url download_annotation manager.original_metadata.id %}';"/>
{% if manager.global_metadata %}
<h1>Global Metadata</h1>
<div style="height:250px; overflow:auto">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@

$("#clear_activities").click(function() {
$.post("{% url activities_update action='clean' %}");
$("#activities_content").empty();
$("#jobsTable>tbody>tr").filter(":not(.in_progress)").remove();
});

// close panels on 'ESCAPE'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
var syncPanels = function(get_selected) {
$("#content_details .ui-selectee").removeClass('ui-selected'); // clear selection
get_selected.each(function(i) {
var dtype = $(this).attr("rel").replace("-locked", "");
var dtype = $(this).attr("rel");
dtype = dtype && dtype.replace("-locked", "");
if (dtype == "image") {
var imgId = $(this).attr("id").split("-")[1];
$("#image_icon-"+imgId).addClass('ui-selected');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@


<div id="login">
{% block login %}
<form class="standard_form inlined" action="{% url weblogin %}{% if url %}?{{url}}{% endif %}" method="post">


Expand Down Expand Up @@ -122,6 +123,7 @@

<input type="submit" value="Login" />
</form>
{% endblock %}
</div>

<div id="login-footer">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
var buttonsShowHide = function(selected) {
var toolbar_config = new Object();
if(selected.length > 0) {
if(selected.attr("rel").indexOf("locked")>=0) {
if((typeof selected.attr("rel") === 'undefined') ||
(selected.attr("rel").indexOf("locked")>=0)) {
toolbar_config = {"adddiscussion":false, 'removecontent':false};
} else {
if(selected.attr("id").indexOf("experimenter")>=0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,26 @@
e.preventDefault();
return false;
});

// If 'Data_Type' changes, clear 'IDs' (but note values to add back)
var $Data_Type = $("select[name=Data_Type]"),
$IDs = $("input[name=IDs]");
var noteIDs = function() {
var dt = $Data_Type.val(),
ids = $IDs.val();
$Data_Type.data(dt, ids);
};
noteIDs(); // note the initial value...
$IDs.keyup(noteIDs); // ...update any changes
$Data_Type.change(function() { // Clear IDs (or add back previous data)
var dt = $Data_Type.val(),
ids = $Data_Type.data(dt);
if (typeof ids !== "undefined") {
$IDs.val(ids);
} else {
$IDs.val("");
}
});
});
</script>
{% endblock %}
Expand Down
6 changes: 3 additions & 3 deletions components/tools/OmeroWeb/omeroweb/webclient/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,15 @@
url( r'^annotate_tags/$', views.annotate_tags, name="annotate_tags" ),
url( r'^annotate_comment/$', views.annotate_comment, name="annotate_comment" ),
url( r'^annotate_file/$', views.annotate_file, name="annotate_file" ),
url( r'^annotation/(?P<action>[a-zA-Z]+)/(?P<iid>[0-9]+)/$', views.download_annotation, name="download_annotation" ),
url( r'^annotation/(?P<annId>[0-9]+)/$', views.download_annotation, name="download_annotation" ),
url( r'^archived_files/download/(?P<iid>[0-9]+)/$', views.archived_files, name="archived_files" ),

url( r'^load_tags/(?:(?P<o_type>((?i)tag|dataset))/(?P<o_id>[0-9]+)/)?$', views.load_data_by_tag, name="load_data_by_tag" ),

# Open Astex Viewer will try to show file as volume, e.g. mrc.map file.
url( r'^open_astex_viewer/(?P<obj_type>((?i)image|image_8bit|file))/(?P<obj_id>[0-9]+)/$', views.open_astex_viewer, name='open_astex_viewer' ), # 'data_url' to load in REQUEST
url( r'^file/(?P<iid>[0-9]+)\.map$', views.download_annotation, {'action':'download'}, name='open_astex_map' ),# download file
url( r'^file/(?P<iid>[0-9]+)\.bit$', views.download_annotation, {'action':'download'}, name='open_astex_bit' ),# download file
url( r'^file/(?P<annId>[0-9]+)\.map$', views.download_annotation, name='open_astex_map' ),# download file
url( r'^file/(?P<annId>[0-9]+)\.bit$', views.download_annotation, name='open_astex_bit' ),# download file
url( r'^image_as_map/(?P<imageId>[0-9]+)\.map$', views.image_as_map, name='webclient_image_as_map' ), # convert image to map (full size)
url( r'^image_as_map/(?P<imageId>[0-9]+)/(?P<maxSize>[0-9]+)\.map$', views.image_as_map, name='webclient_image_as_map' ), # image to map of max Size (side length)
url( r'^image_as_map/8bit/(?P<imageId>[0-9]+)\.map$', views.image_as_map, {'8bit':True}, name='webclient_image_as_map_8bit' ), # convert image to map
Expand Down
6 changes: 3 additions & 3 deletions components/tools/OmeroWeb/omeroweb/webclient/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1727,11 +1727,11 @@ def archived_files(request, iid, conn=None, **kwargs):
return rsp

@login_required(doConnectionCleanup=False)
def download_annotation(request, action, iid, conn=None, **kwargs):
def download_annotation(request, annId, conn=None, **kwargs):
""" Returns the file annotation as an http response for download """
ann = conn.getObject("Annotation", iid)
ann = conn.getObject("Annotation", annId)
if ann is None:
return handlerInternalError(request, "Annotation does not exist (id:%s)." % (iid))
return handlerInternalError(request, "Annotation does not exist (id:%s)." % (annId))

rsp = ConnCleaningHttpResponse(ann.getFileInChunks())
rsp.conn = conn
Expand Down
17 changes: 11 additions & 6 deletions components/tools/OmeroWeb/omeroweb/webgateway/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@
logger = logging.getLogger(__name__)

try:
import Image
import ImageDraw
from PIL import Image
from PIL import ImageDraw
except: #pragma: nocover
try:
from PIL import Image
from PIL import ImageDraw
import Image
import ImageDraw
except:
logger.error('No PIL installed')

Expand Down Expand Up @@ -421,8 +421,8 @@ def xyListToBbox(xyList):

bBox = None # bounding box: (x, y, w, h)
shape = {}
theT = s.getTheT().getValue()
theZ = s.getTheZ().getValue()
theT = s.getTheT() is not None and s.getTheT().getValue() or 0
theZ = s.getTheZ() is not None and s.getTheZ().getValue() or 0
if type(s) == omero.model.RectI:
shape['type'] = 'Rectangle'
shape['x'] = s.getX().getValue()
Expand Down Expand Up @@ -583,12 +583,17 @@ def resizeXY(xy):
return (int((x-newX + left_xs)*factor), int((y-newY + top_xs)*factor))
resizedXY = [ resizeXY(xy) for xy in shape['xyList'] ]
#draw.polygon(resizedXY, outline=lineColour) # doesn't support 'width' of line
x2 = y2 = None
for l in range(1, len(resizedXY)):
x1, y1 = resizedXY[l-1]
x2, y2 = resizedXY[l]
draw.line((x1, y1, x2, y2), fill=lineColour, width=2)
start_x, start_y = resizedXY[0]
if shape['type'] != 'PolyLine':
if x2 is None: # Seems possible to have Polygon with only 1 point!
x2 = start_x + 1 # This will create a visible dot
if y2 is None:
y2 = start_y + 1
draw.line((x2, y2, start_x, start_y), fill=lineColour, width=2)

rv = StringIO()
Expand Down
Loading