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

File trac_5712-interrupt-notification.4.patch, 36.6 KB (added by mpatel, 9 years ago)

See comment. Replaces previous.

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

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

    diff --git a/sagenb/data/sage/html/notebook/base.html b/sagenb/data/sage/html/notebook/base.html
    a b INPUT: 
    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>
    INPUT: 
    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 --git a/sagenb/data/sage/js/notebook_lib.js b/sagenb/data/sage/js/notebook_lib.js
    a b function interrupt() { 
    43284328    Send a message to the server that we would like to interrupt all
    43294329    running calculations in the worksheet.
    43304330    */
     4331    if (!updating) {
     4332        return;
     4333    }
    43314334    async_request(worksheet_command('interrupt'), interrupt_callback);
    43324335}
    43334336
    function interrupt_callback(status, resp 
    43404343    annoying alert (it might be a good idea to change this, e.g., to
    43414344    blink red or something instead of an alert).
    43424345    */
    4343     if (response_text === "failed") {
    4344         alert('Unable to immediately interrupt calculation.');
    4345         return;
     4346    if (response_text === "failed" || status === 'failure') {
     4347        $.achtung({
     4348            timeout:  0,
     4349            message: "<p>Unable to immediately interrupt calculation.</p>" +
     4350                "<p>Please try again in a few seconds. " +
     4351                "If it doesn't work, please try restarting the worksheet.</p>",
     4352            className: 'interrupt-fail-notification'
     4353        });
    43464354    } else if (status === "success") {
    43474355        halt_active_cells();
    43484356    }
  • sagenb/notebook/run_notebook.py

    diff --git a/sagenb/notebook/run_notebook.py b/sagenb/notebook/run_notebook.py
    a b twist.notebook = notebook.load_notebook( 
    282282twist.SAGETEX_PATH = "%s"
    283283twist.OPEN_MODE = %s
    284284twist.SID_COOKIE = str(hash("%s"))
     285twist.reactor = reactor
    285286twist.init_updates()
    286287import sagenb.notebook.worksheet as worksheet
    287288
  • sagenb/notebook/twist.py

    diff --git a/sagenb/notebook/twist.py b/sagenb/notebook/twist.py
    a b startup.:: 
    2828notebook   = None
    2929OPEN_MODE  = None
    3030SID_COOKIE = None
     31reactor    = None
    3132
    3233############################################################
    3334
    class Worksheet_quit_sage(WorksheetResou 
    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 --git a/sagenb/notebook/worksheet.py b/sagenb/notebook/worksheet.py
    a b import string 
    3636import time
    3737import traceback
    3838
     39from twisted.internet.defer import Deferred
     40
    3941# General sage library code
    4042from sagenb.misc.misc import (cython, load, save,
    4143                              alarm, cancel_alarm, verbose, DOT_SAGENB,
    from sagenb.notebook.all import * 
    30673069
    30683070        return 'd', C
    30693071
    3070     def interrupt(self):
     3072    def interrupt(self, callback = None, timeout = 1):
    30713073        r"""
    30723074        Interrupt all currently queued up calculations.
    30733075
     3076        INPUT:
     3077
     3078        - ``timeout`` -- time to wait for interruption to succeed
     3079       
     3080        - ``callback`` -- callback to be called. Called with True if
     3081          interrupt succeeds, else called with False.
     3082       
    30743083        OUTPUT:
    30753084
    3076         -  ``bool`` - return True if no problems interrupting
    3077            calculation return False if the Sage interpreter had to be
    3078            restarted.
     3085        -  ``deferred`` - a Deferred object with the given callbacks and errbacks
    30793086
    30803087        EXAMPLES: We create a worksheet and start a large factorization
    30813088        going::
    from sagenb.notebook.all import * 
    31183125        # stop the current computation in the running Sage
    31193126        S = self.__sage
    31203127        S.interrupt()
    3121         return True
     3128       
     3129        deferred = Deferred()
     3130        deferred.addCallback(callback)
     3131       
     3132        def interrupt_check():
     3133            if S.is_computing():
     3134                deferred.callback(False)
     3135            else:
     3136                deferred.callback(True)
     3137               
     3138        from twist import reactor
     3139        reactor.callLater(timeout, interrupt_check)
     3140       
     3141        return deferred
    31223142
    31233143    def clear_queue(self):
    31243144        # empty the queue
  • new file sass/src/jquery-plugins/_ui-achtung.sass

    diff --git a/sass/src/jquery-plugins/_ui-achtung.sass b/sass/src/jquery-plugins/_ui-achtung.sass
    new file mode 100644
    - +  
     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 --git a/sass/src/main.sass b/sass/src/main.sass
    a b div.docstring-introspection-dialog 
    462462    :clear both
    463463    :font-size 0.6em
    464464
     465.worksheet-online .interrupt-fail-notification
     466  :background-color #B22222
     467
    465468span.pane div.worksheets_topbar
    466469  :color black
    467470  :height 3ex
    t 
    11901193@import accounts.sass
    11911194@import login.sass
    11921195@import pygment.sass
     1196@import jquery-plugins/ui-achtung.sass