• KalyJupiter

    There are issues with commenting/uncommenting in python files with unicode characters. I obtained the following crash after a tablet hard reset, opening pythonista, and trying to uncomment the 3 highlighted lines via the keyboard shortcut (cmd+/). I do use quite a few unicode chars in my script, such as 𐄙, 𐄚, 𐄛, 𐄜, Ω, and have noticed from some time that it messes up commenting/uncommenting blocks of code, but this is the first actual crash I encounter.

    (I don't know how else to attach some pics here)

    the error encountered
    the stack trace

    posted in Pythonista read more
  • KalyJupiter

    yep, that worked :D I put it on attach

    @on_main_thread
    def attach(self):
    

    now that Overlay is awesome for a quick settings screen :)

    posted in Pythonista read more
  • KalyJupiter

    @dgelessus awesome scripts :D
    @JonB the above main body I placed in overlay.py and simply ran the file ( after correcting the name issue )

    Fatal Python error: Aborted
    
    Current thread 0x000000016e117000 (most recent call first):
    
    ------------------------------------------------------------------------
    
    Objective-C exception details:
    
    NSInternalInconsistencyException: Only run on the main thread!
    
    Stack trace:
    
    0   CoreFoundation                      0x000000018316fd50 <redacted> + 148
    1   libobjc.A.dylib                     0x0000000182684528 objc_exception_throw + 56
    2   CoreFoundation                      0x000000018316fc0c <redacted> + 0
    3   Foundation                          0x0000000183afec90 <redacted> + 88
    4   UIFoundation                        0x000000018d64a70c <redacted> + 1008
    5   UIFoundation                        0x000000018d64a194 <redacted> + 1672
    6   UIFoundation                        0x000000018d656de8 <redacted> + 168
    7   UIFoundation                        0x000000018d647494 <redacted> + 4628
    8   UIFoundation                        0x000000018d647f30 <redacted> + 196
    9   UIFoundation                        0x000000018d648640 <redacted> + 340
    10  UIFoundation                        0x000000018d6513b0 <redacted> + 2180
    11  UIFoundation                        0x000000018d67aed0 <redacted> + 332
    12  UIFoundation                        0x000000018d6a0528 <redacted> + 160
    13  UIKit                               0x000000018d1cd658 <redacted> + 524
    14  UIKit                               0x000000018c5c4eac <redacted> + 248
    15  UIKit                               0x000000018c57c000 <redacted> + 1256
    16  QuartzCore                          0x000000018714d0b4 <redacted> + 184
    17  QuartzCore                          0x0000000187151194 <redacted> + 332
    18  QuartzCore                          0x00000001870bff24 <redacted> + 336
    19  QuartzCore                          0x00000001870e6340 <redacted> + 540
    20  QuartzCore                          0x00000001870e7180 <redacted> + 92
    21  CoreFoundation                      0x00000001831178b8 <redacted> + 32
    22  CoreFoundation                      0x0000000183115270 <redacted> + 412
    23  CoreFoundation                      0x00000001830362f8 CFRunLoopRunSpecific + 468
    24  Foundation                          0x0000000183a5e6e4 <redacted> + 304
    25  Foundation                          0x0000000183a7dafc <redacted> + 96
    26  Py3Kit                              0x0000000102687508 -[PYK3Interpreter setupInterpreterThreadRunLoop] + 252
    27  Foundation                          0x0000000183b5f860 <redacted> + 996
    28  libsystem_pthread.dylib             0x0000000182d9c32c <redacted> + 308
    29  libsystem_pthread.dylib             0x0000000182d9c1f8 <redacted> + 0
    30  libsystem_pthread.dylib             0x0000000182d9ac38 thread_start + 4
    
    End of exception details.
    

    posted in Pythonista read more
  • KalyJupiter

    That Overlay class is quite nice :) I'll keep it around for later, but it does have some quirks:

    for one, the below crashes when trying to set the .text:

    if __name__=='__main__':
        view = ui.View()
        view.frame = (0, 0, 240, 240)
        view.flex = 'WH'
        view.background_color = 'white'
        valuefield = ui.TextField()
        valuefield.frame = (120, 34, 120, 34)
        valuefield.text = "ana" # ⇒ crashes Pythonista
        view.add_subview(valuefield)
        o=Overlay(content=view,parent=AppWindows.root())
    

    posted in Pythonista read more
  • KalyJupiter

    cheers, I found the beta signup form :)

    and I'm not worried about exiting the loop

    posted in Pythonista read more
  • KalyJupiter

    go through the whole Examples folder and run everything - that's how I got started :)

    posted in Pythonista read more
  • KalyJupiter

    that update_interval looks much cleaner :) but I don't have access to the beta, didn't know there was one.

    on the other hand I needed the full console because I don't have the screen real-estate for an in-view text box - and then there's the amount of logs I go through when I do check the console…

    hiding the view temporarily to check the logs was just what I was looking for :)

    posted in Pythonista read more
  • KalyJupiter

    I've actually, wonderfully, found what I was looking for, by accident, with the following setup:

    button.present('popover')
    button.action ⇒ view.present()
    view::button_item.action ⇒ view.alpha = 0 ⇒ clean, transparent view to the console log

    without the initial popover button, setting view.alpha = 0 results in a black, opaque screen.
    seems the popover enables something specific for transparency…

    here's a working example:

    import ui
    import time
    
    view = ui.View()
    view.frame = (0, 0, 240, 240)
    view.flex = 'WH'
    view.background_color = 'white'
    
    def alphaaction(sender):
        print(view.alpha)
        if view.alpha == 1.0:
            view.alpha = 0.0
            sender.tint_color = 'red'
        else:
            view.alpha = 1.0
            sender.tint_color = 'black'
    
    alphabutton = ui.ButtonItem()
    alphabutton.action = alphaaction
    alphabutton.title = 'alpha'
    alphabutton.tint_color = 'black'
    view.right_button_items = [alphabutton]
    
    button = ui.Button()
    button.action = lambda x: view.present()
    button.frame = (0,0,40,40)
    button.background_color = '#9cd8a1'
    
    
    if False:
        view.present() # => black screen
    else:
        button.present('popover') # => transparent screen
    
    @ui.in_background
    def run():
        k = 0
        while True:
            print("### test", k, "###")
            k += 1
            time.sleep(0.5)
            
    run()
    

    posted in Pythonista read more
  • KalyJupiter

    Hi, how can I present a view fullscreen and also check the console from time to time ?

    I've tried view.present('panel') to get the view in a separate tab alongside the console tab, but the trouble with this is that I write to the console constantly (every second or so), and Pythonista keeps changing my tab to the console one at each print - How do I get rid of that behavior, it's annoying as hell

    I've also tried presenting normally, and changing the view's alpha from a ButtonItem action to see the underneath console, but I get a black screen instead, so how could I make the presented view actually transparent ?

    right now I'm stuck with the following setup: a small button presented as 'sheet', that when clicked presents the fullscreen view - when I need to check the console logs I close the view and then I re-present it from the sheeted button...

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!