Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Associate .chn with chaiNNer on MacOS #2115

Merged
merged 1 commit into from
Aug 21, 2023

Conversation

stonerl
Copy link
Collaborator

@stonerl stonerl commented Aug 18, 2023

  • added association of .chn filetype with chainner on macOS
  • added file type icon
  • added open-file event for macOS

This addresses #1062 but does not solve it completely, since file association only works on macOS ATM.

@stonerl

This comment was marked as outdated.

@RunDevelopment
Copy link
Member

Thank you @stonerl!

Let's focus on .chn files for now. Opening models presents the problem that the PyTorch, ONNX, and NCNN packages may not be installed, so what are we supposed to do then? Also, there are no .ncnn files. NCNN stores models as 2 files: .param and .bin.

@stonerl stonerl force-pushed the file-association-#1062 branch from 5888b0e to 3bcadd0 Compare August 18, 2023 10:50
@stonerl
Copy link
Collaborator Author

stonerl commented Aug 18, 2023

Okay, changed it. It now only associates chaiNNer with .chn files.

@stonerl stonerl changed the title associate .chn .ncnn .onnx .pth with chainner associate .chn with chainner Aug 18, 2023
@stonerl stonerl force-pushed the file-association-#1062 branch from 3bcadd0 to b980f07 Compare August 18, 2023 10:54
@RunDevelopment
Copy link
Member

Do we still need to other icons?

@stonerl
Copy link
Collaborator Author

stonerl commented Aug 18, 2023

Do we still need to other icons?

I would let them stay. The are not copied into the app, so no harm done. And if we decide to make use of them then we already have them.

@RunDevelopment
Copy link
Member

Doesn't feel good to have unused files in the repository...

No, please remove them. Let's add them when we actually add support for opening model files.

@stonerl stonerl force-pushed the file-association-#1062 branch from b980f07 to 1b5e53d Compare August 18, 2023 11:26
@stonerl
Copy link
Collaborator Author

stonerl commented Aug 18, 2023

Okay, removed them.

@stonerl stonerl force-pushed the file-association-#1062 branch from 1b5e53d to 507ce91 Compare August 18, 2023 11:27
RunDevelopment
RunDevelopment previously approved these changes Aug 18, 2023
@joeyballentine
Copy link
Member

but double-clicking on them does not do any meaningful for now

Are you sure? On windows if I manually associate the file type, I'm able to open chain files directly by double clicking them. If that doesn't work on Mac, then I guess that means Mac uses different args when launching chaiNNer?

@joeyballentine joeyballentine changed the title associate .chn with chainner Associate .chn with chaiNNer on MacOS Aug 18, 2023
@stonerl
Copy link
Collaborator Author

stonerl commented Aug 18, 2023

@joeyballentine Yes, I tested it. Drag'n'drop does work, though. On macOS we need to use open-file, it seems.

Can you point me to the code where the drag'n'drop and file opening, e.g., on Windows is handled? I am uncertain whether I'm able to implement this for macOS, but I would give it a try.

@joeyballentine
Copy link
Member

Arg parsing:

.positional('file', {

Using the arg:

if (args.file) {

I believe on windows when you open a file with a program it adds the file as a positional arg. I guess this is not the case for MacOS then

@stonerl stonerl marked this pull request as draft August 18, 2023 22:59
@stonerl stonerl force-pushed the file-association-#1062 branch 3 times, most recently from ae9cd8e to fa922dd Compare August 21, 2023 15:03
@stonerl
Copy link
Collaborator Author

stonerl commented Aug 21, 2023

Opening .chn files by double-clicking them now also works on macOS.

CleanShot 2023-08-21 at 17 06 14

@stonerl stonerl marked this pull request as ready for review August 21, 2023 15:07
- added association of .chn filetype with chainner on macOS
- added file type icon
- added open-file event for macOS

This addresses chaiNNer-org#1062 but does not solve it completely, since file association only works on macOS ATM.
@stonerl stonerl force-pushed the file-association-#1062 branch from fa922dd to 91e3da0 Compare August 21, 2023 15:33
@joeyballentine joeyballentine merged commit 64136a2 into chaiNNer-org:main Aug 21, 2023
@stonerl stonerl deleted the file-association-#1062 branch August 21, 2023 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants