Ejemplo n.º 1
0
def searchBarTextDidBeginEditing_(sel, cmd, searchBar):
    s = ObjCInstance(sel)
    sb = ObjCInstance(searchBar)
    sb.becomeFirstResponder()
    sb.position = CGPoint(sb.position().x, (-sb.size().height) + 40)
    if s.resultController.firstRun:
        s.resultController.tableView().position = CGPoint(
            s.resultController.tableView().position().x,
            s.resultController.tableView().position().y - 40)
        s.resultController.firstRun = False
Ejemplo n.º 2
0
    def __init__(self, tableView, filterData, *args, **kwargs):
        ui.View.__init__(self, *args, **kwargs)
        frame = CGRect(CGPoint(0, 0), CGSize(self.width, self.height))
        self.tv = tableView
        self.tableView = ObjCInstance(self.tv)
        flex_width, flex_height = (1 << 1), (1 << 4)
        self.tableView.setAutoresizingMask_(flex_width | flex_height)
        sd = createSearchDelegateClass()
        self.searchDelegate = sd.alloc().init().autorelease()
        self.searchDelegate.filt = filterData
        searchBar = UISearchBar.alloc().init()
        searchBar.setPlaceholder_(ns('Search'))
        searchBar.setDelegate_(self.searchDelegate)
        #searchBar.setShowsBookmarkButton_(ns(True))
        searchBar.setShowsCancelButton_(ns(True))
        #searchBar.setShowsSearchResultsButton_(ns(True))
        #searchBar.setScopeButtonTitles_(ns(['test1','hi']))
        #searchBar.setShowsScopeBar(ns(True))

        self.tableView.setTableHeaderView_(searchBar)
        searchBar.sizeToFit()

        self_objc = ObjCInstance(self)
        self_objc.addSubview_(self.tableView)
        self.tableView.release()
Ejemplo n.º 3
0
 def did_pan(self, data):
     o = data.translation
     self.rv.transform = self.rv.transform.concat(
         self.rv.transform.translation(*o))
     self.iv.transform = self.iv.transform.concat(
         self.iv.transform.translation(*o))
     self.p = CGPoint(0, 0)
     self.pan.setTranslation_inView_(self.p, self.pan.view())
Ejemplo n.º 4
0
 def __init__(self, player, *args, **kwargs):
     ui.View.__init__(self, *args, **kwargs)
     if type(player) == Player:
         self._layer = AVPlayerLayer.playerLayerWithPlayer_(player._objc)
         self.player = player
     else:
         raise TypeError('Must be a Player item')
     self._layer.setVideoGravity_('AVLayerVideoGravityResizeAspect')
     self._rootLayer = ObjCInstance(self).layer()
     self._rootLayer.setMasksToBounds_(True)
     self._layer.setFrame_(
         CGRect(CGPoint(0, 0), CGSize(self.width, self.height)))
     self._rootLayer.insertSublayer_atIndex_(self._layer, 0)
Ejemplo n.º 5
0
    def __init__(self, *args, **kwargs):
        # todo: おまじないになっとる
        super().__init__(self, *args, **kwargs)
        self.bg_color = 'red'
        self.selfIns = ObjCInstance(self)

        initFrame = CGRect(CGPoint(0, 0), CGSize(self.width, self.height))
        # fullViewSize
        flex_w, flex_h = (1 << 1), (1 << 4)

        uiTextView = ObjCClass('UITextView').alloc()
        self.uiTV = uiTextView
        self.uiTV.initWithFrame_(initFrame)
        self.uiTV.setAutoresizingMask_(flex_w | flex_h)
        self.uiTV.returnKeyType = 10
        self.selfIns.addSubview_(self.uiTV)
Ejemplo n.º 6
0
 def __init__(self):
 # Setup SKView
     screen_size = ui.get_screen_size()
     rect = CGRect(
         CGPoint(0, 0),
         CGSize(screen_size[0], screen_size[1]))
     skview = SKView.alloc().initWithFrame_(rect)
     # debug
     skview.showsFPS = self.debug
     skview.showsNodeCount = self.debug
     skview.showsPhysics = self.debug
     ObjCInstance(self).addSubview(skview)
     self.skview = skview
     scene = DemoScene.sceneWithSize_(rect.size)
     scene.backgroundColor = UIColor.color(red=0.2, green=0.5, blue=0.2, alpha=1.0)
     skview.presentScene_(scene)
     self.scene = scene
Ejemplo n.º 7
0
def searchBarTextDidBeginEditing_(sel, cmd, searchBar):
	s = ObjCInstance(sel)
	sb = ObjCInstance(searchBar)
	sb.becomeFirstResponder()
	sb.position = CGPoint(sb.position().x,sb.size().height*2-2)
