Пример #1
0
def processmanager(processname:str):
    """ Displaying active background process to the user"""
    pm = ProcessManagerItem()
    boxlayout = BoxLayout(orientation="vertical")
    main_label = MDLabel(
        text="Process running",
        theme_text_color= "Custom",
        text_color= (1, 1, 1, 1),
        size_hint_y= None,
        adaptive_height= True,
        )
    boxlayout.add_widget(main_label)
    sep = MDSeparator(height= "1dp", color='cyan')
    boxlayout.add_widget(sep)
    process_label = MDLabel(text= processname,
                            theme_text_color= "Custom",
                            text_color= (1, 1, 1, 1),)
    boxlayout.add_widget(process_label)
    boxlayout2 = BoxLayout(orientation= "vertical")
    pb = MDProgressBar(type= "determinate", running_duration= 1, catching_duration= 1.5)
    boxlayout2.add_widget(pb)
    pb.start()
    boxlayout.add_widget(boxlayout2)
    pm.add_widget(boxlayout)
    return pm
Пример #2
0
 def load_list(self):
     c.execute("SELECT * FROM timer ORDER BY number DESC LIMIT 1 ")
     for i in c:
         self.load_name = i[0]
         self.load_hours = i[1]
         self.load_minutes = i[2]
         self.load_seconds = i[3]
         self.Limit_for = True
         for i in range(8):
             if self.Limit_for == True:
                 self.bar = MDProgressBar(id="counter",
                                          max=26,
                                          value=26,
                                          size_hint=(0.7, 0),
                                          pos_hint={
                                              "center_x": 0.5,
                                              "center_y": 0.3
                                          })
                 lists = ProgressList(
                     text=self.help.ids.frij.text,
                     secondary_text=str(self.load_minutes) + ":" +
                     str(self.load_seconds),
                     tertiary_text=" ",
                     bar=self.bar)
                 self.listit.append(lists)
                 self.help.ids.leep.add_widget(lists)
                 #c.execute("INSERT INTO  timer (lists,bar) VALUES (?,?)", (lists,self.bar,))
                 image = IconLeftWidget(icon="plus")
                 lists.add_widget(image)
                 self.Limit_for = False
                 self.help.ids.frij.text = ""
Пример #3
0
 def store_data(self):
     if self.onetime == True:
         self.ider += 1
         self.onetime = False
     self.bar = MDProgressBar(id="counter",
                              max=26,
                              value=26,
                              size_hint=(0.7, 0),
                              pos_hint={
                                  "center_x": 0.5,
                                  "center_y": 0.3
                              })
     self.lists = ProgressList(text=self.help.ids.frij.text,
                               secondary_text=str(self.minutes) + ":" +
                               str(self.seconds),
                               tertiary_text=" ",
                               bar=self.bar)
     self.listitdown.append(self.lists)
     self.bars.append(self.bar)
     for i in self.listitdown:
         if self.oneiter == True:
             self.inserter = i
             c.execute(
                 "INSERT INTO  timer (name,hours,minutes,seconds,number,lists,text,secondary_text,max,min) VALUES (?,?,?,?,?,?,?,?,?,?)",
                 (self.help.ids.frij.text, self.hour, self.minutes,
                  self.seconds, self.ider,
                  "self.listitdown[" + str(self.u) + "]"))
             self.oneiter = False
             self.u += 1
     self.ider += 1
     print(self.ider)
     mydb.commit()
     self.oneiter = True
Пример #4
0
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.master = MDApp.get_running_app()
        self.size_hint_y = None
        self.height = "240dp"
        self.font_style = "H6"

        self.progressbar = MDProgressBar(value=0,
                                         pos_hint={
                                             "center_x": .5,
                                             "center_y": .5
                                         },
                                         opacity=0)
        self.add_widget(self.progressbar)
Пример #5
0
        def build(self):
            self.theme_cls.theme_style = "Dark"
            self.theme_cls.primary_palette = "Pink"
            screen = Screen(name="1")
            self.x = MDProgressBar(value=0, max=10)
            screen.add_widget(self.x)

            screen.add_widget(MDRaisedButton(text="Press ME", on_release=Clock.schedule_once(self.up)))

            

            print(self.x.color, "op co")
            
            #return Builder.load_string(KV)
            return screen
Пример #6
0
    def reset_progressbar(self, *args):
        if isinstance(self.progressbar, MDProgressBar):
            self.remove_widget(self.progressbar)
        self.progressbar = MDProgressBar(value=0,
                                         pos_hint={
                                             "center_x": .5,
                                             "center_y": .5
                                         },
                                         opacity=0)
        self.add_widget(self.progressbar)

        # Remove thread from list since it has finished executing
        self.master.download_threads.pop(
            self.text)  # Text is the title of the manga
        self.master.currently_downloading = False if len(
            self.master.download_threads) == 0 else True
