def open_bubble_not_set(self, ti_not_set): float_lay = FloatLayout() float_lay.size_hint = None, None float_lay.width = 0 float_lay.height = 0 bubble_not_set = Bubble() bubble_not_set.size_hint = None, None bubble_not_set.width = 80 bubble_not_set.height = 30 bubble_not_set.center_x = ti_not_set.center_x bubble_not_set.center_y = ti_not_set.center_y - 30 bubble_not_set.arrow_pos = 'top_mid' bubble_not_set.background_color = (1, 0, 0, 1) bt_not_set = BubbleButton() bt_not_set.font_size = 12 bt_not_set.text = self.lang['Not_Set'] bubble_not_set.add_widget(bt_not_set) float_lay.add_widget(bubble_not_set) #self.add_widget(bubble_not_set) self.lay_file_asc.add_widget(float_lay) parallel_close = threading.Thread(target=self.close_bubble_not_set, args=(float_lay, )) parallel_close.start()
def open_bubble_not_set(self, ti_not_set): float_lay = FloatLayout() float_lay.size_hint = None, None float_lay.width = 0 float_lay.height = 0 bubble_not_set = Bubble() bubble_not_set.size_hint = None, None bubble_not_set.width = 80 bubble_not_set.height = 30 bubble_not_set.center_x = ti_not_set.center_x bubble_not_set.center_y = ti_not_set.center_y - 30 bubble_not_set.arrow_pos = 'top_mid' bubble_not_set.background_color = (1, 0, 0, 1) bt_not_set = BubbleButton() bt_not_set.font_size = 12 bt_not_set.text = self.lang['Not_Set'] bubble_not_set.add_widget(bt_not_set) float_lay.add_widget(bubble_not_set) #self.add_widget(bubble_not_set) self.lay_file_asc.add_widget(float_lay) parallel_close = threading.Thread(target=self.close_bubble_not_set, args=(float_lay,)) parallel_close.start()
def _init_option(self): options_list = [("начало", "start", "int"), ("конец", "end", "int"), ("колличество", "count", "int"), ("разделитель", "sep", None), ("размер шрифта", "font_size", "int")] self.options = {} for name, opt, *flag in options_list: filter = flag[0] v = self._options[opt] if v.endswith("sp"): v = v.replace('sp', '') self.options[opt] = ItemFieldList(opt, v, name) self.options[opt].item_field.bind(text=self.on_text) if filter: self.options[opt].input_filter = filter self.box_content.add_widget(self.options[opt]) strech = MDLabel() # strech.text = "sdgfaerg \nsdefawef" strech.size_hint = 1, 0.1 self.box_content.add_widget(strech) close_box = FloatLayout() close_box.size_hint = 1, 0.1 self.box_content.add_widget(close_box) close = MDIconButton(on_press=self.content_navigation.close_driver) close.pos_hint = {"x": 0.8, "bottom": 0.3} close.icon = "close" close.user_font_size = "18sp" close_box.add_widget(close)
def build(self): image_box = FloatLayout() image_box.add_widget(WordImage("tomato")) image_box.padding = '10sp' image_box.size_hint = (1.0, 1.5) cards = BoxLayout() cards.spacing = '40sp' cards.padding = '40sp' cards.add_widget(Card("to")) cards.add_widget(Card("ma")) cards.add_widget(Card("te")) root = BoxLayout(orientation='vertical') root.add_widget(image_box) root.add_widget(cards) return root
self._animations = {} self._on_complete() def _on_complete(self) -> None: assert len(self._animations) == 0, self._animations self._state = _State.IDLE if self._on_complete_callback is not None: self._on_complete_callback() if __name__ == "__main__": EventLoop.ensure_window() EventLoop.window.size = 400, 400 _float_layout = FloatLayout() _float_layout.size = 400, 400 _float_layout.size_hint = 1, 1 _animation_controller = AnimationController() _animation = Animation(rotation=-45) + \ Animation(center_x=_float_layout.width / 4, center_y=_float_layout.height / 4) + \ Animation(rotation=270) + \ Animation(center_x=_float_layout.width / 4 * 3, center_y=_float_layout.height / 4) + \ Animation(rotation=270 + 90) + \ Animation(center_x=_float_layout.width / 4 * 3, center_y=_float_layout.height / 4 * 3) + \ Animation(rotation=90) + \ Animation(center_x=_float_layout.width / 4, center_y=_float_layout.height / 4 * 3) + \ Animation(rotation=45) + \
def build(self): #*******ROOTWIDGET******* layout = GridLayout(rows=2) #*******SUB-WIDGETS******* layoutTop = GridLayout(cols=3,rows=1)#SUB-WIDGET-1 layoutTop.size_hint = (1, 0.1) layoutMid = FloatLayout()#SUB-WIDGET-2 layoutMid.size_hint = (1, 1) #*******CONTENT-OF-SUB-WIDGET-1******* menubtn = Button(text='Menu') menubtn.size_hint = (0.1, 0.1) head = Label(text='PRO-FORMA',size_hint_y = None,size_hint_x=None, width=200) head.size_hint = (0.8, 0.1) backbtn = Button(text='Drop') backbtn.size_hint = (0.1, 0.1) #dropbtn = Button() #*******CONTENT-OF-SUB-WIDGET-2******* tp_panel = TabbedPanel() tp_panel.default_tab_text = "Global News" layoutnews = GridLayout(rows=2) upperlayout = GridLayout(cols=3, pos_hint ={'center_x': .5, 'center_y': .5},row_force_default=True, row_default_height=40, size_hint_y=None, height = 50, size_hint_x=1) lowerlayout = GridLayout(row=1) upperlayout.add_widget(Button(text='S', size_hint=(0.1, None))) upperlayout.add_widget(TextInput(text='search', size_hint=(0.8, None), focus=True, multiline=False)) upperlayout.add_widget(Button(text='settings', size_hint=(0.1, None))) lowerlayout.add_widget(Label()) layoutnews.add_widget(upperlayout) layoutnews.add_widget(lowerlayout) tp_panel.default_tab_content = layoutnews #*******TAB1******* th_tab1 = TabbedPanelHeader(text = 'Pro-Forma') #*******SCROLLABILITY-WIDGET******* scroll = ScrollView(size_hint=(1, None), size=(800, 1000)) mainlayout = GridLayout(cols = 1, spacing = 10, size_hint_y=None, size_hint_x=1) mainlayout.bind(minimum_height=mainlayout.setter('height')) #*******LAYOUT-FOR-PROPERTY-INFORMATION******* layouttab1 = GridLayout(cols=2,rows=6, pos_hint ={'center_x': .5, 'center_y': .5},row_force_default=True, row_default_height=40, size_hint_y=None, height = 250, size_hint_x=1) #*******LAYOUT-FOR-UNIT-MIX******* layoutmix = GridLayout(cols=4, pos_hint ={'center_x': .5, 'center_y': .5},row_force_default=True, row_default_height=40,size_hint_y=None, height = 80) #*******LAYOUT-FOR-EXPENSES******* layoutexpense = GridLayout(cols=2, pos_hint ={'center_x': .5, 'center_y': .5},row_force_default=True, row_default_height=40, size_hint_y=None, height = 960) #*******LAYOUT-FOR-ACCOUNTS******* layoutacc = GridLayout(cols=2, pos_hint ={'center_x': .5, 'center_y': .5},row_force_default=True, row_default_height=40,size_hint_y=None, height = 240) #*******CONTENT1***** mainlayout.add_widget(Label(text='Property Information',size_hint=(None, 1))) #*******CONTENT2******* layouttab1.add_widget(Label(text= 'Property Name', font_size=15, size_hint=(0.4, None))) layouttab1.add_widget(TextInput(text='input', font_size=15, halign ='left', valign='middle',size_hint=(0.6, None),multiline=False, focus=True)) layouttab1.add_widget(Label(text= 'Property Address', font_size=15, size_hint=(0.4, None))) layouttab1.add_widget(TextInput(text='input', font_size=15, halign ='left', valign='middle',size_hint=(0.6, None),multiline=False, focus=True)) layouttab1.add_widget(Label(text= 'Town/City', font_size=15, size_hint=(0.4, None))) layouttab1.add_widget(TextInput(text='input', font_size=15, halign ='left', valign='middle',size_hint=(0.6, None),multiline=False, focus=True)) layouttab1.add_widget(Label(text= 'Asking Price', font_size=15, size_hint=(0.4, None))) layouttab1.add_widget(TextInput(text='input', font_size=15, halign ='left', valign='middle',size_hint=(0.6, None),multiline=False, focus=True)) layouttab1.add_widget(Label(text= 'Total Units', font_size=15, size_hint=(0.4, None))) layouttab1.add_widget(TextInput(text='input', font_size=15, halign ='left', valign='middle',size_hint=(0.6, None),multiline=False, focus=True)) layouttab1.add_widget(Label(text= 'Square Footage', font_size=15, size_hint=(0.4, None))) layouttab1.add_widget(TextInput(text='input', font_size=15, halign ='left', valign='middle',size_hint=(0.6, None),multiline=False, focus=True)) mainlayout.add_widget(layouttab1) #*******CONTENT3******* mainlayout.add_widget(Label(text='Unit Mix',size_hint_x=None, width=200, size_hint_y=None, height=50)) #*******CONTENT4******* layoutmix.add_widget(Label(text='# of Units')) layoutmix.add_widget(Label(text='Unit Type')) layoutmix.add_widget(Label(text='SquareFeet')) layoutmix.add_widget(Label(text='Monthly Rent')) layoutmix.add_widget(TextInput(text='Input', font_size=15)) layoutmix.add_widget(TextInput(text='Input', font_size=15)) layoutmix.add_widget(TextInput(text='Input', font_size=15)) layoutmix.add_widget(TextInput(text='Input', font_size=15)) mainlayout.add_widget(layoutmix) #*******CONTENT7******* mainlayout.add_widget(Label(text='Accounts',size_hint_x=None, width=200, size_hint_y=None, height=50)) #*******CONTENT7******* layoutacc.add_widget(Label(text='Purchase Price')) layoutacc.add_widget(TextInput(text='Input')) layoutacc.add_widget(Label(text='Deposit')) layoutacc.add_widget(TextInput(text='Input')) layoutacc.add_widget(Label(text='Loan Amount')) layoutacc.add_widget(TextInput(text='Input')) layoutacc.add_widget(Label(text='Annual Interest')) layoutacc.add_widget(TextInput(text='Input')) layoutacc.add_widget(Label(text='Period')) layoutacc.add_widget(TextInput(text='Input')) layoutacc.add_widget(Label(text='Total Cash Outlay')) layoutacc.add_widget(TextInput(text='Input')) mainlayout.add_widget(layoutacc) #*******CONTENT5******* mainlayout.add_widget(Label(text='Expenses',size_hint_x=None, width=200, size_hint_y=None, height=50)) #*******CONTENT6******* layoutexpense.add_widget(Label(text='Accounting')) layoutexpense.add_widget(TextInput(text='Input', font_size=15,)) layoutexpense.add_widget(Label(text='Advertising')) layoutexpense.add_widget(TextInput(text='Input', font_size=15)) layoutexpense.add_widget(Label(text='Bank Charges')) layoutexpense.add_widget(TextInput(text='Input', font_size=15)) layoutexpense.add_widget(Label(text='Electricity')) layoutexpense.add_widget(TextInput(text='Input', font_size=15)) layoutexpense.add_widget(Label(text='Gas')) layoutexpense.add_widget(TextInput(text='Input', font_size=15)) layoutexpense.add_widget(Label(text='Security')) layoutexpense.add_widget(TextInput(text='Input', font_size=15)) layoutexpense.add_widget(Label(text='All insurance')) layoutexpense.add_widget(TextInput(text='Input', font_size=15)) layoutexpense.add_widget(Label(text='Permits and fees')) layoutexpense.add_widget(TextInput(text='Input', font_size=15)) layoutexpense.add_widget(Label(text='Maintenance')) layoutexpense.add_widget(TextInput(text='Input', font_size=15)) layoutexpense.add_widget(Label(text='Trash Pick-up')) layoutexpense.add_widget(TextInput(text='Input', font_size=15)) layoutexpense.add_widget(Label(text='All other')) layoutexpense.add_widget(TextInput(text='Input', font_size=15)) mainlayout.add_widget(layoutexpense) #*******CALLING-MAINLAYOUT-IN-TAB1******* scroll.add_widget(mainlayout) th_tab1.content = scroll tp_panel.add_widget(th_tab1) #___*******TAB3*******___# th_tab3 = TabbedPanelHeader(text = 'Saved Reports') tp_panel.add_widget(th_tab3) #*******ADDING-CONTENTS-OF-SUB-WIDGETS******* layoutTop.add_widget(menubtn) layoutTop.add_widget(head) layoutTop.add_widget(backbtn) layoutMid.add_widget(tp_panel) #*******ADDING-CONTENTS-OF-ROOT-WIDGET******* layout.add_widget(layoutTop) layout.add_widget(layoutMid) #*******CALLING-THE-ROOT-WIDGET******* return layout
def __init__(self, *args, **kwargs): global s_y, n, yh, yg, sa, btnlist, lbllist btnlist = [] lbllist = [] super().__init__(*args) sel = ScrollView() self.add_widget(sel) dat = os.listdir('.') data = [] for item in range(len(dat)): if dat[item].endswith(".pdf"): data.append(dat[item]) n = len(data) sa = FloatLayout() s_y = 1.02 if n < 11: pass else: s_y = s_y + (n - 10) / 11 sa.size_hint = (1, s_y) with self.canvas: Color(0, 0.5, 1, 1) Rectangle(pos=(0, 0.95 * h), size=(w, h * 0.05)) self.bt2 = Button(size_hint=(0.1, 0.05), pos_hint={ 'x': 0.9, 'y': 0.95 }, background_normal="Icon/add.png") self.add_widget(self.bt2) self.bt2.bind(on_press=self.change) sel.do_scroll_x: False sel.do_scroll_y: True sel.scroll_y = 1 sel.bar_width = 5 sel.size = Window.size sel.add_widget(sa) yh = 0.2 for i in range(n): if i % 2 == 0: z = 0 else: z = 0.5 lb = Label(color=(0, 0, 0, 1), text=data[i], size_hint=(0.5, 0.05 / s_y), pos_hint={ 'x': z, 'y': (s_y - yh) / s_y }) sa.add_widget(lb) if i % 2 != 0: yh = yh + 0.17 lbllist.append(lb) yg = 0.16 for i in range(n): if i % 2 == 0: z = 0.15 else: z = 0.65 btn = Button(background_normal="Icon/pdf.png", size_hint=(0.2, 0.1 / s_y), pos_hint={ 'x': z, 'y': (s_y - yg) / s_y }) sa.add_widget(btn) if i % 2 != 0: yg = yg + 0.17 btnlist.append(btn)
def update_info(btn_self, index, main_self, music_app_self, *args): global song_page_self, co, pre_sound, bt2, ite, pre_song, bt1, bt3, sh, len_btn2, len_slid global cpb, ite, my_fb # def animate(self,dt, song_len): # print(self) # print(dt) # print(song_len) # bar = self.children[0] # if bar.value < bar.max: # bar.value_normalized += 1/(self.children[0]._max_progress) curr_song = index file = File(songlist[index][0]) song_length = float(file.info.pprint().split(',')[-1:][0][:-8]) time = song_length / 60 minute = int(time) min_str = "{0:0=2d}".format(minute) second = int(round((time - minute) * 60, 2)) sec_str = "{0:0=2d}".format(second) try: singer = file['TPE1'].text[0] except: try: singer = file['TALB'].text[0] except: singer = '' try: song_name = file['TIT2'].text[0] except: song_name = (file.filename.split('/'))[-1:][0] song_page_self.tb.title = '[b]' + song_name + '[/b]' song_page_self.tb.ids['lbl2'].text = singer song_page_self.b2.text = min_str + ':' + sec_str song_page_self.slid.max = int(song_length) # song_page_self.im1.source = cover_album[index] song_page_self.song_page_float.rect.source = cover_album[index] # ######################################################## if (co == 0): my_fb = FloatLayout() my_fb.size_hint = [1, 0.09] # ############################################3 ite = ItemMenuForFitness() ite.bt_img(my_fb) ite.bind(on_release=partial(song_page_self.gonext_playpage, music_app_self)) ############################################3 cpb = CircularProgressBar(ite) cpb.size_hint = ite.size_hint my_fb.add_widget(cpb) ############################################# co += 1 main_self.add_widget(my_fb) ################################################## bt1.bind(on_press=partial(song_page_self.previous_song, btn_self, main_self, music_app_self)) bt2.bind(on_press=partial(song_page_self.play_pause, btn_self)) bt3.bind(on_press=partial(song_page_self.next_song, btn_self, main_self, music_app_self)) ################################################ ite.rect4.source = cover_album[index] cpb._max_progress = int(song_length) # try: # csh.cancel() # except: # pass # csh = Clock.schedule_interval(partial(animate, my_fb, (song_length)), 1) # ######################################################## ##################################################################### ## play song try: bt2.state = 'down' ImgToggleButton_play.on_state(bt2, 'fwfwf', 'normal') pre_sound.stop() pre_sound.unload() pre_song = -1 except: pre_song = -1 if (curr_song != pre_song): if (btn_self.state == 'down'): bt2.state = 'down' ImgToggleButton_play.on_state(bt2, 'fwfwf', 'down') sound = SoundLoader.load(songlist[index][0]) if (sound != None): val_pre = -1 sh = slid_func(sound, len_slid, len_btn2, my_fb, song_page_self) sound.play() pre_sound = sound pre_song = index song_counter = index songlist[pre_song][1].state = 'down'