• @JonB thanks!


    rotated the camera but wrong rotation


    is working and with correct rotation!

    Thank you!

  • @JonB thanks so much, that's perfect.

    @omz can I request that some future minor update to pythonista put the ability to check the build version and the iOS version into some globally available module?

  • @stephen 👍

  • @cvp Fullscreen objc scrollview
    Normaly Yes but this is tied into this lol and that titlebar is givin me a run for my lunch.. we have done the following so far..

    walked SuperViewTree Iterated over objc UIApplicstion Checked layout for all inset values.

    every time i feel close... nothin lol i even think i found a nav view with y set to 70.. but nothingbwith height 70..

  • Is the idea just to use pythonista for the UI bits, and write Swift backends?

    Or vice versa?

    Or just to try out some Swift libraries?

    Swift playgrounds seems to be a place one can play in Swift for rapid prototypes on the iPad.

  • @mikael well, ever since the update, UITableViews are always in the native light theme and I want a native dark theme one. Other than that though... maybe I'm just crazy.

  • @Samer Sorry for the late reply. been working on this one all night.

    my post

    I still dont have the ideal fix for this.. (meaning without overriding present) but am u got three choices..


    Hard setting scrollView() like before..

    self.scrollView = ui.ScrollView( delegate=self, paging_enabled=True, shows_horizontal_scroll_indicator=False, bounces=False, frame=self.bounds, flex='WH', y=20 # ⥢⬅ here ) TWO:

    Hard set inside SetPage..

    def set_page(self, page_number): if page_number < self.pageControl.numberOfPages() and page_number > -1: x = page_number * self.scrollView.width self.scrollView.content_offset = (x, -20) # ⥢⬅ here else: raise ValueError("Invalid Page Number. page_number is zero indexing.") THREE:

    Your favorit override..
    added an instance variable to it though..

    class PageControl(ui.View): def __init__(self, **kwargs): self.titleBarAdjustment=0 # ⥢⬅ here ... #with this guy.. def present(self, **kwargs): # evaluate input before presenting if kwargs['hide_title_bar']: self.scrollView.y=20 #if hide_title_bar then adjust scrollView super(PageControl, self).present(**kwargs) # Continue..

    the second option needs to know if the bar is present otherwise it just has a revers effect to original image issue.. (jumps up)

    im still looking for a beter solution for this. the objc methods were not working last night and im sure it was writers error. but im the mean time at least two of these will hold by maybe?

    as for your other issues..

    Depending on your phone and tabelets they could be explained.

    i suspect that it has todo with Retina scaling and resolution. i have an iPhone 6s and iPad Air 2 and they both have a 2x1 Retina Display so i dont get this issue but id imagine if u has a 2x1 phone and 3x1 ipad it would creat this. all you really need to do if thats the case is check device at runtime and setup Layout accordingly. ui/scene, atleast for 2x1, should auto compensate for this but pil doesnt. just for future info lol.. but by using ui.from_data(data, scale) is where u set scaling for retina convertion. this could help if your dispay happends to be a factor. if i find anything ill let you know!

  • @mikael Thanks I'll look into it.

  • @mikael it works...it isn't feature-complete, and I was unable to figure out how to consistently get the proper animation of items when they are moved to a new location (it doesn't always animate the properties of the moved cell in the right way, or the cell in the new location is displayed before the move animation happens).

    Let me try to extricate the code which is unrelated to the implementation of the UICollectionView from the custom code for my specific purposes. Maybe someone can figure out why my end-move animation is wonky.

  • @mikael in my use case, I'm actually making a Gestures instance per-custom-widget. Since each of my widgets can have 2 or 3 gestures, it is simpler to just let each one have its own Gestures instance and install the various recognizers on each one. Gestures isn't particularly heavyweight, especially without the internal ui.Button instance, and then I don't need any global tracking of who has gestures installed, since when the widget goes away, it takes the gestures instance with it.

    Creating a little handler method in the gesture delegate class, which can be attached to a gesture recognizer is as simple as:

    ...existing gesture delegate definition... def handleGesture_(_self, _cmd, recognizer): import objc_util delegate = objc_util.ObjCInstance(_self) if not delegate: return recognizer = objc_util.ObjCInstance(recognizer) if not recognizer: return gestures = delegate._gestures() if not gestures: return gestures._handleGestureRecognizer(recognizer) methods = [... handleGesture_]

    Then, where you make the recognizers, instead of the whole button action thing, with all the associated bookkeeping:

    recognizer = \ objc_util.ObjCClass(recognizer_type).alloc() recognizer.initWithTarget_action_(self._delegate, objc_util.sel("handleGesture:")).autorelease() view.objc_instance.addGestureRecognizer_(recognizer)
  • @cvp no, somehow that did not appear when I searched for UICollectionView. Probably would have if I'd searched more deeply...that looks promising.

    @mikael I promise to provide an example for whatever I end up with.

  • Change the language to Swift on Apple’s docu pages and you will see the values (in this case anyway).

  • @b0hr see @JonB real original code

    which is the first line of the script linked by your "original code"

  • @cvp yep...just realized that must be the reason, since CGFloat can be 32 or 64 bits, so isn't always compatible with a float.
    I just changed things to this:

    CGFloat_p = ctypes.POINTER(objc_util.CGFloat) CGGradientCreateWithColors = objc_util.c.CGGradientCreateWithColors CGGradientCreateWithColors.restype = c_void_p CGGradientCreateWithColors.argtypes = [c_void_p, c_void_p, CGFloat_p] locations = (objc_util.CGFloat * 2)(0.0,1.0) gradient = CGGradientCreateWithColors(colorSpace, objc_util.ns(colors), ctypes.cast(locations, CGFloat_p))

    and of course it works fine now. Should have realized that right away. I'll update the original thread as well.

  • @JonB regardless of the troubles I was having...that objc decorator idea is brilliant, and ought to be rolled into objc_util.

    re: my problems with pyObject being crashy. After going over the way my code was executing, I rearranged things to be absolutely certain that all attempts to access internals via pyObject() and cast() were within a @on_main_thread...and that seemed to finally make it stable. So, though I'm not entirely clear where it was going wrong, somewhere at least one of those calls was being made outside the main thread, and was therefore making the whole thing unstable at any future call.

  • Hey thank you everyone.

    I must have had a typo when I initially posted this - but it seems to work now.

    Notes: I used ui.parse_color('blue').CGColor()

    This works with RGBA, Hex and Named Colors.

    Ill post the code when done, I am using this to create custom button styles, along with some custom styles for "checkbox" functionality (circles, squares, stars, etc)

    Thanks again for your help!

  • @shinyformica, thanks. I will include the weakref version.

    I was also wondering if you had some globals-clearing code somewhere. Remembering some previous threads where the goal was to make Pythonista act like a fresh interpreter starting every time you run a script.

Internal error.

Oops! Looks like something went wrong!