Пример #7
0
 def start_load_list(self):
     c.execute("SELECT * FROM timer ORDER BY number ASC")
     d = c.fetchall()
     for t in d:
         u = 0
         self.bar = MDProgressBar(id="counter", max=t[3], value=t[3], size_hint=(0.7, 0),
                                  pos_hint={"center_x": 0.5, "center_y": 0.3})
         lists = ProgressList(text=t[0],
                              secondary_text=str(self.bar.value//60) + ":" + str(self.bar.value)+str(self.bar.value),
                              tertiary_text=" ", bar=self.bar)
         self.help.ids.leep.add_widget(lists)
         image = IconLeftWidget(icon="plus")
         self.image2 = IconRightWidget(icon="minus",on_press=lambda x: self.delete_row(x.parent.parent))
         self.listitdown.append(lists)
         lists.add_widget(self.image2)
         lists.add_widget(image)
         u += 1
 def process_set_list(self, *args, text="", search=False):
     from kivymd.uix.progressbar import MDProgressBar
     pb = MDProgressBar(type="determinate",
                        running_duration=1,
                        catching_duration=1.5)
     status_bar = get_app().modellist_controller.screen.status_bar
     status_bar.clear_widgets()
     status_bar.add_widget(pb)
     pb.start()
     Clock.schedule_once(
         partial(self.set_list, self, *args, text=text, search=search))
     pb.stop()
Пример #9
0
    def start_downloading(self):
        user_input = self.root.get_screen('main').ids.url_input.text

        # video = YouTube(user_input)
        # print(type(video))
         
        if user_input != '' and re.search(r'^(https?\:\/\/)?(www\.)?(youtube\.com|youtu\.?be)\/.+$', user_input):
            self.root.current = 'progress'
            
            screen_id = self.root.get_screen('progress').ids.video_list

            for num in range(1):
                main_layout = MDFloatLayout()
                flip_card = MDCard(size_hint=(.9, .9), pos_hint={'center_x':.5, 'center_y': .5})
                box_1 = MDBoxLayout(orientation='vertical',)
                box_2 = MDBoxLayout(orientation='vertical', )
                box_3 = MDBoxLayout(orientation='vertical', padding=20)

                img = AsyncImage(source=video.thumbnail_url, size_hint=(.9, .9), pos_hint={'center_x': .5, 'center_y': .5})
                
                box_3.add_widget(img)
                box_3.add_widget(
                    MDLabel(
                        text=video.title, halign='center', font_style='Body2'
                        )
                            )
                box_2.add_widget(box_3)
                box_2.add_widget(MDRaisedButton(text='Download', pos_hint={'center_x': .5, 'center_y': .5}, size_hint=(.6, .1), on_release = self.quality_check,))

                box_1.add_widget(box_2)
                advertisement_box = MDBoxLayout(orientation='vertical', size_hint=(1, .2))
                advertisement_box.add_widget(MDLabel(text='Advertisement', halign='center'))
                advertisement_box.add_widget(MDProgressBar(pos_hint={"center_x": .5, }))
                box_1.add_widget(advertisement_box)


                flip_card.add_widget(box_1)
                
                main_layout.add_widget(flip_card)
                screen_id.add_widget(main_layout)

            
        else:
            self.show_message('Invalid URL!')
Пример #10
0
    def __init__(self, updater, **kwargs):
        self.updater_instance = updater

        self.title = "Update Available!"
        self.type = "custom"

        display_label = Label(text="New Feature")
        self.ignore_button = MDFlatButton(text="Ignore",
                                          on_press=self.dismissed)
        self.content_cls = Screen()
        self.progress_bar = MDProgressBar(value=self.progress[0])
        self.confirm_button = MDRaisedButton(text="Update",
                                             on_touch_down=self.user_confirmed)
        self.buttons = [
            self.ignore_button,
            self.confirm_button,
        ]

        super().__init__(**kwargs)
Пример #11
0
 def download_bar(self):
     self.download_progress = MDProgressBar(
         pos_hint={
             'center_x': 0.5,
             'center_y': 0.5
         },
         size_hint_x=0.8,
         value=0,
         color=self.theme_cls.primary_color)
     self.dia = MDDialog(text='Downloading',
                         buttons=[
                             MDFlatButton(
                                 text="CANCEL",
                                 text_color=self.theme_cls.primary_color,
                                 on_press=lambda x: self.cancel())
                         ])
     #self.dia.add_widget(IconLeftWidget(icon='download', pos_hint={'center_x': .1, 'center_y': .1}))
     self.dia.add_widget(self.download_progress)
     self.dia.open()
     t2 = threading.Thread(target=self.download_song)
     t2.start()
Пример #12
0
 def start_load_list(self):
     c.execute("SELECT * FROM timer ORDER BY number ASC")
     d = c.fetchall()
     # print(d[0])
     for t in d:
         # print(t[3])
         u = 0
         self.bar = MDProgressBar(id="counter",
                                  max=26,
                                  value=26,
                                  size_hint=(0.7, 0),
                                  pos_hint={
                                      "center_x": 0.5,
                                      "center_y": 0.3
                                  })
         lists = ProgressList(text=t[0],
                              secondary_text=str(t[2]) + ":" + str(t[3]),
                              tertiary_text=" ",
                              bar=self.bar)
         self.help.ids.leep.add_widget(lists)
         image = IconLeftWidget(icon="plus")
         self.listit.append(lists)
         lists.add_widget(image)
         u += 1
Пример #13
0
def pdfimages(pdfpath, cmds, instance, *args):
    pb = MDProgressBar(color=get_app().theme_cls.primary_color,
                       type="indeterminate")
    status_bar = get_app().image_selection_controller.status_bar
    status_bar.clear_widgets()
    status_bar.add_widget(pb)
    pb.start()
    pdfdir = Path(pdfpath.split('.')[0])
    makedirs(pdfdir, exist_ok=True)
    params = []
    children = instance.parent.parent.parent.parent.content_cls.children
    process = cmds["pdfimages"]
    for idx, child in enumerate(reversed(children)):
        if idx == 6:
            for fileformat in child.children:
                if fileformat.state == 'down':
                    params.extend([f"-{fileformat.text}"])
        if idx == 2 and child.text != "":
            params.extend(["-f", child.text])
        if idx == 4 and child.text != "":
            params.extend(["-l", child.text])
        if idx == 9 and child.ids['_left_container'].children[0].active:
            params.extend(["-p"])
        if idx == 8:
            for convprocess in child.children:
                if convprocess.state == 'down':
                    if convprocess.text == "rendering":
                        process = cmds["pdftoppm"]
                    else:
                        process = cmds["pdfimages"]
                        fileformat.text = "j" if fileformat.text == "jpeg" else fileformat.text
                        fileformat.text = "jpeg" if fileformat.text == "jp2" else fileformat.text
    p1 = Popen([process, *params, pdfpath, pdfdir.joinpath(pdfdir.name)])
    p1.communicate()
    get_app().image_selection_controller.file_chooser._update_files()
    get_app().image_selection_controller.add_images([pdfdir])
    pb.stop()
Пример #14
0
def download_with_progress(url, file_path, on_success, color="#54B3FF"):
    """ Downloader helper customized for the needs """
    pb = MDProgressBar(color=color)
    status_bar = get_app().image_selection_controller.status_bar
    status_bar.clear_widgets()
    status_bar.add_widget(pb)
    pb.max = 1
    pb.min = 0
    pb.start()

    def update_progress(request, current_size, total_size):
        pb.value = current_size / total_size
        if pb.value == 1:
            pb.stop()

    try:
        UrlRequest(url=requests.get(url).url,
                   on_progress=update_progress,
                   chunk_size=1024,
                   on_success=on_success,
                   on_failure=download_error,
                   file_path=file_path)
    except:
        download_error()
Пример #15
0
    def play_song(self, i):
        try:
            self.stop()
        except:
            pass
        link = self.down_path_list[i][0]
        if self.root.ids.screen_manager.current != 'PlayScreen':
            self.change_screen("PlayScreen")
        self.prepare(link)
        if link.endswith('.m4a'):
            self.audio = MP4(link)
            self.play_song_name = self.audio.get('\xa9nam', ['Unknown'])[0]
            #print(audio['\xa9alb'])
            self.play_art_name = self.audio.get('\xa9ART', ['Unknown'])[0]
            #print(audio['\xa9day'])
            #print(audio['\xa9gen'])
            try:
                self.img_data = self.audio["covr"][0]
            except:
                with open('cover.jpg', 'rb') as f:
                    self.img_data = f.read()
        elif link.endswith('.mp3'):
            self.audio = MP3(link, ID3=EasyID3)
            self.audio_tags = ID3(link)
            self.play_song_name = self.audio.get('title', ['Unknown'])[0]
            self.play_art_name = self.audio.get('artist', ['Unknown'])[0]
            try:
                self.img_data = self.audio_tags.get("APIC:").data
            except:
                with open('cover.jpg', 'rb') as f:
                    self.img_data = f.read()
        else:
            with open('cover.jpg', 'rb') as f:
                self.img_data = f.read()
                self.play_song_name = 'Unknown'
                self.play_art_name = 'Unknown'

        play_image_data = io.BytesIO(self.img_data)
        img = CoreImage(play_image_data, ext="jpg").texture
        song_image = Image(allow_stretch=True)
        song_image.texture = img
        self.root.ids.PlayScreen.clear_widgets()
        self.root.ids.PlayScreen.add_widget(
            MDIconButton(icon='chevron-left',
                         pos_hint={
                             "center_x": 0.05,
                             "center_y": 0.95
                         },
                         on_press=lambda x: self.back_screen()))
        card = MDCard(orientation='vertical',
                      pos_hint={
                          "center_x": 0.5,
                          "center_y": 0.65
                      },
                      size_hint=(None, None),
                      size=(self.win_size * 0.9, self.win_size * 0.9))
        card.add_widget(song_image)
        self.root.ids.PlayScreen.add_widget(card)
        self.root.ids.PlayScreen.add_widget(
            MDLabel(text=self.play_song_name,
                    halign='center',
                    theme_text_color='Custom',
                    text_color=self.theme_cls.primary_color,
                    font_style='H4',
                    bold=True,
                    pos_hint={"top": 0.84}))
        self.root.ids.PlayScreen.add_widget(
            MDLabel(text=self.play_art_name,
                    halign='center',
                    theme_text_color='Secondary',
                    font_style='H6',
                    pos_hint={"top": 0.8}))
        self.play_progress = MDProgressBar(pos_hint={
            'center_x': 0.5,
            'center_y': 0.25
        },
                                           size_hint_x=0.9,
                                           value=0,
                                           color=self.theme_cls.primary_color)
        self.root.ids.PlayScreen.add_widget(self.play_progress)
        self.root.ids.PlayScreen.add_widget(
            MDIconButton(icon="chevron-double-left",
                         pos_hint={
                             "center_x": .15,
                             "center_y": .15
                         },
                         user_font_size="40sp",
                         on_release=lambda x: self.rewind()))
        self.root.ids.PlayScreen.add_widget(
            MDIconButton(icon="chevron-double-right",
                         pos_hint={
                             "center_x": .85,
                             "center_y": .15
                         },
                         user_font_size="40sp",
                         on_release=lambda x: self.forward()))
        self.next_button = MDIconButton(
            icon="skip-next",
            pos_hint={
                "center_x": .65,
                "center_y": .15
            },
            user_font_size="55sp",
            on_release=lambda x: self.play_song(i + 1))
        self.root.ids.PlayScreen.add_widget(self.next_button)
        self.previous_button = (MDIconButton(
            icon="skip-previous",
            pos_hint={
                "center_x": .35,
                "center_y": .15
            },
            user_font_size="55sp",
            on_release=lambda x: self.play_song(i - 1)))
        self.root.ids.PlayScreen.add_widget(self.previous_button)
        self.play_btn = MDFloatingActionButton(
            icon='play',
            pos_hint={
                'center_x': 0.5,
                "center_y": 0.15
            },
            user_font_size="50sp",
            md_bg_color=(1, 1, 1, 1),
            elevation_normal=10,
            on_press=lambda x: self.play_song_offline(i))
        self.root.ids.PlayScreen.add_widget(self.play_btn)
        self.length_stamp = MDLabel(text=self.convert_sec(
            self.sound.getDuration()),
                                    halign='right',
                                    theme_text_color='Secondary',
                                    padding_x='20dp',
                                    pos_hint={"top": 0.725})
        self.root.ids.PlayScreen.add_widget(self.length_stamp)
        self.play_stamp = (MDLabel(text=self.convert_sec(
            self.sound.getCurrentPosition()),
                                   halign='left',
                                   theme_text_color='Secondary',
                                   padding_x='20dp',
                                   pos_hint={"top": 0.725}))
        self.root.ids.PlayScreen.add_widget(self.play_stamp)
        self.play_song_offline(i)
Пример #16
0
 def song_details(self, i):
     self.s_manager = self.root.ids.screen_manager
     self.change_screen('SongDetailsScreen')
     self.details_screen = self.root.ids.SongDetailsScreen
     self.details_screen.clear_widgets()
     self.song_name = self.search_data[i]['title'].replace(
         """, "'").replace("&", "&").replace("'", "'")
     self.song_id = self.search_data[i]['id']
     try:
         self.artist_name = self.search_data[i]['more_info'][
             'primary_artists'].replace(""", "'").replace(
                 "&", "&").replace("'", "'")
         self.album = self.search_data[i]['album'].replace(
             """, "'").replace("&", "&").replace("'", "'")
     except:
         self.artist_name = self.search_data[i]['subtitle']
     self.image_url = self.search_data[i]['image'].replace(
         '50x50', '500x500').replace('150x150', '500x500')
     self.image_path = os.path.join(self.data_path, self.song_id + '.jpg')
     self.fetch_thread = threading.Thread(target=self.fetch_details)
     self.fetch_thread.start()
     self.details_screen.add_widget(
         MDIconButton(icon='chevron-left',
                      pos_hint={
                          "center_x": 0.05,
                          "center_y": 0.95
                      },
                      on_press=lambda x: self.back_screen()))
     song_image = AsyncImage(source=self.image_url,
                             pos_hint={
                                 "center_x": 0.5,
                                 "center_y": 0.5
                             },
                             allow_stretch=True)
     card = MDCard(orientation='vertical',
                   pos_hint={
                       "center_x": 0.5,
                       "center_y": 0.65
                   },
                   size_hint=(None, None),
                   size=(self.win_size * 0.9, self.win_size * 0.9))
     card.add_widget(song_image)
     self.details_screen.add_widget(card)
     self.details_screen.add_widget(
         MDLabel(text=self.song_name,
                 halign='center',
                 theme_text_color='Custom',
                 text_color=self.theme_cls.primary_color,
                 font_style='H4',
                 bold=True,
                 pos_hint={"top": 0.84}))
     self.details_screen.add_widget(
         MDLabel(text=self.artist_name,
                 halign='center',
                 theme_text_color='Secondary',
                 font_style='H6',
                 pos_hint={"top": 0.8}))
     self.spinner = MDSpinner(size_hint=(None, None),
                              size=("50", "50"),
                              pos_hint={
                                  'center_x': 0.5,
                                  "center_y": 0.15
                              },
                              active=True)
     #self.details_screen.add_widget(MDLabel(text=self.album, halign='center', theme_text_color='Hint', font_style='H6', pos_hint={"top":0.9}))
     self.heart_icon = MDIconButton(icon='heart-outline',
                                    user_font_size="30sp",
                                    theme_text_color='Secondary',
                                    pos_hint={
                                        "center_x": 0.1,
                                        "center_y": 0.15
                                    },
                                    on_press=lambda x: self.add_fav())
     self.details_screen.add_widget(self.heart_icon)
     self.play_progress = MDProgressBar(pos_hint={
         'center_x': 0.5,
         'center_y': 0.25
     },
                                        size_hint_x=0.9,
                                        value=0,
                                        color=self.theme_cls.primary_color)
     self.details_screen.add_widget(self.play_progress)
     self.tap_target_view = MDTapTargetView(
         widget=self.heart_icon,
         title_text="Add to Favorites",
         description_text="Feature currently under development",
         widget_position="left_bottom",
     )
     self.details_screen.add_widget(
         MDIconButton(icon="chevron-double-left",
                      pos_hint={
                          "center_x": .3,
                          "center_y": .15
                      },
                      user_font_size="50sp",
                      on_release=lambda x: self.rewind()))
     self.details_screen.add_widget(
         MDIconButton(icon="chevron-double-right",
                      pos_hint={
                          "center_x": .7,
                          "center_y": .15
                      },
                      user_font_size="50sp",
                      on_release=lambda x: self.forward()))
     self.play_btn = MDFloatingActionButton(
         icon='play',
         pos_hint={
             'center_x': 0.5,
             "center_y": 0.15
         },
         user_font_size="50sp",
         md_bg_color=(1, 1, 1, 1),
         elevation_normal=10,
         on_press=lambda x: self.play_song_online())
     self.details_screen.add_widget(self.play_btn)
     self.details_screen.add_widget(
         MDIconButton(icon='arrow-collapse-down',
                      user_font_size="30sp",
                      theme_text_color='Secondary',
                      pos_hint={
                          'center_x': 0.9,
                          "center_y": 0.15
                      },
                      on_press=lambda x: self.download_bar()))
     try:
         self.dia.dismiss()
     except:
         pass
Пример #17
0
def pdfimages(pdfpath, cmds, instance, ocr, *args):
    """ Converts the pdf to images"""
    pb = MDProgressBar(color=get_app().theme_cls.primary_color,
                       type="indeterminate")
    status_bar = get_app().image_selection_controller.status_bar
    status_bar.clear_widgets()
    status_bar.add_widget(pb)
    pb.start()
    if ocr:
        tmpdir = tempfile.TemporaryDirectory()
        pdfdir = Path(tmpdir.name)
    else:
        pdfdir = Path(pdfpath.split('.')[0])
        makedirs(pdfdir, exist_ok=True)
    params = []
    children = instance.parent.parent.parent.parent.content_cls.children
    process = cmds["pdfimages"]
    for idx, child in enumerate(reversed(children)):
        if idx == 6:
            for fileformat in child.children:
                if fileformat.state == 'down':
                    params.extend([f"-{fileformat.text}"])
        if idx == 2 and child.text != "":
            params.extend(["-f", child.text])
        if idx == 4 and child.text != "":
            params.extend(["-l", child.text])
        if idx == 9 and child.ids['_left_container'].children[0].active:
            params.extend(["-p"])
        if idx == 8:
            for convprocess in child.children:
                if convprocess.state == 'down':
                    if convprocess.text == "rendering":
                        process = cmds["pdftoppm"]
                    else:
                        process = cmds["pdfimages"]
                        params = " ;".join(params).replace('-jpeg',
                                                           '-j').split(' ;')
    p1 = Popen([
        process, *params, pdfpath,
        pdfdir.joinpath(Path(pdfpath.split('.')[0]).name)
    ])
    p1.communicate()
    get_app().image_selection_controller.file_chooser._update_files()
    if not ocr:
        get_app().image_selection_controller.add_images([pdfdir])
    else:
        images = list(pdfdir.glob('*.*'))
        tc_screen = get_app().tesseract_controller
        thread = tc_screen.recognize_thread(None,
                                            file_list=images,
                                            profile={
                                                'outputformats': ['pdf'],
                                                'groupfolder': '',
                                                'subforlder': False,
                                                'print_on_screen': False
                                            })
        thread.join()
        p2 = Popen([
            cmds["pdfunite"], *sorted(list(pdfdir.glob('*.pdf'))),
            pdfpath[:-3] + "ocr.pdf"
        ])
        p2.communicate()
    get_app().image_selection_controller.file_chooser._update_files()
    pb.stop()
    def __init__(self, **kwargs):
        super(Test, self).__init__(**kwargs)

        self.click = 0

        # ---以下定義點擊前三名按鈕時的次數---
        self.add1 = 0
        self.add1_shop_list = []
        self.add1_temp_list = []
        self.add1_rent_list = []
        self.add1_bound = []
        self.bound1 = GeoJsonMapLayer()

        self.add2 = 0
        self.add2_shop_list = []
        self.add2_temp_list = []
        self.add2_rent_list = []
        self.add2_bound = []
        self.bound2 = GeoJsonMapLayer()

        self.add3 = 0
        self.add3_shop_list = []
        self.add3_temp_list = []
        self.add3_rent_list = []
        self.add3_bound = []
        self.bound3 = GeoJsonMapLayer()

        # from geopy.geocoders import Nominatim
        # self.geolocator = Nominatim(user_agent="Brian_map")

        # self.wid = Widget()
        self.progress_bar = MDProgressBar()
        self.popup = MDDialog(title='數據加載中,請稍後!',

                              #content = self.progress_bar
                              )
        self.popup.auto_dismiss = False
        self.popup.add_widget(self.progress_bar)
        self.popup.children[1].size_hint = [1, 1]
        self.popup.children[1].children[5].font_size = 40
        self.popup.children[1].children[5].font_name = 'msjhbd.ttc'
        self.popup.size_hint = [0.5, 0.5]
        self.popup.background_color = [0.5, 0.5, 0.5, 0.75]
        self.progress_bar.value = 1
        self.popup.bind(on_open=self.puopen)

        # 主畫面切成左右兩欄
        self.cols = 3

        # 左欄是一個Gridlayout,有四列
        self.left = MDGridLayout(rows=6, size_hint=[0.4, 1], spacing=[0, 3])
        # 創建地圖
        self.map = FarmersMapView()

        # 左欄最上方要來做店租範圍
        self.left.one = MDGridLayout(size=[590, 657],
                                     rows=2,
                                     size_hint=[1, 0.2],
                                     md_bg_color=[0.39, 0.4, 0.72, 1],
                                     padding=[35, -20, 35, -20],
                                     spacing=[0, -30])
        # 把標籤裝進去最上層
        self.left.one.add_widget(
            Label(text='選擇月租範圍',
                  font_size='20sp',
                  font_name='msjhbd.ttc',
                  size_hint_y=0.18))
        # 新增一層容器準備裝三個東西
        self.left.one.box = BoxLayout(spacing=8, size_hint_y=0.15)
        # 盒子裝進一個下限input、一上限input、一個'-'tag
        self.lower_bound = MDTextFieldRect(x=275,
                                           hint_text="$下限",
                                           font_name='msjhbd.ttc',
                                           pos_hint={'y': 0.45},
                                           size_hint=[1.5, 0.5],
                                           use_bubble=True,
                                           use_handles=True)
        self.upper_bound = MDTextFieldRect(hint_text="$上限",
                                           font_name='msjhbd.ttc',
                                           pos_hint={'y': 0.45},
                                           center_x=275.76,
                                           center_y=508.20,
                                           size_hint=[1.5, 0.5],
                                           use_bubble=True,
                                           use_handles=True)
        self.dash_sign = MDFlatButton(text='-',
                                      font_size=30,
                                      size_hint=[1, 0.49],
                                      pos_hint={'y': 0.45})
        self.dash_sign.md_bg_color = [1, 1, 1, 1]
        self.left.one.box.add_widget(self.lower_bound)
        self.left.one.box.add_widget(self.dash_sign)
        self.left.one.box.add_widget(self.upper_bound)
        # 盒子裝回上層
        self.left.one.add_widget(self.left.one.box)

        # 新增行政區選單
        self.left.six = MDGridLayout(size=[590, 657],
                                     rows=2,
                                     size_hint=[1, 0.25],
                                     md_bg_color=[0.39, 0.4, 0.72, 1],
                                     padding=[35, -5, 35, 5],
                                     spacing=[0, -10])
        self.left.six.add_widget(
            Label(text='行政區選擇',
                  font_size='20sp',
                  font_name='msjhbd.ttc',
                  height=32,
                  size_hint=[1, 0.1]))
        self.left.six.box = BoxLayout(size_hint_y=0.15, center_y=390)
        from kivy.uix.spinner import Spinner
        district = [
            "中區", "東區", "西區", "南區", "北區", "西屯區", "南屯區", "北屯區", "豐原區", "大里區",
            "太平區", "清水區", "沙鹿區", "大甲區", "東勢區", "梧棲區", "烏日區", "神岡區", "大肚區",
            "大雅區", "后里區", "霧峰區", "潭子區", "龍井區", "外埔區", "和平區", "石岡區", "大安區",
            "新社區"
        ]
        self.spinner = Spinner(
            text='行政區',
            values=[n for n in district],
            size_hint=(None, None),
            size=(95, 44),
            #pos_hint = {'right':0.2},
            font_name='msjhbd.ttc',
            background_color=[1, 0, 0, 1])
        self.spinner.option_cls.font_name = 'msjhbd.ttc'
        self.spinner.option_cls.background_color = [1, 0, 0, 1]
        #self.spinner.values[0].font_name = 'msjhbd.ttc'
        self.spinner.dropdown_cls.max_height = self.spinner.height * 7 + 7 * 4
        #self.spinner.center_x = 160
        #self.left.six.box.add_widget(BoxLayout(size_hint_y=0.5, size_hint_x=0.5, width=100))
        self.left.six.box.add_widget(
            MDGridLayout(md_bg_color=[0.39, 0.4, 0.72, 1],
                         size_hint=[None, 0.5]))
        self.left.six.box.add_widget(self.spinner)
        self.left.six.add_widget(self.left.six.box)
        #self.left.six.box.children[0].center = (160, 522.1339285)
        #self.spinner.pos_hint = {'right':0.9}
        #self.spinner.center_x = 150

        # 這裡是畫面左欄第二格
        self.left.two = MDGridLayout(rows=2,
                                     size_hint=[1, None],
                                     size=[365, 170],
                                     md_bg_color=[0.39, 0.4, 0.72, 1])
        #self.left.two.center_y = 400
        # 把"指標排序"標籤裝進第二格子的上方
        self.left.two.add_widget(
            Label(text='指標排序',
                  font_size='20sp',
                  font_name='msjhbd.ttc',
                  height=32,
                  size_hint=[1, 0.1]))
        # 左欄第二格下方增加一個grid容器
        self.left.two.grid = MDGridLayout(rows=3,
                                          size_hint=[1, 0.26],
                                          padding=[30, 0, 20, 0])
        self.left.two.grid.size_hint = [1, 0.26]
        self.left.two.add_widget(self.left.two.grid)
        # 準備三個box放入此grid
        self.left.two.box1 = BoxLayout(size_hint=[1, None],
                                       size=[365, 40],
                                       spacing=13)
        self.left.two.box2 = BoxLayout(size_hint=[1, None],
                                       size=[365, 40],
                                       spacing=13)
        self.left.two.box3 = BoxLayout(size_hint=[1, None],
                                       size=[365, 40],
                                       spacing=13)
        self.left.two.grid.add_widget(self.left.two.box1)
        self.left.two.grid.add_widget(self.left.two.box2)
        self.left.two.grid.add_widget(self.left.two.box3)
        # 處理第一個box的標籤(全用按鈕取代)、輸入
        self.left.two.btn1 = MDRaisedButton(text='      人口特性      ',
                                            font_name='msjhbd.ttc',
                                            font_size='16sp')
        self.left.two.btn1.md_bg_color = [0.55, 0.63, 0.99, 1]
        self.left.two.input1 = MDTextFieldRect(hint_text='請輸入1、2、3:',
                                               size_hint=[1, None],
                                               size=[94, 37],
                                               font_name='msjhbd.ttc')
        self.left.two.input1.size_hint_x = None
        self.left.two.input1.width = 120
        self.left.two.box1.add_widget(self.left.two.btn1)
        self.left.two.box1.add_widget(self.left.two.input1)

        self.left.two.btn3 = MDRaisedButton(text='      薪資所得      ',
                                            font_name='msjhbd.ttc',
                                            font_size='16sp')
        self.left.two.btn3.md_bg_color = [0.68, 0.82, 0.96, 1]
        self.left.two.input3 = MDTextFieldRect(hint_text='請輸入1、2、3:',
                                               size_hint=[1, None],
                                               size=[94, 37],
                                               font_name='msjhbd.ttc')
        self.left.two.input3.size_hint_x = None
        self.left.two.input3.width = 120
        self.left.two.box2.add_widget(self.left.two.btn3)
        self.left.two.box2.add_widget(self.left.two.input3)

        self.left.two.btn5 = MDRaisedButton(text='      人口消長      ',
                                            font_name='msjhbd.ttc',
                                            font_size='16sp')
        self.left.two.btn5.md_bg_color = [0.5, 0.87, 0.98, 1]
        self.left.two.input5 = MDTextFieldRect(hint_text='請輸入1、2、3:',
                                               size_hint=[1, None],
                                               size=[94, 37],
                                               font_name='msjhbd.ttc')
        self.left.two.input5.size_hint_x = None
        self.left.two.input5.width = 120
        self.left.two.box3.add_widget(self.left.two.btn5)
        self.left.two.box3.add_widget(self.left.two.input5)

        # 這裡是畫面左欄第三格
        self.left.three = MDGridLayout(rows=2,
                                       md_bg_color=[0.39, 0.4, 0.72, 1],
                                       size_hint=[1, 0.57])
        # 把"指標排序"標籤裝進第二格子的上方
        self.left.three.add_widget(
            Label(text='選擇競爭對手',
                  font_size='20sp',
                  font_name='msjhbd.ttc',
                  height=32,
                  size_hint=[1, 0.06]))

        # 左欄第三格下方增加一個grid容器
        self.left.three.grid = MDGridLayout(rows=5,
                                            size_hint=[1, 0.26],
                                            spacing=3,
                                            padding=[30, 0, 40, 0])
        self.left.three.add_widget(self.left.three.grid)
        # 準備五個box放入此grid
        self.left.three.box1 = BoxLayout(size_hint=[1, 0.05])
        self.left.three.box2 = BoxLayout(size_hint=[1, 0.05])
        self.left.three.box3 = BoxLayout(size_hint=[1, 0.05])
        self.left.three.box4 = BoxLayout(size_hint=[1, 0.05])
        #self.left.three.box5 = BoxLayout(size_hint=[1, 0.4])
        self.left.three.box6 = BoxLayout()
        self.left.three.grid.add_widget(self.left.three.box1)
        self.left.three.grid.add_widget(self.left.three.box2)
        self.left.three.grid.add_widget(self.left.three.box3)
        self.left.three.grid.add_widget(self.left.three.box4)

        # 處理第一個box的標籤(全用按鈕取代)、勾選
        self.left.three.btn1 = MDRaisedButton(text='       早餐店         ',
                                              font_name='msjhbd.ttc',
                                              size_hint=[None, 0.9],
                                              font_size='16sp')
        self.left.three.btn1.md_bg_color = [0.55, 0.63, 0.99, 1]
        self.left.three.input1 = MDCheckbox()
        self.left.three.input1.x = 140
        self.left.three.input1.selected_color = (1, 1, 1, 1)
        self.left.three.input1.unselected_color = (1, 1, 1, 1)
        self.left.three.box1.add_widget(self.left.three.btn1)
        self.left.three.box1.add_widget(self.left.three.input1)
        # 處理第二個box的標籤(全用按鈕取代)、勾選
        self.left.three.btn2 = MDRaisedButton(text='便當、自助餐店',
                                              font_name='msjhbd.ttc',
                                              size_hint=[None, 0.9],
                                              font_size='16sp')
        self.left.three.btn2.md_bg_color = [0.48, 0.81, 0.78, 1]
        self.left.three.input2 = MDCheckbox()
        self.left.three.input2.x = 140
        self.left.three.input2.selected_color = (1, 1, 1, 1)
        self.left.three.input2.unselected_color = (1, 1, 1, 1)
        self.left.three.box2.add_widget(self.left.three.btn2)
        self.left.three.box2.add_widget(self.left.three.input2)
        # 處理第三個box的標籤(全用按鈕取代)、勾選
        self.left.three.btn3 = MDRaisedButton(text='麵店、小吃店    ',
                                              font_name='msjhbd.ttc',
                                              size_hint=[None, 0.9],
                                              font_size='16sp')
        self.left.three.btn3.md_bg_color = [0.68, 0.82, 0.96, 1]
        self.left.three.input3 = MDCheckbox()
        self.left.three.input3.x = 140
        self.left.three.input3.selected_color = (1, 1, 1, 1)
        self.left.three.input3.unselected_color = (1, 1, 1, 1)
        self.left.three.box3.add_widget(self.left.three.btn3)
        self.left.three.box3.add_widget(self.left.three.input3)
        # 處理第四個box的標籤(全用按鈕取代)、勾選
        self.left.three.btn4 = MDRaisedButton(text='      餐館餐廳      ',
                                              font_name='msjhbd.ttc',
                                              size_hint=[None, 0.9],
                                              font_size='16sp')
        self.left.three.btn4.md_bg_color = [0.62, 0.84, 0.51, 1]
        self.left.three.input4 = MDCheckbox()
        self.left.three.input4.x = 140
        #self.left.three.input4.color = [1,1,1,2]
        self.left.three.input4.selected_color = (1, 1, 1, 1)
        self.left.three.input4.unselected_color = (1, 1, 1, 1)
        self.left.three.box4.add_widget(self.left.three.btn4)
        self.left.three.box4.add_widget(self.left.three.input4)

        self.run_button = MDRaisedButton(text='Run')

        # 製作廟宇按鈕
        self.left.four = MDGridLayout(rows=2,
                                      size_hint=[1, None],
                                      size=[365, 90],
                                      md_bg_color=[0.39, 0.4, 0.72, 1])
        self.left.four.add_widget(
            Label(text='廟宇出現與否',
                  font_size='20sp',
                  font_name='msjhbd.ttc',
                  height=32,
                  size_hint=[1, 0.025]))
        self.left.four.box = BoxLayout(size_hint=[1, 0.025],
                                       padding=[30, -20, 40, 5])
        self.left.four.add_widget(self.left.four.box)
        self.left.four.btn = MDRaisedButton(text='          廟宇          ',
                                            font_name='msjhbd.ttc',
                                            size_hint=[None, 0.8],
                                            font_size='16sp')
        self.left.four.input = MDCheckbox()
        self.left.four.input.selected_color = (1, 1, 1, 1)
        self.left.four.input.unselected_color = (1, 1, 1, 1)
        self.left.four.box.add_widget(self.left.four.btn)
        self.left.four.box.add_widget(self.left.four.input)

        # 把每一層加回去
        self.left.add_widget(self.left.one)
        self.left.add_widget(self.left.six)
        self.left.add_widget(self.left.two)
        self.left.add_widget(self.left.three)
        self.left.add_widget(self.left.four)
        self.add_widget(self.left)
        self.add_widget(self.map)

        # 測試用的按鈕
        #self.run_button = MDRaisedButton(text='Run')
        self.left.five = MDGridLayout(size_hint=[1, 0.1],
                                      md_bg_color=[0.39, 0.4, 0.72, 1])
        self.left.five.add_widget(self.run_button)
        self.run_button.bind(on_release=self.popup.open)
        self.left.add_widget(self.left.five)
        self.run_button.right = 270
        self.run_button.ripple_alpha = 0.7
        self.run_button.radius = [10, 10, 10, 10]
        self.run_button.md_bg_color = [1, 1, 1, 1]
        self.run_button.text_color = [0, 0, 0, 1]
Пример #19
0
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.app = MDApp.get_running_app()
        self.valorbarra = 0

        self.buttonactualizar = MDRectangleFlatIconButton(
            pos_hint={
                "center_x": .5,
                "top": .95
            },
            #size_hint = (.3,.1),
            icon="cart-arrow-down",
            text=" Precios",
        )
        self.msgactualiza = MDLabel(text='Actualizando, espera por favor',
                                    pos_hint={
                                        "center_x": .5,
                                        "top": .87
                                    },
                                    size_hint=(.8, .1),
                                    theme_text_color="Primary",
                                    font_style="Subtitle1",
                                    halign="center")

        self.barra = MDProgressBar(id="barrasss",
                                   value=0,
                                   pos_hint={
                                       "center_x": .5,
                                       "center_y": .80
                                   },
                                   size_hint=(.9, .1))

        self.etiqueta1 = MDLabel(text='Consultar por Tienda',
                                 pos_hint={
                                     "center_x": .5,
                                     "top": .80
                                 },
                                 size_hint=(.5, .1),
                                 theme_text_color="Primary",
                                 font_style="Subtitle1",
                                 halign="center")

        self.buttonche = MDFillRoundFlatButton(
            pos_hint={
                "x": .05,
                "y": .6
            },
            size_hint=(.40, .1),
            text="Chedraui",
            on_release=lambda x: self.verboton('che'))

        self.buttonsor = MDFillRoundFlatButton(
            pos_hint={
                "x": .55,
                "y": .6
            },
            size_hint=(.40, .1),
            text="Soriana",
            on_release=lambda x: self.verboton('sor'))

        self.buttonhbe = MDFillRoundFlatButton(
            pos_hint={
                "x": .05,
                "y": .45
            },
            size_hint=(.40, .1),
            #theme_text_color = "Primary",
            text="HBE",
            on_release=lambda x: self.verboton('hbe'))

        self.buttoncomer = MDFillRoundFlatButton(
            pos_hint={
                "x": .55,
                "y": .45
            },
            size_hint=(.40, .1),
            text="La Comer",
            on_release=lambda x: self.verboton('comer'))

        self.etiqueta2 = MDLabel(text='Consultar por Categoría',
                                 pos_hint={
                                     "center_x": .5,
                                     "top": .40
                                 },
                                 size_hint=(.5, .1),
                                 theme_text_color="Primary",
                                 font_style="Subtitle1",
                                 halign="center")

        self.buttonfrutas = MDFillRoundFlatButton(
            pos_hint={
                "x": .05,
                "y": .20
            },
            size_hint=(.25, .1),
            text="Frutas",
            on_release=lambda x: self.verboton('frutas'))

        self.buttonverduras = MDFillRoundFlatButton(
            pos_hint={
                "x": .35,
                "y": .20
            },
            size_hint=(.25, .1),
            text="Verduras",
            on_release=lambda x: self.verboton('verduras'))

        self.buttoncarnes = MDFillRoundFlatButton(
            pos_hint={
                "x": .65,
                "y": .20
            },
            size_hint=(.25, .1),
            text='Carnes',
            on_release=lambda x: self.verboton('carnes'))

        self.buttonlacteos = MDFillRoundFlatButton(
            pos_hint={
                "x": .20,
                "y": .05
            },
            size_hint=(.25, .1),
            text='Lácteos',
            on_release=lambda x: self.verboton('lacteos'))

        self.buttonenlatados = MDFillRoundFlatButton(
            pos_hint={
                "x": .50,
                "y": .05
            },
            size_hint=(.25, .1),
            text='Enlatados',
            on_release=lambda x: self.verboton('enlatados'))

        self.buttonactualizar.bind(on_press=lambda x: self.ActualizaPrecio())

        self.add_widget(self.buttonactualizar)

        self.add_widget(self.buttonche)
        self.add_widget(self.buttonsor)
        self.add_widget(self.buttonhbe)
        self.add_widget(self.buttoncomer)
        self.add_widget(self.etiqueta1)
        self.add_widget(self.etiqueta2)
        self.add_widget(self.buttonfrutas)
        self.add_widget(self.buttonverduras)
        self.add_widget(self.buttoncarnes)
        self.add_widget(self.buttonlacteos)
        self.add_widget(self.buttonenlatados)
Пример #20
0
    def __init__(self, data, tot, spent, alll, **kwargs):
        super(Results, self).__init__(**kwargs)
        self.one = data.keys()
        self.two = data.values()
        self.tot = float(sum(tot))
        self.allofit = alll
        self.spent = spent
        self.title = 'Income managements'.title()
        self.title_size = 30
        self.title_size = '20dp'
        self.title_align = 'center'
        self.auto_dismiss = False
        self.size_hint = [.9, .9]
        self.pos_hint = {'x': .05, 'y': .05}
        self.caption1 = MDLabel(text='monthly spendings:'.title(),
                                italic=True,
                                halign='left',
                                underline=True,
                                size_hint=(1, .1),
                                theme_text_color='Custom',
                                text_color=[.6, 0, 0, 1],
                                pos_hint={
                                    'x': 0,
                                    'top': 1
                                })

        self.box0 = BoxLayout(size_hint=(.1, .5),
                              pos_hint={
                                  "top": .92,
                                  "center_x": .55
                              },
                              orientation='vertical',
                              spacing=14)
        self.box1 = BoxLayout(size_hint=(.55, .5),
                              pos_hint={
                                  "top": .92,
                                  "x": 0
                              },
                              orientation='vertical',
                              spacing=14)
        self.box2 = BoxLayout(size_hint=(.45, .5),
                              pos_hint={
                                  "top": .92,
                                  "x": .53
                              },
                              orientation='vertical',
                              spacing=14)
        for item in self.one:
            self.lbl = MDLabel(text=str(item),
                               bold=True,
                               text_color=[1, 1, 1, 1],
                               halign='left',
                               theme_text_color='Custom')
            self.box1.add_widget(self.lbl)
        for item2 in self.two:
            self.lbl = MDLabel(text=str(item2) + '$',
                               bold=True,
                               text_color=[1, 1, 1, 1],
                               halign='right',
                               theme_text_color='Custom')
            self.box2.add_widget(self.lbl)
        for item2 in self.one:
            self.lbl = Label(text=":", bold=True, color=[1, 1, 1, 1])
            self.box0.add_widget(self.lbl)

        self.total = MDLabel(text='total spendings'.title(),
                             theme_text_color='Custom',
                             text_color=[.6, 0, 0, 1],
                             bold=True,
                             halign='left')
        self.box1.add_widget(self.total)
        self.colom = Label(text=':', color=[1, 1, 1, 1], bold=True)
        self.box0.add_widget(self.colom)
        self.res = MDLabel(text=str(self.tot) + "$",
                           theme_text_color='Custom',
                           text_color=[.6, 0, 0, 1],
                           bold=True,
                           halign='right')
        self.box2.add_widget(self.res)

        self.txt = MDLabel(
            text=
            f'- you still have an amount of  [b][color=#980000]{str(self.spent)}$[/color][/b]  from your monthly income.'
            .lower(),
            markup=True,
            theme_text_color='Custom',
            text_color=[1, 1, 1, 1],
            halign='left',
            size_hint=(1, .2),
            pos_hint={
                "top": .45,
                "x": 0
            })
        self.txt2 = MDLabel(
            text=
            f'- you spent a percentage of  [b][color=#980000]{str(100-((float(self.spent)*100)/float(self.allofit)))}%[/color][/b]  from your monthly income'
            .lower(),
            markup=True,
            theme_text_color='Custom',
            text_color=[1, 1, 1, 1],
            halign='left',
            size_hint=(1, .2),
            pos_hint={
                "top": .35,
                "x": 0
            })
        self.txt3 = MDLabel(
            text='- this is how much is spent from your monthly income:'.title(
            ),
            bold=True,
            theme_text_color='Custom',
            text_color=[1, 1, 1, 1],
            halign='left',
            size_hint=(1, .2),
            pos_hint={
                "top": .25,
                "x": 0
            })

        self.bar = MDProgressBar(
            value=float(100 -
                        ((float(self.spent) * 100) / float(self.allofit))),
            color=[1, 1, 1, 1],
            size_hint=(.6, .1),
            pos_hint={
                "x": .05,
                "top": .15
            })

        self.txt4 = MDLabel(text=str(
            int(100 - ((float(self.spent) * 100) / float(self.allofit)))) +
                            "%",
                            theme_text_color='Custom',
                            text_color=[1, 1, 1, 1],
                            size_hint=(.1, .1),
                            pos_hint={
                                "top": .15,
                                "x": 0.73
                            },
                            halign='left')

        self.cancel = Button(text='OK',
                             background_normal='',
                             color=[0, 0, 0, 1],
                             background_color=[1, 1, 1, 1],
                             size_hint=(.9, .06),
                             pos_hint={
                                 "x": .05,
                                 'top': .07
                             },
                             bold=True)
        self.cancel.bind(on_release=lambda x: self.dismiss())
        self.float = FloatLayout(size_hint=(1, 1), pos_hint={'top': 1})
        self.float.add_widget(self.caption1)
        self.float.add_widget(self.box1)
        self.float.add_widget(self.box2)
        self.float.add_widget(self.box0)
        self.float.add_widget(self.txt)
        self.float.add_widget(self.txt2)
        self.float.add_widget(self.txt3)
        self.float.add_widget(self.txt4)
        self.float.add_widget(self.cancel)
        self.float.add_widget(self.bar)
        self.add_widget(self.float)
Пример #21
0
    def __init__(self, **kwargs):
        super(Test, self).__init__(**kwargs)

        self.click = 0

        # rect_color = Color(1,0,0,1)
        # rect_color1 = Color(0,1,1,0.6)
        # rect = Rectangle(pos=(100,10), size=(400,300))
        # rect1 = Rectangle(pos=(400,50), size=(400,300))

        # self.wid = Widget()
        self.progress_bar = MDProgressBar()
        self.popup = Popup(title='數據加載中,請稍後!', content=self.progress_bar)
        self.popup.title_size = 30
        self.popup.title_font = 'msjhbd.ttc'
        self.popup.size_hint = [0.5, 0.5]
        self.popup.background_color = [0.5, 0.5, 0.5, 0.75]
        self.progress_bar.value = 1
        self.popup.bind(on_open=self.puopen)

        # 主畫面切成左右兩欄
        self.cols = 3
        #self.origin = MDGridLayout(cols=2, padding=[35, 0, 35, 0])

        # 左欄是一個Gridlayout,有四列
        self.left = MDGridLayout(rows=5, size_hint=[0.4, 1], spacing=[0, 3])
        # 創建地圖
        self.map = FarmersMapView()

        # 左欄最上方要來做店租範圍
        self.left.one = MDGridLayout(size=[590, 657],
                                     rows=2,
                                     size_hint=[1, 0.2],
                                     md_bg_color=[0.39, 0.4, 0.72, 1],
                                     padding=[35, -20, 35, -20],
                                     spacing=[0, -30])
        # 把標籤裝進去最上層
        self.left.one.add_widget(
            Label(text='選擇店租範圍',
                  font_size='20sp',
                  font_name='msjhbd.ttc',
                  size_hint_y=0.18))
        # 新增一層容器準備裝三個東西
        self.left.one.box = BoxLayout(spacing=8, size_hint_y=0.15)
        # 盒子裝進一個下限input、一上限input、一個'-'tag
        self.lower_bound = MDTextFieldRect(x=275,
                                           hint_text="$下限",
                                           font_name='msjhbd.ttc',
                                           pos_hint={'y': 0.45},
                                           size_hint=[1, 0.5],
                                           use_bubble=True,
                                           use_handles=True)
        self.upper_bound = MDTextFieldRect(hint_text="$上限",
                                           font_name='msjhbd.ttc',
                                           pos_hint={'y': 0.45},
                                           center_x=275.76,
                                           center_y=508.20,
                                           size_hint=[1, 0.5],
                                           use_bubble=True,
                                           use_handles=True)
        self.dash_sign = MDFlatButton(text='-',
                                      font_size=30,
                                      size_hint=[1, 0.49],
                                      pos_hint={'y': 0.45})
        self.dash_sign.md_bg_color = [1, 1, 1, 1]
        self.left.one.box.add_widget(self.lower_bound)
        self.left.one.box.add_widget(self.dash_sign)
        self.left.one.box.add_widget(self.upper_bound)
        # 盒子裝回上層
        self.left.one.add_widget(self.left.one.box)

        # 這裡是畫面左欄第二格
        self.left.two = MDGridLayout(rows=2,
                                     size_hint=[1, None],
                                     size=[365, 180],
                                     md_bg_color=[0.39, 0.4, 0.72, 1])
        #self.left.two.center_y = 400
        # 把"指標排序"標籤裝進第二格子的上方
        self.left.two.add_widget(
            Label(text='指標排序',
                  font_size='20sp',
                  font_name='msjhbd.ttc',
                  height=32,
                  size_hint=[1, 0.1]))
        # 左欄第二格下方增加一個grid容器
        self.left.two.grid = MDGridLayout(rows=3,
                                          size_hint=[1, 0.26],
                                          padding=[30, 0, 20, 0])
        self.left.two.grid.size_hint = [1, 0.26]
        self.left.two.add_widget(self.left.two.grid)
        # 準備三個box放入此grid
        self.left.two.box1 = BoxLayout(size_hint=[1, None],
                                       size=[365, 40],
                                       spacing=13)
        self.left.two.box2 = BoxLayout(size_hint=[1, None],
                                       size=[365, 40],
                                       spacing=13)
        self.left.two.box3 = BoxLayout(size_hint=[1, None],
                                       size=[365, 40],
                                       spacing=13)
        self.left.two.grid.add_widget(self.left.two.box1)
        self.left.two.grid.add_widget(self.left.two.box2)
        self.left.two.grid.add_widget(self.left.two.box3)
        # 處理第一個box的標籤(全用按鈕取代)、輸入
        self.left.two.btn1 = MDRaisedButton(text='      人口特性      ',
                                            font_name='msjhbd.ttc',
                                            font_size='16sp')
        self.left.two.btn1.md_bg_color = [0.55, 0.63, 0.99, 1]
        self.left.two.input1 = MDTextFieldRect(hint_text='排序:',
                                               size_hint=[1, None],
                                               size=[94, 37],
                                               font_name='msjhbd.ttc')
        self.left.two.input1.size_hint_x = None
        self.left.two.input1.width = 120
        #self.left.two.input1.right = 310
        self.left.two.box1.add_widget(self.left.two.btn1)
        self.left.two.box1.add_widget(self.left.two.input1)

        # self.left.two.btn2 = MDRaisedButton(text='薪資所得', font_name='msjhbd.ttc', font_size='16sp')
        # self.left.two.btn2.md_bg_color =  [0.48, 0.81, 0.78, 1]
        # self.left.two.input2 = TextInput(hint_text='排序:', size_hint=[1,None], size=[94,37], font_name='msjhbd.ttc')
        # self.left.two.box1.add_widget(self.left.two.btn2)
        # self.left.two.box1.add_widget(self.left.two.input2)
        # 處理第二個box的標籤(全用按鈕取代)、輸入
        self.left.two.btn3 = MDRaisedButton(text='      薪資所得      ',
                                            font_name='msjhbd.ttc',
                                            font_size='16sp')
        self.left.two.btn3.md_bg_color = [0.68, 0.82, 0.96, 1]
        self.left.two.input3 = MDTextFieldRect(hint_text='排序:',
                                               size_hint=[1, None],
                                               size=[94, 37],
                                               font_name='msjhbd.ttc')
        self.left.two.input3.size_hint_x = None
        self.left.two.input3.width = 120
        self.left.two.box2.add_widget(self.left.two.btn3)
        self.left.two.box2.add_widget(self.left.two.input3)

        # self.left.two.btn4 = MDRaisedButton(text='生活指數', font_name='msjhbd.ttc', font_size='16sp')
        # self.left.two.btn4.md_bg_color =  [0.62, 0.84, 0.51, 1]
        # self.left.two.input4 = TextInput(hint_text='排序:', size_hint=[1,None], size=[94,37], font_name='msjhbd.ttc')
        # self.left.two.box2.add_widget(self.left.two.btn4)
        # self.left.two.box2.add_widget(self.left.two.input4)
        # 處理第三個box的標籤(全用按鈕取代)、輸入
        self.left.two.btn5 = MDRaisedButton(text='      人口消長      ',
                                            font_name='msjhbd.ttc',
                                            font_size='16sp')
        self.left.two.btn5.md_bg_color = [0.5, 0.87, 0.98, 1]
        self.left.two.input5 = MDTextFieldRect(hint_text='排序:',
                                               size_hint=[1, None],
                                               size=[94, 37],
                                               font_name='msjhbd.ttc')
        self.left.two.input5.size_hint_x = None
        self.left.two.input5.width = 120
        self.left.two.box3.add_widget(self.left.two.btn5)
        self.left.two.box3.add_widget(self.left.two.input5)

        # self.left.two.btn6 = MDRaisedButton(text='薪資所得', font_name='msjhbd.ttc', font_size='16sp')
        # self.left.two.btn6.md_bg_color =  [0.81, 0.88, 0.39, 1]
        # self.left.two.input6 = TextInput(hint_text='排序:', size_hint=[1,None], size=[94,37], font_name='msjhbd.ttc')
        # self.left.two.box3.add_widget(self.left.two.btn6)
        # self.left.two.box3.add_widget(self.left.two.input6)

        # 這裡是畫面左欄第三格
        self.left.three = MDGridLayout(rows=2,
                                       md_bg_color=[0.39, 0.4, 0.72, 1],
                                       size_hint=[1, 0.57])
        # 把"指標排序"標籤裝進第二格子的上方
        self.left.three.add_widget(
            Label(text='選擇競爭對手',
                  font_size='20sp',
                  font_name='msjhbd.ttc',
                  height=32,
                  size_hint=[1, 0.06]))

        # 左欄第三格下方增加一個grid容器
        self.left.three.grid = MDGridLayout(rows=5,
                                            size_hint=[1, 0.26],
                                            spacing=3,
                                            padding=[30, 0, 40, 0])
        self.left.three.add_widget(self.left.three.grid)
        # 準備五個box放入此grid
        self.left.three.box1 = BoxLayout(size_hint=[1, 0.05])
        self.left.three.box2 = BoxLayout(size_hint=[1, 0.05])
        self.left.three.box3 = BoxLayout(size_hint=[1, 0.05])
        self.left.three.box4 = BoxLayout(size_hint=[1, 0.05])
        #self.left.three.box5 = BoxLayout(size_hint=[1, 0.4])
        self.left.three.box6 = BoxLayout()
        self.left.three.grid.add_widget(self.left.three.box1)
        self.left.three.grid.add_widget(self.left.three.box2)
        self.left.three.grid.add_widget(self.left.three.box3)
        self.left.three.grid.add_widget(self.left.three.box4)
        #self.left.three.grid.add_widget(self.left.three.box5)
        #self.left.three.grid.add_widget(self.left.three.box6)

        # 處理第一個box的標籤(全用按鈕取代)、勾選
        self.left.three.btn1 = MDRaisedButton(text='       早餐店         ',
                                              font_name='msjhbd.ttc',
                                              size_hint=[None, 0.9],
                                              font_size='16sp')
        self.left.three.btn1.md_bg_color = [0.55, 0.63, 0.99, 1]
        self.left.three.input1 = MDCheckbox()
        self.left.three.input1.x = 140
        #self.left.three.input1.color = [1,1,1,2]
        self.left.three.input1.selected_color = (1, 1, 1, 1)
        self.left.three.input1.unselected_color = (1, 1, 1, 1)
        self.left.three.box1.add_widget(self.left.three.btn1)
        self.left.three.box1.add_widget(self.left.three.input1)
        # 處理第二個box的標籤(全用按鈕取代)、勾選
        self.left.three.btn2 = MDRaisedButton(text='便當、自助餐店',
                                              font_name='msjhbd.ttc',
                                              size_hint=[None, 0.9],
                                              font_size='16sp')
        self.left.three.btn2.md_bg_color = [0.48, 0.81, 0.78, 1]
        self.left.three.input2 = MDCheckbox()
        self.left.three.input2.x = 140
        #self.left.three.input2.color = [1,1,1,2]
        self.left.three.input2.selected_color = (1, 1, 1, 1)
        self.left.three.input2.unselected_color = (1, 1, 1, 1)
        self.left.three.box2.add_widget(self.left.three.btn2)
        self.left.three.box2.add_widget(self.left.three.input2)
        # 處理第三個box的標籤(全用按鈕取代)、勾選
        self.left.three.btn3 = MDRaisedButton(text='麵店、小吃店    ',
                                              font_name='msjhbd.ttc',
                                              size_hint=[None, 0.9],
                                              font_size='16sp')
        self.left.three.btn3.md_bg_color = [0.68, 0.82, 0.96, 1]
        self.left.three.input3 = MDCheckbox()
        self.left.three.input3.x = 140
        #self.left.three.input3.color = [1,1,1,2]
        self.left.three.input3.selected_color = (1, 1, 1, 1)
        self.left.three.input3.unselected_color = (1, 1, 1, 1)
        self.left.three.box3.add_widget(self.left.three.btn3)
        self.left.three.box3.add_widget(self.left.three.input3)
        # 處理第四個box的標籤(全用按鈕取代)、勾選
        self.left.three.btn4 = MDRaisedButton(text='      餐館餐廳      ',
                                              font_name='msjhbd.ttc',
                                              size_hint=[None, 0.9],
                                              font_size='16sp')
        self.left.three.btn4.md_bg_color = [0.62, 0.84, 0.51, 1]
        self.left.three.input4 = MDCheckbox()
        self.left.three.input4.x = 140
        #self.left.three.input4.color = [1,1,1,2]
        self.left.three.input4.selected_color = (1, 1, 1, 1)
        self.left.three.input4.unselected_color = (1, 1, 1, 1)
        self.left.three.box4.add_widget(self.left.three.btn4)
        self.left.three.box4.add_widget(self.left.three.input4)
        # 處理第五個box的標籤(全用按鈕取代)、勾選
        # self.left.three.btn5 = MDRaisedButton(text='咖啡館', font_name='msjhbd.ttc', size_hint=[None, 1], font_size='16sp')
        # self.left.three.btn5.md_bg_color = [0.62, 0.84, 0.51, 1]
        # self.left.three.input5 = CheckBox()
        # self.left.three.input5.color = [1,1,1,2]
        # self.left.three.box5.add_widget(self.left.three.btn5)
        # self.left.three.box5.add_widget(self.left.three.input5)

        self.run_button = MDRaisedButton(text='Run')
        #self.left.three.box6.add_widget(self.run_button)

        # 製作廟宇按鈕
        self.left.four = MDGridLayout(rows=2,
                                      size_hint=[1, None],
                                      size=[365, 110],
                                      md_bg_color=[0.39, 0.4, 0.72, 1])
        self.left.four.add_widget(
            Label(text='廟宇出現與否',
                  font_size='20sp',
                  font_name='msjhbd.ttc',
                  height=32,
                  size_hint=[1, 0.04]))
        self.left.four.box = BoxLayout(size_hint=[1, 0.035],
                                       padding=[30, 0, 40, 0])
        self.left.four.add_widget(self.left.four.box)
        self.left.four.btn = MDRaisedButton(text='          廟宇          ',
                                            font_name='msjhbd.ttc',
                                            size_hint=[None, 1],
                                            font_size='16sp')
        self.left.four.input = MDCheckbox()
        self.left.four.input.selected_color = (1, 1, 1, 1)
        self.left.four.input.unselected_color = (1, 1, 1, 1)
        self.left.four.box.add_widget(self.left.four.btn)
        self.left.four.box.add_widget(self.left.four.input)

        # 把每一層加回去
        self.left.add_widget(self.left.one)
        self.left.add_widget(self.left.two)
        self.left.add_widget(self.left.three)
        self.left.add_widget(self.left.four)
        self.add_widget(self.left)
        self.add_widget(self.map)

        #self.add_widget(self.right)
        #self.add_widget(self.right)

        # 測試用的按鈕
        #self.run_button = MDRaisedButton(text='Run')
        self.run_button.bind(on_release=self.popup.open)
        self.left.add_widget(self.run_button)