def __init__(self, **kwargs): Screen.__init__(self, **kwargs) # with self.canvas: # Color(1, 0, 0, 1) # set the colour to red # self.rect = Rectangle(pos=self.pos,size=self.size) #self.state = self.path self.route = 'ACB' #define initial list, because kivy requires an initial value to run. We will change this later #self.route = keywithmaxval(dict_routes) #print self.route self.count = 0 #initialize a count to keep track of the current map self.layout = BoxLayout(orientation='vertical') self.nested = BoxLayout(orientation='horizontal', size_hint_y=0.11) #create a nested boxlayout self.image = Image(source='Map1.png', allow_stretch=False) self.btn = Button(text='Analyze Route', color=hex('#151712'), on_press=self.main, on_release=self.path, font_size=24, font_name='Adam', background_normal='', background_color=hex('#83A55C')) self.btn2 = Button(text='Return to Menu', color=hex('#151712'), on_press=self.switchM, font_size=24, font_name='Adam', background_normal='', background_color=hex('#A93F55')) self.layout.add_widget(self.image) self.layout.add_widget(self.nested) self.nested.add_widget(self.btn) self.nested.add_widget(self.btn2) self.add_widget(self.layout)
def on_mouse_pos(self, window, pos): if ((window.mouse_pos[0] / window.size[0]) < 0.5): self.fileImg1.color = hex("#a6a6a6") self.fileImg2.color = hex("#c9c9c9") else: self.fileImg1.color = hex("#c9c9c9") self.fileImg2.color = hex("#a6a6a6")
def popup(self, text): popup_button = Button(text='Dismiss', background_color=hex('#FFA69E')) invalid_popup = Popup(title=text, content=popup_button, size_hint=(0.7, 0.7)) popup_button.bind(on_press=lambda *args: invalid_popup.dismiss()) return invalid_popup.open()
def switchM( self, instance ): #changes back to the menu screen when the return to menu button is pressed self.image.source = 'Map1.png' #sets the map screen back to the empty map self.btn.text = 'Analyze Route' #replaces the text with the original text self.btn.background_color = hex('#83A55C') self.count = 0 #reverts count back to zero self.manager.current = 'menu' #goes back to menu screen vals = [0.0, 0.0, 0.0, 0.0] #revert vals back to original list self.manager.transition.direction = 'down'
def _on_file_drop(self, window, file_path): homeScreen = self.manager.get_screen('homeScreen') homeScreen.path = file_path.decode("utf-8") if ((window.mouse_pos[0] / window.size[0]) < 0.5): if (os.path.isdir(homeScreen.path)): homeScreen.fileImport("Directory") self.fileSpellChecker = FileSpellChecker( directoryManager.dirContents) result = self.fileSpellChecker.spellCheck() misspelledWords = [] suggestions = [] for index, x in enumerate(result): misspelledWords.append({'text': x[0] + x[1]}) suggestions.append({'text': str(index) + ": " + x[2][0]}) directoryManager.suggestions = result spellChecker = self.manager.get_screen('spellCheckerScreen') spellChecker.misspelledWords.data = misspelledWords spellChecker.suggestions.data = suggestions spellChecker.folderName.text = os.path.splitext( directoryManager.path)[0] self.manager.current = "spellCheckerScreen" self.manager.transition.direction = "left" else: fileImg1_animation = Animation( color=hex("#c93838"), duration=0.0) + Animation( color=hex("#c93838"), duration=0.5) + Animation( color=homeScreen.fileImg1.color, duration=2.0) fileImg1_animation.start(homeScreen.fileImg1) homeScreen.fileImg1.color = hex("#c9c9c9") else: if (os.path.isfile(homeScreen.path)): homeScreen.fileImport("File") self.manager.current = "spellCheckerScreen" self.manager.transition.direction = "left" else: fileImg2_animation = Animation( color=hex("#c93838"), duration=0.0) + Animation( color=hex("#c93838"), duration=0.5) + Animation( color=homeScreen.fileImg2.color, duration=2.0) fileImg2_animation.start(homeScreen.fileImg2) homeScreen.fileImg2.color = hex("#c9c9c9")
from kivy.utils import get_color_from_hex as hex # config SIM_MODE = True UPDATE_INTERVAL = 1.0/60 # colors BLUE = hex('#83BCFE') ORANGE = hex('#FF9F00') GREEN = hex('#8FD345')
dt = dt.now() conn = sql.connect(f"C:/Users/ejrfl/Dropbox/bd_pointEsp/pointesp.db") cursor = conn.cursor() conn.close() def disconectBD(): return conn.close() Config.set('kivy', 'window_icon', 'img/icone.png') Config.set('kivy', 'exit_on_escape', '0') Window.clearcolor = hex("#e9e9bb") Window.size = (1366, 768) Config.write() def msg_suporte(mensagem): server = smtplib.SMTP('smtp.gmail.com', 587) server.ehlo() server.starttls() user = "******" senha = "123point456" para = "*****@*****.**" msg = mensagem try: server.login(user, senha)
def drawInformationContainer(self): information_layout = BoxLayout(orientation='vertical', size_hint=(1 - skinContainerSize, 1)) championNameLayout = RelativeLayout(size_hint=(1, 0.15)) infoSize = (Window.width) * (1 - skinContainerSize) infoSize = math.floor(infoSize / 5) championName = Label(text=self.championName, font_size='32sp', pos_hint={ 'middle': 1, 'top': 1 }) back_button = Button( on_press=lambda back: self.returnToSearch(), background_normal='images\\icons\\back-arrow-white.png', background_down='images\\icons\\back-arrow-white_pressed.png', size_hint=(0.03, 0.2), pos_hint={ 'right': 0.98, 'y': 0.75 }, border=(0, 0, 0, 0)) tp = TabbedPanel(tab_pos='top_mid', padding=(dp(20), dp(2), dp(2), dp(2)), tab_width=infoSize, do_default_tab=False, size_hint=(1, 0.85)) labelText = TabbedPanelItem(text="Statistics", background_color=(0, 0, 0, 0), halign="left", disabled_color=hex('#ffffff'), font_size=20) labelText.disabled = True defenseTab = TabbedPanelItem(id='defenseTab', background_color=hex('#5BBD80'), text='Defense', content=self.drawDefenseLayoutContent()) offenseTab = TabbedPanelItem(background_color=hex('#C3403C'), text='Offensive', content=self.drawOffensiveLayoutContent()) rangesTab = TabbedPanelItem(background_color=hex('#0988DB'), text='Ranges', content=self.drawRangesLayoutContent()) abilitiesTab = TabbedPanelItem( background_color=hex('#E1E135'), text='Abilities', content=self.drawAbilitiesLayoutContent()) tp.add_widget(labelText) tp.add_widget(defenseTab) tp.add_widget(offenseTab) tp.add_widget(rangesTab) tp.add_widget(abilitiesTab) #switches the tabbed panel to whatever we want to set as our default Clock.schedule_once(lambda dt: tp.switch_to(defenseTab), 0.1) championNameLayout.add_widget(championName) championNameLayout.add_widget(back_button) information_layout.add_widget(championNameLayout) information_layout.add_widget(tp) return information_layout
class EntityColor(): Brown = hex('#d97f09') Blue = hex('#4266f5')
def path( self, instance ): #depending on user input/sensor input, the path will be determined by the algorithm self.count += 1 self.route = self.main(Screen) #print self.route if self.route == 'ABC': #for the purposes of this project, we determine the routes in advance. However in a full implementation, we will use maps api to generate the routes. if self.count == 1: self.image.source = 'ADA2.png' self.btn.text = 'Bin cleared. Next route!' elif self.count == 2: self.image.source = 'AAB2.png' elif self.count == 3: self.image.source = 'ABC2.png' elif self.count >= 4: self.image.source = 'ACD2.png' self.btn.text = 'All bins cleared!' self.btn.background_color = hex('#CBCEEE') if self.route == 'ACB': if self.count == 1: self.image.source = 'ADA2.png' self.btn.text = 'Bin cleared. Next route!' elif self.count == 2: self.image.source = 'AAC2.png' elif self.count == 3: self.image.source = 'ACB2.png' elif self.count >= 4: self.image.source = 'ABD2.png' self.btn.text = 'All bins cleared!' self.btn.background_color = hex('#CBCEEE') if self.route == 'BAC': if self.count == 1: self.image.source = 'ADB2.png' self.btn.text = 'Bin cleared. Next route!' elif self.count == 2: self.image.source = 'ABA2.png' elif self.count == 3: self.image.source = 'AAC2.png' elif self.count >= 4: self.image.source = 'ACD2.png' self.btn.text = 'All bins cleared!' self.btn.background_color = hex('#CBCEEE') if self.route == 'BCA': if self.count == 1: self.image.source = 'ADB2.png' self.btn.text = 'Bin cleared. Next route!' elif self.count == 2: self.image.source = 'ABC2.png' elif self.count == 3: self.image.source = 'ACA2.png' elif self.count >= 4: self.image.source = 'AAD2.png' self.btn.text = 'All bins cleared!' self.btn.background_color = hex('#CBCEEE') if self.route == 'CAB': if self.count == 1: self.image.source = 'ADC2.png' self.btn.text = 'Bin cleared. Next route!' elif self.count == 2: self.image.source = 'ACA2.png' elif self.count == 3: self.image.source = 'AAB2.png' elif self.count >= 4: self.image.source = 'ABD2.png' self.btn.text = 'All bins cleared!' self.btn.background_color = hex('#CBCEEE') if self.route == 'CBA': if self.count == 1: self.image.source = 'ADC2.png' self.btn.text = 'Bin cleared. Next route!' elif self.count == 2: self.image.source = 'ACB2.png' elif self.count == 3: self.image.source = 'ABA2.png' elif self.count >= 4: self.image.source = 'AAD2.png' self.btn.text = 'All bins cleared!' self.btn.background_color = hex('#CBCEEE')