当前位置: 首页>>代码示例>>Python>>正文


Python ui.View方法代码示例

本文整理汇总了Python中ui.View方法的典型用法代码示例。如果您正苦于以下问题:Python ui.View方法的具体用法?Python ui.View怎么用?Python ui.View使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ui的用法示例。


在下文中一共展示了ui.View方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: makeButtons

# 需要导入模块: import ui [as 别名]
# 或者: from ui import View [as 别名]
def makeButtons(self):
		buttonsize = int(self.height / CELLS_PER_ROW)
		self.startx = int(self.width / 2 - self.height / 2)
	
		rot=ui.Button(frame=(self.startx-2*buttonsize-10,10,2*buttonsize,2*buttonsize))
		rot.image = ui.Image.named('ionicons-ios7-refresh-empty-256')
		rot.action = self.rotate
		rot.tint_color = 'black'

		self.add_subview(rot)
		
		self.buttonView = ui.View(frame=(self.startx, 0, buttonsize*16,buttonsize*16))
		for x in range(CELLS_PER_ROW):
			for y in range(CELLS_PER_ROW):
				frame = (x*buttonsize, y*buttonsize, buttonsize, buttonsize)
				b = ui.Button(frame = frame)
				b.background_color = self.load[x,y]
				b.action = self.invert
				self.buttonView.add_subview(b)
		self.add_subview(self.buttonView) 
开发者ID:controversial,项目名称:maze-cv,代码行数:22,代码来源:MazeEditView.py

示例2: init

# 需要导入模块: import ui [as 别名]
# 或者: from ui import View [as 别名]
def init():
    # Monkey-patch the ui module to use Multipanel
    try:
        ui.view_real_present
    except AttributeError:
        ui.view_real_present = ui.View.present
    
    def present(self, mode, **kwargs):
        if mode == "panel":
            ui.multipanel.add_view(self)
        else:
            ui.view_real_present(self, mode, **kwargs)
    
    instancemethod = type(Multipanel.add_view)
    # ui.View is too builtin for us mere mortals to change its methods.
    ##ui.View.present = instancemethod(present, None, ui.View)
    
    ui.multipanel = Multipanel()
    ui.view_real_present(ui.multipanel.root, "panel") 
开发者ID:dgelessus,项目名称:pythonista-scripts,代码行数:21,代码来源:multipanel.py

示例3: __init__

# 需要导入模块: import ui [as 别名]
# 或者: from ui import View [as 别名]
def __init__(self):
        ui.View.__init__(self)
        self.background_color = "#ffffff"
        self.table = ui.TableView()
        self.table.delegate = self.table.data_source = self
        self.table.flex = "WH"
        self.add_subview(self.table)
        self.ai = ui.ActivityIndicator()
        self.ai.style = ui.ACTIVITY_INDICATOR_STYLE_WHITE_LARGE
        self.ai.hides_when_stopped = True
        self.ai.x = self.width / 2.0 - (self.ai.width / 2.0)
        self.ai.y = self.height / 2.0 - (self.ai.height / 2.0)
        self.ai.flex = "LRTB"
        self.ai.background_color = "#000000"
        self.ai.alpha = 0.7
        self.ai.corner_radius = 5
        self.add_subview(self.ai)
        self.subview_open = False
        self.cur_tf = None
        self.hide_kb_button = ui.ButtonItem(
            "Hide Keyboard",
            action=self.hide_keyboard,
            enabled=False,
        )
        self.right_button_items = (self.hide_kb_button, ) 
开发者ID:ywangd,项目名称:stash,代码行数:27,代码来源:easy_config.py

示例4: __init__

# 需要导入模块: import ui [as 别名]
# 或者: from ui import View [as 别名]
def __init__(self, view, attribute, other=None, other_attribute=LayoutAttribute.notAnAttribute):
        assert(isinstance(view, LayoutProxy))
        assert(isinstance(attribute, LayoutAttribute))

        self._view = view
        self._attribute = attribute
        self._constraints = {}

        if other:
            assert(isinstance(other, ui.View))
            assert(isinstance(other_attribute, LayoutAttribute))

            self._other = other
            self._other_attribute = other_attribute
        else:
            self._other = None
            self._other_attribute = LayoutAttribute.notAnAttribute 
