def pop_up(self, header, message): popup = Popup(title=header, content=Label(text=message), size_hint=(None, None), size=(400, 400)) popup.open()
def openFilePick(self): self.filePickPopup = Popup( title="Choose in what file to save the data", content=FilePickDialog(save=self.save, cancel=self.cancel), size_hint=(0.5, 0.9)) self.filePickPopup.open()
def __init__(self, **kwargs): """ Create all the default gui elements """ super(Menu, self).__init__(**kwargs) self.fcv = fire_cv.FireCv() self.imT = im_transform.Image_Transform() # main screen config self.main_screen = Screen(name='Most-g4') self.layout = BoxLayout(orientation='vertical') self.logo = Image(source='static/logo.png', allow_stretch=True, size_hint_y=1) self.layout_down = GridLayout(cols=2, rows=2, size_hint_y=0.2) self.layout.add_widget(self.logo) self.layout.add_widget(self.layout_down) self.main_screen.add_widget(self.layout) # self.cols = 1 # define os and default path self.os = platform self.path = "" if self.os == 'win': self.path = dirname(expanduser("~")) else: self.path = expanduser("~") # Define and add buttons to main Screen self.vid = Button(text='Dividir Video', size_hint_y=0.1) self.vid.bind(on_press=lambda x: (self.browser('vid'))) self.im = Button(text='Processar Frames', size_hint_y=0.1) self.im.bind(on_press=lambda x: (self.browser('frame'))) self.seg = Button(text='Contornos de Interesse ', size_hint_y=0.1) self.seg.bind(on_press=self.seg_workflow) self.image_transform = Button(text='Coordenadas Georeferenciadas', size_hint_y=0.1) self.image_transform.bind(on_press=self.image_transformation_workflow) self.layout_down.add_widget(self.vid) self.layout_down.add_widget(self.im) self.layout_down.add_widget(self.seg) self.layout_down.add_widget(self.image_transform) # init default popup self.popup = Popup() # Screen Manager self.s_open_file = Screen(name='Abrir Ficheiro') self.s_save_frame = Screen(name='Gravar Frames') self.s_save_area = Screen(name='Gravar Area') self.s_coords = Screen(name='Coords') self.s_wait = Screen(name='Wait') self.add_widget(self.main_screen) self.add_widget(self.s_open_file) self.add_widget(self.s_save_frame) self.add_widget(self.s_save_area) self.add_widget(self.s_wait) self.add_widget(self.s_coords) # filename self.text_input = TextInput() self.text = "" # watershed original fg and bg arrays self.ws_original = "" self.fg = [] self.bg = [] # Image transformation self.img_t_og = "" self.img_t_map = "" self.img_t_cntr = "" self.georef_x_min_text = "" self.georef_x_max_text = "" self.georef_y_min_text = "" self.georef_y_max_text = ""
def SendToken(self, txid): def Confrim(*arg): backstr = "feedback@ " + datetime.now().strftime( '%Y-%m-%d %H:%M:%S') + "\n" popup.dismiss() if txid == 1: backstr += str( self.wi.SendToken(address, amount, token=token, txid=1)) if txid == 2: backstr += str(self.wi.SendToken(token=token, txid=2)) self.root.ids.sm.get_screen('PayToken').ids.feedback.text = backstr return def Cancel(*arg): popup.dismiss() return token = self.root.ids.sm.get_screen('PayToken').ids.btn.text if txid == 1: try: address = self.root.ids.sm.get_screen( 'PayToken').ids.addrinput.text.strip() amount = int(1000000 * float( self.root.ids.sm.get_screen( 'PayToken').ids.aminput.text.strip())) status = True except: backstr = "feedback@ " + datetime.now().strftime( '%Y-%m-%d %H:%M:%S') + "\n" + str("input is not correct.") status = False if not Wallet.VerifyAddress(address): backstr = "feedback@ " + datetime.now().strftime( '%Y-%m-%d %H:%M:%S') + "\n" + str("Address is not valid.") status = False if not status: self.root.ids.sm.get_screen( 'PayToken').ids.feedback.text = backstr return box = BoxLayout(orientation="vertical") if txid == 1: lb = Label(text='From address: \n' + self.wi.wc.address + "\n" + "To address: \n" + address + "\n" + "amount: " + str(amount / 1000000) + " " + token) if txid == 2: lb = Label(text='From address: \n' + self.wi.wc.address + "\n" + "Integrating token\n") buttonok = Button(text="Confirm", on_press=Confrim, size_hint_y=None, height=40) buttonca = Button(text="Cancel", on_press=Cancel, size_hint_y=None, height=40) lb.font_size = str(max(10, int(buttonok.width * 0.07 + 6))) + "dp" box.add_widget(lb) box.add_widget(buttonok) box.add_widget(buttonca) box.add_widget(Widget(size_hint=(0.8, 0.8))) popup = Popup(title='Payment Confirm', content=box, size_hint=(1.0, 0.7)) popup.open() return
def __init__(self, parent, titleheader="Message", message="", options={"OK": ""}, size_hint=(.8, .3), font_size=None, size=None, modal=0, edit_add=False, edit_default_text=""): #def build(self, parent, titleheader="Message", message="", options={"OK": ""}, size_hint=(.8,.2), size=(None, None)): def popup_callback(instance): self.retvalue = instance.text self.popup.dismiss() self.parent = parent self.retvalue = None self.titleheader = titleheader self.message = message self.options = options self.font_size = font_size self.edit_add = edit_add self.edit_default_text = edit_default_text if size: self.size = size else: self.size = (0, 0) if size_hint: self.size_hint = size_hint #box = GridLayout(orientation='vertical', cols=1) box = GridLayout(cols=1) box.orientation = 'vertical' #self.add_widget(box) #box.add_widget(Label(text=self.message, font_size=self.font_size)) box.add_widget(Label(text=self.message)) if self.edit_add: self.edit = TextInput(text=self.edit_default_text) box.add_widget(self.edit) b_list = [] buttonbox = BoxLayout(orientation='horizontal', size_hint=(1, None), height=32) box.add_widget(buttonbox) for b in self.options: b_list.append(Button(text=b, on_press=popup_callback)) #b_list[-1].bind(on_press=self.popup_callback) buttonbox.add_widget(b_list[-1]) if modal: #Допилить self.popup = ModalView() self.popup.title = titleheader self.popup.size_hint = self.size_hint self.popup.size = self.size self.popup.add_widget(box) else: self.popup = Popup(title=titleheader, content=box, size_hint=self.size_hint, size=self.size) #self.popup = Popup(title=titleheader, content=box, size_hint=self.size_hint) self.popup.open() self.popup.bind(on_dismiss=self.OnClose)
def show_load_labels(self): content = LoadDialog(load=self.load_labels, cancel=self.dismiss_popup) self._popup = Popup(title="Selecione as Classes(.PBTXT) ", content=content, size_hint=(0.9, 0.9)) self._popup.open()
def _build_associated_status_popup(self): return Popup(title='Associate your Lamp', content=Label(text='Msg here', font_size='30sp'), size_hint=(1, 1), auto_dismiss=False)
def show_save(self): content = SaveDialog(save=self.save, cancel=self.dismiss_popup) self._popup = Popup(title='Выбрать директорию для сохранения выгрузки', content=content, size_hint=(0.9, 0.9)) self._popup.open()
def finish_popup(self, operation_type): content = PopUps(cancel=self.dismiss_popup) self._popup = Popup(title=operation_type, content=content, size_hint=(0.3, 0.3)) self._popup.open()
def alarmPopup(self, *args): box = FloatLayout() hourbutton = Button(text='Select Hour', size_hint=(.2, .2), pos_hint={ 'x': .2, 'y': .5 }) hourdropdown = DropDown() for i in range(24): if (i < 10): btn = Button(text='0%r' % i, size_hint_y=None, height=70) else: btn = Button(text='%r' % i, size_hint_y=None, height=70) btn.bind(on_release=lambda btn: hourdropdown.select(btn.text)) hourdropdown.add_widget(btn) hourbutton.bind(on_release=hourdropdown.open) hourdropdown.bind( on_select=lambda instance, x: setattr(hourbutton, 'text', x)) box.add_widget(hourbutton) box.add_widget(hourdropdown) minutebutton = Button(text='Select Minute', size_hint=(.2, .2), pos_hint={ 'x': .6, 'y': .5 }) minutedropdown = DropDown() for i in range(60): if (i < 10): btn = Button(text='0%r' % i, size_hint_y=None, height=70) else: btn = Button(text='%r' % i, size_hint_y=None, height=70) btn.bind(on_release=lambda btn: minutedropdown.select(btn.text)) minutedropdown.add_widget(btn) minutebutton.bind(on_release=minutedropdown.open) minutedropdown.bind( on_select=lambda instance, x: setattr(minutebutton, 'text', x)) box.add_widget(minutebutton) box.add_widget(minutedropdown) #button to dismiss alarm selector and set alarm once user has chosen alarm dismissButton1 = SetAlarmPopup() dismissButton2 = SetSleepPopup() box.add_widget(dismissButton1) box.add_widget(dismissButton2) currentDay = time.strftime("%A") alarmPopup = Popup(title='Set Your Alarm for {}:'.format(currentDay), content=box, size_hint=(.8, .8)) dismissButton1.bind( on_press=partial(dismissButton1.dismissAlarmPopup, alarmPopup, hourbutton, minutebutton)) dismissButton2.bind( on_press=partial(dismissButton2.dismissSleepPopup, alarmPopup, hourbutton, minutebutton)) alarmPopup.open()
def show_load(self): content = LoadDialog(load=self.load, cancel=self.dismiss_popup) self._popup = Popup(title='Выбрать директорию с музыкой', content=content, size_hint=(0.9, 0.9)) self._popup.open()
def on_press_button(self, instance): print('You pressed the button!') button_text = instance.text if button_text == 'START FETCHING DATA': self.valArray = [] self.progresslabel.text = 'Fetching data...' #create a csv file with all of the values from the firebase database ref = firebase.database() data = ref.child("smells").get() key = data.val() print("hello") if (key == None): self.progresslabel.text = 'No data currently in database' else: db = firebase.database() a = db.child("smells") smelldict = a.get().val() print(smelldict) with open('finalsmelllist.csv', 'w', newline='') as file: writer = csv.writer(file) writer.writerow([ "MQ136", "MQ137", "MQ3", "MQ5", "MQblank", "MQblank2" ]) for key in smelldict: MQ136 = db.child("smells").child(key).child( "MQ136").get().val() MQ137 = db.child("smells").child(key).child( "MQ137").get().val() MQ3 = db.child("smells").child(key).child( "MQ3").get().val() MQ5 = db.child("smells").child(key).child( "MQ5").get().val() MQblank = db.child("smells").child(key).child( "MQblank").get().val() MQblank2 = db.child("smells").child(key).child( "MQblank2").get().val() writer.writerow( [MQ136, MQ137, MQ3, MQ5, MQblank, MQblank2]) print("Finished writing csv file.") self.progresslabel.text = 'Data fetched! CSV generated in folder.' with open('finalsmelllist.csv', 'r') as file: reader = csv.reader(file) counter = 0.0 MQ136count = 0.0 MQ137count = 0.0 MQ3count = 0.0 MQ5count = 0.0 MQblankcount = 0.0 MQblank2count = 0.0 next(reader) for row in reader: if counter != 0.0: MQ136count = MQ136count + float(row[0]) MQ137count = MQ137count + float(row[1]) MQ3count = MQ3count + float(row[2]) MQ5count = MQ5count + float(row[3]) MQblankcount = MQblankcount + float(row[4]) MQblank2count = MQblank2count + float(row[5]) counter = counter + 1.0 self.MQ136.text = str(MQ136count / counter) self.MQ137.text = str(MQ137count / counter) self.MQ3.text = str(MQ3count / counter) self.MQ5.text = str(MQ5count / counter) self.MQblank.text = str(MQblankcount / counter) self.MQblank2.text = str(MQblank2count / counter) self.valArray.append(MQ3count / counter) self.valArray.append(MQ137count / counter) self.valArray.append(MQ5count / counter) self.valArray.append(MQblankcount / counter) self.valArray.append(MQblank2count / counter) print("ValArray v") print(self.valArray) self.progresslabel.text = 'Data fetched! CSV generated in folder. Values updated.' self.swap_label( 'Data fetched! CSV generated in folder. On standby for a signal.' ) '''print('3 seconds start') time.sleep(2) print('3 seconds are over') self.swap_label('On Standby. Looking for signal from synthesizer (every 2 seconds).')''' instance.text = "Check for Signal" #instance.text = "Push to Database" if button_text == "Check for Signal": x = 1 self.progresslabel.text = 'Checking for Signal......' while True: ref = firebase.database() users = ref.child("Signal").get() key = users.val() #print(key) if (key == None): self.progresslabel.text = 'On Standby. No Signal yet.' else: db = firebase.database() keyDict = firebase.database().child("Signal").get().val() keyList = list(keyDict) self.chosenKeyInd = 0 finalKey = firebase.database().child("Signal").child( keyList[0]).get().val() keyCount = int(len(keyDict)) print(keyCount) if (keyCount == 1): self.progresslabel.text = 'Ready to Go! Key = ' + str( finalKey) instance.text = "Push to Database" else: content = BoxLayout(orientation="vertical") for x in range(0, keyCount): db = firebase.database() keyDict = firebase.database().child( "Signal").get().val() keyList = list(keyDict) thisKey = firebase.database().child( "Signal").child(keyList[x]).get().val() button = Button(text=str(thisKey), background_color=[0, 0, 1, 1]) content.add_widget(button) button.thisKeyInd = x button.bind(on_press=self.chooseSignal) button.subInst = instance self.popup = Popup( content=content, auto_dismiss=False, title="Pick a synthesis key!", title_align="center", ) # bind the on_press event of the button to the dismiss function # open the popup self.popup.open() break if (x == 10): print('program terminated') self.progresslabel.text = "No Signal Found." instance.text = "Click button to check again for Signal." break x = x + 1 print(x) time.sleep(2) if button_text == "Click button to check again for Signal.": x = 1 self.progresslabel.text = 'Checking for Signal......' while True: ref = firebase.database() users = ref.child("Signal").get() key = users.val() #print(key) if (key == None): self.progresslabel.text = 'On Standby. No Signal yet.' else: db = firebase.database() keyDict = firebase.database().child("Signal").get().val() keyList = list(keyDict) chosenKeyInd = 0 finalKey = firebase.database().child("Signal").child( keyList[0]).get().val() keyCount = int(len(keyDict)) print(keyCount) if (keyCount == 1): self.progresslabel.text = 'Ready to Go! Key = ' + str( finalKey) instance.text = "Push to Database" chosenKeyInd = 0 else: content = BoxLayout(orientation="vertical") for x in range(0, keyCount): db = firebase.database() keyDict = firebase.database().child( "Signal").get().val() keyList = list(keyDict) thisKey = firebase.database().child( "Signal").child(keyList[x]).get().val() button = Button(text=str(thisKey), background_color=[0, 0, 1, 1]) content.add_widget(button) button.thisKeyInd = x button.bind(on_press=self.chooseSignal) button.subInst = instance self.popup = Popup( content=content, auto_dismiss=False, title="Pick a synthesis key!", title_align="center", ) # bind the on_press event of the button to the dismiss function # open the popup self.popup.open() break if (x == 10): print('program terminated') self.progresslabel.text = "No Signal Found." instance.text = "Click button to check again for Signal." break x = x + 1 print(x) time.sleep(2) if button_text == "Push to Database": db = firebase.database() keyDict = firebase.database().child("Signal").get().val() keyList = list(keyDict) finalKey = firebase.database().child("Signal").child( keyList[self.chosenKeyInd]).get().val() b = db.child(finalKey) #Algorithm goes here##---------------------------------## valArray = self.valArray '''valArray = [] valArray.append(111) valArray.append(13.0) valArray.append(88.3) valArray.append(7.6) valArray.append(71.26)''' x = valArray[0] print(x) testAvg = x #testAvg = 190 print(testAvg) meanList = [ 101.77966101694915, 187.50169491525423, 143.08474576271186, 111.5186440677966, 207.4237288135593, 246.92542372881357 ] dists = [] currentLowest = 0 for x in range(6): dists.append(abs(testAvg - meanList[x])) if (x != 0): if (dists[x] < dists[currentLowest]): currentLowest = x print(dists) print(currentLowest) if currentLowest == 0: print("LemonGrass") self.smellName = "LemonGrass" finalNum = 4 if currentLowest == 1: print("Eucalyptus") self.smellName = "Eucalyptus" finalNum = 2 if currentLowest == 2: print("Peppermint") self.smellName = "Peppermint" finalNum = 1 if currentLowest == 3: print("Lavendar") self.smellName = "Lavendar" finalNum = 6 if currentLowest == 4: print("TeaTree") self.smellName = "TeaTree" finalNum = 5 if currentLowest == 5: print("Orange") self.smellName = "Orange" finalNum = 3 #Algorithm ends here##---------------------------------## data = finalNum b.child("finalint").set(data) self.progresslabel.text = 'Smell classified as ' + self.smellName + '. Data sent!' instance.text = "START FETCHING DATA"
def success(self): popup = Popup(title='Closing', content=Label(text=str('Success')), size_hint=(.5, .5), on_dismiss=self.close) popup.open()
def popup_folder_exist(self, ): error_popup = Popup(title='Folder Exist', content=Label(text='That folder already exists'), size_hint=(.5, .5)) error_popup.open()
def build(self): self.root = Builder.load_file('kv/root.kv') screen = Builder.load_file('kv/add_scene.kv') self.root.container.add_widget(screen) spin1 = self.root.ids['spin1'] spinner1 = Spinner(text='None', values=(), size_hint=(0.9, 1)) spin1.add_widget(spinner1) def show_selected_scene(spinner1, text): self.Scene = text self.update_GUI(s2=self.s2) spinner1.bind(text=show_selected_scene) spin2 = self.root.ids['spin2'] spinner2 = Spinner(text='None', values=(), size_hint=(0.9, 1)) spin2.add_widget(spinner2) def show_selected_building(spinner2, text): self.Building = text self.update_GUI(s3=self.s3) spinner2.bind(text=show_selected_building) spin3 = self.root.ids['spin3'] spinner3 = Spinner(text='None', values=(), size_hint=(0.9, 1)) spin3.add_widget(spinner3) def show_selected_floor(spinner3, text): self.Floor = text spinner3.bind(text=show_selected_floor) spin4 = self.root.ids['spin4'] spinner4 = Spinner(text='Format', values=('csv', 'separt csv'), size_hint=(0.9, 1)) spin4.add_widget(spinner4) def show_selected_format(spinner4, text): self.Format = text spinner4.bind(text=show_selected_format) self.s1 = spinner1 self.s2 = spinner2 self.s3 = spinner3 self.update_GUI(spinner1) # add popup content = GridLayout(cols=1) content_cancel = Button(text='Cancel', size_hint_y=None, height=40) content.add_widget(Label(text='Please select map')) content.add_widget(content_cancel) popup = Popup(title='Error', size_hint=(None, None), size=(256, 256), content=content, disabled=True) content_cancel.bind(on_release=popup.dismiss) self.popup = popup
def show_load(self): content = LoadDialog(load=self.load, cancel=self.dismiss_popup) self._popup = Popup(title="Load file", content=content, size_hint=(0.9, 0.8), pos_hint={'y': 0.2}, auto_dismiss=False) self._popup.open()
def show_load_model(self): content = LoadDialog(load=self.load_model, cancel=self.dismiss_popup) self._popup = Popup(title="Selecione um Modelo(.PB)", content=content, size_hint=(0.9, 0.9)) self._popup.open()
def invalidLogin(): pop = Popup(title='Invalid Login', content=Label(text='Invalid username or password.'), size_hint=(None, None), size=(400, 400)) pop.open()
def show_load_video(self): content = LoadDialog(load=self.load_video, cancel=self.dismiss_popup) self._popup = Popup(title="Selecione um Video", content=content, size_hint=(0.9, 0.9)) self._popup.open()
def invalidForm(): pop = Popup(title='Invalid Form', content=Label(text='Please fill in all inputs with valid information.'), size_hint=(None, None), size=(400, 400)) pop.open()
def _build_network_status_popup(self): return Popup(title='Device Status', content=Label(text='IP ADDRESS WILL GO HERE'), size_hint=(1, 1), auto_dismiss=False)
if __name__ == '__main__': from kivy.base import runTouchApp from kivy.uix.boxlayout import BoxLayout from kivy.uix.label import Label from kivy.uix.button import Button from kivy.uix.popup import Popup from kivy.uix.image import Image from kivy.core.window import Window navigationdrawer = NavigationDrawer() side_panel = BoxLayout(orientation='vertical') side_panel.add_widget(Label(text='Panel label')) popup = Popup(title='Sidebar popup', content=Label(text='You clicked the sidebar\npopup button'), size_hint=(0.7, 0.7)) first_button = Button(text='Popup\nbutton') first_button.bind(on_release=popup.open) side_panel.add_widget(first_button) side_panel.add_widget(Button(text='Another\nbutton')) navigationdrawer.add_widget(side_panel) navigationdrawer.side_panel_height = 400 # let the user choose the height of the side panel # If he doesn't choose, it defaults to the full height label_head = ('[b]Example label filling main panel[/b]\n\n[color=ff0000](p' 'ull from left to right!)[/color]\n\nIn this example, the le' 'ft panel is a simple boxlayout menu, and this main panel is' ' a BoxLayout with a label and example image.\n\nSeveral pre' 'set layouts are available (see buttons below), but users ma' 'y edit every parameter for much more customisation.')
def check_online(self): popup = Popup(title='Check Online', content=Label(text='Coming soon!'), size_hint=(None, None), size=(400, 400)) popup.open()
def explain_popup(self): content_label = Label(text = 'This Count window counts how many\n of each number there are in a list', font_size=20) popup = Popup(title='Count Explanation', content=content_label, size_hint=(.75, .75)) popup.open()
def updateDatabase(self): wb = xl.load_workbook( "Lottery databases.xlsx") #load the workbook into memory #variable to hold strings popupStrings = [] #empty list #list of the sheet names within the workbook sheetnames = ["SuperLotto", "MegaMillions", "Powerball"] days = ["Fri. ", "Wed. ", "Tue. ", "Sat. "] #days the draws on done on #list of the webpages to use grab the new draws webPages = [ 'http://www.calottery.com/play/draw-games/superlotto-plus/winning-numbers', 'http://www.calottery.com/play/draw-games/mega-millions/winning-numbers', 'http://www.calottery.com/play/draw-games/powerball/winning-numbers' ] x = 3 while x != 0: ws = wb.get_sheet_by_name(sheetnames[x - 1]) # which sheet to update rowIndex = ws.get_highest_row( ) # gets the highest row index in the sheet #lastCellValue = ws.cell(row = rowIndex - 1, column = 0).value #gets the last value in the first column, draw number lastCellValue = ws.cell( row=rowIndex, column=1 ).value #gets the last value in the first column, draw number, for openpyxl 2.0.0+ page = requests.get(webPages[x - 1]) #grabs the webpage needed tree = html.fromstring( page.text ) #puts the webpage into a tree structure to make it easy to traverse #get the newest draw and date from the webpage for comparasion purposes draw_and_date = tree.xpath( '//*[@id="objBody_content_0_pagecontent_0_objPastWinningNumbers_rptPast_ctl01_lblDrawDateNumber"]/text()' ) #if the table is up to date, it will move on to the next table else it will update it y = int(draw_and_date[0][-4:]) - int( lastCellValue ) # checks to see how many draws are missing from the table if y == 0: #print("The table for " + sheetnames[x-1] + " is up to date.") popupStrings.append("The table for " + sheetnames[x - 1] + " is up to date.") x -= 1 #decrement x by 1 to move on to the next table else: #while loop to check if the table needs to be updated or not, if yes it will update it while y != 0: #grabs the draw and date of the missing draws from the table draw_and_date = tree.xpath( '//*[@id="objBody_content_0_pagecontent_0_objPastWinningNumbers_rptPast_ctl0' + str(y) + '_lblDrawDateNumber"]/text()') numbers = tree.xpath( ".//*[@id='content']/div[3]/table/tr[" + str(y) + "]/td[2]/span/text()") #numbers numbers = [ int(_) for _ in numbers ] # converts the text to integers, seems to the convention to use (_) as a variable for these type of situations numbers.sort() #sort the number from smallest to largest mega = tree.xpath(".//*[@id='content']/div[3]/table/tr[" + str(y) + "]/td[3]/text()") #mega number mega = int(mega[0]) # converts the text to integers #write to the file if sheetnames[x - 1] == "MegaMillions": d = 0 else: d = 1 if int(draw_and_date[0][-4:]) % 2 == 0: # if the draw date is even then the day is a Tuesday/Saturday ws.append([ int(draw_and_date[0][-4:]), (days[d + 2] + draw_and_date[0][:12]), numbers[0], numbers[1], numbers[2], numbers[3], numbers[4], mega ]) # print the draw date else: # if the draw date is odd then the day is a Wednesday/Friday ws.append([ int(draw_and_date[0][-4:]), (days[d] + draw_and_date[0][:12]), numbers[0], numbers[1], numbers[2], numbers[3], numbers[4], mega ]) y -= 1 #decrement y by 1 to get the next missing draw #print("Updated the " + sheetnames[x-1] + " table successfully!") popupStrings.append("Updated the " + sheetnames[x - 1] + " table successfully!") x -= 1 #decrement x by 1 to move on to the next table wb.save("Lottery databases.xlsx") #save the workbook #print("Saved the database Sucessfully!") popupMessage = Popup( title='Update Databases', content=Label(text=popupStrings[0] + '\n' + popupStrings[1] + '\n' + popupStrings[2]), size_hint=(None, None), size=(350, 150)) popupMessage.open()
def popup_error_inputfield(self, ): error_popup = Popup(title='Error', content=Label(text='Input field has no input,\nor it has an invalid input', font_size=20), size_hint=(.5, .5)) error_popup.open()
def popup_results(self, result): popup = Popup( title="GAME RESULTS:", content=Label(text=result), size=(400,200), size_hint=(None, None)) popup.bind(on_dismiss=self.reset_board) popup.open()
def popup_error(self, error): error_popup = Popup(title='Error', content=Label(text=str(error), font_size=20), size_hint=(.5, .5)) error_popup.open()
def UpdateDatabase(self, num): # Loops through the number of deliverables for x in range(0, num): # Loops through the widgets in the grid layout for i in range(0, len(self.ids.grid.children)): # If the last character of the widget id matches x if str(x) == str(self.ids.grid.children[i].id)[-1]: # Checks to make sure that if the response is 'Other', then Comments cannot be empty if self.ids.grid.children[ i + 2].text == "Other" and self.ids.grid.children[ i].text == "": # if so, makes a pop up to warn user box = BoxLayout(orientation='vertical', padding=(10)) labl = Label( text= "Specify Your Response of 'Other' in the 'Comments' Section for Deliverable: " + self.ids.grid.children[i + 5].text) box.add_widget(labl) popup = Popup(title='Warning', content=box, size_hint=(None, None), size=(650, 100), pos=(0, 0)) popup.open() return None # qty is the text value of the QTY spinner qty = self.ids.grid.children[i + 3].text # If the text value of the QTY spinner is empty if self.ids.grid.children[i + 3].text == '': # Make qty 0 qty = 0 else: # Otherwise, convert the text value into a integer qty = int(qty) # Checks to make sure that if the qty is greater and the Person text input is empty if qty > 0 and self.ids.grid.children[i + 1].text == '': # if so, makes a pop up to warn user box = BoxLayout(orientation='vertical', padding=(10)) labl = Label( text= "State the Person that completed the Deliverable: " + self.ids.grid.children[i + 5].text) box.add_widget(labl) popup = Popup(title='Warning', content=box, size_hint=(None, None), size=(500, 100), pos=(0, 0)) popup.open() return None # Execute SQL update statement to update the database cursor.execute( "UPDATE tblSowTaskDel SET DelResponse =?, DelComments =?, PersonSubmit =?, DelQTYDone =?, DelDateDone =? WHERE DelName =?", (self.ids.grid.children[i + 2].text, self.ids.grid.children[i].text, self.ids.grid.children[i + 1].text, qty, self.ids.grid.children[i + 4].text, self.ids.grid.children[i + 5].text)) # Commits the changes to the database database.commit() # Increment x x += 1 # Creates a pop up to tell the user that the database is updated box = BoxLayout(orientation='vertical', padding=(10)) labl = Label(text="Database Has Been Updated!") box.add_widget(labl) popup = Popup(title='Finished!', content=box, size_hint=(None, None), size=(500, 100), pos=(0, 0)) popup.open() # Clears the values of all the widgets in the screen self.ids.spinnerTask.text = 'Task' self.ids.spinnerSow.text = 'Choose a SOW' # Clears all the widgets in the grid layout self.ids.grid.clear_widgets()
def show_popup(self, content, title="Load file"): self._popup = Popup(title=title, content=content, size_hint=(.8, .8)) self._popup.open()