Ticket #1230: sage-1230.patch

File sage-1230.patch, 5.1 KB (added by was, 13 years ago)
  • sage/server/notebook/js.py

    # HG changeset patch
    # User William Stein <wstein@gmail.com>
    # Date 1210453431 25200
    # Node ID 7593840775c06b739298d5d164813ba6c3c14da4
    # Parent  f851683c53b399e132f06c33182e204b6a6ee740
    Trac #1230: fix all the issues listed at trac #1230:
       1. Makes the quick worksheet menu item (under Action) actually return to the home screen
          after it saves and quits the worksheet.
       2. Change "active" to "running" in the home screen.
       3. Added a quit button to the main screen, which works just like the archive and delete buttons.
    
    diff -r f851683c53b3 -r 7593840775c0 sage/server/notebook/js.py
    a b function worksheet_list_button(action) { 
    11591159    filenames = "";
    11601160
    11611161    // Concatenate the list of all worksheet filenames that are checked
    1162     // togethers separated by the separator string.
     1162    // together separated by the separator string.
    11631163    for(i=0; i<worksheet_filenames.length; i++) {
    11641164        id = worksheet_filenames[i];
    11651165        X  = get_element(id);
    function worksheet_list_button_callback( 
    11881188        if (response_text != '') {
    11891189            alert(response_text);
    11901190        }
    1191     } else {
    1192         alert("Failure deleting worksheet." + response_text);
    11931191    }
    11941192    window.location.reload(true);
    11951193}
    function archive_button() { 
    12171215    worksheet_list_button("/send_to_archive");
    12181216}     
    12191217
     1218function quit_worksheets_button() {
     1219    /*
     1220    Saves and then quits sage process for each checked worksheet.
     1221    */
     1222    worksheet_list_button("/send_to_quit");
     1223}
    12201224
    12211225function history_window() {
    12221226    /*
  • sage/server/notebook/notebook.py

    diff -r f851683c53b3 -r 7593840775c0 sage/server/notebook/notebook.py
    a b class Notebook(SageObject): 
    11511151                s += '&nbsp;&nbsp;<button onClick="delete_button();" title="Move the selected worksheets to the trash">Delete</button>'
    11521152            else:
    11531153                s += '&nbsp;&nbsp;<button onClick="make_active_button();" title="Move the selected worksheets out of the trash">Undelete</button>'
     1154
     1155            s += '&nbsp;&nbsp;<button onClick="quit_worksheets_button();" title="Quit selected worksheets">Quit</button>'
    11541156           
    11551157            s += '<span>'
    11561158            s += '&nbsp;'*10
    class Notebook(SageObject): 
    11961198            k += '<td class="entry">%s</td>'%self.html_check_col(w, user, pub)
    11971199            name = self.html_worksheet_link(w, pub)
    11981200            if w.compute_process_has_been_started():
    1199                 name = '(active) %s'%name
     1201                name = '(running) %s'%name
    12001202            if w.is_active(user):
    12011203                k += '<td class="worksheet_link">%s</td>'%name
    12021204            else:
  • sage/server/notebook/twist.py

    diff -r f851683c53b3 -r 7593840775c0 sage/server/notebook/twist.py
    a b class EmptyTrash(resource.Resource): 
    12881288        """
    12891289        notebook.empty_trash(self.username)
    12901290        return http.Response(stream = message("Trash emptied."))
    1291        
    12921291
    12931292class SendWorksheetToFolder(resource.PostableResource):
    12941293    def __init__(self, username):
    class SendWorksheetToActive(SendWorkshee 
    13321331class SendWorksheetToActive(SendWorksheetToFolder):
    13331332    def action(self, W):
    13341333        W.set_active(self.username)
     1334
     1335# Using SendWorksheet does feel somewhat hackish.  It however is
     1336# exactly the right thing to actually do, and minimizes code
     1337# duplication.
     1338class SendWorksheetToQuit(SendWorksheetToFolder):
     1339    """
     1340    Saves and quits each selected worksheet.
     1341    """
     1342    def action(self, W):
     1343        W.save_snapshot(self.username)
     1344        W.quit()
    13351345
    13361346############################
    13371347# Publically Available Worksheets
    class UserToplevel(Toplevel): 
    18331843    userchild_send_to_trash = SendWorksheetToTrash
    18341844    userchild_send_to_archive = SendWorksheetToArchive
    18351845    userchild_send_to_active = SendWorksheetToActive
     1846    userchild_send_to_quit = SendWorksheetToQuit
    18361847
    18371848    userchild_settings = UserSettings
    18381849
  • sage/server/notebook/worksheet.py

    diff -r f851683c53b3 -r 7593840775c0 sage/server/notebook/worksheet.py
    a b class Worksheet: 
    963963 <option title="Select a worksheet function" value="" selected>Action...</option>
    964964 <option title="Interrupt currently running calculations, if possible" value="interrupt();">Interrupt</option>
    965965 <option title="Restart the worksheet process" value="restart_sage();">Restart worksheet</option>
    966  <option title="Quit the worksheet process" value="quit_sage();">Quit worksheet</option>
     966 <option title="Quit the worksheet process" value="save_worksheet_and_close();">Save and quit worksheet</option>
    967967 <option value="">---------------------------</option>
    968968 <option title="Evaluate all input cells in the worksheet" value="evaluate_all();">Evaluate All</option>
    969969 <option title="Hide all output" value="hide_all();">Hide All Output</option>