Ejemplo n.º 1
0
    def Show(self):
        async def show():
            await asynckivy.sleep(1)

            # Adding Widgets to the Cards - Mudasir Ali
            self.ids.chapter_1_heading.text = f'Ch:1, {Chapter_1_name}'
            self.ids.card_1.add_widget(self.Chapter_1_table)
            self.ids.card_1.add_widget(self.Chapter_1_button)
            self.ids.card_1.add_widget(self.label)

            self.ids.chapter_2_heading.text = f'Ch:2, {Chapter_2_name}'
            self.ids.card_2.add_widget(self.Chapter_2_table)
            self.ids.card_2.add_widget(self.Chapter_2_button)
            # self.ids.card_2.add_widget(self.label_2)

            self.ids.chapter_3_heading.text = f'Ch:3, {Chapter_3_name}'
            self.ids.card_3.add_widget(self.Chapter_3_table)
            self.ids.card_3.add_widget(self.Chapter_3_button)
            self.ids.card_3.add_widget(self.label_3)

            self.ids.chapter_4_heading.text = f'Ch:4, {Chapter_4_name}'
            self.ids.card_4.add_widget(self.Chapter_4_table)
            self.ids.card_4.add_widget(self.Chapter_4_button)
            self.ids.card_4.add_widget(self.label_4)

            self.ids.chapter_5_heading.text = f'Ch:5, {Chapter_5_name}'
            self.ids.card_5.add_widget(self.Chapter_5_table)
            self.ids.card_5.add_widget(self.Chapter_5_button)
            self.ids.card_5.add_widget(self.label_5)

        asynckivy.start(show())
Ejemplo n.º 2
0
        def Show(self):
            async def show():
                await asynckivy.sleep(1)

                self.ids.true_false_box.add_widget(self.true_false_table)

            asynckivy.start(show())
Ejemplo n.º 3
0
 def add_playlist(self, name_new_playlist):
     """
     Fires async method to add a playlist.
     :param name_new_playlist:
     :return:
     """
     asynckivy.start(self.async_add_playlist(name_new_playlist))
Ejemplo n.º 4
0
 async def _build_page():
     grid = self.m_grid
     grid.clear_widgets()
     for comic in object_lsit:
         await asynckivy.sleep(0)
         c = ReadingListComicImage(comic_obj=comic)
         c.lines = 2
         c.readinglist_obj = self.new_readinglist
         c.paginator_obj = self.paginator_obj
         y = self.comic_thumb_height
         thumb_filename = f"{comic.Id}.jpg"
         id_folder = self.app.store_dir
         my_thumb_dir = os.path.join(id_folder, "comic_thumbs")
         t_file = os.path.join(my_thumb_dir, thumb_filename)
         if os.path.isfile(t_file):
             c_image_source = t_file
         else:
             part_url = f"/Comics/{comic.Id}/Pages/0?"
             part_api = "&apiKey={}&height={}".format(
                 self.api_key, round(dp(y)))
             c_image_source = f"{self.api_url}{part_url}{part_api}"
             asynckivy.start(save_thumb(comic.Id, c_image_source))
         c.source = c_image_source
         c.PageCount = comic.PageCount
         c.pag_pagenum = self.current_page.number
         grid.add_widget(c)
         grid.cols = (Window.width - 10) // self.comic_thumb_width
         self.dynamic_ids[id] = c
     self.ids.page_count.text = "Page #\n{} of {}".format(
         self.current_page.number, self.paginator_obj.num_pages())
     self.loading_done = True
Ejemplo n.º 5
0
 def add_lineup_entry(self, name_new_lineup_entry):
     """
     Fires async method to add a lineup_entry.
     :param name_new_lineup_entry:
     :return:
     """
     asynckivy.start(self.async_add_lineup_entry(name_new_lineup_entry))
