Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from kivy.lang import Builder
- from kivymd.app import MDApp
- from kivymd.uix.screen import MDScreen
- from kivy.uix.screenmanager import ScreenManager
- from kivy.config import Config
- Config.set('kivy', 'keyboard_mode', 'dock')
- from kivymd.app import MDApp
- from kivy.lang import Builder
- from kivymd.uix.screen import MDScreen
- from kivy.uix.screenmanager import ScreenManager
- from kivymd.uix.textfield import MDTextFieldRound
- from kivy.properties import NumericProperty
- from kivy.core.window import Window
- from kivy.uix.scrollview import ScrollView
- import re
- #timeday=ObjectProperty()
- KV=('''
- <LOGIN_Window>:
- name:'login_window1'
- RelativeLayout:
- MDToolbar:
- title: 'Permit Me'
- elevation: 10
- left_action_items: [['menu', lambda x: nav_drawer.set_state('open')]]
- pos_hint: {"left":1, "top":1}
- MDLabel:
- text:'PERMIT ME MOBILE'
- font_size: 50 #cm(10), cm(10)
- pos_hint: {'x':.3, 'y':.3}
- MDLabel:
- text:'Email-ID'
- #halign:'center'
- pos_hint : {'x':.3, 'y':.2}
- MDTextFieldRound:
- id: login
- hint_text: 'For Eg:- [email protected]'
- icon_left: "email"
- halign: 'left'
- valign: 'middle'
- pos_hint : {'x':.3, 'y':.63}
- size_hint : 0.4, .047
- #pos_hint ={'center_x':.7, 'center_y':.5}
- MDLabel:
- text:'Password'
- pos_hint : {'x':.3, 'y':.1}
- MDTextFieldRound:
- id: passw
- hint_text: 'Password'
- icon_left: 'key-variant'
- icon_right: 'eye-off'
- pos_hint : {'x':.3, 'y':.53}
- size_hint : 0.4, .047
- MDFillRoundFlatButton:
- id: logIn
- text: 'Login'
- pos_hint : {'x':.3, 'y':.4}
- on_release:
- app.change_screen('tolBar_Window1')
- app.add_datatable()
- app.on_start()
- #on_release: app.on_start()
- MDFillRoundFlatButton:
- text: 'Register'
- pos_hint : {'x':.6, 'y':.4}
- on_release:root.manager.current = 'regitration_window1'
- MDLabel:
- text:'Powered By KO-AAHAM Technology'
- pos_hint : {'x':0, 'y':-0.48}
- MDNavigationDrawer:
- id:nav_drawer
- ScrollView:
- MDList:
- #orientation: 'vertical'
- padding: '8dp'
- spacing: '8dp'
- MDRoundFlatIconButton:
- icon: 'account-settings'
- text: 'Server Setting'
- on_press: app.change_screen('Server_Setting_window1')
- MDRoundFlatIconButton:
- text: 'Support'
- icon: 'face-agent'
- on_press:app.change_screen('Support_window1')
- MDRoundFlatIconButton:
- icon: 'information-outline'
- text: 'About'
- on_press:app.change_screen('About_window1')
- #ContentNavigationDrawer:
- <REGITRATION_Window>:
- name:'regitration_window1'
- #RelativeLayout:
- MDToolbar:
- title: 'Registration'
- elevation: 10
- left_action_items: [['arrow-left', lambda x: app.change_screen('login_window1')]]
- pos_hint: {"left":1, "top":1}
- MDLabel:
- text: 'Full Name'
- font_size: 15
- pos_hint : {'x':0.0322, 'y':0.35}
- MainKeypad:
- max_characters: 70
- hint_text: 'For Eg:- xxx yyy zzz'
- pos_hint : {'x':0.0322, 'y':0.790}
- size_hint : 0.6, .045
- MDLabel:
- text: 'Country Code '
- font_size: 15
- pos_hint : {'x':0.0322, 'y':0.272}
- NumericInput:
- max_characters: 3
- int_text: 'For Eg:- +91'
- pos_hint : {'x':0.0322, 'y':0.710}
- size_hint : 0.09, .045
- MDLabel:
- text: 'Mobile Number'
- font_size: 15
- pos_hint : {'x':0.305, 'y':0.272}
- NumericInput:
- max_characters: 10
- hint_text: 'For Eg:- 987654321'
- pos_hint :{'x':0.305, 'y':0.710}
- size_hint : 0.35, .045
- MDLabel:
- text: 'Location'
- font_size: 15
- pos_hint : {'x':0.0322, 'y':0.190}
- MainKeypad:
- max_characters: 70
- hint_text: 'For Eg:- kalyan'
- pos_hint : {'x':0.0322, 'y':0.630}
- size_hint : 0.6, .045
- MDLabel:
- text: 'Pin Code'
- font_size: 15
- pos_hint : {'x':0.0322, 'y':0.11}
- NumericInput:
- max_characters: 7
- hint_text: 'For Eg:- 400050'
- pos_hint : {'x':0.0322, 'y':0.550}
- size_hint : 0.6, .045
- MDLabel:
- text: 'City/Town/Village'
- font_size: 15
- pos_hint : {'x':0.0322, 'y':0.03}
- MainKeypad:
- max_characters: 70
- hint_text: 'For Eg:- Mumbai'
- pos_hint : {'x':0.0322, 'y':0.470}
- size_hint : 0.6, .045
- MDLabel:
- text: 'District/Taluka'
- font_size: 15
- pos_hint : {'x':0.0322, 'y':-0.05}
- MainKeypad:
- max_characters: 70
- hint_text: 'For Eg:- Mumbai'
- pos_hint : {'x':0.0322, 'y':0.390}
- size_hint : 0.6, .045
- MDLabel:
- text: 'State'
- font_size: 15
- pos_hint : {'x':0.0322, 'y':-0.13}
- MainKeypad:
- max_characters: 70
- hint_text: 'For Eg:- Maharashtra'
- pos_hint : {'x':0.0322, 'y':0.310}
- size_hint : 0.6, .045
- MDLabel:
- text: 'Country'
- font_size: 15
- pos_hint : {'x':0.0322, 'y':-0.21}
- MainKeypad:
- max_characters: 70
- hint_text: 'For Eg:- India'
- pos_hint : {'x':0.0322, 'y':0.230}
- size_hint : 0.6, .045
- MDLabel:
- text: 'Password'
- font_size: 15
- pos_hint : {'x':0.0322, 'y':-0.29}
- MainKeypad:
- id: field_password
- max_characters: 70
- hint_text: 'For Eg:- Chennai@123'
- pos_hint : {'x':0.0322, 'y':0.150}
- size_hint : 0.6, .045
- MDLabel:
- text: 'Confirm Password'
- font_size: 15
- pos_hint : {'x':0.0322, 'y':-0.37}
- MainKeypad:
- id: field_confirmpassword
- max_characters: 70
- hint_text: 'For Eg:- Chennai@123'
- password: True
- pos_hint : {'x':0.0322, 'y':0.070}
- size_hint : 0.6, .045
- MDLabel:
- id: is_vallid
- #text: 'Vallidation'
- font_size: 45
- pos_hint : {'x':0.67, 'y':0.38}
- MDFillRoundFlatButton:
- text:'REGISTER'
- pos_hint: {'x':.1, 'y':.1}
- on_press: app.vall()
- MDFillRoundFlatButton:
- text:'Cancel'
- pos_hint: {'x':.3, 'y':.1}
- WindowManager:
- LOGIN_Window:
- REGITRATION_Window:
- ''')
- class LOGIN_Window(MDScreen):
- pass
- class REGITRATION_Window(MDScreen):
- pass
- class WindowManager(ScreenManager):
- pass
- class NumericInput(MDTextFieldRound):
- max_characters = NumericProperty()
- def __init__(self, **kwargs):
- super().__init__(input_filter=self.char_limit, **kwargs)
- def on_focus(self, instance_text_field, focus_value: bool):
- if focus_value:
- num_kb = Window.request_keyboard(self.close_key, self)
- if num_kb.widget:
- num_kb.widget.layout ='numeric.json'
- def close_key(self):
- pass
- def char_limit(self, substring, from_undo):
- if len(self.text) < self.max_characters:
- return substring
- class MainKeypad(MDTextFieldRound):
- def __init__(self, **kwargs):
- super().__init__(input_filter=self.char_limit, **kwargs)
- def on_focus(self, instance_text_field, focus_value: str):
- if focus_value:
- kb = Window.request_keyboard(self.close_key, self)
- if kb.widget:
- kb.widget.layout = 'qwerty'
- def close_key(self):
- pass
- def char_limit(self, substring, from_undo):
- if len(self.text) < self.max_characters:
- return substring
- class MainApp(MDApp):
- def build(self):
- return Builder.load_string(KV)
- def change_screen(self, screen):
- self.root.current = screen
- def vall(self):
- self.root.get_screen('regitration_window1').ids.is_vallid.text=""
- main_pswd = self.root.get_screen('regitration_window1').ids.field_password.text
- confirm_pswd=self.root.get_screen('regitration_window1').ids.field_confirmpassword.text
- reg = "^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*#?&])[A-Za-z\d@$!#%*?&]{6,16}$"
- match_re = re.compile(reg)
- main_res = re.search(match_re, main_pswd)
- confirm_res = re.search(match_re, confirm_pswd)
- if (main_res==confirm_res):
- self.root.get_screen('regitration_window1').ids.is_vallid.text = "Error"
- else:
- self.change_screen('login_window1')
- if __name__ == '__main__':
- MainApp().run()
Advertisement
Add Comment
Please, Sign In to add comment