Exemplo n.º 1
0
    def __init__(self):
        super().__init__()
        self.row = 2
        self.music_list = get_all_music(MUSIC_DIR[PLATFORM])
        self.orientation = "vertical"
        self.toolbar = MDToolbar(title="Music Player")
        self.toolbar.right_action_items = [[
            "database-settings", lambda x: self.goto_setting()
        ]]
        self.add_widget(self.toolbar)
        scroll_list = ScrollView()
        dml = MDList()
        self.counter = 0
        try:
            for music in self.music_list:
                meta = music['meta']
                path = music['path']
                self.dl = TwoLineListItem(text=(meta['title'] or path),
                                          secondary_text=(meta['artist']
                                                          or 'Unkown'))
                self.dl.id = str(self.counter)
                self.dl.bind(on_press=self.to_playing)
                dml.add_widget(self.dl)
                self.counter += 1
        except Exception as e:
            print(e)
            # raise e

        scroll_list.add_widget(dml)
        self.add_widget(scroll_list)
Exemplo n.º 2
0
    def all_tasks(self):
        mycursor = main.sqliteConnection.cursor()
        mycursor.execute("SELECT id_type, task_name, scheduled_time "
                         "FROM task_type ")
        rows = mycursor.fetchall()
        task_id = []
        task_name = []
        task_time = []

        for i in range(len(rows)):
            task_id.append(rows[i][0])
            task_name.append(rows[i][1])
            task_time.append(rows[i][2])

        for i in range(len(task_name)):
            self.ids.task_list.add_widget(
                TwoLineListItem(text=f'{str(task_name[i])}',
                                secondary_text=f'{str(task_time[i])} minutes',
                                theme_text_color='Custom',
                                text_color=get_color_from_hex('#e5e5e5'),
                                font_style='Subtitle1',
                                on_press=partial(
                                    self.delete_dialog,
                                    task_id[i],
                                )))
Exemplo n.º 3
0
    def build(self):
        screen = Screen()
        scroll = ScrollView()
        list_view = MDList()
        scroll.add_widget(list_view)

        for i in range(20):
            item = OneLineListItem(text="Item " + str(i))
            list_view.add_widget(item)

        item2 = TwoLineListItem(text="Two Line item1",
                                secondary_text="Hello world")
        item3 = ThreeLineListItem(text="Three Line item1",
                                  secondary_text="Hello world",
                                  tertiary_text="Sample text")
        icon = IconLeftWidget(icon="android")
        itemicon = ThreeLineIconListItem(text="Three Line item1",
                                         secondary_text="Hello world",
                                         tertiary_text="Sample text")
        itemicon.add_widget(icon)

        list_view.add_widget(item2)
        list_view.add_widget(item3)
        list_view.add_widget(itemicon)
        screen.add_widget(scroll)
        return screen
Exemplo n.º 4
0
    def ask_question(self):
        """ Main function. """
        self.check_voice()
        user_question = self.ids.ask_question.text.lower()
        answer = None

        if user_question in self.questions:
            position = self.questions.index(user_question)
            user_question = self.questions[position]
            answer = self.answers[position]
        elif ("quit" in user_question) or ("bye" in user_question) or ("see you later" in user_question):
            self.speak_function("Bye!")
            exit()
        elif (user_question in self.names) or ("name" in user_question) or (user_question in self.word):
            answer = random.choice(self.name_responses)
            self.speak_function(answer)
        elif (user_question in self.created) or ("owner" in user_question) or ("creator" in user_question):
            answer = random.choice(self.created_responses)
        elif ("work" in user_question) or ("help me" in user_question) or (user_question in self.word_response) or \
                ("my future" in user_question) or ("fortune" in user_question) or ("you do" in user_question):
            answer = random.choice(self.word_response)
        else:
            answer = random.choice(self.responses)

        self.questions.append(user_question)
        self.answers.append(answer)
        self.ids.comp_reply.text = f"Alex: {answer}"
        self.speak_function(answer)
        self.ids.chat_questions.add_widget(TwoLineListItem(text=f"You: {self.questions[-1]}",
                                                           secondary_text=f"Alex: {self.answers[-1]}",
                                                           theme_text_color="Custom", text_color=[1, 1, 1, 1],
                                                           secondary_theme_text_color="Custom",
                                                           secondary_text_color=[1, 1, 1, 1]))