Ejemplo n.º 6
0
    def on_start(self):
        def _load_kv_for_demo(name_screen):
            from demo_apps.shopwindow import ShopWindow

            Builder.load_string(self.data_for_demo[name_screen]["kv_string"])
            self.data_for_demo[name_screen]["object"] = eval(
                self.data_for_demo[name_screen]["class"])
            self.main_widget.ids.scr_mngr.add_widget(
                self.data_for_demo[name_screen]["object"])

        async def load_all_kv_files():
            from demo_apps.shopwindow import screen_shop_window

            data = {"Shop Window": screen_shop_window}

            for name_screen in data.keys():
                await asynckivy.sleep(0)
                self.dialog_load_kv_files.name_kv_file = name_screen
                self.data_for_demo[name_screen]["kv_string"] = data[
                    name_screen]
                _load_kv_for_demo(name_screen)

            self.dialog_load_kv_files.dismiss()

        self.dialog_load_kv_files = DialogLoadKvFiles()
        self.dialog_load_kv_files.open()
        asynckivy.start(load_all_kv_files())
Ejemplo n.º 7
0
    def collect_readinglist_data(
        self,
        readinglist_name="",
        readinglist_Id="",
        mode="From Server",
        current_page_num=1,
        *largs,
    ):
        async def collect_readinglist_data():
            self.readinglist_name = readinglist_name
            self.app.set_screen(self.readinglist_name + " Page 1")
            self.reading_list_title = self.readinglist_name + " Page 1"
            self.readinglist_Id = readinglist_Id
            self.page_number = current_page_num
            self.mode = mode
            if self.mode == "From Server":
                self.fetch_data = ComicServerConn()
                lsit_count_url = "{}/Lists/{}/Comics/".format(
                    self.api_url, readinglist_Id)
                # self.fetch_data.get_list_count(lsit_count_url,self)
                self.fetch_data.get_server_data(lsit_count_url, self)
            elif self.mode == "From DataBase":
                self.got_db_data()

        asynckivy.start(collect_readinglist_data())
Ejemplo n.º 8
0
        def Show(self):
            async def show():
                await asynckivy.sleep(1)

                self.ids.question_answer_card.add_widget(self.question_1)
                self.ids.question_answer_card.add_widget(self.answer_1)

                self.ids.question_answer_card.add_widget(self.spacing_1)

                self.ids.question_answer_card.add_widget(self.question_2)
                self.ids.question_answer_card.add_widget(self.answer_2)

                self.ids.question_answer_card.add_widget(self.spacing_2)

                self.ids.question_answer_card.add_widget(self.question_3)
                self.ids.question_answer_card.add_widget(self.answer_3_1)
                self.ids.question_answer_card.add_widget(self.answer_3_2)
                self.ids.question_answer_card.add_widget(self.answer_3_3)
                self.ids.question_answer_card.add_widget(self.answer_3_4)

                self.ids.question_answer_card.add_widget(self.spacing_4)

                self.ids.question_answer_card.add_widget(self.question_4)
                self.ids.question_answer_card.add_widget(self.answer_4)

            asynckivy.start(show())
Ejemplo n.º 9
0
    def on_open(self):
        async def create_zip():
            if os.path.isdir(path):
                root_dir = os.path.basename(path)
                count = 0
                for dir_path, dir_names, file_names in os.walk(path):
                    await asynckivy.sleep(0)
                    for file_name in file_names:
                        count += 1
                        self.set_progress_value(count_files, count)
                        self.set_name_packed_file(file_name)
                        file_path = os.path.join(dir_path, file_name)
                        parentpath = os.path.relpath(file_path, path)
                        archive_name = os.path.join(root_dir, parentpath)
                        zip_file.write(file_path, archive_name)
            else:
                zip_file.write(path, os.path.split(path)[1])

            zip_file.close()
            self.dismiss()

        path = self.instance_context_menu.entry_object.path
        count_files = sum((len(f) for _, _, f in os.walk(path)))
        zip_file = zipfile.ZipFile(f"{path}.zip", "w", zipfile.ZIP_DEFLATED)
        asynckivy.start(create_zip())
Ejemplo n.º 10
0
    def set_list(self):
        self.user = self.get_by_username(self.username)
        self.friend_match_arr =  self.tag_match(self.user['tags'])
        self.friends = self.user['friends']
        for u in self.friend_match_arr:
            if u['username']==self.username: 
                self.friend_match_arr.remove(u)
            if u['username'] in self.friends: 
                self.friend_match_arr.remove(u)

        if len(self.friend_match_arr) < 3:
            self.friend_match_arr += self.get_all()
            for u in self.friend_match_arr:
                if u['username']==self.username: 
                    self.friend_match_arr.remove(u)
                if u['username'] in self.friends: 
                    self.friend_match_arr.remove(u)

        random.shuffle(self.friend_match_arr)
        async def set_list():
            for u in self.friend_match_arr:
                await asynckivy.sleep(0)
                userbox = UserCard()
                userbox.ids.username.text = u['username']
                userbox.ids.username.secondary_text = u['status']
                userbox.ids.bio.text = u['bio']
                userbox.ids.streak.text = str(u['streak'])
                userbox.ids.tag.text = ', '.join(u['tags'])
                self.explorescreen.ids.layout.add_widget(userbox)
        asynckivy.start(set_list())
