-
-
Notifications
You must be signed in to change notification settings - Fork 455
Use JsonLibrary to Parse object, and replace ProcessStartInfo.Arguments with ArgumentList #464
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
Conversation
… new api to allow auto escape
…hen calling callback
|
@AnthonMS I will be afk soon, so if you would like to test it earlier, you can check out the ci build artifact directly after it has done its job. |
|
I will continue the conversation here, I don't know which issue is the correct to use. |
Just discuss here no problem. The log is weird, which should only happens if your python path is not set correctly in Flow. Would you please check the Python Path setting in Flow? |
Oh that can make sense, I tested it on another pc. And I don't know if python path i correct on this pc. I will test again when I'm home on my personal computer again. I know the python path is correct on that. Sorry about that. |
|
No problem. If python is installed, you can checkout the python path by typing |
Oh I didn't know about that command on windows, thanks. I do have python installed and it does find it in my path. Output: |
Try setting them in Flow's setting? Not include the exe like |
Is that the settings.json in the appdata/roaming/FlowLauncher/Settings folder? and is it this setting: This is the only place I can find anything named python in the settings.json file |
|
Yes, you are right, but I guess it would be more easy to directly set this with Flow's setting window hhh |
This is definitely a stupid question, but what do you mean? Haven't used Flow's setting window before. |
|
Thank you! I appreciate all the help to a newcomer like me. Sorry I keep finding new bugs xD But it actually looks like it works now. It at least created the test.txt file and wrote the line in it. I do get a single line error when executing the query. I don't know if that's something I am doing wrong or just some output you have set to show for now. |
|
Thank you as well! Finding and fixing bugs are what we always need to encounter when building a better program! Thank you so much for helping us discovering these bugs that exist in our python plugin system!
This is not quite a significant bug, and if you like, you can ignore it. If you would like to remove this warning, simply create another message back at the end of the callback method as what's been done in the query method. This is used for executing Flow's API after finishing up the callback method. |
I'm really just happy to help. I was so close to loosing interest, but you guys have been more than helpful with my issues. And have been nice to talk to. So I will help as much as I can. I will probably try to stitch some kind of documentation together for Python Plugin development when I have gotten it to work. But I have never made pull requests to larger projects before, so expect an issue/question about that in the near future :)
There will be some instances where I will wan't to do that, but for now it's fine. But I will go home and play around with it later, now that I can finally get something working. Just excited to see if I can get the FlowLauncherAPI to work. So when the user selects a certain query, it will call the FlowLauncherAPI.ChangeQuery function. But you have already mentioned you don't know how to invoke the API functions from python. So I will just play around with the syntax. |
|
Sure. Remember to reach out if you find something weird happens. Even though I am not sure what's the right way to do that, the understanding of how Flow deal with certain callback messages makes me easy to understand what's going wrong. |
|
@taooceros Every time I write something in Flow Launcher, I get some errors that I dont know why are coming. I'm not certain it has anything to do with my specific plugin though. It does execute the function correctly but no matter if I set the "dontHideAfterAction" to false or true, it still displays the flow launcher. I would like to close it down when the query is selected.
And regarding what you said earlier about I could send another message back at the end of the callback. How do I do this, I'm not quite sure I am following what needs to be done. |
|
I do think this exception is causing some problems though: |
|
Okay now I got it to close after the query is clicked. But that's not the function I was trying to figure out. Now I am trying to figure out the FlowLauncherAPI change query function, and no matter how the syntax is or where I call the funtion, it just closes the launcher. No error messages in the logs. (Or there where error messages when I had the wrong syntax and it couldn't find the function. So it can apparently find the flowlauncher api functions and calls them, but it closes the launcher. This is the script. I have also tried by calling the "this_is_a_test_function" with line 37 uncommented. And it has the same result. |
|
@taooceros @jjw24 And I can also say now that I am testing some more, there is something very wrong with everything. Why is the title the same on the 2 queries when you can see in the code that it should be different. You can see this in the screenshot I have attached. The code should return a query with title "Get Entities" and another query with title "Get States" But both of them has the title "Get States". And I have also tested the HelloWorldJavascript and HelloWorldTypescript plugin, and they are not even working at all. A ton of errors are thrown in the log files, that I will not even try to mention, because then we can start a new with those languages. I think you guys need to test some more on your own with these plugins made in python, javascript, typescript and the others. Because I think I have given up trying to get this to work, at least with python or any of the other languages, except C#. (And I have no idea how to set up a development environment in C# for this. So unless you can point me to some documentation to do this, then I won't even try that on my own.) Unless we can set up some kind of workshop over discord in the weekend, where we can do this together. Because this process is taking too much of my time without getting any closer to getting anywhere really. Timezones don't matter. I can stay up late in the weekend. But you really need to look into the api with the different languages, except C# since I imagine this is the only working language to create interactable plugins in at the moment. I'm sorry I'm not more helpful, but this project is just not that important to me. I would love to help! Don't get me wrong, but I also have other stuff going on and this process is just too tedious to keep doing. Because every time you guys fix a bug I find, a new bug pops up, and it's not even because I'm trying to do anything crazy. I'm just trying to do as I'm supposed to. But again, if you wanna fix all these bugs while talking on discord, so we can get some actual work done, I'm down. Just give me time and place :) |
Hi, I just get up. This error is not supposed to be thrown. Don't care about it. |
Thank you so much for your help! Don't give yourselves so much pressure. Sorry that I believe one of our previous change has brought too much bugs than our expected. Give me a few time to check what's going wrong. |
I found the issue for this. It is not Flow's bug, but the template bug. The template uses the same reference for Template for every single message, which results in that if you would like to send two message with the template, it will not work as you expected. You can solve it by adding .copy() after referencing the TEMPLATE. |
|
I will leave a pr there to fix it. |
|
Unable to hide is my bad. I forget to add that property name with our last fix. |
There's some issue with the new Json Library that won't immediately change the value type, which makes invoking kindly hard. I will try to find a solution toward that. (Also, there's some hard-coding issue there and I will post the fix as well). |
|
@AnthonMS There's already a deepcopy in @Zeroto521 's Python Template😂😂 |
|
I post the fix for executing callback in #466. Sorry for the various bug brought by Json Library Change |
|
Sorry about my frustration yesterday. I just felt so lost. The deepcopy is obviously my bad, I was trying to make it easier to work with for my own sake while testing. I also felt like it was weird it had the same title and action, since it was working before I started using the template and just made the json objects from scratch in the beginning. I was not sure how the deepcopy worked, but I set the template json in the first call, so obviously it is already set in the second, I could have told myself that, if I had just used some common sense instead of just giving up immediately. Again, I'm sorry about my long rant. I have not given up yet, and will try again tonight. Thanks for the help! |
I'm so dumb.... 😂 |
|
@taooceros or @jjw24 I was wondering if I can find artefacts with hotfixes myself, or you guys have to compile it and upload? Because I don't want to be burden more than I already have, but I would love to test these new fixes from #466 |
Yes, you can. Here's the link. https://ci.appveyor.com/api/buildjobs/kwpa3s1trlsculid/artifacts/Output%2FPackages%2FFlow-Launcher-v1.7.2.exe Here's where you can find the artifact for pull request. |
Finally got time to test out the hot fix you posted in last comment. It seems as if it's still not hiding flow launcher when I set the "dontHideAfterAction" to False. I do not get any errors in the log and the function is still executed. And I still can't get change query function to work. I have tried both this approach: When I do the last option, it just closes the launcher, and the first option, nothing happens and no errors are thrown in the log. Here is the script. I will come back in a couple months and hopefully these issues has been addressed, tested and known to work by that time. |
|
Hmmm it's not working? That's weird, because I do successfully change the query. I will check it again. Anyway, thank you so much for all the time spending on this. We are sorry that our release version contains so much bugs for python plugin that wasn't discovered before. It's time to write more unit test. |
|
@AnthonMS My bad, I make one logic wrong. So the DontHideAfterAction only works when you have a reply for callback method.
It close the launcher, but also change the query. |
What kind of reply is it listening for? Because I tried some different return strings and objects and it didn't seem to make a difference. |
You're welcome, I have enjoyed helping you guys. And I will still do some more testing when I have more free time. |
You will need to print out the resulted json value. I will modify the template to make that process easier. That will only be useful when you would like to execute Flow api after executing the callback method. |
action = copy.deepcopy(ACTION_TEMPLATE)["JsonRPCAction"]
action["method"] = "Flow.Launcher.ChangeQuery"
action["parameters"] = ["ha new test query", False]
print(demjson.encode(action))Something like this. Let me try to make the library do that easier. |





Related to Later discussion in #461