Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
toast('Done')
Test().run()
"""
from kivy.clock import Clock
from kivy.core.window import Window
from kivy.animation import Animation
from kivy.network.urlrequest import UrlRequest
from kivy.lang import Builder
from kivy.properties import StringProperty, ObjectProperty, BooleanProperty
from kivymd.uix.card import MDCard
Builder.load_string(
"""
#:import Window kivy.core.window.Window
pos: (Window.width // 2) - (self.width // 2), (Window.height // 2) - (self.height // 2)
size_hint_y: None
size_hint_x: .8
height: spinner.height + dp(20)
spacing: dp(10)
padding: dp(10)
canvas:
Color:
rgba: app.theme_cls.primary_color
Rectangle:
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.button import Button
from kivy.uix.label import Label
from kivy.uix.popup import Popup
from kivy.uix.boxlayout import BoxLayout
from plyer import wifi
from functools import partial
Builder.load_string('''
:
orientation: 'vertical'
padding: '30dp'
spacing: '20dp'
GridLayout:
cols: 2
padding: 20
spacing: 20
size_hint: 1,.4
Button:
text: "Disconnect"
on_release: root.disconnect()
TextInput:
id: password
hint_text: "Password"
disabled: True
# Dynamic kv classes
from kivy.lang import Builder
from kivy.base import runTouchApp
root = Builder.load_string('''
:
source: None
Image:
source: root.source
center: root.center
ImageButton:
source: 'kivy/data/logo/kivy-icon-512.png'
''')
runTouchApp(root)
# -*- coding: utf-8 -*-
from kivy.lang import Builder
from kivy.properties import ListProperty, OptionProperty, BooleanProperty
from kivy.utils import get_color_from_hex
from YourApp.kivymd.color_definitions import colors
from YourApp.kivymd.theming import ThemableBehavior
from kivy.uix.progressbar import ProgressBar
Builder.load_string('''
:
canvas:
Clear
Color:
rgba: self.theme_cls.divider_color
Rectangle:
size: (self.width , dp(4)) if self.orientation == 'horizontal' else (dp(4),self.height)
pos: (self.x, self.center_y - dp(4)) if self.orientation == 'horizontal' \
else (self.center_x - dp(4),self.y)
Color:
rgba: self.theme_cls.primary_color
Rectangle:
size: (self.width*self.value_normalized, sp(4)) if self.orientation == 'horizontal' else (sp(4), \
self.height*self.value_normalized)
Button:
id: c_button
text: "Hello"
background_normal: "{1}"
'''
meshes = ["./editor/meshes/x-rot-axis.obj", "./editor/meshes/y-rot-axis.obj", "./editor/meshes/z-rot-axis.obj",
"./editor/meshes/x-scale-axis.obj", "./editor/meshes/z-scale-axis.obj", "./editor/meshes/y-scale-axis.obj",
"./editor/meshes/x-axis.obj", "./editor/meshes/z-axis.obj", "./editor/meshes/y-axis.obj"]
colors = ["./editor/images/red.png", "./editor/images/green.png", "./editor/images/blue.png",
"./editor/images/green.png", "./editor/images/blue.png", "./editor/images/red.png",
"./editor/images/red.png", "./editor/images/green.png", "./editor/images/blue.png"]
for i, e in enumerate(meshes):
node = Builder.load_string(dedent(axis.format(e, colors[i])))
node.ids.c_button.bind(on_touch_down=parent.on_button_touch_down)
node.ids.c_button.bind(on_touch_up=parent.on_button_touch_up)
node.ids.c_button.bind(on_touch_move=parent.on_button_touch_move)
node.ids.c_button.c_id = i
layout.add_widget(node)
node.meta_value = -1
self.node_helper.add_mesh(node)
def build(self):
"""
Build and return the root widget.
"""
# The line below is optional. You could leave it out or use one of the
# standard options, such as SettingsWithSidebar, SettingsWithSpinner
# etc.
self.settings_cls = MySettingsWithTabbedPanel
# We apply the saved configuration settings or the defaults
root = Builder.load_string(kv)
label = root.ids.label
label.text = self.config.get('My Label', 'text')
label.font_size = float(self.config.get('My Label', 'font_size'))
return root
# -*- coding: utf-8 -*-
from kivy.lang import Builder
from kivy.properties import BooleanProperty, ListProperty, OptionProperty
from kivy.uix.progressbar import ProgressBar
from kivy.utils import get_color_from_hex
from kivymd.color_definitions import colors
from kivymd.theming import ThemableBehavior
Builder.load_string('''
:
canvas:
Clear
Color:
rgba: self.theme_cls.divider_color
Rectangle:
size: (self.width , dp(4)) if self.orientation == 'horizontal' else (dp(4),self.height)
pos: (self.x, self.center_y - dp(4)) if self.orientation == 'horizontal' \
else (self.center_x - dp(4),self.y)
Color:
rgba: self.theme_cls.primary_color
Rectangle:
size: (self.width*self.value_normalized, sp(4)) if self.orientation == 'horizontal' else (sp(4), \
self.height*self.value_normalized)
pos: (self.width*(1-self.value_normalized)+self.x if self.reversed else self.x, self.center_y - dp(4)) \
import traceback
# sys.path.append('/vagrant/mi-dev/mobileinsight-mobile/app/kivymd')
from kivymd.date_picker import MDDatePicker
from kivymd.theming import ThemeManager
from kivymd.time_picker import MDTimePicker
# not working
# SERVICE_DIR = os.path.join(os.getcwd(), 'service')
# sys.path.append(SERVICE_DIR)
Logger.info("Import Coordinator")
from coordinator import COORDINATOR
Logger.info("Finish Import")
Builder.load_string('''
:
Label:
text: root.text
size_hint_y: None
text_size: self.width, None
height: self.texture_size[1]
markup: True
Button:
text: 'OK'
on_release: root.dispatch('on_answer','yes')
background_color: 0.1,0.65,0.88,1
color: 1,1,1,1
''')
Logger.info("Finish Builder")
# Load main UI
'''
logo_screen:
=============
Display the logo
'''
from kivy.uix.screenmanager import Screen
from kivy.lang import Builder
class LogoScreen(Screen):
Builder.load_string('''