Advertisement
Guest User

Untitled

a guest
May 8th, 2017
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 12.53 KB | None | 0 0
  1. <LargerButton@Button>:
  2.     size_hint: (None, None)
  3.     font_name: 'Constantia.ttf'
  4.     size: 200, 50
  5.  
  6. <SmallerButton@Button>:
  7.     size_hint: (None, None)
  8.     font_name: 'Constantia.ttf'
  9.     size: 100, 40
  10.  
  11. <CustomScreen@Screen>:
  12.     FloatLayout:
  13.         canvas.before:
  14.             Color:
  15.                 rgba: (0.2, 0.2, 0.2, 0.5)
  16.             Rectangle:
  17.                 size: self.width, self.height
  18.  
  19.         # Rectangle top banner
  20.         canvas:
  21.             Color:
  22.                 rgba: (0.59, 0.15, 0.17, 1)
  23.             Rectangle:
  24.                 size: self.width, self.height / 4
  25.                 pos: 0, self.height - self.height / 4
  26.  
  27.         # Logo
  28.         Image:
  29.             source: 'Logo.png'
  30.             # Need the following line to change size!
  31.             size_hint: (None, None)
  32.             height: dp(100)
  33.             pos: root.width - self.width - 25 , root.height - self.height - 10
  34.  
  35. <IdentiKeyRoot>:
  36.     ScreenManager:
  37.         id: screen_manager
  38.         LoginScreen:
  39.             id: login_screen
  40.             name: "Login_Screen"
  41.         AdminScreen:
  42.             id: admin_screen
  43.             name: "Admin_Screen"
  44.         AddUserScreen:
  45.             id: add_user_screen
  46.             name: "Add_User_Screen"
  47.         RemoveUserScreen:
  48.             id: remove_user_screen
  49.             name: "Remove_User_Screen"
  50.         KeyScreen:
  51.             id: key_screen
  52.             name: "Key_Screen"
  53.  
  54. <ReturnKeyPopup>:
  55.     id: ReturnKeyPopup
  56.     title: "Check In Ring"
  57.     title_align: 'center'
  58.     title_font: 'Constantia.ttf'
  59.     auto_dismiss: False
  60.     on_dismiss: app.root.checkInRingDismiss()
  61.     size_hint: 0.5, 0.5
  62.     FloatLayout:
  63.         Label:
  64.             text: "Please press 'Placed' after placing key ring on hook!"
  65.             font_name: 'Constantia.ttf'
  66.             pos: app.root.width / 2 - self.width / 2, app.root.height / 2 - 60
  67.         SmallerButton:
  68.             text: "Placed"
  69.             on_release: root.dismiss()
  70.             pos: app.root.width / 2 - self.width / 2, app.root.height / 2 - 90
  71.  
  72. <RetrieveKeyPopup>:
  73.     id: RetrieveKeyPopup
  74.     title: "Check Out Ring"
  75.     title_align: 'center'
  76.     title_font: 'Constantia.ttf'
  77.     auto_dismiss: False
  78.     on_dismiss: app.root.checkOutRingDismiss()
  79.     size_hint: 0.5, 0.5
  80.     FloatLayout:
  81.         Label:
  82.             text: "Please touch 'Removed' after removing key ring from hook!"
  83.             font_name: 'Constantia.ttf'
  84.             pos: app.root.width / 2 - self.width / 2, app.root.height / 2 - 60
  85.         SmallerButton:
  86.             text: "Removed"
  87.             on_release: root.dismiss()
  88.             pos: app.root.width / 2 - self.width / 2, app.root.height / 2 - 90
  89.  
  90. <LoginScreen@CustomScreen>:
  91.     FloatLayout:
  92.         # Welcome text
  93.         Label:
  94.             text: 'Welcome to IdentiKey!'
  95.             color: (1, 1, 1, 1)
  96.             font_name: 'Constantia.ttf'
  97.             font_size: 30
  98.             pos: -self.width / 3 + 40, self.height / 2 - 80
  99.  
  100.         # Username label
  101.         Label:
  102.             text: 'Username:'
  103.             font_name: 'Constantia.ttf'
  104.             font_size: 20
  105.             pos: -130, 18
  106.  
  107.         # Username entry
  108.         TextInput:
  109.             id: username_entry
  110.             size_hint: (None, None)
  111.             font_name: 'Constantia.ttf'
  112.             size: 200, 35
  113.             pos: root.width / 2 - self.width / 10, root.height / 2
  114.             multiline: False
  115.             write_tab: False
  116.             on_text_validate: app.root.check_login_info(username_entry.text, password_entry.text)
  117.  
  118.         # Password label
  119.         Label:
  120.             text: 'Password:'
  121.             font_name: 'Constantia.ttf'
  122.             font_size: 20
  123.             pos: -130, -32
  124.  
  125.         # Password entry
  126.         TextInput:
  127.             id: password_entry
  128.             size_hint: (None, None)
  129.             font_name: 'Constantia.ttf'
  130.             size: 200, 35
  131.             pos: root.width / 2 - self.width / 10, root.height / 2 - root.height / 10
  132.             multiline: False
  133.             password: True
  134.             write_tab: False
  135.             on_text_validate: app.root.check_login_info(username_entry.text, password_entry.text)
  136.  
  137.         # Login button
  138.         SmallerButton:
  139.             text: 'Login'
  140.             pos: root.width / 2 - self.width / 2, root.height / 4 - self.height / 2
  141.             on_release: app.root.check_login_info(username_entry.text, password_entry.text)
  142.  
  143.         # Username/Password invalid text
  144.         Label:
  145.             id: invalid_text
  146.             text: ""
  147.             font_name: 'Constantia.ttf'
  148.             color: (0.59, 0.15, 0.17, 1)
  149.             font_size: 30
  150.             pos: root.width / 2 - self.width / 2, -200
  151.  
  152. <AdminScreen@CustomScreen>:
  153.     FloatLayout:
  154.         # Welcome text
  155.         Label:
  156.             text: 'Welcome, admin!'
  157.             color: (1, 1, 1, 1)
  158.             font_name: 'Constantia.ttf'
  159.             font_size: 30
  160.             pos: -self.width / 3, self.height / 2 - 80
  161.  
  162.         # Add new user button
  163.         LargerButton:
  164.             text: 'Add New User'
  165.             pos: root.width / 2 - self.width - 5, root.height / 2 + self.height / 2 - 40
  166.             on_release: app.root.ids.screen_manager.current = "Add_User_Screen"
  167.  
  168.         # Remove user button
  169.         LargerButton:
  170.             text: 'Remove User'
  171.             pos: root.width / 2 + 5, root.height / 2 + self.height / 2 - 40
  172.             on_release: app.root.ids.screen_manager.current = "Remove_User_Screen"
  173.  
  174.         # Check key status button
  175.         LargerButton:
  176.             text: 'Check Key Status'
  177.             pos: root.width / 2 - self.width / 2, root.height / 2 - self.height / 2 - 60
  178.  
  179.         # Log out button
  180.         SmallerButton:
  181.             text: 'Log Out'
  182.             pos: 10, 10
  183.             on_release: app.root.log_out()
  184.  
  185. <AddUserScreen@CustomScreen>:
  186.     FloatLayout:
  187.         # Welcome text
  188.         Label:
  189.             text: 'Add new user:'
  190.             color: (1, 1, 1, 1)
  191.             font_name: 'Constantia.ttf'
  192.             font_size: 30
  193.             pos: -self.width / 3 - 10, self.height / 2 - 80
  194.  
  195.         # New username label
  196.         Label:
  197.             text: 'New Username:'
  198.             font_name: 'Constantia.ttf'
  199.             font_size: 20
  200.             pos: -130, 15
  201.  
  202.         # New username entry
  203.         TextInput:
  204.             id: new_username_entry
  205.             size_hint: (None, None)
  206.             font_name: 'Constantia.ttf'
  207.             size: 200, 35
  208.             pos: root.width / 2 - self.width / 10, root.height / 2
  209.             multiline: False
  210.  
  211.         # New password label
  212.         Label:
  213.             text: 'New Password:'
  214.             font_name: 'Constantia.ttf'
  215.             font_size: 20
  216.             pos: -130, -35
  217.  
  218.         # New password entry
  219.         TextInput:
  220.             id: new_password_entry
  221.             size_hint: (None, None)
  222.             font_name: 'Constantia.ttf'
  223.             size: 200, 35
  224.             pos: root.width / 2 - self.width / 10, root.height / 2 - root.height / 10
  225.             multiline: False
  226.  
  227.         # New access level label
  228.         Label:
  229.             text: 'Access Level:'
  230.             font_name: 'Constantia.ttf'
  231.             font_size: 20
  232.             pos: -130, -80
  233.  
  234.         # New access level entry
  235.         TextInput:
  236.             id: new_access_level_entry
  237.             size_hint: (None, None)
  238.             font_name: 'Constantia.ttf'
  239.             size: 200, 35
  240.             pos: root.width / 2 - self.width / 10, root.height / 2 - root.height / 5
  241.  
  242.         # Add new user button
  243.         LargerButton:
  244.             text: 'Add New User'
  245.  
  246.             pos: root.width / 2 - self.width / 2, 70
  247.             on_release: app.root.add_new_user(new_username_entry.text, new_password_entry.text, new_access_level_entry.text)
  248.  
  249.         # Back button
  250.         SmallerButton:
  251.             text: '<-- Back'
  252.             pos: 10, 55
  253.             on_release: app.root.ids.screen_manager.current = "Admin_Screen"
  254.  
  255.         # Log out button
  256.         SmallerButton:
  257.             text: 'Log Out'
  258.             pos: 10, 10
  259.             on_release: app.root.log_out()
  260.  
  261.         # New username/Password success text
  262.         Label:
  263.             id: new_user_success_text
  264.             text: ""
  265.             font_name: 'Constantia.ttf'
  266.             color: (0.59, 0.15, 0.17, 1)
  267.             font_size: 30
  268.             pos: root.width / 2 - self.width / 2, -200
  269.  
  270. <RemoveUserScreen@CustomScreen>:
  271.     FloatLayout:
  272.         # Welcome text
  273.         Label:
  274.             text: 'Remove user:'
  275.             color: (1, 1, 1, 1)
  276.             font_name: 'Constantia.ttf'
  277.             font_size: 30
  278.             pos: -self.width / 3 - 10, self.height / 2 - 80
  279.  
  280.         # Username to remove label
  281.         Label:
  282.             text: 'User to Remove:'
  283.             font_name: 'Constantia.ttf'
  284.             font_size: 20
  285.             pos: -130, 20
  286.  
  287.         # Username to remove entry
  288.         TextInput:
  289.             id: remove_username_entry
  290.             size_hint: (None, None)
  291.             font_name: 'Constantia.ttf'
  292.             size: 200, 35
  293.             pos: root.width / 2 - self.width / 10, root.height / 2
  294.             multiline: False
  295.  
  296.         # User to remove password label
  297.         Label:
  298.             text: 'Password of User:'
  299.             font_name: 'Constantia.ttf'
  300.             font_size: 20
  301.             pos: -130, -35
  302.  
  303.         # New password entry
  304.         TextInput:
  305.             id: remove_password_entry
  306.             size_hint: (None, None)
  307.             font_name: 'Constantia.ttf'
  308.             size: 200, 35
  309.             pos: root.width / 2 - self.width / 10, root.height / 2 - root.height / 10
  310.             multiline: False
  311.  
  312.         # Remove user button
  313.         LargerButton:
  314.             text: 'Remove User'
  315.             pos: root.width / 2 - self.width / 2, 100
  316.             on_release: app.root.remove_user(remove_username_entry.text, remove_password_entry.text)
  317.  
  318.         # Remove user success text
  319.         Label:
  320.             id: remove_user_success_text
  321.             text: ""
  322.             font_name: 'Constantia.ttf'
  323.             color: (0.59, 0.15, 0.17, 1)
  324.             font_size: 30
  325.             pos: root.width / 2 - self.width / 2, -200
  326.  
  327.         # Back button
  328.         SmallerButton:
  329.             text: '<-- Back'
  330.             pos: 10, 55
  331.             on_release: app.root.ids.screen_manager.current = "Admin_Screen"
  332.  
  333.         # Log out button
  334.         SmallerButton:
  335.             text: 'Log Out'
  336.             pos: 10, 10
  337.             on_release: app.root.log_out()
  338.  
  339.  
  340. <KeyScreen@CustomScreen>:
  341.     FloatLayout:
  342.         canvas:
  343.             Color:
  344.                 rgba: (0.59, 0.15, 0.17, 1)
  345.             Rectangle:
  346.                 size: 24, root.height
  347.                 pos: self.width / 2 - 12, 0
  348.             Rectangle:
  349.                 size: 24, root.height - root.height / 4
  350.                 pos: 0, 0
  351.             Rectangle:
  352.                 size: 24, root.height - root.height / 4
  353.                 pos: root.width - 24, 0
  354.             Rectangle:
  355.                 size: root.width, root.height / 8
  356.                 pos: 0, 0
  357.  
  358.         # Logo
  359.         Image:
  360.             source: 'Logo.png'
  361.             # Need the following line to change size!
  362.             size_hint: (None, None)
  363.             height: dp(100)
  364.             pos: root.width - self.width - 25 , root.height - self.height - 10
  365.  
  366.         # Welcome text
  367.         Label:
  368.             id: welcome_text
  369.             color: (1, 1, 1, 1)
  370.             font_name: 'Constantia.ttf'
  371.             font_size: 30
  372.             pos: -self.width / 4 + 20, self.height / 2 - 50
  373.  
  374.         # Spinner menu
  375.         Spinner:
  376.             id: key_menu
  377.             text: 'Select Key:'
  378.             on_press: app.root.clearErrorLabel()
  379.             font_name: 'Constantia.ttf'
  380.             values: ['']
  381.             size_hint: (None, None)
  382.             size: 300, 50
  383.             pos: (3 * root.width / 4) - 6 - self.width / 2, root.height - root.height / 4 - self.height - 10
  384.  
  385.         # Error label
  386.         Label:
  387.             id: error_label
  388.             text: ""
  389.             font_name: 'Constantia.ttf'
  390.             font_size: 28
  391.             color: (1, 1, 1, 1)
  392.             pos: root.width / 2 - self.width / 2, root.height / 4 + 20
  393.        
  394.  
  395.         # Check Out Button
  396.         LargerButton:
  397.             text: 'Check Out Key'
  398.             pos: (3 * root.width / 4) - 6 - self.width / 2, root.height / 8 + 10
  399.             on_release: app.root.checkOutRing(key_menu.text)
  400.  
  401.         # Return Key Button
  402.         Button:
  403.             size_hint: (None, None)
  404.             font_name: 'Constantia.ttf'
  405.             size: 200, 150
  406.             text: 'Return Key'
  407.             pos: (root.width / 4) + 6 - self.width / 2, 5 * root.height / 16
  408.             on_release: app.root.checkInRing()
  409.  
  410.         # Log out button
  411.         SmallerButton:
  412.             text: 'Log Out'
  413.             pos: 24, 10
  414.             on_release: app.root.log_out()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement