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


Python Builder.load_string方法代码示例

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


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

示例1: __init__

# 需要导入模块: from kivy.app import Builder [as 别名]
# 或者: from kivy.app.Builder import load_string [as 别名]
 def __init__(self, **kwargs):
     Builder.load_string(FLYIN_PANEL_LAYOUT)
     super(FlyinPanel, self).__init__(**kwargs)
     self.hide_decay = Clock.create_trigger(lambda dt: self.hide(), self.SESSION_HIDE_DELAY)
     Window.bind(mouse_pos=self.on_mouse_pos)
     Window.bind(on_motion=self.on_motion)
     Clock.schedule_once(lambda dt: self.show())
开发者ID:ryandoherty,项目名称:RaceCapture_App,代码行数:9,代码来源:flyinpanel.py

示例2: dp

# 需要导入模块: from kivy.app import Builder [as 别名]
# 或者: from kivy.app.Builder import load_string [as 别名]
Builder.load_string('''

<WifiConfigView>:
    id: wifi
    cols: 1
    spacing: [0, dp(20)]
    row_default_height: dp(40)
    size_hint: [1, None]
    height: self.minimum_height
    HSeparator:
        text: 'WiFi'
    SettingsView:
        id: wifi_enabled
        label_text: 'WiFi Module'
    BaseLabel:
        text_size: self.size
        halign: 'center'
        text: 'Client Mode Configuration'
        font_size: dp(26)
    BaseLabel:
        text: 'Use this mode to setup the wifi module to connect [b]to[/b] an existing wireless network.'
        markup: True
        text_size: (self.parent.width, None)
        padding: [dp(20), 0]
    SettingsView:
        id: client_mode
        label_text: 'Client Mode'
    GridLayout:
        spacing: (dp(30), dp(5))
        cols: 2
        FieldLabel:
            text: 'SSID'
            halign: 'right'
        ValueField:
            id: client_ssid
            disabled: False
            on_text: root.on_client_ssid(*args)
    GridLayout:
        spacing: (dp(30), dp(5))
        cols: 2
        FieldLabel:
            text: 'Password'
            halign: 'right'
        ValueField:
            id: client_password
            disabled: False
            on_text: root.on_client_password(*args)
    BaseLabel:
        text: 'Access Point Mode Configuration'
        text_size: self.size
        halign: 'center'
        font_size: dp(26)
    BaseLabel:
        text: 'Use this mode to create a wireless network for your phone or table to connect to.'
        markup: True
        text_size: (self.parent.width, None)
        padding: [dp(20), 0]
    SettingsView:
        id: ap_mode
        label_text: 'Access Point Mode'
    GridLayout:
        spacing: (dp(30), dp(5))
        cols: 2
        FieldLabel:
            text: 'SSID'
            halign: 'right'
        BetterTextInput:
            id: ap_ssid
            disabled: False
            on_text: root.on_ap_ssid(*args)
            max_chars: 24
    GridLayout:
        spacing: (dp(30), dp(5))
        cols: 2
        FieldLabel:
            text: 'Password'
            halign: 'right'
        BetterTextInput:
            id: ap_password
            disabled: False
            on_text: root.on_ap_password(*args)
            max_chars: 24
    SettingsView:
        id: ap_channel
        label_text: 'Channel'
    SettingsView:
        id: ap_encryption
        label_text: 'Encryption'
''')
开发者ID:ddimensia,项目名称:RaceCapture_App,代码行数:91,代码来源:wificonfigview.py

示例3: on_map_updated

# 需要导入模块: from kivy.app import Builder [as 别名]
# 或者: from kivy.app.Builder import load_string [as 别名]
        self.channelConfig = channelConfig
        
    def on_map_updated(self, *args):
        self.channelConfig.stale = True
        self.dispatch('on_modified', self.channelConfig)        
        

class AnalogScaler(Graph):
    def __init__(self, **kwargs):
        super(AnalogScaler, self).__init__(**kwargs)

Builder.load_string('''
<WarnLabel>
    canvas.before:
        Color:
            rgba: (1.0, 0, 0, 0.5)
        Rectangle:
            pos: self.pos
            size: self.size
            
''')

class WarnLabel(Label):
    pass


WARN_DISMISS_TIMEOUT = 3

class AnalogScalingMapEditor(BoxLayout):
    map_size = SCALING_MAP_POINTS
    scaling_map = None
    plot = None
开发者ID:brentpicasso,项目名称:RaceCapture_App,代码行数:34,代码来源:analogchannelsview.py

示例4:

# 需要导入模块: from kivy.app import Builder [as 别名]
# 或者: from kivy.app.Builder import load_string [as 别名]
Builder.load_string('''
<ConfirmPopup>:
    cols:1
    Label:
        text: root.text
    GridLayout:
        cols: 2
        size_hint_y: None
        height: '44sp'
        spacing: '5sp'
        IconButton:
            text: u'\uf00c'
            on_press: root.dispatch('on_answer', True)
        IconButton:
            text: u'\uf00d'
            color: ColorScheme.get_primary()            
            on_release: root.dispatch('on_answer', False)
            
<OkPopup>:
    cols:1
    Label:
        text: root.text
    GridLayout:
        cols: 2
        size_hint_y: None
        height: '44sp'
        spacing: '5sp'
        IconButton:
            text: u'\uf00c'
            on_press: root.dispatch('on_answer', True)
            
            
<EditorPopup>:
    id: editor_popup
    cols:1
    BoxLayout:
        id: content
    GridLayout:
        cols: 2
        size_hint_y: None
        height: '44sp'
        spacing: '5sp'
        IconButton:
            text: u'\uf00c'
            on_press: root.dispatch('on_answer', True)
        IconButton:
            text: u'\uf00d'
            color: ColorScheme.get_primary()            
            on_release: root.dispatch('on_answer', False)
            
''')
开发者ID:imstimpy,项目名称:RaceCapture_App,代码行数:53,代码来源:alertview.py

示例5: CustomizeGaugeBubble

# 需要导入模块: from kivy.app import Builder [as 别名]
# 或者: from kivy.app.Builder import load_string [as 别名]
DEFAULT_NORMAL_COLOR  = [1.0, 1.0 , 1.0, 1.0]

DEFAULT_VALUE = None
DEFAULT_MIN = 0
DEFAULT_MAX = 100
DEFAULT_PRECISION = 0
DEFAULT_TYPE = CHANNEL_TYPE_SENSOR
MENU_ITEM_RADIUS = 100
POPUP_DISMISS_TIMEOUT_SHORT = 10.0
POPUP_DISMISS_TIMEOUT_LONG = 60.0

Builder.load_string('''
<CustomizeGaugeBubble>
    orientation: 'vertical'
    size_hint: (None, None)
    #pos_hint: {'center_x': .5, 'y': .5}
    #arrow_pos: 'bottom_mid'
    #background_color: (1, 0, 0, 1.0) #50% translucent red
    #border: [0, 0, 0, 0]    
''')

class CustomizeGaugeBubble(CenteredBubble):
    pass

NULL_LAP_TIME='--:--.---'

class Gauge(AnchorLayout):
    rcid = None
    settings = ObjectProperty(None)    
    value_size = NumericProperty(0)
    title_size = NumericProperty(0)
开发者ID:ddimensia,项目名称:RaceCapture_App,代码行数:33,代码来源:gauge.py

示例6: BluetoothConfigView

# 需要导入模块: from kivy.app import Builder [as 别名]
# 或者: from kivy.app.Builder import load_string [as 别名]
from kivy.metrics import dp
from settingsview import SettingsView, SettingsSwitch, SettingsButton
from autosportlabs.widgets.separator import HLineSeparator
from autosportlabs.racecapture.views.util.alertview import editor_popup
from autosportlabs.racecapture.views.configuration.rcp.advancedbluetoothconfigview import AdvancedBluetoothConfigView

Builder.load_string('''
<BluetoothConfigView>
    id: bluetooth
    cols: 1
    spacing: [0, dp(20)]
    size_hint: [1, None]
    height: self.minimum_height
    HSeparator:
        text: 'Bluetooth'
        size_hint_y: None
    SettingsView:
        id: bt_enable
        label_text: 'Bluetooth'
        help_text: 'If the Bluetooth module is connected, enable it here'
    SettingsView:
        id: btconfig
        label_text: 'Advanced configuration'
        help_text: 'Change Bluetooth name and passkey. Firmware version 2.9.0 or greater required.'
''')


