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


Python compat.string_types方法代码示例

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


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

示例1: on_map_source

# 需要导入模块: from kivy import compat [as 别名]
# 或者: from kivy.compat import string_types [as 别名]
def on_map_source(self, instance, source):
        if isinstance(source, string_types):
            self.map_source = MapSource.from_provider(source)
        elif isinstance(source, (tuple, list)):
            cache_key, min_zoom, max_zoom, url, attribution, options = source
            self.map_source = MapSource(url=url, cache_key=cache_key,
                                        min_zoom=min_zoom, max_zoom=max_zoom,
                                        attribution=attribution,
                                        cache_dir=self.cache_dir, **options)
        elif isinstance(source, MapSource):
            self.map_source = source
        else:
            raise Exception("Invalid map source provider")
        self.zoom = clamp(self.zoom,
                          self.map_source.min_zoom, self.map_source.max_zoom)
        self.remove_all_tiles()
        self.trigger_update(True) 
开发者ID:pythonindia,项目名称:PyCon-Mobile-App,代码行数:19,代码来源:view.py

示例2: get_cls

# 需要导入模块: from kivy import compat [as 别名]
# 或者: from kivy.compat import string_types [as 别名]
def get_cls(self):
        '''
        .. versionadded:: 1.9.0

        Returns the widget type specified by self.cls. If it is a
        string, the :class:`~kivy.factory.Factory` is queried to retrieve the
        widget class with the given name, otherwise it is returned directly.
        '''
        cls = self.cls
        if isinstance(cls, string_types):
            try:
                cls = getattr(Factory, cls)
            except AttributeError:
                raise AttributeError(
                    'Listadapter cls widget does not exist.')
        return cls 
开发者ID:BillBillBillBill,项目名称:Tickeys-linux,代码行数:18,代码来源:adapter.py

示例3: create_settings

# 需要导入模块: from kivy import compat [as 别名]
# 或者: from kivy.compat import string_types [as 别名]
def create_settings(self):
        '''Create the settings panel. This method will normally
        be called only one time per
        application life-time and the result is cached internally,
        but it may be called again if the cached panel is removed
        by :meth:`destroy_settings`.

        By default, it will build a settings panel according to
        :attr:`settings_cls`, call :meth:`build_settings`, add a Kivy panel if
        :attr:`use_kivy_settings` is True, and bind to
        on_close/on_config_change.

        If you want to plug your own way of doing settings, without the Kivy
        panel or close/config change events, this is the method you want to
        overload.

        .. versionadded:: 1.8.0
        '''
        if self.settings_cls is None:
            from kivy.uix.settings import SettingsWithSpinner
            self.settings_cls = SettingsWithSpinner
        elif isinstance(self.settings_cls, string_types):
            self.settings_cls = Factory.get(self.settings_cls)
        s = self.settings_cls()
        self.build_settings(s)
        if self.use_kivy_settings:
            s.add_kivy_panel()
        s.bind(on_close=self.close_settings,
               on_config_change=self._on_config_change)
        return s 
开发者ID:BillBillBillBill,项目名称:Tickeys-linux,代码行数:32,代码来源:app.py

示例4: _setup_default_tab

# 需要导入模块: from kivy import compat [as 别名]
# 或者: from kivy.compat import string_types [as 别名]
def _setup_default_tab(self):
        if self._default_tab in self.tab_list:
            return
        content = self._default_tab.content
        _tabs = self._tab_strip
        cls = self.default_tab_cls

        if isinstance(cls, string_types):
            cls = Factory.get(cls)

        if not issubclass(cls, TabbedPanelHeader):
            raise TabbedPanelException('`default_tab_class` should be\
                subclassed from `TabbedPanelHeader`')

        # no need to instanciate if class is TabbedPanelHeader
        if cls != TabbedPanelHeader:
            self._current_tab = self._original_tab = self._default_tab = cls()

        default_tab = self.default_tab
        if self._original_tab == self.default_tab:
            default_tab.text = self.default_tab_text

        default_tab.height = self.tab_height
        default_tab.group = '__tab%r__' % _tabs.uid
        default_tab.state = 'down'
        default_tab.width = self.tab_width if self.tab_width else 100
        default_tab.content = content

        tl = self.tab_list
        if default_tab not in tl:
            _tabs.add_widget(default_tab, len(tl))

        if default_tab.content:
            self.clear_widgets()
            self.add_widget(self.default_tab.content)
        else:
            Clock.schedule_once(self._load_default_tab_content)
        self._current_tab = default_tab 
