Comments (3)
- I don't know anything about Objective-C, Swift or iOS app development, if this involves more than getting/setting the
history
property (?) then I may be the wrong person for the job:)
- I'm quite certain that interactive Python input does not go through normal stdin in any way, so I'm not sure what a stdin hook would be. (And would it be necessary if the history list is accessible via
objc_util
?) Of course "commands" can be implemented by sayingbuiltins.save_history = object()
and making the displayhook react specially to that, but then you might as well make it a normal function. - Last I checked Pythonista wouldn't run
atexit
s, I'll need to check that though. (Edit: still doesn't, tested withatexit.register(lambda: open(os.path.expanduser("~/Documents/atexit_test.txt"), "wb").close())
.)
from pythonista_startup.
I thought in a recent beta that atexit was supported, though I don't think it runs when killed by the os for memory reasons, or when crashing, so maybe has little value.
I thought you had done some work monkey patching the _stdoutcatcher, but maybe my memory is fuzzy. My thinking would be to log to a file each console command as it is run, then restore in startup. I am not sure if there is another "standard" method to hook into console commands? I guess, for example, whenever you append to Out, we could store the new history commands....
Okay, I guess I know where to look now.
from pythonista_startup.
Ah, atexit
hooks run when you do sys.exit()
, not when the app exits.
What I did "back then" was related to the autocompletion in the interactive console. Before Pythonista 2 the completion list was built by injecting a bit of Python code that printed the completions to stdout
, which was then captured by Pythonista and shown in the completion list. I managed to patch that so it would show a custom suggestion at the top of the list every time, but there was no way to get the full text of the partial line typed at that point (and no way to tell whether stdout was currently in "normal" or "autocomplete list" mode, so any patching may also have affected normal output).
from pythonista_startup.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pythonista_startup.