• cvp

    @ihf I think it is the same for Shortcut as for Pythonista: a background run of a small non-UI script is only possible in Siri. In all other cases the full app is launched in foreground.

    posted in Pythonista read more
  • cvp

    @JoanneWillian I use it on an iPad mini 4, see here for all functionalities

    posted in Pythonista read more
  • cvp

    @ihf I think that is almost always possible to write a Pythonista script which performs the same process as a Shortcut script.

    posted in Pythonista read more
  • cvp

    @ihf That would say that Shortcut app would run in background...

    posted in Pythonista read more
  • cvp

    @JonB That' what I do when I need such a function but he hoped a better way...

    posted in Pythonista read more
  • cvp

    @JonB I think that @shinyformica hopes to find a way to use functions like without be obliged to define them entirely.
    As we can use any method of a class/instance (found by dir).

    posted in Pythonista read more
  • cvp

    @shinyformica Never found a standard way but always found a workaround like

    CGRect(CGPoint(x,y), CGSize(w, h)) is similar to CGRectMake(x,y,w,h)
    

    posted in Pythonista read more
  • cvp

    @djl or

    import ui
    import time
    import dialogs
    from objc_util import *
    
    def open_in_with_specified_activities(path_in,uiview):
        global handler_done,SUIViewController_service
        handler_done = False
        SUIViewController_service = None
        def handler(_cmd,obj1_ptr,_error):
            global handler_done,SUIViewController_service
            # obj1_ptr = None if no service selected
            if obj1_ptr:
                obj1 = ObjCInstance(obj1_ptr)
                SUIViewController_service = str(obj1)
            handler_done = True
            return
    
        vo = ObjCInstance(uiview)
        SUIViewController = ObjCClass('SUIViewController')
        root_vc = SUIViewController.viewControllerForView_(vo)
        main_view = root_vc.view()
        handler_block = ObjCBlock(handler, restype=None, argtypes=[c_void_p, c_void_p, c_void_p])
        if type(path_in) is list or type(path_in) is tuple:
            path = path_in
        else:
            path = [path_in]        
        url_array = []
        for elem in path:
            url_array.append(nsurl(elem))
        UIActivityViewController = ObjCClass('UIActivityViewController').alloc().initWithActivityItems_applicationActivities_(url_array,None)
        
        UIActivityViewController.setCompletionWithItemsHandler_(handler_block)
            
        UIActivityViewController.popoverPresentationController().sourceView = main_view
        UIActivityViewController.popoverPresentationController().sourceRect = CGRect(CGPoint(10,10), CGSize(uiview.width,uiview.height))
        
        root_vc.presentViewController_animated_completion_(UIActivityViewController, True, None)
                    
        while not handler_done:
            time.sleep(1)
        
        if SUIViewController_service == None:
            SUIViewController_service = 'None'  # for checking at return and use in alert       
        
        return SUIViewController_service
        
    v = ui.View()
    v.frame = (0,0,600,400)
    v.background_color = 'white'
    v.present('sheet')
        
    service = open_in_with_specified_activities('sample.gpx', v)
    print(service)
    v.close()
    

    posted in Pythonista read more
  • cvp

    @djl In this case, is this not sufficient ?

    console.open_in(file_path)
    

    posted in Pythonista read more
  • cvp

    @ccc Sincerely, what do you think about the functionality?

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!