Created
November 24, 2017 21:05
-
-
Save cruor99/fe85e36635da102a16e0c213bfeab49f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<JobListItem>: | |
border: dp(10) | |
swipe_threshold: .2 | |
ThreeLineListItem: | |
text: root.maintext | |
secondary_text: root.subtext | |
size_hint_y: 1 | |
size_hint_x: None | |
width: app.root.width | |
on_release: app.root.ids.schedule_screen_manager.get_screen("front_screen").view_job_details(root) | |
BoxLayout: | |
orientation: "horizontal" | |
Button: | |
text: "Deleger" | |
size_hint_y: 1 | |
Button: | |
text: "Slett" | |
size_hint_y: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from kivy.app import App | |
from kivymd.list import ThreeLineListItem | |
from kivy.uix.button import ButtonBehavior | |
from kivy.uix.scrollview import ScrollView | |
from kivy.uix.recycleview import RecycleView | |
from kivy.uix.pagelayout import PageLayout | |
from kivy.properties import ObjectProperty, StringProperty | |
from kivy.lang import Builder | |
from kivy.metrics import dp | |
Builder.load_file("kv/components/listitems.kv") | |
class JobListItem(PageLayout, ButtonBehavior): | |
job = ObjectProperty() | |
maintext = StringProperty("") | |
subtext = StringProperty("") | |
def __init__(self, job, **kwargs): | |
super(JobListItem, self).__init__(**kwargs) | |
self.job = job | |
self.maintext = str(job.job_date + " " + job.clock_time) | |
self.subtext = "Klient: {} | Addresse: {} | Kontaktnummer: {} | Nøkkelord: {}".format( | |
job.client_name, job.address, job.contact_number, job.keywords | |
) | |
def on_page(self, instance, value): | |
if value >= 1: | |
self.border = dp(150) | |
elif value == 0: | |
self.border = dp(10) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment