I guess I’ll give it a try, but I’m a little concerned that samplerbox consists of 3 python files, wouldn’t it break it if I copy only samplerbox.py to bin?
Try this possibly.
Thanks. I’ll give it a try this weekend
After some trial, error and putting files into
/usr/local/bin I found quite simple solution. All you need to do is just add a line
os.chdir(os.path.dirname(sys.argv)) after all the imports into samplerbox.py. This way you can leave the script in
opt folder and run it from wherever you wish, and .sh file with
python /opt/SamplerBox/samplerbox.py works fine from the menu.
The only thing is it stays on “loading” screen if ran from the menu, and you can’t close it by pushing menu button. I’ve tried adding some code to address the menu button, but it didn’t seem to help, so I’ll need to investigate some more, then I’ll probably will post the solution here. And any ideas on how to hide “loading” screen? It would be nice to see the command line feedback from the script while it’s running
Fantastic! Yeah, that is definitely a much easier solution, and much more relevant given you’re working with python! Nice work finding that!
Ugh, the dreaded loading screen. I’ve got a similar problem using scummvm, requiring the use of the F5 key to exit/access the system menu. Not easy to do via the gameshell. One solution I’ve been looking at is “xbindkeys” and making a “rage quit kill key combo”, pushing ABXY+SEL+START at the same time; kinda the same as what you could do to soft reset the original Game Boy, mapping it to the magic alt+sysrq key.
If you find a more eloquent solution however, I would love to hear it.
For reference, here are the outputs according to xbindkey
Key code. name. snes mapping
c:111 Up up
c:116 Down down
c:113 Left left
c:114 Right right
c:45 k a (east)
c:44 j b (south)
c:31 i x (north)
c:30 u y (west)
c:46 l shift+a (east) or R2 (outer LK5)
c:43 h shift+b (south) or L2 (outer LK1)
c:32 o shift+x (north) or R1 (inner LK4)
c:29 y shift+y (west) or L1 (inner LK2)
c:65 space select
c:36 Return start
c:9 Escape menu
c:82 KP_Subtract shift+sel
c:86 KP_Add shift+start
c:22 Backspace shift+menu
c:112 Prior shift+L1 (inner LK2)
c:117 Next shift+R1 (inner LK4)
c:110 Home shift+L2 (outer LK1)
c:115 End shift+R2 (outer LK5)
nul nul shift (centre LK3)
I also just found this
Found a way to get rid of loading screen in my case… It’s quite logical to run the script in the terminal, so I changed my .sh file to
xterm -e python /opt/SamplerBox/samplerbox.py. Now I can see the output of the script. The only thing left is to find a way to close the xterm using menu button. This rage quit combo might work, but I still hope to find a way to use menu button
If you make a profile that loads up upon executing your script, you could probably have it bind the menu key to whatever key combo you use to exit. Or the magic key.
(And of course kill the process upon execution)
I was trying to bind
exit in .sh file, but it didn’t work for some reason. could you please tell what kind of profile are you talking about so I can investigate how it can be done?
I also was thinking about adding handling of
Esc in python script, but I think it would be cool to not change the script that much
Not a strict profile per se, but rather just a .xbindkeysrc file mapping the command required. If it’s not something included in the .xinitrc startup, it shouldn’t load with startup, making the menu key still functional.
Just to make things return to normal, include this at the end of the definition, killing xbindkeys:
1. use this command to reset the keyboard shortcuts to default xbindkeys --defaults > ~/.xbindkeysrc 2. Then kill the `xbindkeys` daemon process with the command: killall xbindkeys
The question is, is there a keystroke to exit, if using a full sized QWERTY keyboard?
thanks! I’ll try this as soon as I have some time
and I finally got it to work
my .sh file now looks like this:
#!/bin/bash xbindkeys -f ~/.bindsamplerbox xterm -e python /opt/SamplerBox/samplerbox.py
.bindsamplerbox is like this
"killall xterm" Escape
I know it’s not the most elegant solution, but it works. I also didn’t bother resetting the binding yet, might just add
&& killall xbindkeys to the binding itself if I’ll have any issues
Nice work! Seems elegant to me. This should almost be considered the official way to get samplerbox running on 0.5.
I guess it could be more problematic to kill all xbindkeys if say, you’re using it for anything else. Chances are, if you’re using xterm you run anything else, you’d want a kill switch too.
yeah, that’s why I didn’t bother to reset the mapping. I don’t have anything else for xterm at the moment, but I think it might be handy this way with other apps later
aaaand, I’m back to say that it’s not a good idea to leave the mapping after closing xterm, as it prevents other games to use menu button to exit, so it’s better to add
&& killall xbindkeys to the command executed on Escape
It was mentioned in a tiny note in the 0.4 release, as a dot point. It was very missable! Nice little Easter eggs are littered throughout the image.
I can send you my final files to make it accessible through the UI, if you want. But there’s not much more than discussed in this topic, only the icon is missing here.
Oh, wait. I guess I’m talking to some spam bot or something, as it’s literally part of my first comment in this thread…
Hmm, they could very well be human, seeing as they’ve made a thread before:
But at the same time, I came across as rude to another user in another thread, not replying to their reply.
But on closer inspection, I just noticed the periods are little hyper links! I wouldn’t have noticed this, had you not mentioned responding to a bot. Note that both of them have very similar names.
I loathe bots. Hurm.
Might be a hacked account. There’s another replay in another topic that’s exactly the same as the other comment in the same topic.
yeah, this one is definitely spam
I just got https://github.com/jpetazzo/griode/ working on the clockworkpi in a matter for minutes.
I can do a forum post if anyone is interested !