weixin_39909212
weixin_39909212
2020-12-08 21:35

Adjusting Visible View to Window Size callback and or flex attrs?

SplitView has been around for some time but I have not been using it. When a View is displayed as a sheet, and the Window is resized due to splitting appears Pythonista does its own calculations to resize the view. It seems to me that like there is a layout callback method, there should be a callback method that is called before layout so you can size your view based on the new Window size rather than Pythonista doing it. It could also be nice if in addition you could set flex attrs for resizing, maybe the smartest way. Sorry if this has been brought up, as it seems like it would have been. I searched, but could not find any entries for this subject.

该提问来源于开源项目:omz/Pythonista-Issues

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

4条回答

  • weixin_39612499 weixin_39612499 5月前

    I probably don't understand it well. You would like to have callback just before layout, so, you can resize view there instead of layout, which, according to your requirement, will be called immediately after this callback? Then why not to resize it in the layout?

    点赞 评论 复制链接分享
  • weixin_39909212 weixin_39909212 5月前

    , you are right I guess. There is no real reason to have the 2 callbacks. The first thing that needs to be changed is to be able to change the size of the view after its presented. As far as I know this is not possible at the moment. All the resizing is being done by Pythonista when the window resizes. The reason I mentioned a new callback, it would just be more inline/natural with the current way of doing things. Whilst they can be combined, they are 2 different distinct events. Oh, actually, if the Window resize event occurs, does not necessarily mean your layout code needs to be called. Only if decide resize your view. But regardless the way its implemented we need a way to change the size of a presented view. Not sure why this has not been possible in the past. If its a technical issue or a design decision by .

    点赞 评论 复制链接分享
  • weixin_39538962 weixin_39538962 5月前

    To summarize, the real issue, as you point out i think, is that sheets cannot be resized after presenting, without resorting to objc, and that there is some automatic sizing to ensure the view fits on screen (if not, it resorts to a default size).
    For instance, if you present a sheet that is wider than 760 in landscape, then switch to portrait, it is resized to 540x576, then is stuck at that size.. layout is called, but you cannot resize the frame. I am guessing something similar is happening for splits? if frame was adjustable after present, you could check the window size in layout and adjust if needed.

    (does screen_size return the size of the split screen, or device size?)

    点赞 评论 复制链接分享
  • weixin_39909212 weixin_39909212 5月前

    , screen_size is the device screen, window_size is the split window size

    点赞 评论 复制链接分享

相关推荐