Ejemplo n.º 11
0
        def Show(self):
            async def show():

                self.ids.fill_in_blanks_box.add_widget(
                    self.fill_in_blanks_table)

            asynckivy.start(show())
Ejemplo n.º 12
0
    def clear_cards(self):
        async def clear_cards():
            for child in self.children:
                child.header_text.text = ""
                child.sub_text.text = ""
                child.link.link_to_post = ""

        asynckivy.start(clear_cards())
Ejemplo n.º 13
0
 def set_list(self):
     async def set_list():
         names_icons_list = list(md_icons.keys())[self.x:self.y]
         for name_icon in names_icons_list:
             await asynckivy.sleep(0)
             self.screen.ids.box.add_widget(
                 ItemForList(icon=name_icon, text=name_icon))
     asynckivy.start(set_list())
Ejemplo n.º 14
0
 def refresh_list(self):
     """
     Fires async method to refresh the internal list.
     :return:
     """
     # Clear existing list<SongEntry>:
     self._list.clear()
     asynckivy.start(self.async_refresh_list())
Ejemplo n.º 15
0
 def rename_song(self, song_rowview, new_name_song):
     """
     Fires async method to rename a song.
     :param song_rowview:
     :param new_name_song:
     :return:
     """
     asynckivy.start(self.async_rename_song(song_rowview, new_name_song))
Ejemplo n.º 16
0
 def set_list_loc(self):
     async def set_list_loc():
         for i in range(20):
             await asynckivy.sleep(0)
             userbox = UserCard()
             userbox.ids.username.text = f'usernameloc {i}'
             self.explorescreen.ids.layout2.add_widget(userbox)
     asynckivy.start(set_list_loc())
Ejemplo n.º 17
0
 def remove_song(self, song_rowview, *args):
     """
     Fires async method to remove a song.
     :param song_rowview:
     :param args:
     :return:
     """
     asynckivy.start(self.async_remove_song(song_rowview, *args))
Ejemplo n.º 18
0
 def rename_help(self, help_rowview, new_name_help):
     """
     Fires async method to rename a help.
     :param help_rowview:
     :param new_name_help:
     :return:
     """
     asynckivy.start(self.async_rename_help(help_rowview, new_name_help))
Ejemplo n.º 19
0
 def remove_help(self, help_rowview, *args):
     """
     Fires async method to remove a help.
     :param help_rowview:
     :param args:
     :return:
     """
     asynckivy.start(self.async_remove_help(help_rowview, *args))
Ejemplo n.º 20
0
 def remove_playlist(self, playlist_rowview, *args):
     """
     Fires async method to remove a playlist.
     :param playlist_rowview:
     :param args:
     :return:
     """
     asynckivy.start(self.async_remove_playlist(playlist_rowview, *args))
Ejemplo n.º 21
0
    def got_json(self, req, results):
        print("Start got_json")

        async def _got_json():
            print("Start _got_json")
            self.new_readinglist = ComicReadingList(
                name=self.readinglist_name,
                data=results,
                slug=self.readinglist_Id,
            )
            totalCount = self.new_readinglist.totalCount
            i = 1
            for item in self.new_readinglist.comic_json:
                await asynckivy.sleep(0)
                str_name = "{} #{}".format(item["Series"], item["Number"])
                self.dialog_load_comic_data.name_kv_file = str_name
                self.dialog_load_comic_data.percent = str(
                    i * 100 // int(totalCount)
                )
                comic_index = self.new_readinglist.comic_json.index(item)
                new_comic = ComicBook(
                    item,
                    readlist_obj=self.new_readinglist,
                    comic_index=comic_index,
                )
                self.new_readinglist.add_comic(new_comic)
                i += 1
            print("End for item in self.new_readinglist.comic_json:")
            self.setup_options()
            new_readinglist_reversed = self.new_readinglist.comics[::-1]
            self.paginator_obj = Paginator(
                new_readinglist_reversed, self.max_books_page
            )
            page = self.paginator_obj.page(self.page_number)
            self.current_page = page
            if page.has_next():
                self.next_button.opacity = 1
                self.next_button.disabled = False
                self.next_button.page_num = page.next_page_number()
            else:
                self.next_button.opacity = 0
                self.next_button.disabled = True
                self.next_button.page_num = ""
            if page.has_previous():
                self.prev_button.opacity = 1
                self.prev_button.disabled = False
                self.prev_button.page_num = page.previous_page_number()
            else:
                self.prev_button.opacity = 0
                self.prev_button.disabled = True
                self.prev_button.page_num = ""
            self.build_page(page.object_list)
            self.list_loaded = True
            self.dialog_load_comic_data.dismiss()

        self.dialog_load_comic_data = DialogLoadKvFiles()
        self.dialog_load_comic_data.open()
        asynckivy.start(_got_json())
Ejemplo n.º 22
0
    def refresh_list(self):
        """
        Fires async method to refresh the internal list.
        :return:
        """
        # Clear existing list<PlayListProvider>:
        self._list.clear()

        asynckivy.start(self.async_refresh_list())
Ejemplo n.º 23
0
    def set_heading(self):
        async def set_heading():
            for i in range(5):
                await asynckivy.sleep(1)
                text_heading = self.strng.get_screen('main').ids.heading
                text_heading.text = str(i)
            text_heading.text = "Happy Birthday !!"

        asynckivy.start(set_heading())
Ejemplo n.º 24
0
 def remove_lineup_entry(self, lineup_entry_rowview, *args):
     """
     Fires async method to remove a lineup_entry.
     :param lineup_entry_rowview:
     :param args:
     :return:
     """
     asynckivy.start(
         self.async_remove_lineup_entry(lineup_entry_rowview, *args))
Ejemplo n.º 25
0
    def refresh_editable_list(self):
        """
        Fires async method to refresh the internal editable_list.
        :return:
        """
        # Clear existing editable_list<TFSetting>:
        self._editable_list.clear()

        asynckivy.start(self.async_refresh_editable_list())
Ejemplo n.º 26
0
 def rename_playlist(self, playlist_rowview, new_name_playlist):
     """
     Fires async method to rename a playlist.
     :param playlist_rowview:
     :param new_name_playlist:
     :return:
     """
     asynckivy.start(
         self.async_rename_playlist(playlist_rowview, new_name_playlist))
Ejemplo n.º 27
0
 def restore_factory_setting(self, setting_rowview, *args):
     """
     Fires async method to restore a setting.
     :param setting_rowview:
     :param args:
     :return:
     """
     asynckivy.start(
         self.async_restore_factory_setting(setting_rowview, *args))
Ejemplo n.º 28
0
 def edit_setting(self, setting_rowview, new_name_setting):
     """
     Fires async method to edit a setting.
     :param setting_rowview:
     :param new_name_setting:
     :return:
     """
     asynckivy.start(
         self.async_edit_setting(setting_rowview, new_name_setting))
Ejemplo n.º 29
0
    def set_list_for_refresh_layout(self):
        async def set_list_for_refresh_layout():
            names_icons_list = list(md_icons.keys())[self.start:self.end]
            for name_icon in names_icons_list:
                await asynckivy.sleep(0)
                self.ids.box.add_widget(
                    KitchenSinkOneLineLeftIconItem(icon=name_icon,
                                                   text=name_icon))
            self.ids.refresh_layout.refresh_done()

        asynckivy.start(set_list_for_refresh_layout())
Ejemplo n.º 30
0
    def set_list_for_refresh_layout(self):
        async def set_list_for_refresh_layout():
            names_icons_list = list(md_icons.keys())[self.x:self.y]
            for name_icon in names_icons_list:
                await asynckivy.sleep(0)
                self.data["Refresh Layout"]["object"].ids.box.add_widget(
                    ItemForListRefreshLayout(icon=name_icon, text=name_icon))
            self.data["Refresh Layout"][
                "object"].ids.refresh_layout.refresh_done()

        asynckivy.start(set_list_for_refresh_layout())