开发者ID:zrzka,项目名称:blackmamba,代码行数:19,代码来源:autolayout.py

示例5: __new__

# 需要导入模块: import ui [as 别名]
# 或者: from ui import View [as 别名]
def __new__(cls, ptr):
		# If there is already an instance that wraps this pointer, return the same object...
		# This makes it a little easier to put auxiliary data into the instance (e.g. to use in an ObjC callback)
		# Note however that a new instance may be created for the same underlying ObjC object if the last instance gets garbage-collected.
		if isinstance(ptr, ui.View):
			ptr = ptr._objc_ptr
		if isinstance(ptr, ObjCInstance):
			return ptr
		if isinstance(ptr, c_void_p):
			ptr = ptr.value
		cached_instance = _cached_instances.get(ptr)
		if cached_instance:
			return cached_instance
		objc_instance = super(ObjCInstance, cls).__new__(cls)
		_cached_instances[ptr] = objc_instance
		if isinstance(ptr, ui.View):
			ptr = ptr._objc_ptr
		objc_instance.ptr = ptr
		objc_instance._as_parameter_ = ptr
		objc_instance._cached_methods = weakref.WeakValueDictionary()
		objc_instance.weakrefs = weakref.WeakValueDictionary()
		if ptr:
			# Retain the ObjC object, so it doesn't get freed while a pointer to it exists:
			objc_instance.retain(restype=c_void_p, argtypes=[])
		return objc_instance 
开发者ID:khilnani,项目名称:pythonista-scripts,代码行数:27,代码来源:objcnew.py

示例6: __init__

# 需要导入模块: import ui [as 别名]
# 或者: from ui import View [as 别名]
def __init__(self,device=1, *args, **kwargs):
      ui.View.__init__(self,*args,**kwargs)
      self._session=ObjCClass('AVCaptureSession').alloc().init()
      self._session.setSessionPreset_('AVCaptureSessionPresetHigh');
      inputDevices=ObjCClass('AVCaptureDevice').devices()
      self._inputDevice=inputDevices[device]

      deviceInput=ObjCClass('AVCaptureDeviceInput').deviceInputWithDevice_error_(self._inputDevice, None);
      if self._session.canAddInput_(deviceInput):
         self._session.addInput_(deviceInput)
      self._previewLayer=ObjCClass('AVCaptureVideoPreviewLayer').alloc().initWithSession_(self._session)
      self._previewLayer.setVideoGravity_( 
         'AVLayerVideoGravityResizeAspectFill')
      rootLayer=ObjCInstance(self).layer()
      rootLayer.setMasksToBounds_(True)
      self._previewLayer.setFrame_(
         CGRect(CGPoint(-70, 0), CGSize(self.height,self.height)))
      rootLayer.insertSublayer_atIndex_(self._previewLayer,0)
      self._session.startRunning() 
开发者ID:khilnani,项目名称:pythonista-scripts,代码行数:21,代码来源:live_camera_view.py

示例7: __init__

# 需要导入模块: import ui [as 别名]
# 或者: from ui import View [as 别名]
def __init__(self,detailwidth=320-22,style='slide',delegate=None,mainview= None,detailview=None, initial_state=0,**kwargs):
		ui.View.__init__(self,**kwargs)
		self._sv=ui.ScrollView()
		self._sv.flex='wh'
		self._sv.frame=self.bounds
		self._sv.content_size=(self.bounds[2]+1,self.bounds[3])
		self._mainviewcontainer=ui.View()
		self._mainviewcontainer.frame=self.bounds
		self._detailviewcontainer=ui.View()
		self._detailviewcontainer.frame=self.bounds
		self.detailwidth = detailwidth
		self._detailviewcontainer.width=detailwidth
		self._detailviewcontainer.x=-detailwidth
		self._mainviewcontainer.flex='WH'
		self._detailviewcontainer.flex='H'
		self._mainview=None
		self._detailview=None
		self.delegate=delegate
		self._sv.delegate=self
		self._sv.add_subview(self._mainviewcontainer)
		self._sv.add_subview(self._detailviewcontainer)
		self.add_subview(self._sv)
		self.style='slide'# 'slide','resize'
		self.state=0 #1 when detail shown
		self._modify_gesture() 
