def __init__(self, bulletin=None, schedule_generator=lambda courses, N: [], *args, **kwargs): super(type(self), self).__init__(*args, **kwargs) self.bulletin = bulletin self.schedule_generator = schedule_generator self.schedules = [] self.stored_schedules = [] self.gen_sched = False self.schedule_index = -1 self.schedule_generation_thread = threading.Thread( target=self.generation_object) self.on_touch_down = lambda e: exclusion.on_touch_down(self, e) self.on_touch_move = lambda e: exclusion.on_touch_move(self, e) self.on_touch_up = lambda e: exclusion.on_touch_up(self, e) self.active_button = None #for class-block popups self.create_layers() self.pb1 = ProgressBar(max=1000) self.pb2 = ProgressBar(max=1000, pos=(w / 2, 0)) self.top_layer.add_widget(self.pb1) #self.top_layer.add_widget( self.pb2 ) self.build_middle_layer() draw_window_frame(self.bottom_layer) draw_border(self.bottom_layer) hold_hz = 7.0 Clock.schedule_interval(self.hold_checker, 1.0 / hold_hz)
def on_enter(self): layout = self.ids.otherlayout floatEr = FloatLayout(size=(480,800)) player = Music_Player() self.label = Label(text=str(self.slider_val)) s = Slider(min=0, max=player.current_playing.length, value_track=True, value_track_color=[1, 0, 0, 1], sensitivity='handle', pos = (0, 300), size = (100, 30)) s.step = .01 btnp = Button(text='play', size=(96,72), pos = (0,72)) btnpau = Button(text='pause', size=(96,72), pos = (96,72)) btnb = Button(text='back', size=(96,72), pos = (192,72)) btn2 = Button(text='go to list', size=(96,72), pos = (288,72)) btnn = Button(text='next', size=(96,72), pos = (384,72)) pb = ProgressBar(max=player.current_playing.length) pb.bind(value=lambda x:self.sliderProgress(player.current_playing.get_pos())) btn2.bind(on_press=self.changer) btnp.bind(on_press=lambda x:player.play()) btnpau.bind(on_press=lambda x:player.pause()) btnb.bind(on_press=lambda x:player.back()) btnn.bind(on_press=lambda x:player.next()) s.bind(value=self.sliderProgress) s.bind(on_touch_up=lambda x, y:player.playAtTime(self.sliderProgress)) floatEr.add_widget(btn2) floatEr.add_widget(btnp) floatEr.add_widget(btnpau) floatEr.add_widget(btnn) floatEr.add_widget(btnb) floatEr.add_widget(s) floatEr.add_widget(pb) layout.add_widget(self.label) layout.add_widget(floatEr)
def makeMilestoneLayout(self, tid, milestone = None, oldScore=None): milestone2 = getPreviousMilestone(tid, milestone) newScore = getScore(tid, milestone2, milestone) if oldScore is None: oldScore = newScore scoreLayout = GridLayout(cols=1, spacing=10, size_hint_y = None) milestoneButton = Button(text=getDateString(milestone, False), font_size='16sp', size_hint_y = None, height=50) milestoneButton.bind(on_press=self.milestoneMenu(tid, milestone)) scoreLayout.add_widget(milestoneButton) progressLayout = BoxLayout(orientation='horizontal') prevScoreMilestone = Label(text=getScoreText(oldScore)) prevScoreMilestone.color = (1,1-float(prevScoreMilestone.text[:-1])/100,1-float(prevScoreMilestone.text[:-1])/100,1) progressLayout.add_widget(prevScoreMilestone) scoreProgress = ProgressBar(max=0.1) scoreProgress.value = oldScore % 0.1 progressLayout.add_widget(scoreProgress) nextScoreMilestone = Label(text=getScoreText(oldScore, True)) nextScoreMilestone.color = (1,1-float(nextScoreMilestone.text[:-1])/100,1-float(nextScoreMilestone.text[:-1])/100,1) nextScoreMilestone.bold = nextScoreMilestone.text == '100%' progressLayout.add_widget(nextScoreMilestone) Clock.schedule_interval(self.incrementScoreProgress(scoreProgress, prevScoreMilestone, nextScoreMilestone, oldScore, newScore), 0.1) scoreLayout.add_widget(progressLayout) scoreLabel = Label(text=str(int(100*newScore))+"%") if getNextMilestone(tid) == milestone: #expScore = newScore * (milestone-time.time()) / (time.time()-milestone2) idealScore = newScore + (milestone-time.time())/(milestone-milestone2) scoreLabel.text += ' ('+ str(int(100*idealScore))+"%)" scoreLabel.color = (1,1-newScore,1-newScore,1) scoreLabel.bold = newScore>=0.99 scoreLayout.add_widget(scoreLabel) return scoreLayout
def download_apk(instance, answer): global popup if answer == "yes": global apk_url apk_path = os.path.join(main_utils.get_mobileinsight_path(), "update.apk") if os.path.isfile(apk_path): os.remove(apk_path) t = threading.Thread(target=download_thread, args=(apk_url, apk_path)) t.start() progress_bar = ProgressBar() progress_bar.value = 1 def download_progress(instance): def next_update(dt): if progress_bar.value >= 100: return False progress_bar.value += 1 Clock.schedule_interval(next_update, 1 / 25) progress_popup = Popup(title='Downloading MobileInsight...', content=progress_bar) progress_popup.bind(on_open=download_progress) progress_popup.open() popup.dismiss()
def build(self): #Window.clearcolor = (0, 0, 0, 1) Window.size = (640, 387) # sizing kivy windows root = customlayout(rows=6, cols=1, size_hint=(1, 1)) # from kivy lang class for background img1 = Image(source ='safcom.png',size_hint=(1, None)) # Adding images in kivy app row1 = GridLayout(rows=1, cols=1, size_hint=(1, None)) row1.add_widget(img1) row2 = GridLayout(rows=4, cols=2, size_hint=(1, None)) #check boxes btn1 = CheckBox(size_hint=(None, None), height=20, color=[0, 128, 0, 1]) lblchk1= Label(text='[b]500mb[/b]', markup=True, color=[0, 0, 0, 1], size_hint=(None, None), height=20) btn2 = CheckBox(size_hint=(None, None), height=20) lblchk2 = Label(text='[b]2gb[/b]',markup=True, color=[0, 0, 0, 1], size_hint=(None, None), height=20) btn3 = CheckBox(size_hint=(None, None), height=20) lblchk3 = Label(text='[b]4gb[/b]',markup=True, color=[0, 0, 0, 1], size_hint=(None, None), height=20) btn4 = CheckBox(size_hint=(None, None), height=20) lblchk4 = Label(text='[b]8gb[/b]',markup=True, color=[0, 0, 0, 1], size_hint=(None, None), height=20) row2.add_widget(btn1) row2.add_widget(lblchk1) row2.add_widget(btn2) row2.add_widget(lblchk2) row2.add_widget(btn3) row2.add_widget(lblchk3) row2.add_widget(btn4) row2.add_widget(lblchk4) row3 = GridLayout(rows=1, cols=2, size_hint=(1, None)) lbl1 = Label(text=' [b]PHONE NUMBER[/b]',markup=True, color=[0, 0, 0, 1], size_hint=(0.3, None), height=30, halign='left', valign='middle') lbl1.bind(size=lbl1.setter('text_size')) txt1 = TextInput(multiline=False, size_hint=(0.7, None), height=30) row3.add_widget(lbl1) row3.add_widget(txt1) row4 = GridLayout(rows=1, cols=3) lbbl = Label(size_hint=(0.3, None), height=40) lbbbl= Label(size_hint=(0.3, None), height=40) btn = Button(text='Generate', color=[0, 128, 0, 1], size_hint=(0.4, None), height=40, halign='left') row4.add_widget(lbbl) row4.add_widget(btn) row4.add_widget(lbbbl) # loading bar in kivy pb = ProgressBar(max=200) pb.value=40 row5 = Label(text=' Cytech@ 2016 computer solutions', size_hint=(1, None), height=20, halign='right') row5.bind(size=row5.setter('text_size'))#binding text in label helps in alignment root.add_widget(row1) root.add_widget(row2) root.add_widget(row3) root.add_widget(row4) root.add_widget(pb) root.add_widget(row5) return root
def __init__(self, **kwargs): super().__init__(**kwargs) self.padding = "10dp" progress = ProgressBar(max=100, size_hint_y=0.01) self.add_widget(progress) self.add_widget(Apiholder(size_hint_y=.2)) progress.value = 50 self.add_widget(Paramholder(size_hint_y=1))
def getUI(self): """get the ui element""" result = ProgressBar() skin = sm.getSkin('meter', self.asset) result.size = sm.getControlSize(skin, self.asset) result.min = sm.getMinimum('meter', self.value, self._typeInfo) result.max = sm.getMaximum('meter', self.value, self._typeInfo) if self.value: result.value = self.value self.uiEl = result self.prepareUiElement() return result
def __init__(self, **kwargs): super().__init__(**kwargs) self.format_list = ["png", "gif", "jpeg", "jpg"] self.img_path = "img/" self.img_list = list() self.img_index = 0 self.counter = 0 self.uploading_text = Label(text="Uploading...") self.bar = ProgressBar() self.body = BoxLayout(orientation="vertical") self.info = Label( text="[color=#05f]A. Ihsan Erdem[/color] Image Viewer", markup=True, size_hint_y=.1) self.button_bar = BoxLayout(size_hint_y=.15) self.next_button = Button(text='Next', size_hint_x=.2, on_release=self.forward) self.prev_button = Button(text='Previous', size_hint_x=.2, on_release=self.backward)
def __init__(self, **kwa): super(CustomProgressbar, self).__init__(**kwa) self.progress_bar = ProgressBar() self.popup = Popup(title=TagApp.lang("analysing"), content=self.progress_bar, size_hint=(.75, .75))
def openfile(obj, value, selected, event): progbar = ProgressBar() obj.logpath = selected obj.switchscreen(progbar) obj.tlog = mp.TelemetryLog(selected[0], progbar, obj.postopen, obj.posterror)
def import_lesson(self, button_sub): button_sub.state = "down" print(self.text_classid + self.text_userid + self.text_lessonid) response_code = 0 if self.lesson_import_flag == 0: response_code, json_object = data_lessons.import_new_lesson( self.text_userid, self.text_classid, self.text_lessonid) if response_code == 1: self.text_status = "There was an error accessing the lesson. Check your access details." button_sub.disabled = False button_sub.state = "normal" self.lesson_import_flag = 0 else: self.text_status = "Access details correct. Downloading the lesson..." self.call_update = Thread( target=data_lessons.update_lesson_details, args=(json_object, )) self.call_update.start() self.progress_bar = ProgressBar() self.popup = Popup(title='Importing lesson', content=self.progress_bar, size_hint=(1, 0.3), auto_dismiss=False) self.popup.open() Clock.schedule_interval(self.next, 0.5)
def __init__(self, **kwargs): super(DataGen, self).__init__(**kwargs) self.add_widget( Label(text='Enter The Id:', size_hint=(.05, .05), pos=(55, 30))) self.Id = TextInput(multiline=False, size_hint=(.2, .05), pos=(120, 30)) self.add_widget(self.Id) self.progress = ProgressBar(max=100, size_hint=(.99, .05), pos=(5, 75)) self.add_widget(self.progress) self.buttn = Button(text="Generate", size_hint=(.6, .05), pos=(260, 30)) self.buttn.bind(on_press=self.gen) self.add_widget(self.buttn) with self.canvas: Line(points=[12, 20, 690, 20, 690, 75, 12, 75, 12, 20], width=2) self.sampleNum = 0 # ----camera coding starts here---- self.img1 = Image(source='images/1.jpg', size_hint=(.9, .80), pos=(40, 100)) self.add_widget(self.img1) self.capture = cv2.VideoCapture(0) self.cascadePath = "xml/haarcascade_frontalface_default.xml" self.faceCascade = cv2.CascadeClassifier(self.cascadePath) Clock.schedule_interval(self.still, 1.0 / 1000)
def login(self, user, pwd): if user.strip() and pwd.strip(): def loading(request, current_size, total_size): self.pb.value += current_size if self.pb.value >= total_size: self.popup.dismiss() def save_auth(req, result): if 'token' in result: get_app().user_store.put('auth', token=result['token']) sm.current = 'messages' params = json.dumps({'username': user, 'password': pwd}) headers = { 'Content-type': 'application/json', 'Accept': 'application/json' } host = get_app().config_store.get('config')['host'] port = get_app().config_store.get('config')['port'] req = UrlRequest('http://{0}:{1}/api-token-auth/'.format( host, port), req_body=params, req_headers=headers, timeout=10, on_success=save_auth, on_progress=loading) self.pb = ProgressBar() self.popup = Popup(title='Get token from the server...', content=self.pb, size_hint=(0.7, 0.3)) self.popup.open()
def Show(self,*,uTitle:str,uMessage:str,iMax:int) -> Popup: """ Shows the Popup """ self.iMax = iMax self.bCancel = False oContent:BoxLayout = BoxLayout(orientation='vertical', spacing='5dp') iHeight:int = int(Globals.iAppHeight*0.5) if Globals.uDeviceOrientation=="landscape": iHeight=int(Globals.iAppHeight*0.9) self.oPopup = Popup(title=ReplaceVars(uTitle),content=oContent, size=(Globals.iAppWidth*0.9,iHeight),size_hint=(None, None),auto_dismiss=False) self.oLabel = Label(text=ReplaceVars(uMessage), text_size=(Globals.iAppWidth*0.86, None), shorten=True, valign='top',halign='left') self.oProgressText = Label(valign='top',halign='center',text_size=(Globals.iAppWidth*0.86, None), shorten=True) oContent.add_widget(Widget()) oContent.add_widget(self.oLabel) oContent.add_widget(Widget()) self.oProgressText.text="" self.oProgressBar = ProgressBar(size_hint_y=None, height='50dp', max=iMax) oContent.add_widget(self.oProgressBar) oContent.add_widget(self.oProgressText) oContent.add_widget(SettingSpacer()) oBtn:Button = Button(size_hint_y=None, height='50dp',text=ReplaceVars('$lvar(5009)')) oBtn.bind(on_release=self.OnCancel) oContent.add_widget(oBtn) self.oPopup.open() return self.oPopup
def __init__(self, **kwargs): super(Gauge, self).__init__(**kwargs) self._gauge = Scatter(size=(self.size_gauge, self.size_gauge), do_rotation=False, do_scale=False, do_translation=False) _img_gauge = Image(source=self.file_gauge, size=(self.size_gauge, self.size_gauge)) self._needle = Scatter(size=(self.size_gauge, self.size_gauge), do_rotation=False, do_scale=False, do_translation=False) _img_needle = Image(source=self.file_needle, size=(self.size_gauge, self.size_gauge)) self._glab = Label(font_size=self.size_text, markup=True) self._progress = ProgressBar(max=100, height=20, value=self.value) self._gauge.add_widget(_img_gauge) self._needle.add_widget(_img_needle) self.add_widget(self._gauge) self.add_widget(self._needle) self.add_widget(self._glab) self.add_widget(self._progress) self.bind(pos=self._update) self.bind(size=self._update) self.bind(value=self._turn)
async def popup_task(title, func, *args, **kwargs): content = ProgressBar(value=0.7, max=1) popup = Popup(title=title, content=content, size_hint=(.8, .1)) popup.open() result = await thread(func, *args, **kwargs) popup.dismiss() return result
def start(self, difficulty): if difficulty == 1: self.play_zones = [ 'N. America', 'C. America', 'S. America', 'Europe', 'Greenland', 'Australia', 'Russia', 'Anime', ] else: self.play_zones = [x for x in ZONES.keys()] self.points = 0 self.life = LIFE self.controls = GControls() self.bar = ProgressBar(max=self.time, value=self.time) self.bar.pos = 20, BOTTOM_BORDER self.bar.size = Window.width - 40, (Window.height / 12.0) self.top_border = TopBorder() self.add_widget(self.controls) self.add_widget(self.bar) self.add_widget(self.top_border) self.select_country()
def __init__(self, **kwa): super(MyWidget, self).__init__(**kwa) self.progress_bar = ProgressBar() self.popup = Popup(title='Download', content=self.progress_bar) self.popup.bind(on_open=self.puopen) self.add_widget(Button(text='Download', on_release=self.pop))
def send_message(self, text): if text.strip(): self.pb = None def loading(request, current_size, total_size): self.pb.value += current_size if self.pb.value >= total_size: self.popup.dismiss() if os.path.exists(IMG_PATH): os.remove(IMG_PATH) token = get_app().user_store.get('auth')['token'] headers = { 'Content-type': 'application/x-www-form-urlencoded', 'Authorization': 'Token {0}'.format(token) } data_to_send = {'message': text} if os.path.exists(IMG_PATH): data_to_send['photo'] = base64.b64encode( open(IMG_PATH, 'rb').read()) params = urllib.urlencode(data_to_send) host = get_app().config_store.get('config')['host'] port = get_app().config_store.get('config')['port'] req = UrlRequest('http://{0}:{1}/messages/'.format(host, port), req_body=params, req_headers=headers, timeout=10, on_progress=loading) self.pb = ProgressBar() self.popup = Popup(title='Sending message', content=self.pb, size_hint=(0.7, 0.3)) self.popup.open()
def newFile(self, title): self.stat.append(Label(text='', size_hint=(1, None), height=30)) self.p_bar.append(ProgressBar()) self.my_grid.add_widget( Label(text=title, size_hint=(1, None), height=30)) self.my_grid.add_widget(self.stat[-1]) self.my_grid.add_widget(self.p_bar[-1])
def process(self): try: if not self.path: raise ValueError('No burst selected.') # Get slider values for compression, gain, and contrast self.compression = self.ids.compression.value self.gain = self.ids.gain.value self.contrast = self.ids.contrast.value self.progress_bar = ProgressBar() self.progress_popup = Popup(title=f'Processing {self.path}', content=self.progress_bar, size_hint=(0.7, 0.2), auto_dismiss=False) self.progress_popup.bind(on_dismiss=self.reload_images) self.progress_bar.value = 1 self.progress_popup.open() Clock.schedule_interval(self.next, 0.1) HDR_thread = threading.Thread(target=HDR, args=(self.path, self.compression, self.gain, self.contrast, self,)) HDR_thread.start() except Exception as e: self.show_error(e)
class ProcessesIndicatorPopup(Popup): ProcesPopup = ObjectProperty() ecxept_trone = ObjectProperty() Progress_Bar = ProgressBar() #sets ecxeption errors trown on ProcessesIndicatorPopup conten label def set_conn_error_msg(self, ecxeptiontrone): if ecxeptiontrone == "ConnectionError": self.title = "No internet connection found" self.content = Label(text="could not connect to the internet") elif ecxeptiontrone == "Timeout": self.title = "Connection timed out" self.content = Label(text="Check device internet connection") elif ecxeptiontrone == "KeyError": self.title = "Location not found" self.content = Label(text="The location entered is not found") else: pass def conn_indicator_popup(self): self.title = "connecting......" self.content = self.Progress_Bar.value = 1 self.open() def calc_conn_progres(self): if self.Progress_Bar.value >= 100: return False self.Progress_Bar.value += 1 def conn_indicator_popup_on_open(self): Clock.schedule_interval(self.calc_conn_progres, 1 / 25)
def __init__(self, movie, labels, params, parallel, **kwargs): super().__init__(**kwargs) self.params = params['seg_param'][...] # Classifier is used if training data is present self.clf = 0 if 'seg_training' in params: self.clf = classifypixels.train_clf(params['seg_training']) self.movie = movie self.labels = labels self.layout = FloatLayout(size=(Window.width, Window.height)) if parallel: # Cannot provide loading bar if parallel processing is used with current structure self.seg_message = Label(text='[b][color=000000]Parallel Processing' \ '\n No Loading Bar[/b][/color]', markup=True, size_hint=(.2, .05), pos_hint={'x': .4, 'y': .65}) with self.canvas: self.add_widget(self.layout) self.layout.add_widget(self.seg_message) else: # Add loading bar to canvas and initiate scheduling of segmentation self.seg_message = Label( text='[b][color=000000]Segmenting Images[/b][/color]', markup=True, size_hint=(.2, .05), pos_hint={ 'x': .4, 'y': .65 }) self.layout2 = GridLayout(rows=1, padding=2, size_hint=(.9, .1), pos_hint={ 'x': .05, 'y': .5 }) self.pb = ProgressBar(max=1000, size_hint=(8., 1.), pos_hint={ 'x': .1, 'y': .6 }, value=1000 / self.movie.frames) self.layout2.add_widget(self.pb) with self.canvas: self.add_widget(self.layout) self.layout.add_widget(self.seg_message) self.layout.add_widget(self.layout2)
def popup_dictionary(self, dictionary, instance): lay_minmax_words = BoxLayout(orientation='vertical', spacing=6) lay_center_minmaxbtn = AnchorLayout(anchor_x='center', anchor_y='center', size_hint=(1, .3)) self.popup = Popup(title="Create my dictionary", content=lay_minmax_words, size=(400, 370), size_hint=(None, None)) inp_min_len = TextInput(text='', hint_text='minimum length', size_hint=(1, .4)) inp_max_len = TextInput(text='', hint_text='maximum length', size_hint=(1, .4)) filename = TextInput(text='', hint_text='file name', size_hint=(1, .4)) self.progressbar = ProgressBar(max=1100, size_hint=(1, .2)) self.update_bar = Clock.create_trigger(self.update_bar_event) btn_minmax_submit = Button(text="Submit", size_hint=(.5, 1), on_press=partial(self.submit_dictionary, dictionary, inp_min_len, inp_max_len, filename, self.update_bar_event)) self.progressbar.value = 0 lay_center_minmaxbtn.add_widget(btn_minmax_submit) lay_minmax_words.add_widget( Label(text='File Name:', size_hint=(1, .2), font_size='16sp')) lay_minmax_words.add_widget( Label(text='(For default length leave empty):', size_hint=(1, .2), font_size='14sp')) lay_minmax_words.add_widget(filename) lay_minmax_words.add_widget( Label(text='Words minimum length:', size_hint=(1, .2), font_size='16sp')) lay_minmax_words.add_widget( Label(text='(For default length leave empty):', size_hint=(1, .2), font_size='14sp')) lay_minmax_words.add_widget(inp_min_len) lay_minmax_words.add_widget( Label(text='Words maximum length:', size_hint=(1, .2), font_size='16sp')) lay_minmax_words.add_widget( Label(text='(For default length leave empty):', size_hint=(1, .2), font_size='14sp')) lay_minmax_words.add_widget(inp_max_len) lay_minmax_words.add_widget(self.progressbar) lay_minmax_words.add_widget(lay_center_minmaxbtn) self.popup.open()
def makeCommandLayout(self, Data, itext): layout = self.CommandLayout layout.clear_widgets() self.commandWidget = TextInput(multiline=False) self.commandWidget.readonly = True self.commandWidget.text = itext pb = ProgressBar(max=1000) pb.value = (Data.total_compl * 1000) / (int(Data.TotalTasks)) layout.add_widget(self.commandWidget) layout.add_widget(pb) #Get current time and add the message to the log pile. logmessage = datetime.now().strftime('%Y-%m-%d %H:%M:%S') logmessage = logmessage + " >>> " + itext Data.log = Data.log + "\n" + logmessage
def __init__(self, **kwa): super( MyPopupProgressBar, self).__init__(**kwa) self.progress_bar = ProgressBar() self.popup = Popup(title='Loading: {}%'.format(int(self.progress_bar.value)), content=self.progress_bar) self.popup.bind(on_open=self.puopen) Clock.schedule_once(self.pop)
def addProgressbar(self): self.recordingProgressBar = ProgressBar(max=1000, pos=(0, -220), width=100, height=400) #self.add_widget(self.recordingProgressBar) self.currentProgress = 0 self.recordingProgressBar.value = self.currentProgress
def add_progress(self): self.pb = ProgressBar(max=self.a.__len__()) self.pb.value = 0 self.progress_pop = Popup(title='Translating...', content=self.pb, size_hint=(0.5, 0.1), auto_dismiss=False) self.progress_pop.open()
def display(self): #dfatrans(txt1,txt2,typ) pb = ProgressBar(max=1000) popup = Popup(title="Result", content=Label(text=self.show), size_hint=(None, None), size=(500, 500)) popup.open()
def makeCommandLayout(self, Data, itext): layout = self.CommandLayout layout.clear_widgets() self.commandWidget = TextInput(multiline=False) self.commandWidget.readonly = True self.commandWidget.text = itext pb = ProgressBar(max=1000) pb.value = (Data.total_compl*1000)/(int(Data.TotalTasks)) layout.add_widget(self.commandWidget) layout.add_widget(pb) #Get current time and add the message to the log pile. logmessage = datetime.now().strftime('%Y-%m-%d %H:%M:%S') logmessage = logmessage + " >>> " + itext Data.log = Data.log + "\n" + logmessage
def build(self): self.bar = ProgressBar(max=100) self.deger = 0 Clock.schedule_once(self.say, 1) # 1 ms sonra self.say adlı fonksiyona git return self.bar
def __init__(self, **kwargs): super(MainScreenSW, self).__init__(**kwargs) # self.pop = LoginPopup() self.progress = ProgressBar() self.progressPopup = Popup(title='loading', content=self.progress, background_color=(1, 1, 4, .9)) self.progressPopup.bind(on_open=self.puopen)
class ProgressScreen(Screen): pb = ProgressBar(max=1000) pb.value = 500 def on_back(self): pass def on_next(self): pass
def gen_xlsx(self, btn: Button): if self.trace is not None: pb = ProgressBar(max=len(self.trace.rows) * 2, value=0, size_hint_y=None, height=30) self.bl.clear_widgets([btn]) self.bl.add_widget(pb, 3) self.trace.regular_as_xlsx(pb, self.popup, self.bl, btn)
def __init__(self, **kw): super(View, self).__init__(**kw) self.orientation='vertical' self._do_update=False progress=ProgressBar() progress.size_hint=(1., None) progress.height=3 self._progress=progress self.add_widget(progress) btn_0=Button(text='Pipe') btn_0.bind(on_press=self.on_press_pipe) self.add_widget(btn_0) btn_1=Button(text='Transcoder') btn_1.bind(on_press=self.on_press_transcoder) self.add_widget(btn_1)
def __init__(self,**kwargs) : super(VideoPlayer,self).__init__(**kwargs) #new events self.register_event_type('on_mute') self.register_event_type('on_unmute') self.register_event_type('on_start') self.register_event_type('on_stop') self.register_event_type('on_fullscreen') self.register_event_type('on_leave_fullscreen') self.video = Video(source = self.source, play=self.play, options = self.options , size_hint = (1,1)) #delay to load the video before launching it Clock.schedule_once(self.start,0.2) Clock.schedule_once(self.stop,2.4) #buttons box self.buttons = BoxLayout(orientation = 'horizontal', size_hint = (None, None), size = (self.video.width, 30 ) ) self.buttons.padding = 5 self.buttons.spacing = 5 #play button self.play_button = SuperButton2(text ='', background_normal= 'video_player/style/1318898242_media-play.png', background_down= 'video_player/style/1318898242_media-play.png', size_hint = (None, None), size = (20, 20) ) self.play_button.bind( on_press = self.start_stop_button ) self.buttons.add_widget( self.play_button ) #sound button self.sound_button = SuperButton2(text ='', background_normal = 'video_player/style/1318898261_media-volume-0.png', background_down = 'video_player/style/1318898261_media-volume-0.png', size_hint = (None, None), size = (20, 20) ) self.sound_button.bind( on_press = self.mute_unmute_button ) self.buttons.add_widget( self.sound_button ) #fullscreen self.fullscreen_button = SuperButton(text ='', background_normal = 'video_player/style/fullscreen-logo.png', background_down = 'video_player/style/fullscreen-logo.png', size_hint = (None, None), size = (20, 20) ) self.fullscreen_button.bind(on_press = self.fullscreen_button_down ) self.buttons.add_widget( self.fullscreen_button ) #duration bar self.duration = -1 self.progress_bar = ProgressBar( size_hint = (1, 1) ) self.progress_bar.bind(on_touch_move = self.move_to_position) self.buttons.add_widget( self.progress_bar ) #manage appearance counter self.last_touch_down_time = 0 #fullscreen status self.full_screen = False #main play button self.main_play_button = SuperButton(text ='', background_normal= 'video_player/style/A-play-T3.png', size_hint = (None, None), size = (50, 50) ) self.main_play_button.bind( on_press = self.start ) self.add_widget( self.main_play_button ) #refresh bar position and size Clock.schedule_interval(self.refresh_player,0.005) self.add_widget(self.video)
class VideoPlayer(Widget): source = StringProperty('') hide_buttons_time_out = NumericProperty(7) play = BooleanProperty( False ) options = DictProperty( {'eos':'loop'} ) def __init__(self,**kwargs) : super(VideoPlayer,self).__init__(**kwargs) #new events self.register_event_type('on_mute') self.register_event_type('on_unmute') self.register_event_type('on_start') self.register_event_type('on_stop') self.register_event_type('on_fullscreen') self.register_event_type('on_leave_fullscreen') self.video = Video(source = self.source, play=self.play, options = self.options , size_hint = (1,1)) #delay to load the video before launching it Clock.schedule_once(self.start,0.2) Clock.schedule_once(self.stop,2.4) #buttons box self.buttons = BoxLayout(orientation = 'horizontal', size_hint = (None, None), size = (self.video.width, 30 ) ) self.buttons.padding = 5 self.buttons.spacing = 5 #play button self.play_button = SuperButton2(text ='', background_normal= 'video_player/style/1318898242_media-play.png', background_down= 'video_player/style/1318898242_media-play.png', size_hint = (None, None), size = (20, 20) ) self.play_button.bind( on_press = self.start_stop_button ) self.buttons.add_widget( self.play_button ) #sound button self.sound_button = SuperButton2(text ='', background_normal = 'video_player/style/1318898261_media-volume-0.png', background_down = 'video_player/style/1318898261_media-volume-0.png', size_hint = (None, None), size = (20, 20) ) self.sound_button.bind( on_press = self.mute_unmute_button ) self.buttons.add_widget( self.sound_button ) #fullscreen self.fullscreen_button = SuperButton(text ='', background_normal = 'video_player/style/fullscreen-logo.png', background_down = 'video_player/style/fullscreen-logo.png', size_hint = (None, None), size = (20, 20) ) self.fullscreen_button.bind(on_press = self.fullscreen_button_down ) self.buttons.add_widget( self.fullscreen_button ) #duration bar self.duration = -1 self.progress_bar = ProgressBar( size_hint = (1, 1) ) self.progress_bar.bind(on_touch_move = self.move_to_position) self.buttons.add_widget( self.progress_bar ) #manage appearance counter self.last_touch_down_time = 0 #fullscreen status self.full_screen = False #main play button self.main_play_button = SuperButton(text ='', background_normal= 'video_player/style/A-play-T3.png', size_hint = (None, None), size = (50, 50) ) self.main_play_button.bind( on_press = self.start ) self.add_widget( self.main_play_button ) #refresh bar position and size Clock.schedule_interval(self.refresh_player,0.005) self.add_widget(self.video) def start_stop_button(self,a) : #actually does start and stop (both functions on same button) m = self.video if m.play == False : self.start(a) else : self.stop(a) def start(self, a): self.video.play = True self.play_button.source = 'video_player/style/1318898221_media-stop.png' self.remove_widget( self.main_play_button ) self.dispatch('on_start') def stop(self, a): self.video.play=False self.play_button.source = 'video_player/style/1318898242_media-play.png' self.add_widget( self.main_play_button ) self.dispatch('on_stop') def mute_unmute_button(self,a): if self.video.volume == 1: self.mute(a) else : self.unmute(a) def mute(self, a): self.video.volume = 0 self.sound_button.source = 'video_player/style/1318898286_media-volume-3.png' self.dispatch('on_mute') def unmute(self, a): self.video.volume = 1 self.sound_button.source = 'video_player/style/1318898261_media-volume-0.png' self.dispatch('on_unmute') def fullscreen_button_down(self, a): if self.full_screen == False: self.fullscreen(1) else : self.leave_fullscreen(1) def fullscreen(self, a): self.full_screen = True self.dispatch('on_fullscreen') def leave_fullscreen(self,a): self.full_screen = False self.dispatch('on_leave_fullscreen') def refresh_player(self, a): #progress bar if self.duration in [-1,1,0] : self.duration = self.video.duration self.progress_bar.max = int(self.duration) self.buttons.pos = self.pos self.buttons.width = self.width self.progress_bar.width = self.width self.video.pos = self.pos self.video.size = self.size self.progress_bar.value = self.video.position self.main_play_button.center = self.video.center def move_to_position(self, a, touch): return x = touch.x x_hint = x / self.progress_bar.width self.video.play = False self.video.position = x_hint * self.duration self.video.play = True def on_touch_down(self, touch): super(VideoPlayer,self).on_touch_down(touch) self.last_touch_down_time = Clock.get_time() #display bar and buttons self.show_buttons() def hide_buttons(self,a): delta = Clock.get_time() - self.last_touch_down_time if delta >= (self.hide_buttons_time_out - 0.02) : self.remove_widget(self.buttons) def show_buttons(self): self.remove_widget(self.buttons) self.add_widget(self.buttons) Clock.schedule_once(self.hide_buttons, self.hide_buttons_time_out) def on_mute(self): pass def on_unmute(self): pass def on_start(self): pass def on_stop(self): pass def on_fullscreen(self): pass def on_leave_fullscreen(self): pass
class XProgress(XNotifyBase): """XProgress class. See module documentation for more information. """ buttons = ListProperty([XNotifyBase.BUTTON_CANCEL]) '''Default button set for class ''' max = NumericProperty(100.) value = NumericProperty(0.) '''Properties that are binded to the same ProgressBar properties. ''' def __init__(self, **kwargs): self._complete = False self._progress = ProgressBar(max=self.max, value=self.value) self.bind(max=self._progress.setter('max')) self.bind(value=self._progress.setter('value')) super(XProgress, self).__init__(**kwargs) def _get_body(self): layout = BoxLayout(orientation='vertical') layout.add_widget(super(XProgress, self)._get_body()) layout.add_widget(self._progress) return layout def complete(self, text='Complete', show_time=2): """ Sets the progress to 100%, hides the button(s) and automatically closes the popup. .. versionchanged:: 0.2.1 Added parameters 'text' and 'show_time' :param text: text instead of 'Complete', optional :param show_time: time-to-close (in seconds), optional """ self._complete = True n = self.max self.value = n self.text = text self.buttons = [] Clock.schedule_once(self.dismiss, show_time) def inc(self, pn_delta=1): """ Increase current progress by specified number of units. If the result value exceeds the maximum value, this method is "looping" the progress :param pn_delta: number of units """ self.value += pn_delta if self.value > self.max: # create "loop" self.value = self.value % self.max def autoprogress(self, pdt=None): """ .. versionadded:: 0.2.1 Starts infinite progress increase in the separate thread """ if self._window and not self._complete: self.inc() Clock.schedule_once(self.autoprogress, .01)
def run(self): sweep_source_dic = {} source_dictionary = self.source_dictionary data_dictionary = self.data_dictionary fucntion_dictionary = self.fucntion_dictionary if 'sweep' in source_dictionary: sweep_source_dic = source_dictionary['sweep'] self.frec_number_point = sweep_source_dic['frec_number_point'] try: self.thread_source = sweep_source_dic['instance'](sweep_source_dic) except FailToConnectTelnet as e: error_label = Label(text = e.message) Popup(title='Source error', content=error_label, size_hint=(None, None), size=(300,300)).open() return except socket.error as e: error_label = Label(text = 'fail to connect,\ncheck connection.') Popup(title='Server error', content=error_label, size_hint=(None, None), size=(300,300)).open() return else: self.frec_number_point = -1 self.thread_source = DummySourceThread() self.tone_source = [] if 'tone' in source_dictionary: for source_config in source_dictionary['tone']: self.tone_source.append(source_config['instance'](source_config)) try: self.thread_data = DataThread(data_dictionary['roach']) except MissingInformation as e: print 'Finish for all this %s' %(e.message) return self.thread_procesing = ProccesThread(fucntion_dictionary) self.end_sweep = False for source in self.tone_source: source.turn_on() progress_bar = ProgressBar(max=self.frec_number_point, value = 0) progress_bar_popup = Popup(content=progress_bar, size_hint = (None, None), size = (300,300), title='Sweep state of progress') progress_bar_popup.open() try: current_channel = 0 self.thread_data.start_connections() while not self.end_sweep: self.thread_source.set_generator(current_channel) extract_dictionary = self.thread_data.accuaire_data() extract_dictionary['current_channel'] = current_channel self.thread_procesing.run_execute_functions(extract_dictionary) if self.frec_number_point - 1 == (current_channel): break current_channel += 1 progress_bar.value = current_channel except RoachException as roach_e: Popup(title='Error Roach', content=Label(text=roach_e.message),\ size_hint=(None, None), size=(300, 120)).open() except Exception as e: Popup(title='Error', content=Label(text=e.message),\ size_hint=(None, None), size=(400, 120)).open() print "stop it all lol" self.thread_data.close_process() self.thread_source.close_process() for source in self.tone_source: source.turn_off() source.stop_source() self.end_sweep = True progress_bar_popup.dismiss()
def __init__(self, **kwargs): self._complete = False self._progress = ProgressBar(max=self.max, value=self.value) self.bind(max=self._progress.setter('max')) self.bind(value=self._progress.setter('value')) super(XProgress, self).__init__(**kwargs)
def buildMainScreen(self, _=None): self.clear_widgets() mainLayout = GridLayout(cols=1, spacing=10, size_hint_y=None) mainLayout.bind(minimum_height=mainLayout.setter('height')) self.scroll_y = 1 self.add_widget(mainLayout) cur.execute("SELECT DISTINCT taskId, endTime FROM Fights WHERE value = 0") runningTaskDeadlines = {} for r in cur.fetchall(): runningTaskDeadlines[r[0]] = r[1] runningTasks = runningTaskDeadlines.keys() runningTasks.sort(key = lambda tid: runningTaskDeadlines[tid], reverse = False) cur.execute("SELECT DISTINCT taskId FROM Milestones WHERE deadline >= ?", [time.time()]) tasks = [t[0] for t in cur.fetchall()] if tasks and not MainScreen.showall: tasks.sort(key = lambda tid: getCompletionExpirationDate(tid), reverse = False) else: MainScreen.showall = True cur.execute("SELECT id FROM Tasks") tasks = [x[0] for x in cur.fetchall()] tasks.sort(key = lambda tid: getScore(tid), reverse = True) tasks = [t for t in tasks if t not in runningTasks] tasks = runningTasks + tasks self.progressbars = [] for tid in tasks: running = isRunning(tid, True) completed = isComplete(tid) taskLayout = GridLayout(cols=2, spacing=0, size_hint_y=None, height=100) mainLayout.add_widget(taskLayout) taskButton = Button(text=getTaskName(tid), size_hint_y=None, height=100) taskLayout.add_widget(taskButton) pledgeButton = Button(size_hint_y=None, size_hint_x=None, width=100, height=100) taskLayout.add_widget(pledgeButton) pledgeButton.background_color = (0,1,0,1) taskButton.bind(on_press=self.taskMenu(tid)) if running: taskButton.background_color = (0.8,1,0.8,1) pledgeButton.background_color = (1,0,0,1) cur.execute("SELECT startTime, endTime FROM Fights WHERE value = 0 AND taskId = ?",[tid]) startTime, endTime = cur.fetchall()[0] pledgeButton.bind(on_press=self.taskPopup(tid, startTime, endTime, True)) taskProgress = ProgressBar(max=endTime-startTime) self.progressbars.append(taskProgress) mainLayout.add_widget(taskProgress) timeLeft = endTime - time.time() if timeLeft > 0: taskProgress.value = (min(time.time()-startTime, endTime-startTime+1)) else: taskProgress.max = taskProgress.value = 1 else: pledgeButton.bind(on_press=self.taskPopup(tid)) if completed: taskButton.background_color = (1,0.8,0.8,1) if not MainScreen.showall: moreButton = Button(text=localisation.get(language,"showmore"), bold=True, size_hint_y=None, height=100) mainLayout.add_widget(moreButton) moreButton.bind(on_press=self.toggleTasksShown) else: writeTaskInput = TextInput(text='') writeTaskPopup = Popup(title=localisation.get(language, "createnew"), content=writeTaskInput, size_hint=(None, None), size=(400, 200)) writeTaskPopup.bind(on_dismiss=self.addEmptyTask(writeTaskInput)) newTaskButton = Button(text=localisation.get(language,"createnew"), bold=True, size_hint_y=None, height=100) newTaskButton.bind(on_release=writeTaskPopup.open) mainLayout.add_widget(newTaskButton) langDropdown = DropDown() for lang in localisation.sections(): btn = Button(text=lang,background_color = (0.6,0.6,0.6,1), valign = 'middle', halign='center', size_hint_y=None, height=100) btn.bind(on_release=self.changeLanguage(lang)) btn.bind(on_release=langDropdown.dismiss) langDropdown.add_widget(btn) langButton = Button(text=localisation.get(language,"language"), bold=True, size_hint_y=None, height=100) langButton.bind(on_press=langDropdown.open) mainLayout.add_widget(langButton) lessButton = Button(text=localisation.get(language,"showless"), bold=True, size_hint_y=None, height=100) mainLayout.add_widget(lessButton) lessButton.bind(on_press=self.toggleTasksShown) Clock.unschedule(self.incrementProgressBars) Clock.schedule_interval(self.incrementProgressBars, 1)
def load(self): screen = HostScreen() screen.ids['bar'].value = 1000 pb = ProgressBar() pb.value = 1000