class BluetoothConfigView(GridLayout):

    def __init__(self, config, **kwargs):
        super(BluetoothConfigView, self).__init__(**kwargs)
开发者ID:autosportlabs,项目名称:RaceCapture_App,代码行数:33,代码来源:bluetoothconfigview.py

示例7: str

# 需要导入模块: from kivy.app import Builder [as 别名]
# 或者: from kivy.app.Builder import load_string [as 别名]
                apn_map[name] = name

            spinner.setValueMap(apn_map, CellSettingsView.CUSTOM_APN)
            self.cell_provider_info = cell_provider_info
        except Exception as detail:
            Logger.error('CellSettingsView: Error loading cell providers ' + str(detail))

Builder.load_string('''
<CellularConfigView>:
    id: cellular
    cols: 1
    spacing: [0, dp(20)]
    row_default_height: dp(40)
    size_hint: [1, None]
    height: self.minimum_height
    HSeparator:
        text: 'Cellular Configuration'
        
    CellSettingsView:
        id: cell_settings
        on_modified: root.modified()
        size_hint_y: None
        height: dp(300)
''')


class CellularConfigView(GridLayout):

    def __init__(self, base_dir, rc_config, **kwargs):
        super(CellularConfigView, self).__init__(**kwargs)
        self.connectivityConfig = None
开发者ID:autosportlabs,项目名称:RaceCapture_App,代码行数:33,代码来源:cellularconfigview.py

示例8: FadeableWidget

# 需要导入模块: from kivy.app import Builder [as 别名]
# 或者: from kivy.app.Builder import load_string [as 别名]
            font_name: root.title_font
            font_size: root.title_font_size
            color: root.title_color
            size_hint_x: 0.75
            text: root.title    

<IconButton>:
    background_color: [0, 0, 0, 0]
    background_down: ''
    font_size: self.height
    
    color: [1.0, 1.0, 1.0, 0.2] if self.disabled else [1.0, 1.0, 1.0, 0.8]
    font_name: 'resource/fonts/fa.ttf'
"""

Builder.load_string(ICON_BUTTON_KV)

class FadeableWidget(EventDispatcher):
    FADED_ALPHA = 0.1
    BRIGHT_ALPHA = 1.0
    FADE_STEP = 0.05
    FADE_INTERVAL = 0.05
    FADE_DELAY = 5.0
    fade_color = ObjectProperty([0, 0, 0, 0])
    pulsing = BooleanProperty(False)

    def __init__(self, **kwargs):
        super(FadeableWidget, self).__init__(**kwargs)
        self._current_alpha = None
        self.brighten_mode = True
        self._schedule_fade = Clock.create_trigger(self._fade_back, FadeableWidget.FADE_DELAY)
开发者ID:autosportlabs,项目名称:RaceCapture_App,代码行数:33,代码来源:iconbutton.py

示例9: ClickAnchorLayout

# 需要导入模块: from kivy.app import Builder [as 别名]
# 或者: from kivy.app.Builder import load_string [as 别名]
from kivy.uix.anchorlayout import AnchorLayout
from autosportlabs.racecapture.theme.color import ColorScheme

class ClickAnchorLayout(ButtonBehavior, AnchorLayout):
    pass

class SectionBoxLayout(BoxLayout):
    """
    Provides a consistent BoxLayout with some some decoration and padding 
    """
Builder.load_string("""
<SectionBoxLayout>:
    canvas.before:
        Color:
            rgba: ColorScheme.get_dark_background_translucent()
        Rectangle:
            pos: self.pos
            size: self.size             
    padding: (dp(10), dp(10))
    spacing: dp(5)                    
            """)

class HeaderSectionBoxLayout(SectionBoxLayout):
    """
    A header variation of SectionBoxLayout with a highlighted background color 
    """
Builder.load_string("""
<HeaderSectionBoxLayout>:
    canvas.before:
        Color:
            rgba: ColorScheme.get_medium_background()
开发者ID:autosportlabs,项目名称:RaceCapture_App,代码行数:33,代码来源:sections.py