开发者ID:BillBillBillBill,项目名称:Tickeys-linux,代码行数:40,代码来源:tabbedpanel.py

示例5: _show_progress

# 需要导入模块: from kivy import compat [as 别名]
# 或者: from kivy.compat import string_types [as 别名]
def _show_progress(self):
        if self._progress:
            return
        cls = self.progress_cls
        if isinstance(cls, string_types):
            cls = Factory.get(cls)
        self._progress = cls(path=self.path)
        self._progress.value = 0
        self.add_widget(self._progress) 
开发者ID:BillBillBillBill,项目名称:Tickeys-linux,代码行数:11,代码来源:filechooser.py

示例6: on_value

# 需要导入模块: from kivy import compat [as 别名]
# 或者: from kivy.compat import string_types [as 别名]
def on_value(self, instance, value):
        if not self.section or not self.key:
            return
        # get current value in config
        panel = self.panel
        if not isinstance(value, string_types):
            value = str(value)
        panel.set_value(self.section, self.key, value) 
开发者ID:BillBillBillBill,项目名称:Tickeys-linux,代码行数:10,代码来源:settings.py

示例7: add_interface

# 需要导入模块: from kivy import compat [as 别名]
# 或者: from kivy.compat import string_types [as 别名]
def add_interface(self):
        '''(Internal) creates an instance of :attr:`Settings.interface_cls`,
        and sets it to :attr:`~Settings.interface`. When json panels are
        created, they will be added to this interface which will display them
        to the user.
        '''
        cls = self.interface_cls
        if isinstance(cls, string_types):
            cls = Factory.get(cls)
        interface = cls()
        self.interface = interface
        self.add_widget(interface)
        self.interface.bind(on_close=lambda j: self.dispatch('on_close')) 
开发者ID:BillBillBillBill,项目名称:Tickeys-linux,代码行数:15,代码来源:settings.py

示例8: on_effect_cls

# 需要导入模块: from kivy import compat [as 别名]
# 或者: from kivy.compat import string_types [as 别名]
def on_effect_cls(self, instance, cls):
        if isinstance(cls, string_types):
            cls = Factory.get(cls)
        self.effect_x = cls(target_widget=self._viewport)
        self.effect_x.bind(scroll=self._update_effect_x)
        self.effect_y = cls(target_widget=self._viewport)
        self.effect_y.bind(scroll=self._update_effect_y) 
开发者ID:BillBillBillBill,项目名称:Tickeys-linux,代码行数:9,代码来源:scrollview.py

示例9: _build_dropdown

# 需要导入模块: from kivy import compat [as 别名]
# 或者: from kivy.compat import string_types [as 别名]
def _build_dropdown(self, *largs):
        if self._dropdown:
            self._dropdown.unbind(on_select=self._on_dropdown_select)
            self._dropdown.unbind(on_dismiss=self._close_dropdown)
            self._dropdown.dismiss()
            self._dropdown = None
        cls = self.dropdown_cls
        if isinstance(cls, string_types):
            cls = Factory.get(cls)
        self._dropdown = cls()
        self._dropdown.bind(on_select=self._on_dropdown_select)
        self._dropdown.bind(on_dismiss=self._close_dropdown)
        self._update_dropdown() 
开发者ID:BillBillBillBill,项目名称:Tickeys-linux,代码行数:15,代码来源:spinner.py

示例10: _update_dropdown

# 需要导入模块: from kivy import compat [as 别名]
# 或者: from kivy.compat import string_types [as 别名]
def _update_dropdown(self, *largs):
        dp = self._dropdown
        cls = self.option_cls
        if isinstance(cls, string_types):
            cls = Factory.get(cls)
        dp.clear_widgets()
        for value in self.values:
            item = cls(text=value)
            item.bind(on_release=lambda option: dp.select(option.text))
            dp.add_widget(item) 
开发者ID:BillBillBillBill,项目名称:Tickeys-linux,代码行数:12,代码来源:spinner.py

示例11: _set_loading_image

# 需要导入模块: from kivy import compat [as 别名]
# 或者: from kivy.compat import string_types [as 别名]
def _set_loading_image(self, image):
        if isinstance(image, string_types):
            self._loading_image = ImageLoader.load(filename=image)
        else:
            self._loading_image = image 
开发者ID:BillBillBillBill,项目名称:Tickeys-linux,代码行数:7,代码来源:loader.py

示例12: _set_error_image

# 需要导入模块: from kivy import compat [as 别名]
# 或者: from kivy.compat import string_types [as 别名]
def _set_error_image(self, image):
        if isinstance(image, string_types):
            self._error_image = ImageLoader.load(filename=image)
        else:
            self._error_image = image 
开发者ID:BillBillBillBill,项目名称:Tickeys-linux,代码行数:7,代码来源:loader.py

示例13: __init__

# 需要导入模块: from kivy import compat [as 别名]
# 或者: from kivy.compat import string_types [as 别名]
def __init__(self, **kw):
        super(Animation, self).__init__(**kw)

        # Initialize
        self._clock_installed = False
        self._duration = kw.get('d', kw.get('duration', 1.))
        self._transition = kw.get('t', kw.get('transition', 'linear'))
        self._step = kw.get('s', kw.get('step', 1. / 60.))
        if isinstance(self._transition, string_types):
            self._transition = getattr(AnimationTransition, self._transition)
        for key in ('d', 't', 's', 'step', 'duration', 'transition'):
            kw.pop(key, None)
        self._animated_properties = kw
        self._widgets = {} 
开发者ID:BillBillBillBill,项目名称:Tickeys-linux,代码行数:16,代码来源:animation.py

示例14: on_viewclass

# 需要导入模块: from kivy import compat [as 别名]
# 或者: from kivy.compat import string_types [as 别名]
def on_viewclass(self, instance, value):
        # resolve the real class if it was a string.
        if isinstance(value, string_types):
            self.viewclass = getattr(Factory, value) 
开发者ID:kivy-garden,项目名称:garden.recycleview,代码行数:6,代码来源:recycleview.py

示例15: on_sizable_from

# 需要导入模块: from kivy import compat [as 别名]
# 或者: from kivy.compat import string_types [as 别名]
def on_sizable_from(self, instance, sizable_from):
        if not instance._container:
            return

        sup = super(Splitter, instance)
        _strp = instance._strip
        if _strp:
            # remove any previous binds
            _strp.unbind(on_touch_down=instance.strip_down)
            _strp.unbind(on_touch_move=instance.strip_move)
            _strp.unbind(on_touch_up=instance.strip_up)
            self.unbind(disabled=_strp.setter('disabled'))

            sup.remove_widget(instance._strip)
        else:
            cls = instance.strip_cls
            if isinstance(cls, string_types):
                cls = Factory.get(cls)
            instance._strip = _strp = cls()

        sz_frm = instance.sizable_from[0]
        if sz_frm in ('l', 'r'):
            _strp.size_hint = None, 1
            _strp.width = instance.strip_size
            instance.orientation = 'horizontal'
            instance.unbind(strip_size=_strp.setter('width'))
            instance.bind(strip_size=_strp.setter('width'))
        else:
            _strp.size_hint = 1, None
            _strp.height = instance.strip_size
            instance.orientation = 'vertical'
            instance.unbind(strip_size=_strp.setter('height'))
            instance.bind(strip_size=_strp.setter('height'))

        index = 1
        if sz_frm in ('r', 'b'):
            index = 0
        sup.add_widget(_strp, index)

        _strp.bind(on_touch_down=instance.strip_down)
        _strp.bind(on_touch_move=instance.strip_move)
        _strp.bind(on_touch_up=instance.strip_up)
        _strp.disabled = self.disabled
        self.bind(disabled=_strp.setter('disabled')) 
开发者ID:BillBillBillBill,项目名称:Tickeys-linux,代码行数:46,代码来源:splitter.py


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