예제 #1
0
    def show_members_with_permission(self, id, permission):
        self.items = []
        self.current_button_id = id
        _touchable_widgets = ListProperty()
        for member in self.app.myfirebase.get_members_with_permission(permission):
            item = OneLineIconListItem(text=member)
            check = CheckboxLeftWidget()
            if member in self.chosen_members:
                check.active = True
            else:
                check.active = False
            item.add_widget(check)
            self.items.append(item)

        self.app.dialog = MDDialog(
            title="Wybierz załoge",
            type="simple",
            items=self.items,
            buttons=[
                MDFlatButton(
                    text="WYCZYŚĆ", text_color=self.app.theme_cls.primary_color, on_release=self.clear_members
                ),
                MDFlatButton(
                    text="ZAPISZ", text_color=self.app.theme_cls.primary_color, on_release=self.accept_members
                ),
            ],
        )
        self.app.dialog.size_hint = 1, None
        self.app.dialog.open()
예제 #2
0
 def __init__(self, content, **kwargs):
     super(PhoneContent, self).__init__(**kwargs)
     self.adaptive_height = True
     item = OneLineIconListItem(text=content)
     icon = IconLeftWidget(icon='phone')
     self.add_widget(item)
     item.add_widget(icon)
예제 #3
0
 def add_item(self, text, callback, icon=None):
     if icon:
         item = OneLineIconListItem(text=text, on_release=callback)
         item.add_widget(ListBSIconLeft(icon=icon))
     else:
         item = OneLineListItem(text=text, on_release=callback)
     item.bind(on_release=lambda x: self.dismiss())
     self.mlist.add_widget(item)
 def item(imageformat):
     item = OneLineIconListItem(
         text=imageformat,
         size_hint=(None, None),
         size=(250,1)
     )
     item.add_widget(LeftCheckbox(active='*'+imageformat in self.file_chooser.filters))
     return item
예제 #5
0
 def converted(self):
     path = r"C:\Users\<converted files path\>"
     for b, n, p in os.walk(path):
         for m in p:
             if m.endswith(".mp3"):
                 lst = OneLineIconListItem(text=m,
                                           on_release=lambda x: toast(path))
                 img = IconLeftWidget(icon='music')
                 lst.add_widget(img)
                 self.ids.converted_list.add_widget(lst)
예제 #6
0
    def on_start(self):
        for i in range(20):

            item = OneLineIconListItem(text=f'item {i} ')
            icon = IconLeftWidget(icon='android')
            item.add_widget(icon)
            self.help_str.get_screen('hello').ids.ls.add_widget(item)
            self.help_str.get_screen('hello').ids.ls.add_widget(
                TwoLineListItem(text=f'item for twoline {i}',
                                secondary_text=f'text {i}'))
예제 #7
0
    def add_item(self, text, callback, icon=None):
        """
        :arg text: element text;
        :arg callback: function that will be called when clicking on an item;
        :arg icon_src: which will be used as an icon to the left of the item;
        """

        if icon:
            item = OneLineIconListItem(text=text, on_release=callback)
            item.add_widget(ListBottomSheetIconLeft(icon=icon))
        else:
            item = OneLineListItem(text=text, on_release=callback)
        item.bind(on_release=lambda x: self.dismiss())
        self.sheet_list.ids.box_sheet_list.add_widget(item)
예제 #8
0
파일: main.py 프로젝트: tjpin/Talabat-clone
    def __init__(self, **kwargs):
        super(MainWindow, self).__init__(**kwargs)

        items = [
            'Home', 'Your Orders', 'Notifications', 'talabat Pay', 'Get help',
            'About'
        ]
        icons = [
            'home-variant-outline', 'file-document-outline', 'tag-outline',
            'card-bulleted-outline', 'chat-outline', 'alert-circle-outline'
        ]

        for item, icon in zip(items, icons):
            lists = OneLineIconListItem(text=item, divider=None)
            image = IconLeftWidget(icon=icon)
            lists.add_widget(image)
            self.ids.nav_items.add_widget(lists)
예제 #9
0
    def build(self):
        screen = Screen()

        # Creating a Simple List
        scroll = ScrollView()

        list_view = MDList()
        for i in range(20):

            # items = ThreeLineListItem(text=str(i) + ' item',
            #                          secondary_text='This is ' + str(i) + 'th item',
            #                          tertiary_text='hello')

            icons = IconLeftWidget(icon="android")
            items = OneLineIconListItem(text=str(i) + ' item')
            items.add_widget(icons)
            list_view.add_widget(items)

        scroll.add_widget(list_view)
        # End List

        screen.add_widget(scroll)
        return screen