开发者ID:khilnani,项目名称:pythonista-scripts,代码行数:27,代码来源:splitview.py

示例8: open_finder

# 需要导入模块: import ui [as 别名]
# 或者: from ui import View [as 别名]
def open_finder(self,sender):
        # expand out a view/dialog from sender
        root=self.find_root()
        overlay=ui.Button(frame=(0,0)+tuple(root.frame)[2:],bg_color=(0,0,0,0.25),name='overlay')
        dialog=ui.View(frame=sender.frame,bg_color='white',name='dialog')
        self.tbl=ui.TableView()
        self.tbl.width=dialog.width
        self.tbl.height=dialog.height
        self.listsource=ui.ListDataSource(items=[])
        self.tbl.data_source=self.listsource
        self.tbl.delegate=self.listsource
        self.listsource.action=self.stop_populating
        self.tbl.flex='wh'
        dialog.add_subview(self.tbl)
        overlay.add_subview(dialog)
        overlay.action=self.stop_populating
        root.add_subview(overlay)
        self.dialog=dialog
        def ani():
            dialog.x,dialog.y=ui.convert_point((self.textfield.x,self.textfield.y+self.textfield.height),self,root)
            dialog.width=self.textfield.width
            dialog.height=min(400,root.height-ui.convert_point((0,dialog.y),self,root)[1])
        ui.delay(self.start_populating,0.16)
        ui.animate(ani,0.15) 
开发者ID:khilnani,项目名称:pythonista-scripts,代码行数:26,代码来源:dropdown.py

示例9: __init__

# 需要导入模块: import ui [as 别名]
# 或者: from ui import View [as 别名]
def __init__(self):
        # Init
        self.views = []
        self.curview = None
        
        self.root = ui.View(name="Multipanel")
        
        self.close = ui.Button()
        self.close.name = "close"
        self.close.enabled = False
        self.close.image = ui.Image.named("ionicons-close-round-32")
        self.close.action = self.close_tapped
        self.root.add_subview(self.close)
        self.close.frame = self.root.width - 32, 0, 32, 32
        self.close.flex = "LB"
        
        self.tabs = ui.SegmentedControl()
        self.tabs.name = "tabs"
        self.tabs.enabled = False
        self.tabs.selected_index = -1
        self.tabs.segments = [PLACEHOLDER_TEXT]
        self.tabs.action = self.segment_changed
        self.root.add_subview(self.tabs)
        self.tabs.frame = 0, 0, self.root.width - self.close.width, self.tabs.height
        self.tabs.flex = "WB"
        
        self.placeholder = ui.View()
        self.placeholder.background_color = "lightgray"
        
        self.ph_label = ui.Label()
        self.ph_label.font = ("<system-bold>", 24)
        self.ph_label.text_color = "gray"
        self.ph_label.text = "No View Selected"
        self.placeholder.add_subview(self.ph_label)
        self.ph_label.size_to_fit()
        self.ph_label.center = self.placeholder.center
        self.ph_label.flex = "TBLR"
        
        self.update_view() 
开发者ID:dgelessus,项目名称:pythonista-scripts,代码行数:41,代码来源:multipanel.py

示例10: close

# 需要导入模块: import ui [as 别名]
# 或者: from ui import View [as 别名]
def close(self):
        ui.View.close(self)
        # on_exit() will be called in will_close()
        # TODO: check the above 
开发者ID:ywangd,项目名称:stash,代码行数:6,代码来源:pythonista_ui.py

示例11: _create_attribute

# 需要导入模块: import ui [as 别名]
# 或者: from ui import View [as 别名]
def _create_attribute(self, cls, attribute, other_attribute, other):
        assert(isinstance(attribute, LayoutAttribute))
        if other:
            assert(isinstance(other_attribute, LayoutAttribute))
            assert(isinstance(other, ui.View))

        name = '{}{}{}'.format(int(attribute), id(other), int(other_attribute))

        layout_attribute = self._attributes.get(name, None)
        if layout_attribute:
            return layout_attribute

        layout_attribute = cls(self._view, attribute, other, other_attribute)
        self._attributes[name] = layout_attribute
        return layout_attribute 
开发者ID:zrzka,项目名称:blackmamba,代码行数:17,代码来源:autolayout.py

示例12: __init__

# 需要导入模块: import ui [as 别名]
# 或者: from ui import View [as 别名]
def __init__(self, root_node, allow_multi=False, async_mode=False):
		self.async_mode = async_mode
		self.allow_multi = allow_multi
		self.selected_entries = None
		self.table_view = ui.TableView()
		self.table_view.frame = (0, 0, 500, 500)
		self.table_view.data_source = self
		self.table_view.delegate = self
		self.table_view.flex = 'WH'
		self.table_view.allows_multiple_selection = True
		self.table_view.tint_color = 'gray'
		self.view = ui.View(frame=self.table_view.frame)
		self.view.add_subview(self.table_view)
		self.view.name = root_node.title
		self.busy_view = ui.View(frame=self.view.bounds, flex='WH', background_color=(0, 0, 0, 0.35))
		hud = ui.View(frame=(self.view.center.x - 50, self.view.center.y - 50, 100, 100))
		hud.background_color = (0, 0, 0, 0.7)
		hud.corner_radius = 8.0
		hud.flex = 'TLRB'
		spinner = ui.ActivityIndicator()
		spinner.style = ui.ACTIVITY_INDICATOR_STYLE_WHITE_LARGE
		spinner.center = (50, 50)
		spinner.start_animating()
		hud.add_subview(spinner)
		self.busy_view.add_subview(hud)
		self.busy_view.alpha = 0.0
		self.view.add_subview(self.busy_view)
		self.done_btn = ui.ButtonItem(title='Done', action=self.done_action)
		if self.allow_multi:
			self.view.right_button_items = [self.done_btn]
		self.done_btn.enabled = False
		self.root_node = root_node
		self.entries = []
		self.flat_entries = []
		if self.async_mode:
			self.set_busy(True)
			t = threading.Thread(target=self.expand_root)
			t.start()
		else:
			self.expand_root() 
开发者ID:khilnani,项目名称:pythonista-scripts,代码行数:42,代码来源:File Picker.py

示例13: ns

# 需要导入模块: import ui [as 别名]
# 或者: from ui import View [as 别名]
def ns(py_obj):
	'''Convert common Python objects to their ObjC equivalents, i.e. str => NSString, int/float => NSNumber, list => NSMutableArray, dict => NSMutableDictionary, bytearray => NSData, set => NSMutableSet. Nested structures (list/dict/set) are supported. If an object is already an instance of ObjCInstance, it is left untouched.
		'''
	if isinstance(py_obj, ObjCInstance):
		return py_obj
	if isinstance(py_obj, c_void_p):
		return ObjCInstance(py_obj)
	if isinstance(py_obj, ui.View):
		return ObjCInstance(py_obj)
	if isinstance(py_obj, str):
		return NSString.stringWithUTF8String_(py_obj)
	if isinstance(py_obj, unicode):
		return NSString.stringWithUTF8String_(py_obj.encode('utf-8'))
	elif isinstance(py_obj, bytearray):
		return NSData.dataWithBytes_length_(str(py_obj), len(py_obj))
	elif isinstance(py_obj, int):
		return NSNumber.numberWithInt_(py_obj)
	elif isinstance(py_obj, float):
		return NSNumber.numberWithDouble_(py_obj)
	elif isinstance(py_obj, bool):
		return NSNumber.numberWithBool_(py_obj)
	elif isinstance(py_obj, list):
		arr = NSMutableArray.array()
		for obj in py_obj:
			arr.addObject_(ns(obj))
		return arr
	elif isinstance(py_obj, set):
		s = NSMutableSet.set()
		for obj in py_obj:
			s.addObject_(ns(obj))
		return s
	elif isinstance(py_obj, dict):
		dct = NSMutableDictionary.dictionary()
		for key, value in py_obj.iteritems():
			dct.setObject_forKey_(ns(value), ns(key))
		return dct 
