Builder.load_string( """ <ProgressWidget>: name: 'ProgressWidget' on_leave: progress_relative= 0 progress_percent= 0 BoxLayout: orientation: 'vertical' MDToolbar: title: root.name left_action_items:[['arrow-left' , lambda x:app.show_screen('Home','back') ]] BoxLayout: orientation: 'vertical' padding: dp(30) spacing: dp(30) AKCircularProgress: id: progress_percent pos_hint: {'center_x': .5, 'center_y': .5} size_hint: None, None size: dp(100), dp(100) percent_type: 'percent' start_deg: 180 end_deg: 540 BoxLayout: spacing: dp(5) BoxLayout: MDRaisedButton: text: '0' on_release: progress_percent.current_percent= 0 MDRaisedButton: text: '45' on_release: progress_percent.current_percent= 45 MDRaisedButton: text: '100' on_release: progress_percent.current_percent= 100 BoxLayout: AKCircularProgress: id: progress_relative pos_hint: {'center_x': .5, 'center_y': .5} size_hint: None, None size: dp(100), dp(100) percent_type: 'percent' start_deg: 240 end_deg: 480 percent_type: 'relative' max_percent: 25 BoxLayout: spacing: dp(5) BoxLayout: MDRaisedButton: text: '0' on_release: progress_relative.current_percent= 0 MDRaisedButton: text: '10' on_release: progress_relative.current_percent= 10 MDRaisedButton: text: '25' on_release: progress_relative.current_percent= 25 BoxLayout: """ )
Builder.load_string(""" <Check@RelativeLayout>: id: checkbox text: '' active: False MDCheckbox: id: check size_hint: None, None size: dp(48), dp(48) active: root.active pos_hint: {'center_x': .3, 'center_y': .5} on_release: setattr(root,'active',self.active) MDLabel: id: label text: root.text pos_hint: {'center_x': 0.9, 'center_y': .5} font_style: 'H6' <Field@MDTextField>: index: 1 size_hint_x: 0.2 pos_hint: {'center_x': 1.5, 'center_y': (5-root.index)/10} on_text: root.parent.parent.color_text(self,self.text) <Main>: MDSpinner: id: spinner size_hint: None, None size: dp(48), dp(48) pos_hint: {'center_x': .5, 'center_y': .7} active: True if state_check.active else False MDFloatLayout: id: mainfloat Check: id: state_check text:'Start' pos_hint: {'center_x': .5, 'center_y': .4} active: True Check: id: prim_check text:'Primary Pallete' pos_hint: {'center_x': .5, 'center_y': .3} active: True Check: id: dark_check text:'Dark Mode' pos_hint: {'center_x': .5, 'center_y': .2} active: False Check: id: custom_color text:'Custom Color' pos_hint: {'center_x': .5, 'center_y': .1} active: False MDFloatLayout: id: textfloat Field: index: 1 hint_text: 'Color of spinner' Field: index: 2 hint_text: 'First color in palette' Field: index: 3 hint_text: 'Second color in palette' Field: index: 4 hint_text: 'Third color in palette' """ )
def build(self, *args, **kwargs): return Builder.load_string(kv)
def build(self): return Builder.load_string(open("main.kv", encoding='utf-8').read())
def build(self): self.mainkv = Builder.load_string(KV) return self.mainkv
Builder.load_string(""" <SaveSettingsButton@MDIconButton>: user_font_size: "45sp" icon: "check" pos_hint: {"right": 1 - dp(20) / (self.parent.width + 1e-6), "center_y": 0.5} on_release: self.parent.parent.parent.save_settings(app.theme_cls.primary_palette,\ app.theme_cls.accent_palette, app.theme_cls.theme_style) app.open_textslist() <Check@MDCheckbox>: group: 'group' size_hint: None, None user_font_size: "25sp" <SettingsScreen@Screen>: BoxLayout: orientation: "vertical" MDToolbar: title: "Настройки" SaveSettingsButton: ScrollView: MDList: OneLineListItem: text: "Изменение темы" on_press: app.settingsscreen.show_theme_picker() OneLineListItem: text: "Количество повторений: " + str(int(self.parent.parent.parent.parent.ids.slider.value)) OneLineListItem: MDSlider: id: slider pos_hint: {'center_x': .5, 'center_y': .5} min: 1 max: 10 value: 5 OneLineListItem: text: "Режим индикации" OneLineListItem: text: " цветовой" Check: active: True pos_hint: {'center_x': .9, 'center_y': .5} OneLineListItem: text: " звуковой" Check: pos_hint: {'center_x': .9, 'center_y': .5} OneLineListItem: text: "Сбросить прогресс" on_release: app.statisticsscreen.delete_statistics() OneLineListItem: text: "Удалить все тексты" on_release: app.delete_all_cards() app.textslistscreen.ids.texts_layout.clear_widgets() """, filename="settings.kv")
from kivy.properties import ObjectProperty from kivy.uix.gridlayout import GridLayout from kivy.lang.builder import Builder Builder.load_string(""" <EditNone>: padding: 0, 0, int(app.button_scale / 2), 0 cols: 1 size_hint: 1, None height: self.minimum_height """) class EditNone(GridLayout): owner = ObjectProperty() def refresh_buttons(self): pass def save_last(self): pass def load_last(self): pass
Builder.load_string(''' #<KvLang> <TitleLabel>: label_month: lbl_month label_year: lbl_year btn_previous: btn_previous btn_next: btn_next Label: id: lbl_month pos_hint: {'x': 2/7, 'y': 0} size_hint: 3/7, 1 font_size: 25 Label: id: lbl_year pos_hint: {'x': 0, 'y': 0} size_hint: 2/7, 0.5 BackgroundButton: id: btn_previous pos_hint: {'x': 5/7, 'y': 0} size_hint: 1/7, 1 text: '<<' BackgroundButton: id: btn_next pos_hint: {'x': 6/7, 'y': 0} size_hint: 1/7, 1 text: '>>' #</KvLang> ''')
Builder.load_string(''' <CustButton@Button>: font_size: 75 <CalcGridLayout>: id: calculator display: entry rows: 6 padding: 10 spacing: 10 BoxLayout: TextInput: id: entry font_size: 75 multiline: True padding_x:[20,0] pos_hint: {'right': 1, 'top': 1} BoxLayout: spacing: 10 CustButton: text: "AC" on_press: entry.text = "" CustButton: text: "(" on_press: entry.text += self.text CustButton: text: ")" on_press: entry.text += self.text CustButton: text: "/" on_press: entry.text += self.text BoxLayout: spacing: 10 CustButton: text: "7" on_press: entry.text += self.text CustButton: text: "8" on_press: entry.text += self.text CustButton: text: "9" on_press: entry.text += self.text CustButton: text: "*" on_press: entry.text += self.text BoxLayout: spacing: 10 CustButton: text: "4" on_press: entry.text += self.text CustButton: text: "5" on_press: entry.text += self.text CustButton: text: "6" on_press: entry.text += self.text CustButton: text: "-" on_press: entry.text += self.text BoxLayout: spacing: 10 CustButton: text: "1" on_press: entry.text += self.text CustButton: text: "2" on_press: entry.text += self.text CustButton: text: "3" on_press: entry.text += self.text CustButton: text: "+" on_press: entry.text += self.text BoxLayout: spacing: 10 CustButton: text: "." on_press: entry.text += self.text CustButton: text: "0" on_press: entry.text += self.text CustButton: text: "DEL" on_press: entry.text = entry.text[:-1] CustButton: text: "=" on_press: calculator.calculat(entry.text) ''')
Builder.load_string( """ <Navigationrail>: name: 'Navigationrail' AKNavigationrail: id: rail AKNavigationrailCustomItem: size_hint_y: None height: dp(60) padding: dp(5) MDIconButton: icon: 'arrow-left' theme_text_color: 'Custom' text_color: 1,1,1,1 on_release: if rail.get_state()=='open': rail.dismiss(); self.icon='menu' else: rail.open(); self.icon='arrow-left' AKNavigationrailItem: text: 'Withdraw' icon: 'wallet-plus' on_release: scr_mng.current= 'withdraw' AKNavigationrailItem: text: 'Deposit' icon: 'wallet-plus-outline' on_release: scr_mng.current= 'deposit' AKNavigationrailItem: text: 'Profile' icon: 'account-circle-outline' on_release: scr_mng.current= 'profile' AKNavigationrailCustomItem: AKNavigationrailContent: ScreenManager: id: scr_mng Screen: name: 'withdraw' MDLabel: text: 'Withdraw' halign: 'center' Screen: name: 'deposit' MDLabel: text: 'Deposit' halign: 'center' Screen: name: 'profile' MDLabel: text: 'Profile' halign: 'center' """ )
import re from kivy.uix.textinput import TextInput from kivy.lang.builder import Builder Builder.load_string(""" <IntegerInput>: write_tab: False background_color: .2, .2, .3, .8 disabled_foreground_color: 1,1,1,.75 foreground_color: 1,1,1,1 size_hint_y: None height: app.button_scale font_size: app.text_scale """) class IntegerInput(TextInput): pat = re.compile('[^0-9]') def insert_text(self, substring, from_undo=False): pat = self.pat s = re.sub(pat, '', substring) return super(IntegerInput, self).insert_text(s, from_undo=from_undo)
Builder.load_string(""" <VideoViewer>: SpecialVideoPlayer: canvas.after: Color: rgba: app.theme.favorite if root.favorite else [0, 0, 0, 0] Rectangle: source: 'data/star.png' pos: self.width - (self.width*.03), 44 size: (self.width*.03, self.width*.03) disabled: True if self.opacity == 0 else False pos: root.pos size: root.size id: player favorite: root.favorite photoinfo: root.photoinfo source: root.file options: {'allow_stretch': True} BoxLayout: orientation: 'vertical' opacity: 0 id: overlay pos: root.pos size: root.size RelativeLayout: id: photoShow height: root.height - 44 - app.button_scale width: root.width size_hint: None, None BoxLayout: size_hint: None, None height: app.button_scale orientation: 'horizontal' width: root.width NormalButton: text: 'Set Start Point' on_release: root.set_start_point() NormalButton: text: 'Clear Start Point' warn: True on_release: root.reset_start_point() Label: size_hint_x: 1 NormalButton: text: 'Clear End Point' warn: True on_release: root.reset_end_point() NormalButton: text: 'Set End Point' on_release: root.set_end_point() HalfSliderLimited: disabled: True if self.parent.opacity == 0 else False size_hint_y: None width: root.width value: root.position start: root.start_point end: root.end_point on_value: root.position = self.value height: app.button_scale """)
Builder.load_string(""" #:import Toolbar kivymd.toolbar.Toolbar #:import MDList kivymd.list.MDList #:import OneLineIconListItem kivymd.list.OneLineIconListItem #:import colors kivymd.color_definitions.colors #:import get_color_from_hex kivy.utils.get_color_from_hex #:import ScrollView kivy.uix.scrollview.ScrollView #:import Window kivy.core.window.Window <NavigationDrawerToolbar> elevation: 0 specific_text_color: root.theme_cls.secondary_text_color opposite_colors: False title_theme_color: 'Secondary' md_bg_color: root.theme_cls.bg_light canvas: Color: rgba: root.theme_cls.divider_color Line: points: self.x, self.y, self.x+self.width,self.y <NavigationLayout> <MDNavigationDrawer>: _list: list _header_container: _header_container canvas: Color: rgba: root.theme_cls.bg_light Rectangle: size: root.size pos: root.pos canvas.before: Color: rgba: root.shadow_color Rectangle: size: Window.size pos: 0, 0 BoxLayout: id: _header_container size_hint_y: None height: _header_container.minimum_height ScrollView: do_scroll_x: False MDList: id: list <NavigationDrawerIconButton>: theme_text_color: 'Primary' if not root._active else 'Custom' if root.use_active else 'Primary' text_color: root.theme_cls.secondary_text_color if not root._active else root.active_color if \ root.active_color_type == "custom" else root._active_color if root.use_active else \ root.theme_cls.secondary_text_color NDIconLabel: id: _icon font_style: 'Icon' theme_text_color: 'Secondary' if not root._active else 'Custom' if root.use_active else 'Custom' text_color: root.theme_cls.secondary_text_color if not root._active else root.active_color if \ root.active_color_type == "custom" else root._active_color if root.use_active else \ root.theme_cls.secondary_text_color BoxLayout: id: _right_container size_hint: None, None x: root.x + root.width - _badge.texture_size[0] - dp(25) # - m_res.HORIZ_MARGINS y: root.y + root.height/2 - self.height/2 size: dp(70), root.height NDBadgeLabel: id: _badge theme_text_color: 'Secondary' if not root._active else 'Custom' if root.use_active else 'Custom' text_color: root.theme_cls.secondary_text_color if not root._active else root.active_color if \ root.active_color_type == "custom" else root._active_color if root.use_active else \ root.theme_cls.secondary_text_color text: root.badge_text halign: 'right' <NavigationDrawerDivider>: canvas: Color: rgba: self.theme_cls.divider_color Line: points: root.x ,root.y+dp(8), root.x+self.width, root.y+dp(8) """)
Builder.load_string( """ <StatusbarColor>: name: 'StatusbarColor' on_leave: root.change_color( app.theme_cls.primary_color , 'Light' ) BoxLayout: orientation: 'vertical' MDToolbar: title: root.name left_action_items:[['arrow-left' , lambda x:app.show_screen('Home','back') ]] FloatLayout: MDRaisedButton: text: 'Red' on_release: root.change_color( (1,0,0,1), 'Light' ) pos_hint: {'center_x': .5, 'center_y': 0.1} MDRaisedButton: text: 'Green' on_release: root.change_color( (0,0.7,0,1), 'Light' ) pos_hint: {'center_x': .5, 'center_y': 0.3} MDRaisedButton: text: 'Blue' on_release: root.change_color( (0,0,1,1), 'Light' ) pos_hint: {'center_x': .5, 'center_y': 0.5} MDRaisedButton: text: 'Yellow' on_release: root.change_color( (1,1,0,1), 'Dark' ) pos_hint: {'center_x': .5, 'center_y': 0.7} MDRaisedButton: text: 'White' on_release: root.change_color( (1,1,1,1), 'Dark' ) pos_hint: {'center_x': .5, 'center_y': 0.9} """ )
def build(self): screen = Builder.load_string(screen_helper) return screen
from kivymd.theming import ThemableBehavior from kivymd.vendor.navigationdrawer import NavigationDrawer Builder.load_string(""" #:import Window kivy.core.window.Window <ModifiedNavigationDrawer>: canvas: Color: rgba: root.theme_cls.bg_light Rectangle: size: root.size pos: root.pos canvas.before: Color: rgba: root.shadow_color Rectangle: size: Window.size pos: 0, 0 BoxLayout: size_hint_y: None orientation: 'vertical' height: self.minimum_height """) class ModifiedNavigationDrawer(BoxLayout, ThemableBehavior, RectangularElevationBehavior):
def __init__(self, **kwargs): BoxLayout.__init__(self, **kwargs) self.orientation = "vertical" self.numpad = Builder.load_string(calc) self.add_widget(self.numpad) #Buttons self.out = self.numpad.ids['out'] self.rout = self.numpad.ids['real_time_update'] self.rout_2 = self.numpad.ids['real_time_update_2'] self.delbutton = self.numpad.ids['cancel_but'] self.equalbutton = self.numpad.ids['equal_but'] self.differnbutton = self.numpad.ids['differentiate'] self.integrabutton = self.numpad.ids['integrate'] self.simplifybutton = self.numpad.ids['simplify'] self.factorisebutton = self.numpad.ids['factorise'] self.expandbutton = self.numpad.ids['expand'] self.fractog = self.numpad.ids['fractog'] self.solvebutton = self.numpad.ids['solve'] #Binds self.delbutton.bind(on_release=self.delholdclr, on_press=self.delbut) self.equalbutton.bind(on_release=self.equal_call) self.differnbutton.bind(on_release=self.differentiate) self.integrabutton.bind(on_release=self.integral) self.simplifybutton.bind(on_release=self.simplify) self.factorisebutton.bind(on_release=self.factorise) self.expandbutton.bind(on_release=self.expand) self.out.bind(text=self.rout_update) self.rout_2.bind(text=self.rout_update) self.fractog.bind(active=self.rout_update) self.solvebutton.bind(on_release=self.solver) #Clock Clock.schedule_interval(self.outputloop, 0) # Coloring self.numpad.ids['arrow'].md_bg_color = (0.1, 0, 0, 0.1) for x in self.numpad.ids['basic_buts'].children: x.md_bg_color = (1, 0, 0, 0.2) for x in self.numpad.ids['functions_but'].children: x.md_bg_color = (0.1, 0, 0, 0.2) self.numpad.ids['inv'].md_bg_color = (0, 0.5, 0.5, 0.2) for x in self.numpad.ids['inv_tri'].children: x.md_bg_color = (0, 0.5, 0.5, 0.2) self.numpad.ids['back'].md_bg_color = (0.1, 0, 0, 0.2) # init() of matrix self.mat_init() # init() of limit self.limit_init() # extras self.pretex = '..' self.expr = 0
ImageFile.LOAD_TRUNCATED_IMAGES = True from kivy.config import Config Config.window_icon = "data/icon.png" from kivy.properties import ObjectProperty, ListProperty, BooleanProperty from kivy.uix.floatlayout import FloatLayout from kivy.lang.builder import Builder Builder.load_string(""" <VideoThumbnail>: pos_hint: {'x': 0, 'y': 0} image_overlay_play: 'atlas://data/images/defaulttheme/player-play-overlay' image_loading: 'data/images/image-loading.gif' AsyncThumbnail: photoinfo: root.photoinfo loadfullsize: False allow_stretch: True mipmap: True source: root.source color: (.5, .5, .5, 1) pos_hint: {'x': 0, 'y': 0} Image: source: root.image_overlay_play if not root.click_done else root.image_loading pos_hint: {'x': 0, 'y': 0} """) class VideoThumbnail(FloatLayout): source = ObjectProperty(None) video = ObjectProperty(None) click_done = BooleanProperty(False) photoinfo = ListProperty()
Builder.load_string(''' <CustBoxLayout>: usr_pswrd: usr_pswrd usr_name: usr_name display: lbl_otpt orientation : "vertical" spacing: 10 padding: 10 BoxLayout : # 1 horizontal box that creates a line size_hint_y : 6 Label : id: lbl_otpt markup: True font_size: 26 #align: 'middle' valign: 'middle' halign: 'center' padding_x: 10 text : "Login info" size_hint_x : 4 size: self.texture_size #text_size: cm(15), cm(4) text_size: self.size BoxLayout : # 1 horizontal box that creates a line size_hint_y : 1 Label : text : "User Name:" size_hint_x : 2 TextInput : id: usr_name font_size: 32 multiline: False size_hint_x : 4 # limit to 20 chars input_filter: lambda text, from_undo: text[:20 - len(self.text)] hint_text: "Between 3 to 20 characters" hint_text_color: [0.5, 0.5, 0.5, 0.5] #gray BoxLayout : # 2 horizontal box that creates the line size_hint_y : 1 Label : size_hint_x : 2 text : " Password: "******"Between 8 to 32 characters" input_filter: lambda text, from_undo: text[:32 - len(self.text)] hint_text_color: [0.5, 0.5, 0.5, 0.5] #gray BoxLayout : # 3 horizontal box that creates the line size_hint_y : 1 size_hint_x: .5 halign: 'middle' Button : text : "Submit" on_press: root.submit_action(root.usr_name,root.usr_pswrd) ''')
Builder.load_string(""" <PhotoRecycleViewButton>: canvas.after: Color: rgba: (1, 1, 1, 0) if self.found else(1, 0, 0, .33) Rectangle: pos: self.pos size: self.size Color: rgba: app.theme.favorite if self.favorite else [0, 0, 0, 0] Rectangle: source: 'data/star.png' pos: (self.pos[0]+(self.width-(self.height*.5)), self.pos[1]+(self.height*.5)-(self.height*.167)) size: (self.height*.33, self.height*.33) Color: rgba: 1, 1, 1, .5 if self.video else 0 Rectangle: source: 'data/play_overlay.png' pos: (self.pos[0]+(self.height*.25)), (self.pos[1]+(self.height*.25)) size: (self.height*.5), (self.height*.5) size_hint_x: 1 height: (app.button_scale * 2) AsyncThumbnail: id: thumbnail #photoinfo: root.photoinfo #source: root.source size_hint: None, None width: (app.button_scale * 2) height: (app.button_scale * 2) NormalLabel: mipmap: True size_hint_y: None height: (app.button_scale * 2) text_size: (self.width - 20, None) text: root.text halign: 'left' valign: 'center' """)
from kivy.uix.boxlayout import BoxLayout from kivy.properties import StringProperty, ListProperty, NumericProperty, OptionProperty, BooleanProperty from kivy.clock import Clock from kivy.uix.floatlayout import FloatLayout from kivy.animation import Animation from kivy.core.window import Window Builder.load_string(""" <AKHintWidgetItem> pos: self.parent.pos <AKHintWidget>: FloatLayout: pos: root.pos size: root.size FloatLayout: id: _float_box # pos: root._hintwidget_x, root._hintwidget_y size_hint: None, None size: root.hintwidget_width, root.hintwidget_height opacity: root._hintwidget_alpha """) class AKHintWidgetItem(BoxLayout): pass class AKHintWidget(BoxLayout):
Builder.load_string(""" <NormalLabel>: mipmap: True color: app.theme.text font_size: app.text_scale size_hint_y: None height: app.button_scale <ShortLabel>: shorten: True shorten_from: 'right' size_hint_x: 1 size_hint_max_x: self.texture_size[0] + 20 <LeftNormalLabel>: shorten: True shorten_from: 'right' text_size: self.size halign: 'left' valign: 'middle' <InfoLabel>: canvas.before: Color: rgba: root.bgcolor Rectangle: pos: self.pos size: self.size mipmap: True text: app.infotext color: app.theme.info_text <HeaderLabel@Label>: mipmap: True color: app.theme.header_text font_size: int(app.text_scale * 1.5) size_hint_y: None height: app.button_scale bold: True """)
def build(self): # bulding the app screen = Builder.load_string(screens) return screen
def build(self): self.theme_cls.primary_palette = "Red" self.theme_cls.primary_hue = "A700" Builder.load_string(open('main.kv', encoding="utf-8").read()) return MyMainWidget()
Builder.load_string(""" <MyAKOnboardingItem@AKOnboardingItem> source: "" text: "" title: "" MDFloatLayout: Image: source: root.source pos_hint: {"center_x": .5, "y": .6} size_hint: .4, .3 MDBoxLayout: orientation: "vertical" padding: dp(10) adaptive_height: True pos_hint: {"center_x": .5, "top": .5} spacing: dp(20) size_hint_x: .7 canvas.before: Color: rgba: app.theme_cls.primary_dark RoundedRectangle: pos: self.pos size: self.size MDLabel: text: root.title bold: True size_hint_y: None height: self.texture_size[1] theme_text_color: "Primary" font_style: "H6" halign: "center" valign: "center" MDLabel: size_hint_y: None height: self.texture_size[1] theme_text_color: "Primary" font_style: "Body1" halign: "center" valign: "center" text: root.text <Onboarding> on_leave: boarding.reset() MDBoxLayout: orientation: "vertical" spacing: dp(10) AKOnboarding: id: boarding on_finish: root.finish_callback() circles_size: dp(15) MyAKOnboardingItem: source: "assets/slide_one_img.png" text: "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book" title:"What is Lorem Ipsum?" MyAKOnboardingItem: source: "assets/slide_two_img.png" text: "It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout." title:"Why do we use it?" MyAKOnboardingItem: source: "assets/slide_three_img.png" text: "Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old." title:"Where does it come from?" """)
def build(self): self.theme_cls.primary_palette = "Green" self.theme_cls.theme_style = "Light" screen = Builder.load_string(screen_helper) return screen
Builder.load_string(""" <EditCropImage>: padding: 0, 0, int(app.button_scale / 2), 0 cols: 1 height: self.minimum_height BoxLayout: orientation: 'horizontal' size_hint_y: None height: app.button_scale WideButton: text: 'Confirm Edit' on_release: root.save_image() WideButton: text: 'Cancel Edit' warn: True on_release: root.owner.set_edit_panel('main') WideButton: id: loadLast disabled: not root.owner.edit_crop text: "Load Last Settings" on_release: root.load_last() MediumBufferY: BoxLayout: orientation: 'horizontal' size_hint_y: None height: app.button_scale LeftNormalLabel: text: 'Image Cropping:' NormalButton: text: 'Reset All' on_release: root.reset_crop() LeftNormalLabel: size_hint_y: None height: app.button_scale text: root.crop_size GridLayout: canvas.before: Color: rgba: app.theme.area_background BorderImage: pos: self.pos size: self.size source: 'data/buttonflat.png' padding: app.padding cols: 1 size_hint: 1, None height: self.minimum_height BoxLayout: orientation: 'horizontal' size_hint_y: None height: app.button_scale LeftNormalLabel: text: 'Crop Top:' ShortLabel: text: str(round(cropTopSlider.value * 100, 1))+'%' HalfSlider: id: cropTopSlider value: root.crop_top on_value: root.crop_top = self.value SmallBufferY: BoxLayout: orientation: 'horizontal' size_hint_y: None height: app.button_scale LeftNormalLabel: text: 'Crop Right:' ShortLabel: text: str(round(cropRightSlider.value * 100, 1))+'%' HalfSlider: id: cropRightSlider value: root.crop_right on_value: root.crop_right = self.value SmallBufferY: BoxLayout: orientation: 'horizontal' size_hint_y: None height: app.button_scale LeftNormalLabel: text: 'Crop Bottom:' ShortLabel: text: str(round(cropBottomSlider.value * 100, 1))+'%' HalfSlider: id: cropBottomSlider value: root.crop_bottom on_value: root.crop_bottom = self.value SmallBufferY: BoxLayout: orientation: 'horizontal' size_hint_y: None height: app.button_scale LeftNormalLabel: text: 'Crop Left:' ShortLabel: text: str(round(cropLeftSlider.value * 100, 1))+'%' HalfSlider: id: cropLeftSlider value: root.crop_left on_value: root.crop_left = self.value SmallBufferY: GridLayout: canvas.before: Color: rgba: app.theme.area_background BorderImage: pos: self.pos size: self.size source: 'data/buttonflat.png' padding: app.padding cols: 1 size_hint: 1, None height: self.minimum_height MenuStarterButtonWide: size_hint_x: 1 text: 'Set Aspect Ratio...' id: aspectRatios on_release: root.aspect_dropdown.open(self) GridLayout: cols: 2 size_hint: 1, None height: app.button_scale NormalToggle: id: horizontalToggle size_hint_x: 1 text: 'Horizontal' state: 'down' if root.orientation == 'horizontal' else 'normal' group: 'orientation' on_press: root.set_orientation('horizontal') NormalToggle: id: verticalToggle size_hint_x: 1 text: 'Vertical' state: 'down' if root.orientation == 'vertical' else 'normal' group: 'orientation' on_press: root.set_orientation('vertical') """)
Builder.load_string( """ <AKFloatingRoundedAppbarItemBase>: orientation: 'vertical' size_hint: None, None height: self.parent.height- dp(5) width: self.minimum_width pos_hint: {'center_x': .5, 'center_y': .5} <AKFloatingRoundedAppbarButtonItem>: MDIcon: icon: root.icon halign: 'center' valign: 'center' theme_text_color: 'Custom' text_color: root.icon_color if root.icon_color else 1,1,1,1 font_size: dp(20) pos_hint: {'center_x': .5, 'center_y': .5} size_hint: None, None size: self.font_size, self.font_size Label: text: root.text halign: 'center' valign: 'center' font_size: dp(10) color: root.text_color if root.text_color else 1,1,1,1 size_hint: None,None size: self.texture_size <AKFloatingRoundedAppbarAvatarItem>: spacing: dp(1) BoxLayout: size_hint: None,None size : [self.parent.height-dp(2),self.parent.height-dp(2)] if not root.text else [dp(20), dp(20)] pos_hint: {'center_x': .5, 'center_y': .5} canvas.after: Color: rgba: 1,1,1,1 Ellipse: pos: self.pos size: self.size source: root.source Label: text: root.text halign: 'center' valign: 'center' font_size: dp(10) color: root.text_color if root.text_color else 1,1,1,1 size_hint: None,None size: self.texture_size <AKFloatingRoundedAppbar>: size_hint: None,None size: self.minimum_width, dp(40) pos_hint: {'center_x': .5} y: dp(10) spacing: dp(40) padding: dp(40) canvas.before: Color: rgba: root.bg_color if root.bg_color else root.theme_cls.primary_color RoundedRectangle: pos: self.pos size: self.size radius: [root.height/2,] """ )
Builder.load_string(""" <AdaptiveBox> adaptive_height: True <BaseMenu> canvas.before: Color: rgba: root._bg_color Rectangle: pos: self.pos size: self.size <AKSwipeMenuMainContent> size_hint_y: None height: root._root.height - root._root._top_content.height <AKSwipeMenuBottomContent> size_hint_y: None _bg_color: root.bg_color if root.bg_color else root.theme_cls.primary_light <AKSwipeMenuTopContent> size_hint_y: None _bg_color: root.bg_color if root.bg_color else root.theme_cls.primary_color <AKSwipeMenu>: _top_content:_top_content _bottom_content:_bottom_content _menu: _menu AdaptiveBox: id: _content y: _top_content.height MenuBox: id: _menu orientation: "vertical" _root: root y: _top_content.height - self.height AdaptiveBox: id: _top_content AdaptiveBox: id: _bottom_content """)
from kivy.uix.settings import SettingItem from kivy.lang.builder import Builder Builder.load_string(""" <SettingAboutButton>: WideButton: text: "About Snu Photo Manager" size: root.size pos: root.pos font_size: '15sp' on_release: app.about() """) class SettingAboutButton(SettingItem): """Widget that opens an about dialog.""" pass
from kivy.uix.boxlayout import BoxLayout from kivy.uix.scrollview import ScrollView from kivy.utils import platform __all__ = ("MDSwiperItem", "MDSwiper") Builder.load_string(""" <MDSwiper> do_scroll_y: False bar_width: 0 MDBoxLayout: adaptive_width: True id: anchor_scroll padding: [root.items_spacing, 0 ] <MDSwiperItem> size_hint: None, None <_ItemsBox> size_hint: None, None anchor_x: "center" anchor_y: "center" """) class _ScrollViewHardStop(DampedScrollEffect): def stop(self, val, t=None): return super().stop(val, t=0.01)
self.transition.direction = direction self.current = "gtl" def user(self, name=None): """ユーザー画面のScreenを構築。""" name = name or getloginfo()["username"] if self.current_screen.name == name: return None self.clear_widgets() config.qt = True config.un = name self.add_widget(UserScreen(name=name)) self.transition.direction = "left" self.current = name class MenuScreen(Screen): pass kv = r""" <MenuScreen>: Image: source: "./images/menu.png" size_hint: None, None size: root.height*2, root.height pos: root.width/2-root.height, 0 """ Builder.load_string(kv)
def build(self): Builder.load_string(kv) return ServiceUI()