omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    [Solved]Pythonista built in images, index access Vrs named

    Pythonista
    1.6 images
    3
    15
    9940
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Phuket2
      Phuket2 last edited by Phuket2

      Does anyone know if there is anyway to iterate through the built in images. If possible, I guess it would not be a single index. But a category, index something like that.
      Just asking. My main reason for asking is just for getting random images for testing without having to define the names in a list and picking a random item from the list etc...

      1 Reply Last reply Reply Quote 1
      • ccc
        ccc last edited by

        import os
        app_path = os.path.abspath(os.path.join(os.__file__, '../../../..'))
        os.chdir(app_path + '/Textures')
        print('\n'.join(os.listdir(os.curdir)))
        
        1 Reply Last reply Reply Quote 2
        • Phuket2
          Phuket2 last edited by

          @ccc, thanks so much. It is so cool, almost every problem/issue/want to have , seems to have a solution. I am sure you can access them in a similar way in 1.5 , maybe exactly the same way. In 1.6 I have noticed that the naming of the in built images has changed to something like 'iob:something' or 'cards:something' . I am guessing underneath somewhere @omz is planning to release a Module with dictionary access to these assets.
          But what you have given is great. Can still filter etc... But it means more mess out of more testing code which is great!

          1 Reply Last reply Reply Quote 1
          • ccc
            ccc last edited by ccc

            app_path = os.path.abspath(os.path.join(os.__file__, '../..'))        # Pythonista v1.5
            app_path = os.path.abspath(os.path.join(os.__file__, '../../../..'))  # Pythonista v1.6 Beta
            

            When a post solves your issue, you should click that ^ at the upper right of the answer post. I do have my reputation to consider.

            1 Reply Last reply Reply Quote 1
            • Phuket2
              Phuket2 last edited by

              ^ done, with kisses.
              Joking aside, I do get it.

              1 Reply Last reply Reply Quote 0
              • ccc
                ccc last edited by ccc

                The second part of your title sticks in my head: index access v.s.named...

                I find that when I want a random element from a sequence (tuple, list, dict, etc.) I always tend to favor random.choice() over messing with indexes.

                Phuket2 1 Reply Last reply Reply Quote 0
                • Phuket2
                  Phuket2 @ccc last edited by

                  @ccc , yes, this is the way for those who have worked out how to do repos :)

                  1 Reply Last reply Reply Quote 0
                  • ccc
                    ccc last edited by ccc

                    those who have worked out how to do repos :)

                    Are you asking for a 12 step program?!?

                    1. In Pythonista, click in your latest script and do "Select All".
                    2. Click again and do "Copy".
                    3. Hit the Home button and switch to Safari.
                    4. Go to your old code in your Github repo.
                    5. Click the pencil icon at the upper right of your old code.
                    6. Click in your old code and do "Select All".
                    7. Do "Paste".
                    8. Scroll down below your code underneath the "Commit Changes" label.
                    9. Enter a brief description of the changes made.
                    10. In the box below that, write a more detailed description of the changes made.
                    11. Click the "Commit Changes" button.
                    12. You might have to repeat 11 on the next screen if you are not the owner of the repo (I.e. You are creating a Pull Request).


                    Try these 12 steps to update your VirtualViews repo and let me know if they work for you.

                    Phuket2 JonB 2 Replies Last reply Reply Quote 1
                    • Phuket2
                      Phuket2 @ccc last edited by

                      @ccc , i can see I frustrate you sometimes. But it's ok, frustrating people are often interesting people :)

                      Yes, I know how to create a manual repo. Maybe my problem is that I have been trying to automate the whole thing. Also dealing with pulls, merges etc... Worry me

                      But I will create a manual one and see how I go. No VirtualView at the moment though. In culinary terms it's deconstructed at the moment :).

                      I am on focusing only on the cell at the moment. Threaded and not. With the idea that the cell could be used in other containers other than just in a scrollview.

                      I don't think you or JonB will like it ;) But I have to try what I think also.

                      But will try to make a repo of that today or tomorrow.

                      I also will switch to choice :)

                      1 Reply Last reply Reply Quote 0
                      • ccc
                        ccc last edited by ccc

                        I am actually seldom frustrated. My writing might give the wrong impression but I am quite laid back. The nice thing about a repo is that you can always temporarily add a VirtualView_deconstructed.py to allow others to to look over your shoulder as you experiment. A few daze later when you have it sussed out, you can fold the changes into the main file and delete VirtualView_deconstructed.py.

                        Enjoy... CCCs

                        Phuket2 1 Reply Last reply Reply Quote 0
                        • Phuket2
                          Phuket2 last edited by Phuket2

                          Even, my best friends will tell you I am frustrating :) oh, yes, choice is a lot easier, thanks :)

                          1 Reply Last reply Reply Quote 0
                          • Phuket2
                            Phuket2 @ccc last edited by

                            @ccc , btw, I didn't mean it in a bad way. If you didn't care, you will just not speak at all :) I really do get your meaning. As I say, I have friends from all around the world, they all communicate a little differently, written and verbal. I like you care enough to tell me! Silence is not always golden :)
                            I am a respectful and decent person.from what I have seen, so are most if not all the people here, even the 13 and 14 yr olds. Great to see!

                            1 Reply Last reply Reply Quote 0
                            • JonB
                              JonB @ccc last edited by

                              @ccc
                              12 steps?
                              In stash this is 4 steps or less

                              1. type git add VirtualView_deconstructed.py
                              2. type git commit
                              3. type username, email, and commit message when prompted (this could have been included in step 2)
                              4. type git push

                              In gitview:

                              1. click the + button for each changed file.
                              2. type a commit message, and press commit
                              3. press the push button.

                              (though i dont necessarily recomment gitview right now until i update the way branching works, and implement fetch/merge. right now it only includes pull, which gets hosed unless you are diligent about always pulling before committing new work, and pushing after committing, and not making changes on the remote in between... git in stash supports fetch/merge for the times when you have not been careful)

                              1 Reply Last reply Reply Quote 0
                              • ccc
                                ccc last edited by

                                You guys missed my humor for my drinking buddy. Even if it took 3 steps or 20 steps, I would have made it a 12 step program.

                                Git is awesome but it has way too many modes and options. I like the web approach that I described above because it all happens in front of me on a ui that I can look at each step of the way.

                                On the Mac I use PyCharm to check in/out of repos and it works almost every time but it is not as bulletproof as the manual approach described above.

                                Phuket2 1 Reply Last reply Reply Quote 0
                                • Phuket2
                                  Phuket2 @ccc last edited by

                                  @ccc , I didn't miss or trip over the 12 step AA humour :)
                                  Look really, I know it seems so easy for you guys. And I am sure it will be easy for me one day also. Hard to put yourself in a place of not knowing something you know so well sometimes.
                                  Ask Stephen Hawkings to explain the universe to you, from at point of view he knows nothing about it. Hmmm, we he tried...failed big time in my opinion. He wrote a book about the Big Bang for beginners. I read it. I have always meant to write to him about that one!

                                  1 Reply Last reply Reply Quote 0
                                  • First post
                                    Last post
                                  Powered by NodeBB Forums | Contributors