예제 #10
0
    def on_box(self, *args):
        if path.isfile('./api_key.txt'):
            with open('api_key.txt', 'r') as file:
                self.full_name = file.readline().replace('\n', '')

        icon = IconLeftWidget(icon='laptop')
        item = OneLineIconListItem(text="Cluster One",
                                   on_release=self.choose_cluster_one)
        item.add_widget(icon)
        self.box.add_widget(item)
        self.slots.append(item)

        icon = IconLeftWidget(icon='laptop')
        item = OneLineIconListItem(text="Cluster Two",
                                   on_release=self.choose_cluster_two)
        item.add_widget(icon)
        self.box.add_widget(item)
        self.slots.append(item)

        for slot in self.cluster:
            slot_splited = slot.split('|')
            begin = "Begin: " + slot_splited[0]
            end = "End:    " + slot_splited[1]
            if slot_splited[3] == '47':
                place = "Place: " + slot_splited[2] + " Cluster: E1"
            else:
                place = "Place: " + slot_splited[2] + " Cluster: E2"

            if "21:00:00" in begin:
                icon = IconLeftWidget(icon='weather-night')
                # if 'night' in timeForSlotsToNotify:
                # 	notification.notify(title="Free Slot", message=begin + '\n' + end + '\n' + place)
            elif "15:00:00" in begin:
                icon = IconLeftWidget(icon='weather-cloudy')
                # if 'evening' in timeForSlotsToNotify:
                # 	notification.notify(title="Free Slot", message=begin + '\n' + end + '\n' + place)
            else:
                icon = IconLeftWidget(icon='weather-sunny')
                # if 'morning' in timeForSlotsToNotify:
                # 	notification.notify(title="Free Slot", message=begin + '\n' + end + '\n' + place)

            item = ThreeLineIconListItem(text=begin,
                                         secondary_text=end,
                                         tertiary_text=place)
            item.add_widget(icon)
            self.slots.append(item)
            self.box.add_widget(item)
    def refresh_data(self):
        print("data", self.data)
        self.now = datetime.now()
        tz = pytz.timezone("Etc/GMT+4")
        tz.localize(self.now)

        self.check_expired_alerts()

        hierarchy = []
        weekday = self.now.weekday()
        old_weekday = self.now.weekday()
        hour = self.now.hour
        today = False
        if hour < 14:
            today = True

        for i in range(6):
            if not today:
                i += 1
            i += weekday
            if i == 6:
                i = 0
            elif i > 6:
                i -= 6

            for j in SCHEDULE[i]:
                if j not in hierarchy:
                    hierarchy.append(j)

        self.algoritmus_data = {}
        self.algoritmus_header = ""
        for i in hierarchy:
            for j in self.data:
                if j.startswith(i):
                    self.algoritmus_data[j] = self.data[j]
                    self.algoritmus_header = i
            if self.algoritmus_data:
                break

        self.main_widget.ids.rasp_list.clear_widgets()

        today_list_item = ThreeLineIconListItem()
        today_list_item.text = "Сегодня ({})".format(DAYOFWEEK_DICT[weekday])
        today_list_item.secondary_text = ", ".join(
            SCHEDULE.get(weekday, DEFAULT_SCHED))

        self.main_widget.ids.rasp_list.add_widget(today_list_item)
        self.algoritmus_nextday = "На потом"
        if weekday in (5, 6):
            weekday = -1
        weekday += 1
        if self.algoritmus_header in SCHEDULE.get(weekday, []):
            self.algoritmus_nextday = "На завтра"
        if self.algoritmus_header in SCHEDULE.get(old_weekday, []) and today:
            self.algoritmus_nextday = "СДЕЛАТЬ СЕГОДНЯ!"

        today_list_item = ThreeLineIconListItem()
        today_list_item.text = "Завтра ({})".format(DAYOFWEEK_DICT[weekday])
        today_list_item.secondary_text = ", ".join(
            SCHEDULE.get(weekday, DEFAULT_SCHED))

        self.main_widget.ids.rasp_list.add_widget(today_list_item)

        if self.data:
            self.main_widget.ids.algoritmuscard.set_data(
                self.algoritmus_data, self.algoritmus_header,
                self.algoritmus_nextday)
        else:
            self.main_widget.ids.algoritmuscard.set_data(
                {
                    "Действия":
                    "Попробуй обновить данные. Если ничего не поменялось, отдыхай))"
                }, "Наверное, ты всё сделал", False, "База данных пуста :(")

        self.tasks_data = {}

        self.main_widget.ids.alerts_list.clear_widgets()
        if alerts['unreaded']:
            item = OneLineIconListItem()
            item.text = "Новые"
            item.add_widget(IconLeftWidget(icon="newspaper-plus"))
            self.main_widget.ids.alerts_list.add_widget(item)
            for i in alerts["unreaded"]:
                self.main_widget.ids.alerts_list.add_widget(
                    ThreeLineListItem(text=i[0]))

        if alerts['readed']:
            item = OneLineIconListItem()
            item.text = "Прочитанные"
            item.add_widget(IconLeftWidget(icon="newspaper"))
            self.main_widget.ids.alerts_list.add_widget(item)
            for i in alerts["readed"]:
                self.main_widget.ids.alerts_list.add_widget(
                    ThreeLineListItem(text=i[0]))

        for i in hierarchy:
            self.tasks_data[i] = {}
            for j in self.data:
                if j.startswith(i):
                    self.tasks_data[i][j] = self.data[j]
            if self.tasks_data[i] == {}:
                self.tasks_data[i] = {
                    "Не найдено записей в базе данных":
                    "Обновите базу данных. Если так и остаётся, значит, всё сделано!"
                }

        self.main_widget.ids.tasks_layout.clear_widgets()
        for i in self.tasks_data:
            item = ItemCard()
            nextday = "На потом"
            if i in SCHEDULE[weekday]:
                nextday = "На завтра"
            if today and i in SCHEDULE[old_weekday]:
                nextday = "СДЕЛАТЬ СЕГОДНЯ!!"
            item.set_data(self.tasks_data[i], i, nextday, from_tasks=True)
            self.main_widget.ids.tasks_layout.add_widget(item)
        self.update_db()
        self.refresh_alerts_navdrawer()