示例10: BackgroundStreamingView

# 需要导入模块: from kivy.app import Builder [as 别名]
# 或者: from kivy.app.Builder import load_string [as 别名]
# this code. If not, see <http://www.gnu.org/licenses/>.

import kivy
kivy.require('1.10.0')
from kivy.app import Builder
from kivy.logger import Logger
from kivy.uix.boxlayout import BoxLayout
from autosportlabs.racecapture.views.configuration.baseconfigview import BaseConfigView
from settingsview import SettingsView, SettingsTextField, SettingsSwitch

Builder.load_string('''
<BackgroundStreamingView>
    size_hint_y: None
    height: dp(80)
    SettingsView:
        id: bgStream
        label_text: 'Background Streaming'
        help_text: 'Stream real-time telemetry continuously in the background'
    HelpLabel:
        text: 'When disabled, telemetry is synchronized with SD logging.'
        halign: 'left'
''')


class BackgroundStreamingView(BaseConfigView):

    def __init__(self, **kwargs):
        self.connectivityConfig = None
        super(BackgroundStreamingView, self).__init__(**kwargs)
        self.register_event_type('on_config_updated')

    def on_bg_stream(self, instance, value):
开发者ID:autosportlabs,项目名称:RaceCapture_App,代码行数:34,代码来源:backgroundstreamingview.py

示例11: dp

# 需要导入模块: from kivy.app import Builder [as 别名]
# 或者: from kivy.app.Builder import load_string [as 别名]
Builder.load_string('''
<CellularConfigView>:
    id: cellular
    cols: 1
    spacing: [0, dp(20)]
    row_default_height: dp(40)
    size_hint: [1, None]
    height: self.minimum_height
    HSeparator:
        text: 'Cellular Configuration'
    SettingsView:
        size_hint_y: 0.20
        rcid: 'cellEnable'
        label_text: 'Cellular Module'
        help_text: 'Enable if the Real-time telemetry module is installed'
    SettingsView:
        size_hint_y: None
        rcid: 'cellprovider'
        label_text: 'Cellular Provider'
        help_text: 'Select the cellular provider, or specify custom APN settings'
    Label:
        text: 'Custom Cellular Settings'
        text_size: self.size
        halign: 'center'
        font_size: dp(26)
    GridLayout:
        cols: 2
        spacing: (dp(30), dp(5))
        FieldLabel:
            text: 'APN Host'
            halign: 'right'
        ValueField:
            rcid: 'apnHost'
            disabled: True
            on_text: root.on_apn_host(*args)
    GridLayout:
        cols: 2
        spacing: (dp(30), dp(5))
        FieldLabel:
            halign: 'right'
            text: 'APN User Name'
        ValueField:
            rcid: 'apnUser'
            size_hint_y: 1
            disabled: True
            on_text: root.on_apn_user(*args)
    GridLayout:
        cols: 2
        spacing: (dp(30), dp(5))
        FieldLabel:
            halign: 'right'
            text: 'APN Password'
        ValueField:
            rcid: 'apnPass'
            disabled: True
            size_hint_y: 1
            on_text: root.on_apn_pass(*args)
''')
开发者ID:ddimensia,项目名称:RaceCapture_App,代码行数:60,代码来源:cellularconfigview.py

示例12:

# 需要导入模块: from kivy.app import Builder [as 别名]
# 或者: from kivy.app.Builder import load_string [as 别名]
Builder.load_string(
    """
<ConfirmPopup>:
    cols:1
    Label:
        text: root.text
    GridLayout:
        cols: 2
        size_hint_y: None
        height: '44sp'
        spacing: '5sp'
        Button:
            text: 'Ok'
            on_release: root.dispatch('on_answer', True)
        Button:
            text: 'Cancel'
            on_release: root.dispatch('on_answer', False)
            
<OkPopup>:
    cols:1
    Label:
        text: root.text
    GridLayout:
        cols: 2
        size_hint_y: None
        height: '44sp'
        spacing: '5sp'
        Button:
            text: 'Ok'
            on_release: root.dispatch('on_ok')
"""
)
开发者ID:aishwaryaMandyam,项目名称:RaceCapture_App,代码行数:34,代码来源:alertview.py


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