Skip to content

Instantly share code, notes, and snippets.

@steventroughtonsmith
Last active July 24, 2021 06:17
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save steventroughtonsmith/ad7eda38c797dfddc394 to your computer and use it in GitHub Desktop.
Save steventroughtonsmith/ad7eda38c797dfddc394 to your computer and use it in GitHub Desktop.
'Show Tab Overview' script for Pythonista - adds button to toolbar to show tab overview
# coding: utf-8
from objc_util import *
UIApplication = ObjCClass('UIApplication')
UIBarButtonItem = ObjCClass('UIBarButtonItem')
@on_main_thread
def main():
rootVC = UIApplication.sharedApplication().keyWindow().rootViewController()
tabVC = rootVC.detailViewController()
tabVC.tabCollectionView().collectionViewLayout().itemSize = CGSize(328,200)
tabVC.tabCollectionView().contentInset = UIEdgeInsets(58,0,0,0)
overviewItem = UIBarButtonItem.alloc().initWithImage_style_target_action_(UIImage.imageNamed_('ShowTabs'), 0, tabVC, sel('showTabOverview:'))
tabVC.persistentLeftBarButtonItems = [overviewItem]
tabVC.reloadBarButtonItemsForSelectedTab()
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment