Ticket #5712: trac_5712-interrupt-notification.2.patch

File trac_5712-interrupt-notification.2.patch, 35.9 KB (added by timdumol, 9 years ago)

Fixes #7702 and a typo in notebook_lib.js from the previous patch. Apply this patch alone.

  • new file sagenb/data/jquery/plugins/ui.achtung-min.js

    #5712 Get rid of the stupid "unable to immediately interrupt computation" alert that drives me nuts
    
    diff -r 696fb9bf24a7 sagenb/data/jquery/plugins/ui.achtung-min.js
    - +  
     1(function(a){a.fn.achtung=function(e){var b=(typeof e==="string"),d=Array.prototype.slice.call(arguments,0),c="achtung";return this.each(function(){var f=a.data(this,c);if(b&&e.substring(0,1)==="_"){return this}(!f&&!b&&a.data(this,c,new a.achtung(this))._init(d));(f&&b&&a.isFunction(f[e])&&f[e].apply(f,d.slice(1)))})};a.achtung=function(d){var b=Array.prototype.slice.call(arguments,0),c;if(!d||!d.nodeType){c=a("<div />");return c.achtung.apply(c,b)}this.$container=a(d)};a.extend(a.achtung,{version:"0.3.0",$overlay:false,defaults:{timeout:10,disableClose:false,icon:false,className:"",animateClassSwitch:false,showEffects:{opacity:"toggle",height:"toggle"},hideEffects:{opacity:"toggle",height:"toggle"},showEffectDuration:500,hideEffectDuration:700}});a.extend(a.achtung.prototype,{$container:false,closeTimer:false,options:{},_init:function(c){var d,b=this;c=a.isArray(c)?c:[];c.unshift(a.achtung.defaults);c.unshift({});d=this.options=a.extend.apply(a,c);if(!a.achtung.$overlay){a.achtung.$overlay=a('<div id="achtung-overlay"></div>').appendTo(document.body)}if(!d.disableClose){a('<span class="achtung-close-button ui-icon ui-icon-close" />').click(function(){b.close()}).hover(function(){a(this).addClass("achtung-close-button-hover")},function(){a(this).removeClass("achtung-close-button-hover")}).prependTo(this.$container)}this.changeIcon(d.icon,true);if(d.message){this.$container.append(a('<span class="achtung-message">'+d.message+"</span>"))}(d.className&&this.$container.addClass(d.className));(d.css&&this.$container.css(d.css));this.$container.addClass("achtung").appendTo(a.achtung.$overlay);if(d.showEffects){this.$container.animate(d.showEffects,d.showEffectDuration)}else{this.$container.show()}if(d.timeout>0){this.timeout(d.timeout)}},timeout:function(c){var b=this;if(this.closeTimer){clearTimeout(this.closeTimer)}this.closeTimer=setTimeout(function(){b.close()},c*1000);this.options.timeout=c},changeClass:function(c){var b=this;if(this.options.className===c){return}this.$container.queue(function(){if(!b.options.animateClassSwitch||/webkit/.test(navigator.userAgent.toLowerCase())||!a.isFunction(a.fn.switchClass)){b.$container.removeClass(b.options.className);b.$container.addClass(c)}else{b.$container.switchClass(b.options.className,c,500)}b.options.className=c;b.$container.dequeue()})},changeIcon:function(c,d){var b=this;if((d!==true||c===false)&&this.options.icon===c){return}if(d||this.options.icon===false){this.$container.prepend(a('<span class="achtung-message-icon ui-icon '+c+'" />'));this.options.icon=c;return}else{if(c===false){this.$container.find(".achtung-message-icon").remove();this.options.icon=false;return}}this.$container.queue(function(){var e=a(".achtung-message-icon",b.$container);if(!b.options.animateClassSwitch||/webkit/.test(navigator.userAgent.toLowerCase())||!a.isFunction(a.fn.switchClass)){e.removeClass(b.options.icon);e.addClass(c)}else{e.switchClass(b.options.icon,c,500)}b.options.icon=c;b.$container.dequeue()})},changeMessage:function(b){this.$container.queue(function(){a(".achtung-message",a(this)).html(b);a(this).dequeue()})},update:function(b){(b.className&&this.changeClass(b.className));(b.css&&this.$container.css(b.css));(typeof(b.icon)!=="undefined"&&this.changeIcon(b.icon));(b.message&&this.changeMessage(b.message));(b.timeout&&this.timeout(b.timeout))},close:function(){var c=this.options,b=this.$container;if(c.hideEffects){this.$container.animate(c.hideEffects,c.hideEffectDuration)}else{this.$container.hide()}b.queue(function(){b.removeData("achtung");b.remove();if(a.achtung.$overlay&&a.achtung.$overlay.is(":empty")){a.achtung.$overlay.remove();a.achtung.$overlay=false}b.dequeue()})}})})(jQuery);
     2 No newline at end of file
  • sagenb/data/sage/css/main.css

    diff -r 696fb9bf24a7 sagenb/data/sage/css/main.css
    a b  
    142142.docstring .click-message { font-size: 0.75em; float: right; clear: both; }
    143143.docstring .unprinted-note { float: right; clear: both; font-size: 0.6em; }
    144144
     145.worksheet-online .interrupt-fail-notification { background-color: #B22222; }
     146
    145147span.pane div.worksheets_topbar { color: black; height: 3ex; top: 0ex; background: url('/images/corner.png') no-repeat top left; background-color: #ccc; text-decoration: none; font-size: 15px; padding-left: 10px; padding-top: 10px; width: 174px; }
    146148
    147149a.left_panel_hide { position: relative; top: 0px; right: -1px; text-align: right; color: blue; font-weight: normal; font-size: 12px; }
     
    574576.vc, .vg, .vi { color: #bb60d5; }
    575577
    576578.il { color: #208050; }
     579
     580* html #achtung-overlay { position: absolute; }
     581* html .achtung { width: 280px; }
     582
     583#achtung-overlay { overflow: hidden; position: fixed; top: 15px; right: 15px; width: 280px; z-index: 50; }
     584
     585.achtung { display: none; margin-bottom: 8px; padding: 15px 15px; background-color: #000; color: white; width: 250px; font-weight: bold; position: relative; overflow: hidden; -moz-box-shadow: #aaa 1px 1px 2px; -webkit-box-shadow: #aaa 1px 1px 2px; box-shadow: #aaa 1px 1px 2px; -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; opacity: .85; filter: Alpha(Opacity=85); }
     586
     587.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; width: 16px; height: 16px; background-image: url(/javascript/jqueryui/css/sage/images/ui-icons_222222_256x240.png); }
     588
     589.ui-icon-carat-1-n { background-position: 0 0; }
     590
     591.ui-icon-carat-1-ne { background-position: -16px 0; }
     592
     593.ui-icon-carat-1-e { background-position: -32px 0; }
     594
     595.ui-icon-carat-1-se { background-position: -48px 0; }
     596
     597.ui-icon-carat-1-s { background-position: -64px 0; }
     598
     599.ui-icon-carat-1-sw { background-position: -80px 0; }
     600
     601.ui-icon-carat-1-w { background-position: -96px 0; }
     602
     603.ui-icon-carat-1-nw { background-position: -112px 0; }
     604
     605.ui-icon-carat-2-n-s { background-position: -128px 0; }
     606
     607.ui-icon-carat-2-e-w { background-position: -144px 0; }
     608
     609.ui-icon-triangle-1-n { background-position: 0 -16px; }
     610
     611.ui-icon-triangle-1-ne { background-position: -16px -16px; }
     612
     613.ui-icon-triangle-1-e { background-position: -32px -16px; }
     614
     615.ui-icon-triangle-1-se { background-position: -48px -16px; }
     616
     617.ui-icon-triangle-1-s { background-position: -64px -16px; }
     618
     619.ui-icon-triangle-1-sw { background-position: -80px -16px; }
     620
     621.ui-icon-triangle-1-w { background-position: -96px -16px; }
     622
     623.ui-icon-triangle-1-nw { background-position: -112px -16px; }
     624
     625.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
     626
     627.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
     628
     629.ui-icon-arrow-1-n { background-position: 0 -32px; }
     630
     631.ui-icon-arrow-1-ne { background-position: -16px -32px; }
     632
     633.ui-icon-arrow-1-e { background-position: -32px -32px; }
     634
     635.ui-icon-arrow-1-se { background-position: -48px -32px; }
     636
     637.ui-icon-arrow-1-s { background-position: -64px -32px; }
     638
     639.ui-icon-arrow-1-sw { background-position: -80px -32px; }
     640
     641.ui-icon-arrow-1-w { background-position: -96px -32px; }
     642
     643.ui-icon-arrow-1-nw { background-position: -112px -32px; }
     644
     645.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
     646
     647.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
     648
     649.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
     650
     651.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
     652
     653.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
     654
     655.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
     656
     657.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
     658
     659.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
     660
     661.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
     662
     663.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
     664
     665.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
     666
     667.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
     668
     669.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
     670
     671.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
     672
     673.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
     674
     675.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
     676
     677.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
     678
     679.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
     680
     681.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
     682
     683.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
     684
     685.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
     686
     687.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
     688
     689.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
     690
     691.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
     692
     693.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
     694
     695.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
     696
     697.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
     698
     699.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
     700
     701.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
     702
     703.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
     704
     705.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
     706
     707.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
     708
     709.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
     710
     711.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
     712
     713.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
     714
     715.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
     716
     717.ui-icon-arrow-4 { background-position: 0 -80px; }
     718
     719.ui-icon-arrow-4-diag { background-position: -16px -80px; }
     720
     721.ui-icon-extlink { background-position: -32px -80px; }
     722
     723.ui-icon-newwin { background-position: -48px -80px; }
     724
     725.ui-icon-refresh { background-position: -64px -80px; }
     726
     727.ui-icon-shuffle { background-position: -80px -80px; }
     728
     729.ui-icon-transfer-e-w { background-position: -96px -80px; }
     730
     731.ui-icon-transferthick-e-w { background-position: -112px -80px; }
     732
     733.ui-icon-folder-collapsed { background-position: 0 -96px; }
     734
     735.ui-icon-folder-open { background-position: -16px -96px; }
     736
     737.ui-icon-document { background-position: -32px -96px; }
     738
     739.ui-icon-document-b { background-position: -48px -96px; }
     740
     741.ui-icon-note { background-position: -64px -96px; }
     742
     743.ui-icon-mail-closed { background-position: -80px -96px; }
     744
     745.ui-icon-mail-open { background-position: -96px -96px; }
     746
     747.ui-icon-suitcase { background-position: -112px -96px; }
     748
     749.ui-icon-comment { background-position: -128px -96px; }
     750
     751.ui-icon-person { background-position: -144px -96px; }
     752
     753.ui-icon-print { background-position: -160px -96px; }
     754
     755.ui-icon-trash { background-position: -176px -96px; }
     756
     757.ui-icon-locked { background-position: -192px -96px; }
     758
     759.ui-icon-unlocked { background-position: -208px -96px; }
     760
     761.ui-icon-bookmark { background-position: -224px -96px; }
     762
     763.ui-icon-tag { background-position: -240px -96px; }
     764
     765.ui-icon-home { background-position: 0 -112px; }
     766
     767.ui-icon-flag { background-position: -16px -112px; }
     768
     769.ui-icon-calendar { background-position: -32px -112px; }
     770
     771.ui-icon-cart { background-position: -48px -112px; }
     772
     773.ui-icon-pencil { background-position: -64px -112px; }
     774
     775.ui-icon-clock { background-position: -80px -112px; }
     776
     777.ui-icon-disk { background-position: -96px -112px; }
     778
     779.ui-icon-calculator { background-position: -112px -112px; }
     780
     781.ui-icon-zoomin { background-position: -128px -112px; }
     782
     783.ui-icon-zoomout { background-position: -144px -112px; }
     784
     785.ui-icon-search { background-position: -160px -112px; }
     786
     787.ui-icon-wrench { background-position: -176px -112px; }
     788
     789.ui-icon-gear { background-position: -192px -112px; }
     790
     791.ui-icon-heart { background-position: -208px -112px; }
     792
     793.ui-icon-star { background-position: -224px -112px; }
     794
     795.ui-icon-link { background-position: -240px -112px; }
     796
     797.ui-icon-cancel { background-position: 0 -128px; }
     798
     799.ui-icon-plus { background-position: -16px -128px; }
     800
     801.ui-icon-plusthick { background-position: -32px -128px; }
     802
     803.ui-icon-minus { background-position: -48px -128px; }
     804
     805.ui-icon-minusthick { background-position: -64px -128px; }
     806
     807.ui-icon-close { background-position: -80px -128px; }
     808
     809.ui-icon-closethick { background-position: -96px -128px; }
     810
     811.ui-icon-key { background-position: -112px -128px; }
     812
     813.ui-icon-lightbulb { background-position: -128px -128px; }
     814
     815.ui-icon-scissors { background-position: -144px -128px; }
     816
     817.ui-icon-clipboard { background-position: -160px -128px; }
     818
     819.ui-icon-copy { background-position: -176px -128px; }
     820
     821.ui-icon-contact { background-position: -192px -128px; }
     822
     823.ui-icon-image { background-position: -208px -128px; }
     824
     825.ui-icon-video { background-position: -224px -128px; }
     826
     827.ui-icon-script { background-position: -240px -128px; }
     828
     829.ui-icon-alert { background-position: 0 -144px; }
     830
     831.ui-icon-info { background-position: -16px -144px; }
     832
     833.ui-icon-notice { background-position: -32px -144px; }
     834
     835.ui-icon-help { background-position: -48px -144px; }
     836
     837.ui-icon-check { background-position: -64px -144px; }
     838
     839.ui-icon-bullet { background-position: -80px -144px; }
     840
     841.ui-icon-radio-off { background-position: -96px -144px; }
     842
     843.ui-icon-radio-on { background-position: -112px -144px; }
     844
     845.ui-icon-pin-w { background-position: -128px -144px; }
     846
     847.ui-icon-pin-s { background-position: -144px -144px; }
     848
     849.ui-icon-play { background-position: 0 -160px; }
     850
     851.ui-icon-pause { background-position: -16px -160px; }
     852
     853.ui-icon-seek-next { background-position: -32px -160px; }
     854
     855.ui-icon-seek-prev { background-position: -48px -160px; }
     856
     857.ui-icon-seek-end { background-position: -64px -160px; }
     858
     859.ui-icon-seek-first { background-position: -80px -160px; }
     860
     861.ui-icon-stop { background-position: -96px -160px; }
     862
     863.ui-icon-eject { background-position: -112px -160px; }
     864
     865.ui-icon-volume-off { background-position: -128px -160px; }
     866
     867.ui-icon-volume-on { background-position: -144px -160px; }
     868
     869.ui-icon-power { background-position: 0 -176px; }
     870
     871.ui-icon-signal-diag { background-position: -16px -176px; }
     872
     873.ui-icon-signal { background-position: -32px -176px; }
     874
     875.ui-icon-battery-0 { background-position: -48px -176px; }
     876
     877.ui-icon-battery-1 { background-position: -64px -176px; }
     878
     879.ui-icon-battery-2 { background-position: -80px -176px; }
     880
     881.ui-icon-battery-3 { background-position: -96px -176px; }
     882
     883.ui-icon-circle-plus { background-position: 0 -192px; }
     884
     885.ui-icon-circle-minus { background-position: -16px -192px; }
     886
     887.ui-icon-circle-close { background-position: -32px -192px; }
     888
     889.ui-icon-circle-triangle-e { background-position: -48px -192px; }
     890
     891.ui-icon-circle-triangle-s { background-position: -64px -192px; }
     892
     893.ui-icon-circle-triangle-w { background-position: -80px -192px; }
     894
     895.ui-icon-circle-triangle-n { background-position: -96px -192px; }
     896
     897.ui-icon-circle-arrow-e { background-position: -112px -192px; }
     898
     899.ui-icon-circle-arrow-s { background-position: -128px -192px; }
     900
     901.ui-icon-circle-arrow-w { background-position: -144px -192px; }
     902
     903.ui-icon-circle-arrow-n { background-position: -160px -192px; }
     904
     905.ui-icon-circle-zoomin { background-position: -176px -192px; }
     906
     907.ui-icon-circle-zoomout { background-position: -192px -192px; }
     908
     909.ui-icon-circle-check { background-position: -208px -192px; }
     910
     911.ui-icon-circlesmall-plus { background-position: 0 -208px; }
     912
     913.ui-icon-circlesmall-minus { background-position: -16px -208px; }
     914
     915.ui-icon-circlesmall-close { background-position: -32px -208px; }
     916
     917.ui-icon-squaresmall-plus { background-position: -48px -208px; }
     918
     919.ui-icon-squaresmall-minus { background-position: -64px -208px; }
     920
     921.ui-icon-squaresmall-close { background-position: -80px -208px; }
     922
     923.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
     924
     925.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
     926
     927.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
     928
     929.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
     930
     931.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
     932
     933.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
     934
     935.achtung .achtung-message-icon { margin-top: 0; margin-left: -.5em; margin-right: .5em; float: left; zoom: 1; }
     936.achtung .ui-icon.achtung-close-button { overflow: hidden; float: right; position: relative; top: -8px; right: -8px; cursor: pointer; background-image: url(/javascript/jqueryui/css/sage/images/ui-icons_888888_256x240.png); }
     937.achtung .ui-icon.achtung-close-button-hover { background-image: url(/javascript/jqueryui/css/sage/images/ui-icons_ffffff_256x240.png); }
     938
     939.achtungSuccess, .achtungFail, .achtungWait { opacity: .93; filter: Alpha(Opacity=93); }
     940
     941.achtungSuccess { background-color: #4DB559; }
     942
     943.achtungFail { background-color: #D64450; }
     944
     945.achtungWait { background-color: #658093; }
     946
     947.achtungSuccess .ui-icon.achtung-close-button, .achtungFail .ui-icon.achtung-close-button { background-image: url(/javascript/jqueryui/css/sage/images/ui-icons_2e83ff_256x240.png); }
     948
     949.achtungSuccess .ui-icon.achtung-close-button-hover, .achtungFail .ui-icon.achtung-close-button-hover { background-image: url(/javascript/jqueryui/css/sage/images/ui-icons_222222_256x240.png); }
     950
     951.achtung .wait-icon { background-image: url(/javascript/jqueryui/css/sage/images/wait.gif); }
     952.achtung .achtung-message { display: inline; }
  • sagenb/data/sage/html/notebook/base.html

    diff -r 696fb9bf24a7 sagenb/data/sage/html/notebook/base.html
    a b  
    1818<link rel="stylesheet" href="/javascript/jqueryui/css/sage/jquery-ui-1.7.2.custom.css" />
    1919<script type="text/javascript" src="/javascript/jqueryui/js/jquery-ui-1.7.2.custom.min.js"></script>
    2020
    21 <!-- jQuery plugins - color pickers, shift-click, AJAX forms, IE fixes -->
     21<!-- jQuery plugins - color pickers, shift-click, AJAX forms, IE fixes, notifications -->
    2222<link rel="stylesheet" href="/javascript/jquery/plugins/farbtastic/farbtastic.css" type="text/css" />
    2323<script type="text/javascript" src="/javascript/jquery/plugins/farbtastic/farbtastic.min.js"></script>
    2424<script type="text/javascript" src="/javascript/jquery/plugins/extendedclick/jquery.event.extendedclick.min.js"></script>
     
    2828<script type="text/javascript" src="/javascript/jquery/plugins/jpicker/jpicker-1.0.11.min.js"></script>
    2929<link rel="stylesheet" media="screen" type="text/css" href="/javascript/jquery/plugins/colorpicker/css/colorpicker.css" />
    3030<script type="text/javascript" src="/javascript/jquery/plugins/colorpicker/js/colorpicker.min.js"></script>
     31<script type="text/javascript" src="/javascript/jquery/plugins/ui.achtung-min.js"></script>
    3132
    3233<script type="text/javascript" src="/javascript/sage/main.js"></script>
    3334
  • sagenb/data/sage/js/notebook_lib.js

    diff -r 696fb9bf24a7 sagenb/data/sage/js/notebook_lib.js
    a b  
    43424342    annoying alert (it might be a good idea to change this, e.g., to
    43434343    blink red or something instead of an alert).
    43444344    */
    4345     if (response_text === "failed") {
    4346         alert('Unable to immediately interrupt calculation.');
     4345    if (response_text === "failed" || status === 'failure') {
     4346        $.achtung({
     4347            timeout: 0,
     4348            message: 'Unable to immediately interrupt calculation.',
     4349            className: 'interrupt-fail-notification'
     4350        });
    43474351        return;
    43484352    } else if (status === "success") {
    43494353        halt_active_cells();
  • sagenb/notebook/run_notebook.py

    diff -r 696fb9bf24a7 sagenb/notebook/run_notebook.py
    a b  
    216216twist.SAGETEX_PATH = "%s"
    217217twist.OPEN_MODE = %s
    218218twist.SID_COOKIE = str(hash("%s"))
     219twist.reactor = reactor
    219220twist.init_updates()
    220221import sagenb.notebook.worksheet as worksheet
    221222
  • sagenb/notebook/twist.py

    diff -r 696fb9bf24a7 sagenb/notebook/twist.py
    a b  
    2828notebook   = None
    2929OPEN_MODE  = None
    3030SID_COOKIE = None
     31reactor    = None
    3132
    3233############################################################
    3334
     
    14621463class Worksheet_interrupt(WorksheetResource, resource.Resource):
    14631464    def render(self, ctx):
    14641465        # TODO -- this must not block long (!)
    1465         s = self.worksheet.interrupt()
    1466         return HTMLResponse(stream='ok' if s else 'failed')
     1466        def callback(success):
     1467            """Called when interrupt is successful"""
     1468            return HTMLResponse(stream = 'success' if success else 'failed')
     1469       
     1470        deferred = self.worksheet.interrupt(callback)
     1471        return deferred
    14671472
    14681473class Worksheet_hide_all(WorksheetResource, resource.Resource):
    14691474    def render(self, ctx):
  • sagenb/notebook/worksheet.py

    diff -r 696fb9bf24a7 sagenb/notebook/worksheet.py
    a b  
    3535import time
    3636import traceback
    3737
     38from twisted.internet.defer import Deferred
     39
    3840# General sage library code
    3941from sagenb.misc.misc import (cython, load, save,
    4042                              alarm, cancel_alarm, verbose, DOT_SAGENB,
     
    30583060
    30593061        return 'd', C
    30603062
    3061     def interrupt(self):
     3063    def interrupt(self, callback = None, timeout = 1):
    30623064        r"""
    30633065        Interrupt all currently queued up calculations.
    30643066
     3067        INPUT:
     3068
     3069        - ``timeout`` -- time to wait for interruption to succeed
     3070       
     3071        - ``callback`` -- callback to be called. Called with True if
     3072          interrupt succeeds, else called with False.
     3073       
    30653074        OUTPUT:
    30663075
    3067         -  ``bool`` - return True if no problems interrupting
    3068            calculation return False if the Sage interpreter had to be
    3069            restarted.
     3076        -  ``deferred`` - a Deferred object with the given callbacks and errbacks
    30703077
    30713078        EXAMPLES: We create a worksheet and start a large factorization
    30723079        going::
     
    31093116        # stop the current computation in the running Sage
    31103117        S = self.__sage
    31113118        S.interrupt()
    3112         return True
     3119       
     3120        deferred = Deferred()
     3121        deferred.addCallback(callback)
     3122       
     3123        def interrupt_check():
     3124            if S.is_computing():
     3125                deferred.callback(False)
     3126            else:
     3127                deferred.callback(True)
     3128               
     3129        from twist import reactor
     3130        reactor.callLater(timeout, interrupt_check)
     3131       
     3132        return deferred
    31133133
    31143134    def clear_queue(self):
    31153135        # empty the queue
  • new file sass/src/jquery-plugins/_ui-achtung.sass

    diff -r 696fb9bf24a7 sass/src/jquery-plugins/_ui-achtung.sass
    - +  
     1* html
     2  #achtung-overlay
     3    position: absolute
     4
     5  .achtung
     6    width: 280px
     7
     8
     9#achtung-overlay
     10  overflow: hidden
     11  position: fixed
     12  top: 15px
     13  right: 15px
     14  width: 280px
     15  z-index: 50
     16
     17
     18.achtung
     19  display: none
     20  margin-bottom: 8px
     21  padding: 15px 15px
     22  background-color: #000
     23  color: white
     24  width: 250px
     25  font-weight: bold
     26  position: relative
     27  overflow: hidden
     28  -moz-box-shadow: #aaa 1px 1px 2px
     29  -webkit-box-shadow: #aaa 1px 1px 2px
     30  box-shadow: #aaa 1px 1px 2px
     31  -moz-border-radius: 4px
     32  -webkit-border-radius: 4px
     33  border-radius: 4px
     34  opacity: .85
     35  filter: Alpha(Opacity=85)
     36
     37
     38.ui-icon
     39  display: block
     40  text-indent: -99999px
     41  overflow: hidden
     42  background-repeat: no-repeat
     43  width: 16px
     44  height: 16px
     45  background-image: url(/javascript/jqueryui/css/sage/images/ui-icons_222222_256x240.png)
     46
     47
     48.ui-icon-carat-1-n
     49  background-position: 0 0
     50
     51
     52.ui-icon-carat-1-ne
     53  background-position: -16px 0
     54
     55
     56.ui-icon-carat-1-e
     57  background-position: -32px 0
     58
     59
     60.ui-icon-carat-1-se
     61  background-position: -48px 0
     62
     63
     64.ui-icon-carat-1-s
     65  background-position: -64px 0
     66
     67
     68.ui-icon-carat-1-sw
     69  background-position: -80px 0
     70
     71
     72.ui-icon-carat-1-w
     73  background-position: -96px 0
     74
     75
     76.ui-icon-carat-1-nw
     77  background-position: -112px 0
     78
     79
     80.ui-icon-carat-2-n-s
     81  background-position: -128px 0
     82
     83
     84.ui-icon-carat-2-e-w
     85  background-position: -144px 0
     86
     87
     88.ui-icon-triangle-1-n
     89  background-position: 0 -16px
     90
     91
     92.ui-icon-triangle-1-ne
     93  background-position: -16px -16px
     94
     95
     96.ui-icon-triangle-1-e
     97  background-position: -32px -16px
     98
     99
     100.ui-icon-triangle-1-se
     101  background-position: -48px -16px
     102
     103
     104.ui-icon-triangle-1-s
     105  background-position: -64px -16px
     106
     107
     108.ui-icon-triangle-1-sw
     109  background-position: -80px -16px
     110
     111
     112.ui-icon-triangle-1-w
     113  background-position: -96px -16px
     114
     115
     116.ui-icon-triangle-1-nw
     117  background-position: -112px -16px
     118
     119
     120.ui-icon-triangle-2-n-s
     121  background-position: -128px -16px
     122
     123
     124.ui-icon-triangle-2-e-w
     125  background-position: -144px -16px
     126
     127
     128.ui-icon-arrow-1-n
     129  background-position: 0 -32px
     130
     131
     132.ui-icon-arrow-1-ne
     133  background-position: -16px -32px
     134
     135
     136.ui-icon-arrow-1-e
     137  background-position: -32px -32px
     138
     139
     140.ui-icon-arrow-1-se
     141  background-position: -48px -32px
     142
     143
     144.ui-icon-arrow-1-s
     145  background-position: -64px -32px
     146
     147
     148.ui-icon-arrow-1-sw
     149  background-position: -80px -32px
     150
     151
     152.ui-icon-arrow-1-w
     153  background-position: -96px -32px
     154
     155
     156.ui-icon-arrow-1-nw
     157  background-position: -112px -32px
     158
     159
     160.ui-icon-arrow-2-n-s
     161  background-position: -128px -32px
     162
     163
     164.ui-icon-arrow-2-ne-sw
     165  background-position: -144px -32px
     166
     167
     168.ui-icon-arrow-2-e-w
     169  background-position: -160px -32px
     170
     171
     172.ui-icon-arrow-2-se-nw
     173  background-position: -176px -32px
     174
     175
     176.ui-icon-arrowstop-1-n
     177  background-position: -192px -32px
     178
     179
     180.ui-icon-arrowstop-1-e
     181  background-position: -208px -32px
     182
     183
     184.ui-icon-arrowstop-1-s
     185  background-position: -224px -32px
     186
     187
     188.ui-icon-arrowstop-1-w
     189  background-position: -240px -32px
     190
     191
     192.ui-icon-arrowthick-1-n
     193  background-position: 0 -48px
     194
     195
     196.ui-icon-arrowthick-1-ne
     197  background-position: -16px -48px
     198
     199
     200.ui-icon-arrowthick-1-e
     201  background-position: -32px -48px
     202
     203
     204.ui-icon-arrowthick-1-se
     205  background-position: -48px -48px
     206
     207
     208.ui-icon-arrowthick-1-s
     209  background-position: -64px -48px
     210
     211
     212.ui-icon-arrowthick-1-sw
     213  background-position: -80px -48px
     214
     215
     216.ui-icon-arrowthick-1-w
     217  background-position: -96px -48px
     218
     219
     220.ui-icon-arrowthick-1-nw
     221  background-position: -112px -48px
     222
     223
     224.ui-icon-arrowthick-2-n-s
     225  background-position: -128px -48px
     226
     227
     228.ui-icon-arrowthick-2-ne-sw
     229  background-position: -144px -48px
     230
     231
     232.ui-icon-arrowthick-2-e-w
     233  background-position: -160px -48px
     234
     235
     236.ui-icon-arrowthick-2-se-nw
     237  background-position: -176px -48px
     238
     239
     240.ui-icon-arrowthickstop-1-n
     241  background-position: -192px -48px
     242
     243
     244.ui-icon-arrowthickstop-1-e
     245  background-position: -208px -48px
     246
     247
     248.ui-icon-arrowthickstop-1-s
     249  background-position: -224px -48px
     250
     251
     252.ui-icon-arrowthickstop-1-w
     253  background-position: -240px -48px
     254
     255
     256.ui-icon-arrowreturnthick-1-w
     257  background-position: 0 -64px
     258
     259
     260.ui-icon-arrowreturnthick-1-n
     261  background-position: -16px -64px
     262
     263
     264.ui-icon-arrowreturnthick-1-e
     265  background-position: -32px -64px
     266
     267
     268.ui-icon-arrowreturnthick-1-s
     269  background-position: -48px -64px
     270
     271
     272.ui-icon-arrowreturn-1-w
     273  background-position: -64px -64px
     274
     275
     276.ui-icon-arrowreturn-1-n
     277  background-position: -80px -64px
     278
     279
     280.ui-icon-arrowreturn-1-e
     281  background-position: -96px -64px
     282
     283
     284.ui-icon-arrowreturn-1-s
     285  background-position: -112px -64px
     286
     287
     288.ui-icon-arrowrefresh-1-w
     289  background-position: -128px -64px
     290
     291
     292.ui-icon-arrowrefresh-1-n
     293  background-position: -144px -64px
     294
     295
     296.ui-icon-arrowrefresh-1-e
     297  background-position: -160px -64px
     298
     299
     300.ui-icon-arrowrefresh-1-s
     301  background-position: -176px -64px
     302
     303
     304.ui-icon-arrow-4
     305  background-position: 0 -80px
     306
     307
     308.ui-icon-arrow-4-diag
     309  background-position: -16px -80px
     310
     311
     312.ui-icon-extlink
     313  background-position: -32px -80px
     314
     315
     316.ui-icon-newwin
     317  background-position: -48px -80px
     318
     319
     320.ui-icon-refresh
     321  background-position: -64px -80px
     322
     323
     324.ui-icon-shuffle
     325  background-position: -80px -80px
     326
     327
     328.ui-icon-transfer-e-w
     329  background-position: -96px -80px
     330
     331
     332.ui-icon-transferthick-e-w
     333  background-position: -112px -80px
     334
     335
     336.ui-icon-folder-collapsed
     337  background-position: 0 -96px
     338
     339
     340.ui-icon-folder-open
     341  background-position: -16px -96px
     342
     343
     344.ui-icon-document
     345  background-position: -32px -96px
     346
     347
     348.ui-icon-document-b
     349  background-position: -48px -96px
     350
     351
     352.ui-icon-note
     353  background-position: -64px -96px
     354
     355
     356.ui-icon-mail-closed
     357  background-position: -80px -96px
     358
     359
     360.ui-icon-mail-open
     361  background-position: -96px -96px
     362
     363
     364.ui-icon-suitcase
     365  background-position: -112px -96px
     366
     367
     368.ui-icon-comment
     369  background-position: -128px -96px
     370
     371
     372.ui-icon-person
     373  background-position: -144px -96px
     374
     375
     376.ui-icon-print
     377  background-position: -160px -96px
     378
     379
     380.ui-icon-trash
     381  background-position: -176px -96px
     382
     383
     384.ui-icon-locked
     385  background-position: -192px -96px
     386
     387
     388.ui-icon-unlocked
     389  background-position: -208px -96px
     390
     391
     392.ui-icon-bookmark
     393  background-position: -224px -96px
     394
     395
     396.ui-icon-tag
     397  background-position: -240px -96px
     398
     399
     400.ui-icon-home
     401  background-position: 0 -112px
     402
     403
     404.ui-icon-flag
     405  background-position: -16px -112px
     406
     407
     408.ui-icon-calendar
     409  background-position: -32px -112px
     410
     411
     412.ui-icon-cart
     413  background-position: -48px -112px
     414
     415
     416.ui-icon-pencil
     417  background-position: -64px -112px
     418
     419
     420.ui-icon-clock
     421  background-position: -80px -112px
     422
     423
     424.ui-icon-disk
     425  background-position: -96px -112px
     426
     427
     428.ui-icon-calculator
     429  background-position: -112px -112px
     430
     431
     432.ui-icon-zoomin
     433  background-position: -128px -112px
     434
     435
     436.ui-icon-zoomout
     437  background-position: -144px -112px
     438
     439
     440.ui-icon-search
     441  background-position: -160px -112px
     442
     443
     444.ui-icon-wrench
     445  background-position: -176px -112px
     446
     447
     448.ui-icon-gear
     449  background-position: -192px -112px
     450
     451
     452.ui-icon-heart
     453  background-position: -208px -112px
     454
     455
     456.ui-icon-star
     457  background-position: -224px -112px
     458
     459
     460.ui-icon-link
     461  background-position: -240px -112px
     462
     463
     464.ui-icon-cancel
     465  background-position: 0 -128px
     466
     467
     468.ui-icon-plus
     469  background-position: -16px -128px
     470
     471
     472.ui-icon-plusthick
     473  background-position: -32px -128px
     474
     475
     476.ui-icon-minus
     477  background-position: -48px -128px
     478
     479
     480.ui-icon-minusthick
     481  background-position: -64px -128px
     482
     483
     484.ui-icon-close
     485  background-position: -80px -128px
     486
     487
     488.ui-icon-closethick
     489  background-position: -96px -128px
     490
     491
     492.ui-icon-key
     493  background-position: -112px -128px
     494
     495
     496.ui-icon-lightbulb
     497  background-position: -128px -128px
     498
     499
     500.ui-icon-scissors
     501  background-position: -144px -128px
     502
     503
     504.ui-icon-clipboard
     505  background-position: -160px -128px
     506
     507
     508.ui-icon-copy
     509  background-position: -176px -128px
     510
     511
     512.ui-icon-contact
     513  background-position: -192px -128px
     514
     515
     516.ui-icon-image
     517  background-position: -208px -128px
     518
     519
     520.ui-icon-video
     521  background-position: -224px -128px
     522
     523
     524.ui-icon-script
     525  background-position: -240px -128px
     526
     527
     528.ui-icon-alert
     529  background-position: 0 -144px
     530
     531
     532.ui-icon-info
     533  background-position: -16px -144px
     534
     535
     536.ui-icon-notice
     537  background-position: -32px -144px
     538
     539
     540.ui-icon-help
     541  background-position: -48px -144px
     542
     543
     544.ui-icon-check
     545  background-position: -64px -144px
     546
     547
     548.ui-icon-bullet
     549  background-position: -80px -144px
     550
     551
     552.ui-icon-radio-off
     553  background-position: -96px -144px
     554
     555
     556.ui-icon-radio-on
     557  background-position: -112px -144px
     558
     559
     560.ui-icon-pin-w
     561  background-position: -128px -144px
     562
     563
     564.ui-icon-pin-s
     565  background-position: -144px -144px
     566
     567
     568.ui-icon-play
     569  background-position: 0 -160px
     570
     571
     572.ui-icon-pause
     573  background-position: -16px -160px
     574
     575
     576.ui-icon-seek-next
     577  background-position: -32px -160px
     578
     579
     580.ui-icon-seek-prev
     581  background-position: -48px -160px
     582
     583
     584.ui-icon-seek-end
     585  background-position: -64px -160px
     586
     587
     588.ui-icon-seek-first
     589  background-position: -80px -160px
     590
     591
     592.ui-icon-stop
     593  background-position: -96px -160px
     594
     595
     596.ui-icon-eject
     597  background-position: -112px -160px
     598
     599
     600.ui-icon-volume-off
     601  background-position: -128px -160px
     602
     603
     604.ui-icon-volume-on
     605  background-position: -144px -160px
     606
     607
     608.ui-icon-power
     609  background-position: 0 -176px
     610
     611
     612.ui-icon-signal-diag
     613  background-position: -16px -176px
     614
     615
     616.ui-icon-signal
     617  background-position: -32px -176px
     618
     619
     620.ui-icon-battery-0
     621  background-position: -48px -176px
     622
     623
     624.ui-icon-battery-1
     625  background-position: -64px -176px
     626
     627
     628.ui-icon-battery-2
     629  background-position: -80px -176px
     630
     631
     632.ui-icon-battery-3
     633  background-position: -96px -176px
     634
     635
     636.ui-icon-circle-plus
     637  background-position: 0 -192px
     638
     639
     640.ui-icon-circle-minus
     641  background-position: -16px -192px
     642
     643
     644.ui-icon-circle-close
     645  background-position: -32px -192px
     646
     647
     648.ui-icon-circle-triangle-e
     649  background-position: -48px -192px
     650
     651
     652.ui-icon-circle-triangle-s
     653  background-position: -64px -192px
     654
     655
     656.ui-icon-circle-triangle-w
     657  background-position: -80px -192px
     658
     659
     660.ui-icon-circle-triangle-n
     661  background-position: -96px -192px
     662
     663
     664.ui-icon-circle-arrow-e
     665  background-position: -112px -192px
     666
     667
     668.ui-icon-circle-arrow-s
     669  background-position: -128px -192px
     670
     671
     672.ui-icon-circle-arrow-w
     673  background-position: -144px -192px
     674
     675
     676.ui-icon-circle-arrow-n
     677  background-position: -160px -192px
     678
     679
     680.ui-icon-circle-zoomin
     681  background-position: -176px -192px
     682
     683
     684.ui-icon-circle-zoomout
     685  background-position: -192px -192px
     686
     687
     688.ui-icon-circle-check
     689  background-position: -208px -192px
     690
     691
     692.ui-icon-circlesmall-plus
     693  background-position: 0 -208px
     694
     695
     696.ui-icon-circlesmall-minus
     697  background-position: -16px -208px
     698
     699
     700.ui-icon-circlesmall-close
     701  background-position: -32px -208px
     702
     703
     704.ui-icon-squaresmall-plus
     705  background-position: -48px -208px
     706
     707
     708.ui-icon-squaresmall-minus
     709  background-position: -64px -208px
     710
     711
     712.ui-icon-squaresmall-close
     713  background-position: -80px -208px
     714
     715
     716.ui-icon-grip-dotted-vertical
     717  background-position: 0 -224px
     718
     719
     720.ui-icon-grip-dotted-horizontal
     721  background-position: -16px -224px
     722
     723
     724.ui-icon-grip-solid-vertical
     725  background-position: -32px -224px
     726
     727
     728.ui-icon-grip-solid-horizontal
     729  background-position: -48px -224px
     730
     731
     732.ui-icon-gripsmall-diagonal-se
     733  background-position: -64px -224px
     734
     735
     736.ui-icon-grip-diagonal-se
     737  background-position: -80px -224px
     738
     739
     740.achtung
     741  .achtung-message-icon
     742    margin-top: 0
     743    margin-left: -.5em
     744    margin-right: .5em
     745    float: left
     746    zoom: 1
     747
     748  .ui-icon
     749    &.achtung-close-button
     750      overflow: hidden
     751      float: right
     752      position: relative
     753      top: -8px
     754      right: -8px
     755      cursor: pointer
     756      background-image: url(/javascript/jqueryui/css/sage/images/ui-icons_888888_256x240.png)
     757
     758    &.achtung-close-button-hover
     759      background-image: url(/javascript/jqueryui/css/sage/images/ui-icons_ffffff_256x240.png)
     760
     761
     762.achtungSuccess, .achtungFail, .achtungWait
     763  opacity: .93
     764  filter: Alpha(Opacity=93)
     765
     766
     767.achtungSuccess
     768  background-color: #4DB559
     769
     770
     771.achtungFail
     772  background-color: #D64450
     773
     774
     775.achtungWait
     776  background-color: #658093
     777
     778
     779.achtungSuccess .ui-icon.achtung-close-button, .achtungFail .ui-icon.achtung-close-button
     780  background-image: url(/javascript/jqueryui/css/sage/images/ui-icons_2e83ff_256x240.png)
     781
     782
     783.achtungSuccess .ui-icon.achtung-close-button-hover, .achtungFail .ui-icon.achtung-close-button-hover
     784  background-image: url(/javascript/jqueryui/css/sage/images/ui-icons_222222_256x240.png)
     785
     786
     787.achtung
     788  .wait-icon
     789    background-image: url(/javascript/jqueryui/css/sage/images/wait.gif)
     790
     791  .achtung-message
     792    display: inline
  • sass/src/main.sass

    diff -r 696fb9bf24a7 sass/src/main.sass
    a b  
    461461    :clear both
    462462    :font-size 0.6em
    463463
     464.worksheet-online .interrupt-fail-notification
     465  :background-color #B22222
     466
    464467span.pane div.worksheets_topbar
    465468  :color black
    466469  :height 3ex
     
    11891192@import accounts.sass
    11901193@import login.sass
    11911194@import pygment.sass
     1195@import jquery-plugins/ui-achtung.sass