diff --git a/anime.py b/anime.py new file mode 100644 index 0000000..e69de29 diff --git a/main.py b/main.py index 50ee2dc..9f1b8ed 100644 --- a/main.py +++ b/main.py @@ -18,6 +18,8 @@ from kivy.uix.label import Label from kivy.uix.boxlayout import BoxLayout from threading import Thread from kivy.clock import mainthread +from kivy.uix.image import Image +from kivy.uix.behaviors import ButtonBehavior kivy.require("2.0.0") from kivy.core.window import Window @@ -346,7 +348,7 @@ class GetTripFromServer(Screen): """Handle the Get trip server data button press.""" selected_device = self.ids.devices_spinner.text start_date = self.ids.start_date_picker_button.text - end_date = self.ids.end_date_picker_button.text + end_date = self.ids.end_date_picker.text if selected_device == "Loading devices..." or selected_device == "No devices found": print("No valid device selected.") @@ -484,18 +486,24 @@ class HomeScreen(Screen): row = BoxLayout( orientation="horizontal", size_hint_y=None, - height=38, + height=44, spacing=6, - padding=(8, 4) + padding=(8, 6) ) - from kivy.graphics import Color, Rectangle + from kivy.graphics import Color, Line, RoundedRectangle with row.canvas.before: - Color(0.11, 0.10, 0.15, 1) # Match app background - row.bg_rect = Rectangle(pos=row.pos, size=row.size) - def update_bg_rect(instance, value): - row.bg_rect.pos = row.pos - row.bg_rect.size = row.size - row.bind(pos=update_bg_rect, size=update_bg_rect) + Color(0.11, 0.10, 0.15, 1) + row.bg_rect = RoundedRectangle(pos=row.pos, size=row.size, radius=[6]) + Color(0.341, 0.235, 0.980, 1) + row.border_line = Line(rounded_rectangle=[row.x, row.y, row.width, row.height, 6], width=1) + # Use a closure to bind the correct row instance + def make_update_bg_rect(r): + def update_bg_rect(instance, value): + r.bg_rect.pos = r.pos + r.bg_rect.size = r.size + r.border_line.rounded_rectangle = [r.x, r.y, r.width, r.height, 6] + return update_bg_rect + row.bind(pos=make_update_bg_rect(row), size=make_update_bg_rect(row)) project_label = Label( text=project, @@ -506,13 +514,6 @@ class HomeScreen(Screen): shorten_from='right' ) - # Edit icon button - from kivy.uix.image import Image - from kivy.uix.behaviors import ButtonBehavior - - class IconButton(ButtonBehavior, Image): - pass - edit_button = IconButton( source="resources/images/edit.png", size_hint_x=0.18, @@ -521,7 +522,6 @@ class HomeScreen(Screen): ) edit_button.bind(on_press=lambda instance, p=project: self.edit_project(p)) - # Delete icon button delete_button = IconButton( source="resources/images/delete.png", size_hint_x=0.18, @@ -600,6 +600,9 @@ class HomeScreen(Screen): # Optionally, delete the project folder after archiving self.delete_project(project_name) +class IconButton(ButtonBehavior, Image): + pass + class TraccarApp(App): def build(self): if not os.path.exists(RESOURCES_FOLDER): diff --git a/resources/credentials.enc b/resources/credentials.enc index fa51204..454ab9d 100644 --- a/resources/credentials.enc +++ b/resources/credentials.enc @@ -1 +1 @@ -gAAAAABoQW_vdU_6k9K8_uHQSqyH5Ym29SpcwEe8z092nCaELg2i2aRJkhcPfDzPwuPLqo8vzHHKhIQpTXTMpm7s3PPqCy1Xok7lGAm5UJIRF2y9BNe77jH2fNENMN_ipmAT4QgNIAFs \ No newline at end of file +gAAAAABoQZZ4y4TyP0vsqVtL5HZvQvAvpF0KWgQHpqUHSdBgQGi0l-Qo1ZOEjNzPcnoXOxbGN6Q6knPNjzqTLxiqIdnxeN6fnX4PkYjWqSLx4USUYnws3XEK99p_YQMjOO0kcrXZUThD \ No newline at end of file diff --git a/resources/track.png b/resources/images/track.png similarity index 100% rename from resources/track.png rename to resources/images/track.png diff --git a/resources/projects/complete route day 4/positions.json b/resources/trip_archive/complete route day 4.json similarity index 100% rename from resources/projects/complete route day 4/positions.json rename to resources/trip_archive/complete route day 4.json diff --git a/traccar.kv b/traccar.kv index 88fe47d..014a106 100644 --- a/traccar.kv +++ b/traccar.kv @@ -1,148 +1,207 @@ : BoxLayout: orientation: "vertical" - padding: 20 - spacing: 20 + padding: [16, 24, 16, 16] + spacing: 14 canvas.before: Color: - rgba: 0.11, 0.10, 0.15, 1 # Background color: #1C1A27 + rgba: 0.11, 0.10, 0.15, 1 Rectangle: pos: self.pos size: self.size + Widget: + size_hint_y: 0.10 # Spacer at the top + Image: - source: "resources/track.png" - size_hint: (1, 0.66) # 2/3 of the screen height + source: "resources/images/track.png" # <-- updated path + size_hint: (1, 0.28) # Smaller logo for phones + allow_stretch: True + keep_ratio: True + + Widget: + size_hint_y: 0.05 # Spacer TextInput: id: username_input hint_text: "Username" multiline: False - font_size: 20 # Text size - height: self.minimum_height - size_hint_y: None # Fix height - size_hint_x: 0.8 # Center horizontally - pos_hint: {"center_x": 0.5} + font_size: 18 + height: 44 + size_hint_y: None + size_hint_x: 1 + padding: [12, 12, 12, 12] + background_normal: '' + background_color: 0.15, 0.15, 0.18, 1 + foreground_color: 1, 1, 1, 1 TextInput: id: password_input hint_text: "Password" multiline: False password: True - font_size: 20 # Text size - height: self.minimum_height - size_hint_y: None # Fix height - size_hint_x: 0.8 # Center horizontally - pos_hint: {"center_x": 0.5} + font_size: 18 + height: 44 + size_hint_y: None + size_hint_x: 1 + padding: [12, 12, 12, 12] + background_normal: '' + background_color: 0.15, 0.15, 0.18, 1 + foreground_color: 1, 1, 1, 1 + + Widget: + size_hint_y: 0.02 # Small spacer BoxLayout: orientation: "horizontal" size_hint_y: None - height: 50 # Fixed height for the button group - size_hint_x: 0.8 # Match the width of the TextInput fields - pos_hint: {"center_x": 0.5} # Center horizontally + height: 48 spacing: 10 Button: text: "Login" - font_size: 20 # Match the font size of the TextInput fields - size_hint_x: 0.5 # Half the width of the BoxLayout - size_hint_y: None - height: 50 # Fixed height for the button - background_color: 0.341, 0.235, 0.980, 1 # Purple color (#573CFA) + font_size: 18 + size_hint_x: 0.5 + background_color: 0.341, 0.235, 0.980, 1 + color: 1, 1, 1, 1 on_press: root.login() Button: text: "Register" - font_size: 20 + font_size: 18 size_hint_x: 0.5 - size_hint_y: None - height: 50 - background_color: 0.341, 0.235, 0.980, 1 # Purple color (#573CFA) - on_press: app.root.current = "register" # Navigate to the RegisterScreen + background_color: 0.341, 0.235, 0.980, 1 + color: 1, 1, 1, 1 + on_press: app.root.current = "register" + + Widget: + size_hint_y: 0.08 # Spacer + + Label: + id: result_label + text: "" + font_size: 15 + size_hint_y: None + height: 28 + color: 1, 1, 1, 1 : BoxLayout: orientation: "vertical" - padding: 20 - spacing: 20 + padding: [16, 24, 16, 16] + spacing: 14 canvas.before: Color: - rgba: 0.11, 0.10, 0.15, 1 # Background color: #1C1A27 + rgba: 0.11, 0.10, 0.15, 1 Rectangle: pos: self.pos size: self.size + Widget: + size_hint_y: 0.08 + Image: - source: "resources/track.png" - size_hint: (1, 0.66) # 2/3 of the screen height + source: "resources/images/track.png" + size_hint: (1, 0.22) + allow_stretch: True + keep_ratio: True + + Label: + text: "Register" + font_size: 22 + color: 1, 1, 1, 1 + size_hint_y: None + height: 36 TextInput: id: set_username_input - hint_text: "Set Username" + hint_text: "Username" multiline: False - font_size: 20 # Text size - height: self.minimum_height - size_hint_y: None # Fix height - size_hint_x: 0.8 # Center horizontally - pos_hint: {"center_x": 0.5} + font_size: 18 + height: 44 + size_hint_y: None + size_hint_x: 1 + padding: [12, 12, 12, 12] + background_normal: '' + background_color: 0.15, 0.15, 0.18, 1 + foreground_color: 1, 1, 1, 1 + + TextInput: + id: set_email_input + hint_text: "Email" + multiline: False + font_size: 18 + height: 44 + size_hint_y: None + size_hint_x: 1 + padding: [12, 12, 12, 12] + background_normal: '' + background_color: 0.15, 0.15, 0.18, 1 + foreground_color: 1, 1, 1, 1 TextInput: id: set_password_input - hint_text: "Set Password" + hint_text: "Password" multiline: False password: True - font_size: 20 # Text size - height: self.minimum_height - size_hint_y: None # Fix height - size_hint_x: 0.8 # Center horizontally - pos_hint: {"center_x": 0.5} + font_size: 18 + height: 44 + size_hint_y: None + size_hint_x: 1 + padding: [12, 12, 12, 12] + background_normal: '' + background_color: 0.15, 0.15, 0.18, 1 + foreground_color: 1, 1, 1, 1 TextInput: id: confirm_password_input hint_text: "Confirm Password" multiline: False password: True - font_size: 20 # Text size - height: self.minimum_height - size_hint_y: None # Fix height - size_hint_x: 0.8 # Center horizontally - pos_hint: {"center_x": 0.5} - - TextInput: - id: set_email_input - hint_text: "Set Email" - multiline: False - font_size: 20 # Text size - height: self.minimum_height - size_hint_y: None # Fix height - size_hint_x: 0.8 # Center horizontally - pos_hint: {"center_x": 0.5} - - - - Button: - text: "Create Username" - font_size: 20 # Match the font size of the TextInput fields - size_hint_x: 0.8 # Match the width of the TextInput fields + font_size: 18 + height: 44 size_hint_y: None - height: 50 # Fixed height for the button - pos_hint: {"center_x": 0.5} - on_press: root.create_user() + size_hint_x: 1 + padding: [12, 12, 12, 12] + background_normal: '' + background_color: 0.15, 0.15, 0.18, 1 + foreground_color: 1, 1, 1, 1 - Button: - text: "Back to Login" - font_size: 20 - size_hint_x: 0.8 + Widget: + size_hint_y: 0.02 + + BoxLayout: + orientation: "horizontal" size_hint_y: None - height: 50 - pos_hint: {"center_x": 0.5} - on_press: app.root.current = "login" + height: 48 + spacing: 10 + + Button: + text: "Register" + font_size: 18 + size_hint_x: 0.5 + background_color: 0.341, 0.235, 0.980, 1 + color: 1, 1, 1, 1 + on_press: root.create_user() + + Button: + text: "Back" + font_size: 18 + size_hint_x: 0.5 + background_color: 0.341, 0.235, 0.980, 1 + color: 1, 1, 1, 1 + on_press: app.root.current = "login" + + Widget: + size_hint_y: 0.06 Label: id: result_label text: "" - size_hint: (1, 0.2) + font_size: 15 + size_hint_y: None + height: 28 + color: 1, 1, 1, 1 : BoxLayout: @@ -387,105 +446,115 @@ : BoxLayout: orientation: "vertical" - padding: 20 - spacing: 20 + padding: [16, 24, 16, 16] + spacing: 14 canvas.before: Color: - rgba: 0.11, 0.10, 0.15, 1 # Background color: #1C1A27 + rgba: 0.11, 0.10, 0.15, 1 Rectangle: pos: self.pos size: self.size Image: - source: "resources/track.png" - size_hint: (1, 0.66) # 2/3 of the screen height + source: "resources/images/track.png" + size_hint: (1, 0.22) + allow_stretch: True + keep_ratio: True TextInput: id: server_url_input hint_text: "Traccar Server URL" multiline: False - font_size: 20 + font_size: 18 + height: 44 size_hint_y: None - height: self.minimum_height - size_hint_x: 0.8 - pos_hint: {"center_x": 0.5} + size_hint_x: 1 + padding: [12, 12, 12, 12] + background_normal: '' + background_color: 0.15, 0.15, 0.18, 1 + foreground_color: 1, 1, 1, 1 TextInput: id: username_input hint_text: "Username" multiline: False - font_size: 20 + font_size: 18 + height: 44 size_hint_y: None - height: self.minimum_height - size_hint_x: 0.8 - pos_hint: {"center_x": 0.5} + size_hint_x: 1 + padding: [12, 12, 12, 12] + background_normal: '' + background_color: 0.15, 0.15, 0.18, 1 + foreground_color: 1, 1, 1, 1 TextInput: id: password_input hint_text: "Password" multiline: False password: True - font_size: 20 + font_size: 18 + height: 44 size_hint_y: None - height: self.minimum_height - size_hint_x: 0.8 - pos_hint: {"center_x": 0.5} + size_hint_x: 1 + padding: [12, 12, 12, 12] + background_normal: '' + background_color: 0.15, 0.15, 0.18, 1 + foreground_color: 1, 1, 1, 1 TextInput: id: token_input hint_text: "Token" multiline: False - font_size: 20 + font_size: 18 + height: 44 size_hint_y: None - height: self.minimum_height - size_hint_x: 0.8 - pos_hint: {"center_x": 0.5} + size_hint_x: 1 + padding: [12, 12, 12, 12] + background_normal: '' + background_color: 0.15, 0.15, 0.18, 1 + foreground_color: 1, 1, 1, 1 BoxLayout: orientation: "horizontal" size_hint_y: None - height: 50 - size_hint_x: 0.8 - pos_hint: {"center_x": 0.5} + height: 48 spacing: 10 Button: text: "Test Connection" - size_hint_x: 0.5 # Half the width of the BoxLayout - size_hint_y: None - height: 50 - background_color: 0.341, 0.235, 0.980, 1 # Purple color (#573CFA) + font_size: 16 + size_hint_x: 0.5 + background_color: 0.341, 0.235, 0.980, 1 + color: 1, 1, 1, 1 on_press: root.test_connection() Button: text: "Save Settings" - size_hint_x: 0.5 # Half the width of the BoxLayout - size_hint_y: None - height: 50 - background_color: 0.008, 0.525, 0.290, 1 # Purple color (#573CFA) + font_size: 16 + size_hint_x: 0.5 + background_color: 0.008, 0.525, 0.290, 1 + color: 1, 1, 1, 1 on_press: root.save_settings() Label: id: result_label text: "Waiting to test connection..." + font_size: 15 size_hint_y: None - height: 50 - size_hint_x: 0.8 - pos_hint: {"center_x": 0.5} - canvas.before: - Color: - rgba: 1, 1, 1, 1 # White color - Line: - width: 1.5 - rectangle: self.x, self.y, self.width, self.height + height: 28 + color: 1, 1, 1, 1 + halign: "center" + valign: "middle" + text_size: self.size + padding: [0, 8] Button: text: "Return to Home" size_hint_y: None - height: 50 - size_hint_x: 0.8 - pos_hint: {"center_x": 0.5} - background_color: 0.341, 0.235, 0.980, 1 # Purple color (#573CFA) + height: 48 + background_color: 0.341, 0.235, 0.980, 1 + color: 1, 1, 1, 1 + font_size: 16 on_press: app.root.current = "home" :