Exemplo n.º 5
0
 def on_start(self):
     for i in range(20):
         self.helper_text.get_screen('hello').ids.ls.add_widget(
             OneLineListItem(text=f"item {i}"))
         self.helper_text.get_screen('hello').ids.ls.add_widget(
             TwoLineListItem(text=f"item {i}",
                             secondary_text=f"second item {i}"))
Exemplo n.º 6
0
    def movie_rated(self, name, positive, participants):

        list = self.ids.movie_list

        item = TwoLineListItem(
            text=name, secondary_text=f'rating: {positive}/{participants}')
        list.add_widget(item, index=len(list.children))
Exemplo n.º 7
0
    def notes_list(self):
        """Add list of all notes on home 
        """

        for num, data in notes.items():
            screenMGR.get_screen("home").ids.notes_list.add_widget(
                TwoLineListItem(text=data["Title"],
                                secondary_text=data["Note"]))
Exemplo n.º 8
0
    def build(self):
        thisstudent = currentUser(self.manager.screens[2].ids.username.text)
        currentS = db.child("users").child(thisstudent).get()

        day1 = db.child("Class").child(
            currentS.val()['Class']).child("Schedule").child("sunday").get()
        day2 = db.child("Class").child(
            currentS.val()['Class']).child("Schedule").child("monday").get()
        day3 = db.child("Class").child(
            currentS.val()['Class']).child("Schedule").child("tuesday").get()
        day4 = db.child("Class").child(currentS.val()['Class']).child(
            "Schedule").child("wednesday").get()
        day5 = db.child("Class").child(
            currentS.val()['Class']).child("Schedule").child("thursday").get()
        sunday = OneLineListItem(text=str("(Sunday)"))
        self.manager.screens[21].ids.sun.add_widget(sunday)
        monday = OneLineListItem(text=str("(monday)"))
        self.manager.screens[21].ids.mon.add_widget(monday)
        tuesday = OneLineListItem(text=str("(tuesday)"))
        self.manager.screens[21].ids.tue.add_widget(tuesday)
        wednesday = OneLineListItem(text=str("(wednesday)"))
        self.manager.screens[21].ids.wed.add_widget(wednesday)
        thursday = OneLineListItem(text=str("(thursday)"))
        self.manager.screens[21].ids.thu.add_widget(thursday)

        for i in day1.each():
            items = TwoLineListItem(text=str(i.val()),
                                    secondary_text=str(i.key()))
            self.manager.screens[21].ids.sun.add_widget(items)
        for i in day2.each():
            items = TwoLineListItem(text=str(i.val()),
                                    secondary_text=str(i.key()))
            self.manager.screens[21].ids.mon.add_widget(items)
        for i in day3.each():
            items = TwoLineListItem(text=str(i.val()),
                                    secondary_text=str(i.key()))
            self.manager.screens[21].ids.tue.add_widget(items)
        for i in day4.each():
            items = TwoLineListItem(text=str(i.val()),
                                    secondary_text=str(i.key()))
            self.manager.screens[21].ids.wed.add_widget(items)
        for i in day5.each():
            items = TwoLineListItem(text=str(i.val()),
                                    secondary_text=str(i.key()))
            self.manager.screens[21].ids.thu.add_widget(items)
Exemplo n.º 9
0
    def update_member_list(self):

        list = self.ids.member_list

        list.clear_widgets()

        for name in player.get_room_member_names():
            item = TwoLineListItem(text=name, secondary_text='member')
            list.add_widget(item)
Exemplo n.º 10
0
 def initUI(self):
     data = [
         ("Backup Database", "Backup encrypted database"),
         ("Restore Database", "Restore encrypted database"),
     ]
     for text, description in data:
         self.ids.database_container.add_widget(
             TwoLineListItem(text=text,
                             secondary_text=description,
                             on_press=self.checkPlatform))
Exemplo n.º 11
0
    def setNamaz(self, iso):
        self.namaz_times = driver().getSalaatTimesForDate(str(iso).split()[0])

        self.nrv.clear_widgets()

        for item in self.namaz_times.keys():
            self.nrv.add_widget(
                TwoLineListItem(text=str(item),
                                secondary_text=str(self.namaz_times[item]),
                                height=dp(60)))
Exemplo n.º 12
0
 def parse_json(self, req, result):
     for i in result["result"]:
         keys = ',   '.join(list(i.keys()))
         values_str = map(lambda x: str(x), list(i.values()))
         values_local = map(self.utc_to_local, values_str)
         self.add_widget(
             TwoLineListItem(text=keys,
                             secondary_text=',   '.join(list(values_local)),
                             font_style='Caption',
                             secondary_font_style='Overline'))
Exemplo n.º 13
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}'))
Exemplo n.º 14
0
class ListPage(BoxLayout):
    def __init__(self):
        super().__init__()
        self.row = 2
        self.music_list = get_all_music(MUSIC_DIR[PLATFORM])
        self.orientation = "vertical"
        self.toolbar = MDToolbar(title="Music Player")
        self.toolbar.right_action_items = [[
            "database-settings", lambda x: self.goto_setting()
        ]]
        self.add_widget(self.toolbar)
        scroll_list = ScrollView()
        dml = MDList()
        self.counter = 0
        try:
            for music in self.music_list:
                meta = music['meta']
                path = music['path']
                self.dl = TwoLineListItem(text=(meta['title'] or path),
                                          secondary_text=(meta['artist']
                                                          or 'Unkown'))
                self.dl.id = str(self.counter)
                self.dl.bind(on_press=self.to_playing)
                dml.add_widget(self.dl)
                self.counter += 1
        except Exception as e:
            print(e)
            # raise e

        scroll_list.add_widget(dml)
        self.add_widget(scroll_list)

    def to_playing(self, isinstance):
        current = self.music_list[int(isinstance.id)]
        app.play(self.music_list[int(isinstance.id)]['path'])
        app.screen_manager.current = "playingpage"
        app.playingpage.init_config(current['meta']['title'],
                                    current['meta']['artist'],
                                    app.playing.length)

    def goto_setting(self):
        app.screen_manager.current = "settingspage"
Exemplo n.º 15
0
 def on_pre_enter(self, *args):
     # for x in repos:
     #     if x.language != None:
     #         self.ids.container.add_widget(
     #             OneLineListItem(text="{0} - {1}".format(x.name, x.language))
     #         )
     for x in repos:
         if x.language != None:
             self.ids.container.add_widget(
                 TwoLineListItem(text=x.name, secondary_text=x.language)
             )
Exemplo n.º 16
0
    def favourites(self):

        c = []
        d = []
        c.append(self.root.ids.namee.text)
        d.append(self.output)

        for i in range(len(c)):
            item = TwoLineListItem(text='{}'.format(c[i]),secondary_text = "{}".format(d[i]))
            self.root.ids.container.add_widget(item)
        self.speak("word added successfully")
Exemplo n.º 17
0
    def databaseRegistry(self, database):
        url = "https://isaifirst-434b9-default-rtdb.firebaseio.com/.json"
        from_database = requests.get(url=url + '?auth=' + self.auth_key)
        new_label = self.root.ids.list

        for key, value in enumerate(from_database):
            print(key, value)
            print("hello wleon")
            widget = TwoLineListItem(text=f"{value}")
            new_label.add_widget(widget)
            new_label.text = str(key)
Exemplo n.º 18
0
 def get_keypad(self, dt=0):
     keys = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '*', '0', '+']
     letters = [
         '~', 'abc', 'def', 'ghi', 'jkl', 'mno', 'pqrs', 'tuv', 'wxyz', '',
         '', ''
     ]
     for key, letter in zip(keys, letters):
         btn = TwoLineListItem(
             text=f"                 [size=26]{key}[/size]",
             secondary_text=f"               {letter}",
             divider=None,
             on_release=self.display)
         self.ids.keypads.add_widget(btn)
Exemplo n.º 19
0
 def get_keypad(self, dt=0):
     keys = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '*', '0', '+']
     letters = [
         '~', 'abc', 'def', 'ghi', 'jkl', 'mno', 'pqrs', 'tuv', 'wxyz', '',
         '', ''
     ]
     for key, letter in zip(keys, letters):
         btn = TwoLineListItem(
             text=key,
             secondary_text=letter,
             # border='Inset',
             on_release=self.display)
         self.ids.keypads.add_widget(btn)
Exemplo n.º 20
0
    def on_start(self):
        memoriaTotal = psutil.virtual_memory().total
        convertendoTotal = memoriaTotal / (1024.0**3)
        self.root.ids.label_qtdTotal.text = f'{round(convertendoTotal, 2)} GB'

        memoriaSendoUsada = psutil.virtual_memory().used
        convertendoUsada = memoriaSendoUsada / (1024.0**3)
        self.root.ids.label_qtdSendoUsada.text = f'{round(convertendoUsada, 2)} GB'

        porcentagemUsada = psutil.virtual_memory().percent
        convertendoPorcentagem = round(porcentagemUsada, 2)
        self.root.ids.label_porcentagemUsada.text = f'{convertendoPorcentagem} %'
        self.root.ids.progressBar_porcentagem.value = convertendoPorcentagem

        info_cpu = cpuinfo.get_cpu_info()
        cpuMarca = info_cpu['brand_raw']
        cpuArquitetura = info_cpu['arch']
        cpuBits = info_cpu['bits']
        cpuNucleos = os.cpu_count()
        cpuPorcentagem = psutil.cpu_percent(interval=0)

        self.root.ids.label_nomeCPU.text = f'{cpuMarca}'
        self.root.ids.label_arquiteturaCPU.text = f'{cpuArquitetura}'
        self.root.ids.label_bitsCPU.text = f'{cpuBits} bits'
        self.root.ids.label_nucleosCPU.text = f'{cpuNucleos} núcleos'
        self.root.ids.label_porcentagemCPU.text = f'{cpuPorcentagem} %'
        self.root.ids.progressBar_cpuPorcentagem.value = cpuPorcentagem

        disco = psutil.disk_usage('.')
        discoTotal = disco.total / (1024.0**3)
        discoSendoUsado = disco.used / (1024.0**3)
        discoEspacoLivre = disco.free / (1024.0**3)
        discoPorcentagem = disco.percent

        self.root.ids.label_quantidadeTotalDisco.text = f'{round(discoTotal, 2)} GB'
        self.root.ids.label_qtdSendoUsadaDisco.text = f'{round(discoSendoUsado, 2)} GB'
        self.root.ids.label_qtdLivreDisco.text = f'{round(discoEspacoLivre, 2)} GB'
        self.root.ids.label_porcentagemDisco.text = f'{round(discoPorcentagem, 2)} %'
        self.root.ids.progressBar_discoPorcentagem.value = discoPorcentagem

        for proc in psutil.process_iter():
            info = proc.as_dict(attrs=['pid', 'name'])
            self.root.ids.listaProcessos.add_widget(
                TwoLineListItem(
                    text=f'{info["name"]}',
                    secondary_text=f'PID - {info["pid"]}',
                    on_press=lambda x: print(
                        f'Processo: {x.text} | {x.secondary_text}')))
        hostname = socket.gethostname()
        IP = socket.gethostbyname(hostname)
        self.root.ids.label_ip.text = f'{IP}'
    def aspect_fn(self):
        with open("C:\\Users\\Kripa\\Desktop\\convo.csv") as file:
            data = list(csv.reader(file))

        strin = " ".join(str(x) for x in data)

        natural_language_understanding.set_service_url(
            'https://api.eu-gb.natural-language-understanding.watson.cloud.ibm.com/instances/c70c1850-5873-495c-b449-d84d30415f06'
        )
        natural_language_understanding.set_disable_ssl_verification(True)
        response = natural_language_understanding.analyze(
            text=strin,
            features=Features(
                categories=CategoriesOptions(limit=3), )).get_result()

        cat1 = response['categories']

        di1 = cat1[0]
        di2 = cat1[1]
        di3 = cat1[2]

        str1 = di1['label']
        str11 = str(di1['score'])
        str2 = di2['label']
        str21 = str(di2['score'])
        str3 = di3['label']
        str31 = str(di3['score'])

        screen = Builder.load_string(screen_helper3)
        screen.ids.aspectlist.add_widget(
            TwoLineListItem(text=str1, secondary_text=str11))
        screen.ids.aspectlist.add_widget(
            TwoLineListItem(text=str2, secondary_text=str21))
        screen.ids.aspectlist.add_widget(
            TwoLineListItem(text=str3, secondary_text=str31))

        sm.add_widget(screen)
Exemplo n.º 22
0
 def calculate(self, *args):
     txt_equation = self.root.ids.txt_equation
     if txt_equation.text:
         equation = txt_equation.text.replace("x", "*")
         answer = str(eval(equation))
         if txt_equation.text not in self.history:
             self.root.ids.container_history.add_widget(
                 TwoLineListItem(
                     text=txt_equation.text,
                     secondary_text="Answer " + answer,
                     on_touch_down=self.restore_history,
                 )
             )
             self.history.add(txt_equation.text)
         txt_equation.text = answer
     txt_equation.focus = True
Exemplo n.º 23
0
 def recent_calls(self):
     log = Recent()
     pop = Popup(title="Call Logs",
                 title_color=[0, 0, 0, 1],
                 title_size=28,
                 content=log,
                 background='',
                 size_hint=(0.8, 0.8))
     pop.open()
     logs = self.client.calls.list(limit=20)
     for lg in logs:
         lis = TwoLineListItem(
             text=f"[size=22]{lg.to}[/size]",
             secondary_text=
             f"{lg.date_created.strftime('%d %B %Y')}     {lg.start_time.strftime('%H:%M:%S')}      {lg.duration}Sec"
         )
         log.ids.recent.add_widget(lis)
Exemplo n.º 24
0
 def on_enter(self):
     db.cmd_reset_connection()
     self.hotel_obj = HotelScreen()
     self.orders_frequency_table = None
     self.cursor = db.cursor()
     self.ids.bill_hotelName.text = str(self.hotel_obj.hotel_ordering_currently).upper()
     self.orders_frequency_table = {i: self.hotel_obj.student_ordering_list.count(i) for i in self.hotel_obj.student_ordering_list}
     self.ids.toBill_ScrollView.clear_widgets()
     for i in self.orders_frequency_table:
         grid_for_bill_card = MDGridLayout(cols=2, adaptive_height = True)
         billDishName_details = TwoLineListItem(text = str(i), secondary_text = "QTY - " + str(self.orders_frequency_table[i]))
         billDishPrice_details = MDLabel(text = str(int(self.hotel_obj.dish_available_in_currentSelectedHotel.query('Dish == @i')['Price']) * self.orders_frequency_table[i]), halign = 'center')
         grid_for_bill_card.add_widget(billDishName_details)
         grid_for_bill_card.add_widget(billDishPrice_details)
         self.ids.toBill_ScrollView.add_widget(grid_for_bill_card)
     self.ids.billTotalAmountToPay_id.text = "\u20B9 " + str(self.hotel_obj.totalAmount_Order)
     self.cursor.close()
Exemplo n.º 25
0
    def pegarArq(self):
        self.ids.panelArq.clear_widgets()
        diretorio = self.ids.text_field_arquivo.text
        nomeUsuario = os.getlogin()
        diretorio_vdd = f'C:\\Users\\{nomeUsuario}\\{diretorio}'
        try:
            arquivos = os.listdir(diretorio_vdd)
            for arquivo in arquivos:
                f_path = os.path.join(diretorio_vdd, arquivo)
                if os.path.isfile(f_path):
                    f_size = os.path.getsize(f_path) / (1024.0**2)
                    self.ids.panelArq.add_widget(
                        TwoLineListItem(
                            text=f'{arquivo}',
                            secondary_text=f'{round(f_size, 2)} MB',
                            on_press=lambda x: print(
                                f'Arquivo: {x.text} | Tamanho: {x.secondary_text}'
                            )))

        except FileNotFoundError as e:
            print(f'diretório não existe')
        self.ids.text_field_arquivo.text = ''
Exemplo n.º 26
0
    def build(self):
        screen = Screen()
        self.theme_cls.primary_palette = "Green"

        list_view = MDList()

        scroll = ScrollView()
        scroll.add_widget(list_view)

        for i in range(1, 21):
            item = OneLineListItem(text=f"Item {i}")
            item2 = TwoLineListItem(text=f"Item {i}",
                                    secondary_text=f"Two lines version")
            item3 = ThreeLineListItem(text=f"Item {i}",
                                      secondary_text="Three lines version",
                                      tertiary_text="Third line")

            list_view.add_widget(item)
            list_view.add_widget(item2)
            list_view.add_widget(item3)

        screen.add_widget(scroll)

        return screen
Exemplo n.º 27
0
    def analyze(self, main): # main is pointing to ---> Main().show_data()
        """Analyse data with bighugelabs API"""
        sent = main.ids.sentence.text.lower()
        if LIST == []:
            self.empty()
        else:
            wrd = LIST[-1].lower()

            if wrd != '' and sent != '':
                API_KEY = 'a701e74e453ee6695e450310340401f5'
                URL = f'http://words.bighugelabs.com/api/2/{API_KEY}/{wrd}/json'

                if wrd not in sent:
                    #print("if wrd not in sent")
                    error = MDDialog(title="Error", text=f"Word: '{wrd}' is not in\n\n'{sent}'")
                    error.open()
                else:
                    #print("else...")
                    r = requests.get(URL) # get's url json file
                    try:
                        #print("j = json...")
                        j = json.loads(r.text) # loads json into 'j' as a dict
                    except KeyError:
                        #print("j = {/}")
                        j = {''}
                    if type(j) == dict: # check is 'j' variable is coming in as a Dict holds the new sentences new = f"{result}\n"
                        words = set()
                        try:
                            for w in j['adjective']['syn']:
                                words.add(w)
                        except KeyError:
                            pass
                            #print(f'Adjective for "{wrd}" is not found.')
                        try:
                            for w in j['noun']['syn']:
                                words.add(w)
                        except KeyError:
                            pass
                            #print(f'Noun for "{wrd}" is not found.') 
                        try:
                            for w in j['verb']['syn']:
                                words.add(w)
                        except KeyError:
                            pass
                            #print(f'Verb for "{wrd}" is not found.')

                        item = TwoLineListItem(text=f"Original sentence: {sent}", secondary_text=f"Analyze word: {wrd}", on_release=self.define)
                        self.ids.container.add_widget(item)
                        for word in words:
                            dictionary = self.load_json("dictionary.json")
                            # w = wordnet.synsets(word) # getting definition from nltk
                            try:
                                definition = dictionary[word.upper()]
                                # definition = str(w[0].definition())
                            except KeyError:
                                definition = "No definition found..."

                            item = TwoLineListItem(text=f"Definition '{word}': ", secondary_text=definition)
                            content = MDExpansionPanel(icon=f'{PATH}/dot.png',
                                                       content=item,
                                                       panel_cls=MDExpansionPanelTwoLine(
                                                            text=f"{sent.replace(wrd, word).lower()}",
                                                            secondary_text=f"{word.lower()}",
                                                        ))
                            self.ids.container.add_widget(content)
            else:
                self.empty()
Exemplo n.º 28
0
    def create_work_plan(self, the_date):

        self.choose_date = str(the_date)
        mycursor = main.sqliteConnection.cursor()
        mycursor.execute(
            f"SELECT a.task_name, a.scheduled_time, b.id_task "
            "FROM task_type a "
            "JOIN work_plan b "
            "ON a.id_type=b.id_type "
            "WHERE b.scheduled_date = ? ", (self.choose_date, ))
        rows = mycursor.fetchall()

        task_id = []
        task_name = []
        task_time = []

        for i in range(len(rows)):
            task_name.append(rows[i][0])
            task_time.append(rows[i][1])
            task_id.append(rows[i][2])

        for i in range(len(task_name)):
            self.ids.work_plan.add_widget(
                TwoLineListItem(text=f'{str(task_name[i])}',
                                secondary_text=f'{str(task_time[i])} minutes',
                                theme_text_color='Custom',
                                text_color=get_color_from_hex('#e5e5e5'),
                                font_style='Subtitle1',
                                on_press=partial(
                                    self.create_dialog,
                                    task_id[i],
                                )))

        self.ids.date_label.add_widget(
            MDLabel(text=self.choose_date,
                    halign='center',
                    theme_text_color='Custom',
                    text_color=get_color_from_hex('#3CB371'),
                    font_style='Caption',
                    font_size=8))
        mycursor.execute(
            f"SELECT sum(a.scheduled_time) "
            "FROM task_type a "
            "JOIN work_plan b "
            "ON a.id_type=b.id_type "
            "WHERE b.scheduled_date = ? ", (self.choose_date, ))
        row = mycursor.fetchone()
        try:
            all_time = int(row[0])

            self.ids.time_label.add_widget(
                MDLabel(text=f"W O R K  T I M E: {str(all_time)} minutes",
                        halign='center',
                        theme_text_color='Custom',
                        text_color=get_color_from_hex('#3CB371'),
                        font_style='Caption',
                        font_size=8))
        except:
            self.ids.time_label.add_widget(
                MDLabel(text="F R E E  T I M E!",
                        halign='center',
                        theme_text_color='Custom',
                        text_color=get_color_from_hex('#3CB371'),
                        font_style='Caption',
                        font_size=8))
 def on_start(self):
     for i in range(20):
         self.screen.ids.md_list.add_widget(
             TwoLineListItem(text=f"Title {i}",
                             secondary_text=f"Secundary title"))
Exemplo n.º 30
0
 def addListItem(self, list, item1, item2):
     dates = TwoLineListItem(text=item1, secondary_text=item2)
     list.add_widget(dates)