Opened 11 years ago

Last modified 9 years ago

#11026 closed enhancement

Add double clicking of sws files for Mac app — at Version 24

Reported by: iandrus Owned by: iandrus
Priority: major Milestone: sage-5.8
Component: user interface Keywords: mac app
Cc: kcrisman, jhpalmieri Merged in:
Authors: Ivan Andrus Reviewers: Karl-Dieter Crisman
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: #8473, #13121 Stopgaps:

Status badges

Description (last modified by iandrus)

With #8473 we have the necessary support for uploading files. This allows the Mac app to support double clicking of sws files. Also able to be opened are txt and zip files.


Apply trac_11026-extcode.patch to the extcode repository.

Change History (26)

comment:1 Changed 11 years ago by kcrisman

  • Cc kcrisman added

comment:2 Changed 11 years ago by kcrisman

I think the patch already exists, right? You could just add it and mark 'needs review'.

comment:3 Changed 11 years ago by iandrus

  • Owner changed from was to iandrus

comment:4 Changed 11 years ago by iandrus

  • Status changed from new to needs_review

comment:5 Changed 10 years ago by kcrisman

This would eventually need also to add html (#10652) and other file types as possible uploads, but I think that those could be additional enhancements to the Mac app.

I have to admit that some of the stuff in designable.nib I will never understand. I see the "new option to automatically start the server when a sws file is opened" from #8473, but some of the things like "IBConnectionRecord" and the mysterious numbers everywhere I can only judge by their effects. I am impressed by all the work bringing the double-click not just to the browser but to the mini-browser you built.

I'll be testing this shortly.

comment:6 Changed 10 years ago by kcrisman

I get a weird error, perhaps related to the problems with browsers at #8473, with this:

The resource /upload_worksheet?url=file://localhost/Users/student/Desktop/Tests.sws cannot be found.

Notice the file://localhost/Users rather than file:///Users which we get at #8473.

comment:7 Changed 10 years ago by kcrisman

From #8473:

The Mac app has a new option to automatically start the server when a sws file is opened. I'm not sure anyone would ever want to turn this off, so I can remove it if it's not useful.

But it does work as advertised. I can imagine one wanting to avoid 'accidentally' starting the server, so let's keep it.

The rest seems to work as it's supposed to, modulo the issues mentioned at #8473.

comment:8 Changed 10 years ago by kcrisman

  • Reviewers set to Karl-Dieter Crisman

Here's a couple more interesting details.

  • Changing the default browser to FF, it still worked! Even if the server was started.
  • BUT if the app was completely turned off, then I got the message about the following not being found - no surprise, as port 0 probably is not open!
    http://localhost:0/upload_worksheet?url=file://localhost/Users/karl-dietercrisman/Desktop/Test.sws
    
    That is certainly some kind of residue from #8473, with somehow the initial port 0 not being changed soon enough or something. You could follow up there if it makes more sense.

comment:9 Changed 10 years ago by kcrisman

Separately, I just experienced the phenomenon of closing the app turning off a different Sage server session! At least that's what it seemed like.

comment:10 Changed 10 years ago by kcrisman

I also get a strange 'doubling' of the pages just now - not before. I'm not sure what's causing it, but somehow it's opening two copies of the loading page, etc. I'm getting port 8001 right now, so maybe that's it.

Now it seems to be more normal again, though I still got two copies of the worksheet, presumably from your !URLQueue. Anyway, not something I'm really concerned with, since it's working nonetheless.

comment:11 Changed 10 years ago by kcrisman

  • Status changed from needs_review to needs_work

Putting to 'needs work'.

  • At least it should work with #8473.
  • The port 0 thing should probably work.
  • The other stuff isn't as important. Probably needs a little more testing in any case, but the concept is more than proven.

comment:12 Changed 10 years ago by kcrisman

  • Status changed from needs_work to needs_info

#8473 is solved, see the sagenb upstream pull request.

Putting this to "needs info" because I don't know whether this patch will be compatible with the new notebook.

Changed 10 years ago by kcrisman

Based on 5.1beta1

comment:13 Changed 10 years ago by kcrisman

  • Dependencies set to #8473, #13121
  • Description modified (diff)
  • Status changed from needs_info to needs_review

I just rebased this, because of a slight change when sage-env was moved. Shouldn't have any other new notebook problems, see comment:12:ticket:10556. Now it's time to look at it!

Dependencies include #13121, where #8473 will eventually live.

Apply trac_11026-extcode-rebase.patch to the extcode repository.

comment:14 Changed 10 years ago by kcrisman

By the way, for positive review I think it's reasonable to ask for this to be tested on Tiger, Snow Leopard, and Lion, with up-to-date Xcode for each platform.

comment:15 follow-up: Changed 10 years ago by kcrisman

  • Status changed from needs_review to needs_work

Well, it's a little tricky. Double-clicking certainly opens the Sage app, and the notebook server opens, but I don't see it opening the file. Yes, this is on a version of Sage with the sws-cmdline going, because if I open the terminal from within the little dropdown list, I get

sage: notebook(upload="/Users/.../Untitled.sws")
The notebook files are stored in: sage_notebook.sagenb
Another Sage Notebook server is running, PID 19872.
Opening web browser at http://localhost:8000/upload_worksheet?url=file:///Users/.../Untitled.sws ...

and it opens fine in its own thing. But when I double-click, it just opens the worksheet list window, nothing else.

When I use the Sage app itself (not the little menubar item) and do File -> Open File ... then I get the "native" app browser with the worksheet I chose as its title, but nothing else (just a clank browser window. It doesn't do anything, and the worksheet is not there when I check.

The only possible problem is that I built this as an Xcode project and then dumped in my Sage that has the sws-cmdline business. But it functions fine otherwise, so I don't know what the story is with this. Sadly, 'needs work'.

Also, I have a feeling that it doesn't wait long enough to upload in any case, but that would be a separate issue.


On an unrelated note, why does sage-document-cython.icns look so much bigger than the other icon files?


By the way, my menubar item never does become blue any more. Maybe that is part of it. I mean, the server is clearly working, so I'm not sure why not. Any ideas?

comment:16 in reply to: ↑ 15 ; follow-up: Changed 10 years ago by iandrus

Replying to kcrisman:

Well, it's a little tricky. Double-clicking certainly opens the Sage app, and the notebook server opens, but I don't see it opening the file. Yes, this is on a version of Sage with the sws-cmdline going, because if I open the terminal from within the little dropdown list, I get

sage: notebook(upload="/Users/.../Untitled.sws")
The notebook files are stored in: sage_notebook.sagenb
Another Sage Notebook server is running, PID 19872.
Opening web browser at http://localhost:8000/upload_worksheet?url=file:///Users/.../Untitled.sws ...

and it opens fine in its own thing. But when I double-click, it just opens the worksheet list window, nothing else.

When I use the Sage app itself (not the little menubar item) and do File -> Open File ... then I get the "native" app browser with the worksheet I chose as its title, but nothing else (just a clank browser window. It doesn't do anything, and the worksheet is not there when I check.

Oh you're right. I wonder if that ever worked.


On an unrelated note, why does sage-document-cython.icns look so much bigger than the other icon files?

I made it at a different time and didn't follow the same steps I guess. I fixed this in the patch as well.


By the way, my menubar item never does become blue any more. Maybe that is part of it. I mean, the server is clearly working, so I'm not sure why not. Any ideas?

Okay, I tried it against sage-5.2.beta0 and you are right (when you use the system browser). The problem is the server detection. They changed the (default) pid file of the notebook server. I have fixed this and tested that it also works with the old pid file, and updated the patch.

comment:17 Changed 10 years ago by iandrus

  • Description modified (diff)

comment:18 Changed 10 years ago by iandrus

  • Status changed from needs_work to needs_review

comment:19 Changed 10 years ago by kcrisman

Notice that you still have the failing hunk.

Changed 10 years ago by kcrisman

Based on 5.1.beta1

comment:20 Changed 10 years ago by kcrisman

  • Description modified (diff)

comment:21 in reply to: ↑ 16 ; follow-up: Changed 10 years ago by kcrisman

Well, it's a little tricky. Double-clicking certainly opens the Sage app, and the notebook server opens, but I don't see it opening the file. Yes, this is on a version of Sage with the sws-cmdline going, because if I open the terminal from within the little dropdown list, I get

sage: notebook(upload="/Users/.../Untitled.sws")
The notebook files are stored in: sage_notebook.sagenb
Another Sage Notebook server is running, PID 19872.
Opening web browser at http://localhost:8000/upload_worksheet?url=file:///Users/.../Untitled.sws ...

and it opens fine in its own thing. But when I double-click, it just opens the worksheet list window, nothing else.

Did you see this? Just curious.

When I use the Sage app itself (not the little menubar item) and do File -> Open File ... then I get the "native" app browser with the worksheet I chose as its title, but nothing else (just a clank browser window. It doesn't do anything, and the worksheet is not there when I check.

Oh you're right. I wonder if that ever worked.

Fixed?

On an unrelated note, why does sage-document-cython.icns look so much bigger than the other icon files?

I made it at a different time and didn't follow the same steps I guess. I fixed this in the patch as well.

Hmm, but it still looks bigger. Probably this isn't a big deal. I can't check what the icons actually look like because I have Xcode as the default to open .pyx files and it won't give me the icon even after saying Sage.app should open them.

By the way, my menubar item never does become blue any more. Maybe that is part of it. I mean, the server is clearly working, so I'm not sure why not. Any ideas?

Okay, I tried it against sage-5.2.beta0 and you are right (when you use the system browser). The problem is the server detection. They changed the (default) pid file of the notebook server. I have fixed this and tested that it also works with the old pid file, and updated the patch.

Okay. What was the change for this?


I'm going to try this out again soon, thanks for the update!

comment:22 in reply to: ↑ 21 ; follow-up: Changed 10 years ago by iandrus

Replying to kcrisman:

Well, it's a little tricky. Double-clicking certainly opens the Sage app, and the notebook server opens, but I don't see it opening the file. Yes, this is on a version of Sage with the sws-cmdline going, because if I open the terminal from within the little dropdown list, I get

sage: notebook(upload="/Users/.../Untitled.sws")
The notebook files are stored in: sage_notebook.sagenb
Another Sage Notebook server is running, PID 19872.
Opening web browser at http://localhost:8000/upload_worksheet?url=file:///Users/.../Untitled.sws ...

and it opens fine in its own thing. But when I double-click, it just opens the worksheet list window, nothing else.

Did you see this? Just curious.

When I use the Sage app itself (not the little menubar item) and do File -> Open File ... then I get the "native" app browser with the worksheet I chose as its title, but nothing else (just a clank browser window. It doesn't do anything, and the worksheet is not there when I check.

Oh you're right. I wonder if that ever worked.

Fixed?

No. It will take some time for me to figure out how to fix it. I haven't looked at it yet.

On an unrelated note, why does sage-document-cython.icns look so much bigger than the other icon files?

I made it at a different time and didn't follow the same steps I guess. I fixed this in the patch as well.

Hmm, but it still looks bigger. Probably this isn't a big deal. I can't check what the icons actually look like because I have Xcode as the default to open .pyx files and it won't give me the icon even after saying Sage.app should open them.

Hmm. It looks the same size to me. Actually, I uploaded the wrong patch. Oops.

You might have to logout and back in to get the icons to change in the Finder.

By the way, my menubar item never does become blue any more. Maybe that is part of it. I mean, the server is clearly working, so I'm not sure why not. Any ideas?

Okay, I tried it against sage-5.2.beta0 and you are right (when you use the system browser). The problem is the server detection. They changed the (default) pid file of the notebook server. I have fixed this and tested that it also works with the old pid file, and updated the patch.

Okay. What was the change for this?

In sage-is-running-on-port.sh. I think it's pretty obvious where the change is. There is also a change in AppController.m, but since I uploaded the wrong patch you wouldn't have been able to see it. :-)

comment:23 in reply to: ↑ 22 ; follow-up: Changed 10 years ago by kcrisman

Fixed?

No. It will take some time for me to figure out how to fix it. I haven't looked at it yet.

Ok. You could just make that functionality raise an error for the time being.

On an unrelated note, why does sage-document-cython.icns look so much bigger than the other icon files?

I made it at a different time and didn't follow the same steps I guess. I fixed this in the patch as well.

Hmm, but it still looks bigger. Probably this isn't a big deal. I can't check what the icons actually look like because I have Xcode as the default to open .pyx files and it won't give me the icon even after saying Sage.app should open them.

Hmm. It looks the same size to me. Actually, I uploaded the wrong patch. Oops.

Well, there we go.

In sage-is-running-on-port.sh. I think it's pretty obvious where the change is. There is also a change in AppController.m, but since I uploaded the wrong patch you wouldn't have been able to see it. :-)

Of course.

comment:24 in reply to: ↑ 23 Changed 10 years ago by iandrus

  • Description modified (diff)

Replying to kcrisman:

Fixed?

No. It will take some time for me to figure out how to fix it. I haven't looked at it yet.

Ok. You could just make that functionality raise an error for the time being.

Okay, it's not too hard to change, but unfortunately, even making it raise an error requires a change to the nib file. Sadly, although the nib files are technically xml, even the tiniest change creates a mountain of changes which almost certainly will conflict with later changes to the nib file. I'll have to rebase all my other patches on top of these changes and it might take me a couple days since I want to be very careful about it.

Note: See TracTickets for help on using tickets.