Ejemplo n.º 8
0
def searchBar_textDidChange_(sel, cmd, searchBar, searchText):
	s = ObjCInstance(sel)
	if s.resultController.firstRun:
		s.resultController.tableView().position = CGPoint(s.resultController.tableView().position().x, s.resultController.tableView().position().y-40)
		s.resultController.firstRun = False
Ejemplo n.º 9
0
	def __init__(self, tableView, filterData, selectCallBack, theme_manager, soofflineSelectCallBack, *args, **kwargs):
		ui.View.__init__(self, *args, **kwargs)
		self.width, self.height = ui.get_screen_size()
		frame = CGRect(CGPoint(0, 0), CGSize(self.width, self.height))
		theme_manager_g = theme_manager
		self.theme_manager = theme_manager
		bkg_view = ui.View()
		bkg_view.background_color = self.theme_manager.currentTheme.backgroundColour
		self.tv = tableView
		self.tv.width = self.width
		self.tv.height = self.height
		self.tableView = ObjCInstance(self.tv)
		self.tableView.setBackgroundView(bkg_view)
		flex_width, flex_height = (1<<1), (1<<4)
		self.tableView.setAutoresizingMask_(flex_width|flex_height)
		self.selectCallBack = selectCallBack
		self.soofflineSelectCallBack = soofflineSelectCallBack
		v = UITableViewController.alloc().init().autorelease()
		tvd = createTableViewDelegateClass(theme_manager)
		self.tb_ds = tvd.alloc().init().autorelease()

		v.tableView().setDataSource_(self.tb_ds)
		v.tableView().setDelegate_(self.tb_ds)
		v.tableView().dataSource().data = []
		v.tableView().dataSource().selectCallBack = self.performSelectCallBack
		self.searchController = UISearchController.alloc().initWithSearchResultsController_(v)
		self.searchController.resultController = v
		self.searchController.firstRun = True
		
		sd = createSearchDelegateClass()
		self.searchDelegate = sd.alloc().init().autorelease()
		self.searchDelegate.filter = filterData
		self.searchDelegate.resultController = v
		self.tableView.extendedLayoutIncludesOpaqueBars = True
		self.searchController.searchResultsUpdater = self.searchDelegate
		self.searchController.dimsBackgroundDuringPresentation = True
		self.searchController.hidesNavigationBarDuringPresentation = True
		self.searchController.searchBar().delegate = self.searchDelegate
		self.searchController.searchBar().setPlaceholder_(ns('Search'))
		self.tableView.tableHeaderView =self.searchController.searchBar();
		self.searchController.searchBar().sizeToFit();		
		tColour = tuple(int(self.theme_manager.currentTheme.searchTintColour.lstrip('#')[i:i+2], 16) for i in (0, 2 ,4))
		bTColour = tuple(int(self.theme_manager.currentTheme.searchBackgroundColour.lstrip('#')[i:i+2], 16) for i in (0, 2 ,4))
		tColour = (tColour[0]/255, tColour[1]/255, tColour[2]/255)
		bTColour = (bTColour[0]/255, bTColour[1]/255, bTColour[2]/255)
		searchTintColour = UIColor.colorWithRed_green_blue_alpha_(tColour[0], tColour[1], tColour[2], 1)
		self.searchController.searchBar().tintColor = searchTintColour
		searchBackgroundTintColour = UIColor.colorWithRed_green_blue_alpha_(bTColour[0], bTColour[1], bTColour[2], 1)
		self.searchController.searchBar().tintColor = searchTintColour
		self.searchController.searchBar().barTintColor = searchBackgroundTintColour


		# self.tb_ds.textColour = searchTColour
		self.tv.border_color = self.theme_manager.currentTheme.borderColour
		self.tv.background_color = self.theme_manager.currentTheme.backgroundColour
		self.tv.bg_color = self.theme_manager.currentTheme.backgroundColour		
		self.tv.tint_color = self.theme_manager.currentTheme.tintColour
		self.tv.separator_color = self.theme_manager.currentTheme.separatorColour
		bk_view = ui.View()
		bk_view.background_color = self.theme_manager.currentTheme.backgroundColour
		v.tableView().setBackgroundView(bk_view)
		
		self_objc = ObjCInstance(self)
		self_objc.addSubview_(self.tableView)
		self.tableView.release()
Ejemplo n.º 10
0
 def layout(self):
     self._layer.setFrame_(
         CGRect(CGPoint(0, 0), CGSize(self.width, self.height)))