开发者ID:khilnani,项目名称:pythonista-scripts,代码行数:38,代码来源:objcnew.py

示例14: __init__

# 需要导入模块: import ui [as 别名]
# 或者: from ui import View [as 别名]
def __init__(self, *args, **kwargs):
      ui.View.__init__(self, *args, **kwargs)
      self.pinchgesture_recognizer_target = ui.Button()
      self.pinchgesture_recognizer_target.action = self.did_pinch
      
      self.pangesture_recognizer_target = ui.Button()
      self.pangesture_recognizer_target.action = self.did_pan
      
      self.gr_delegate=GRDelegate.alloc().init().autorelease()
      self.recognizers={}
      self_objc = ObjCInstance(self)     
      pinchobjctarget=ObjCInstance(self.pinchgesture_recognizer_target)
      panobjctarget=ObjCInstance(self.pangesture_recognizer_target)
 
      pinchrecognizer = ObjCClass('UIPinchGestureRecognizer').alloc()
      self.recognizers['pinch'] =         pinchrecognizer.initWithTarget_action_( pinchobjctarget, sel('invokeAction:')).autorelease()

      
      panrecognizer = ObjCClass('UIPanGestureRecognizer').alloc()
      self.recognizers['pan'] =            panrecognizer.initWithTarget_action_( panobjctarget, sel('invokeAction:')).autorelease()
      self.recognizers['pan'].setMinimumNumberOfTouches_(2)
      
      for r in self.recognizers.values():
         self_objc.addGestureRecognizer_(r)
         r.setDelegate_(self.gr_delegate)
      self.panx,self.pany,self.sx,self.sy=0,0,1,1
      self.panx0,self.pany0,self.sx0,self.sy0=0,0,1,1 
开发者ID:khilnani,项目名称:pythonista-scripts,代码行数:29,代码来源:SPLView.py

示例15: display_toast

# 需要导入模块: import ui [as 别名]
# 或者: from ui import View [as 别名]
def display_toast(view, help_text, width = 220, height = 110, show_duration=2, fade_duration=0.5, background_colour=(.42, .42, .42), text_colour= (.96, .96, .96), corner_radius=10):

	w, h = ui.get_screen_size()

	help_view = ui.View(frame=((w/2)-(width/2),(h/2)-height, width, height))
	help_view.background_color = background_colour
	help_view.corner_radius = corner_radius

	label = ui.Label()
	label.text = help_text
	label.flex = 'H'
	label.width = help_view.width * 0.9
	label.alignment = ui.ALIGN_CENTER
	label.x = (help_view.width / 2) - (label.width / 2)
	label.y = (help_view.height / 2) - (label.height / 2)
	label.number_of_lines = 3

	label.text_color = text_colour

	help_view.add_subview(label)

	def animation_fade_in():
		help_view.alpha = 1.0
	def animation_fade_out():
		help_view.alpha = 0.0

	help_view.alpha = 0.0
	view.add_subview(help_view)
	ui.animate(animation_fade_in, duration=fade_duration)
	time.sleep(show_duration+fade_duration)
	ui.animate(animation_fade_out, duration=fade_duration)
	time.sleep(fade_duration)
	view.remove_subview(help_view) 
开发者ID:khilnani,项目名称:pythonista-scripts,代码行数:35,代码来源:ToastView.py


注:本文中的ui.View方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。