Esempio n. 1
0
def checkLogin():
    #---------------------------------------------------------------
    #   Open up the username_profile.txt and verify the user credentials
    #       if the credentials match what is in file, upload user progress
    #        from file and go to main home screen
    #
    #---------------------------------------------------------------
    profileName = loginUsernameEntry.get() + "_profile.txt"
    #Check if the username profile exist
    if os.path.isfile(profileName):
        existingProfile = Methods.fileSplitter(profileName)
        searchedUsername = existingProfile[2]
        searchedPassword = existingProfile[3]
        #Check if the username and passwrod match
        if (searchedUsername == loginUsernameEntry.get()
                and searchedPassword == loginPasswordEntry.get()):
            # Send user to homePage
            Label(frame, text="Successful Login").grid(row=2, column=2)
            #Go to the home Screen module
            Home.main(root, frame)
        else:
            Label(frame, text="incorrect password/username").grid(row=2,
                                                                  column=2)
    else:
        Label(frame, text="incorrect password/username").grid(
            row=3, column=2)  # remove the hard code
Esempio n. 2
0
    def _close_dialog( self, OK=False ):
        # verifie si l'option default a ete utilise, si oui remets l'etat du custom backgroung
        if not OK:
            if ( self.passion_show_fanart != xbmc.getCondVisibility( "!Skin.HasSetting(PassionShowFanart)" ) ):
                xbmc.executebuiltin( "Skin.ToggleSetting(PassionShowFanart)" )
            if ( self.use_custom_background != xbmc.getCondVisibility( "!Skin.HasSetting(use_passion_custom_background)" ) ):
                xbmc.executebuiltin( "Skin.ToggleSetting(use_passion_custom_background)" )
            if ( self.custom_background != unicode( xbmc.getInfoLabel( 'Skin.String(passion_custom_background)' ), 'utf-8') ):
                xbmc.executebuiltin( "Skin.SetString(passion_custom_background,%s)" % ( self.custom_background, ) )

        if "Dialog" in XBMCGUI_WINDOW_XML:
            import time
            xbmc.executebuiltin( "Skin.Reset(AnimeWindowXMLDialogClose)" )
            time.sleep( .1 ) # pour les fade plus que .1 pas beau :(
        else:
            xbmc.sleep( 100 )
        self.close()
        if self.homeLastPosition is not None:
            try:
                import Home
                Home.show_home( self.homeLastPosition )
            except:
                print_exc()
        if self.reload_script:
            self.mainwin._close_script()
            sys.modules[ "__main__" ].MAIN()
        sys.modules[ "__main__" ].output.PRINT_DEBUG = ( XBMC_SETTINGS.getSetting( "script_debug" ) == "true" )
Esempio n. 3
0
    def _close_dialog(self, OK=False):
        # verifie si l'option default a ete utilise, si oui remets l'etat du custom backgroung
        if not OK:
            if (self.passion_show_fanart != xbmc.getCondVisibility(
                    "!Skin.HasSetting(PassionShowFanart)")):
                xbmc.executebuiltin("Skin.ToggleSetting(PassionShowFanart)")
            if (self.use_custom_background != xbmc.getCondVisibility(
                    "!Skin.HasSetting(use_passion_custom_background)")):
                xbmc.executebuiltin(
                    "Skin.ToggleSetting(use_passion_custom_background)")
            if (self.custom_background != unicode(
                    xbmc.getInfoLabel(
                        'Skin.String(passion_custom_background)'), 'utf-8')):
                xbmc.executebuiltin(
                    "Skin.SetString(passion_custom_background,%s)" %
                    (self.custom_background, ))

        if "Dialog" in XBMCGUI_WINDOW_XML:
            import time
            xbmc.executebuiltin("Skin.Reset(AnimeWindowXMLDialogClose)")
            time.sleep(.1)  # pour les fade plus que .1 pas beau :(
        else:
            xbmc.sleep(100)
        self.close()
        if self.homeLastPosition is not None:
            try:
                import Home
                Home.show_home(self.homeLastPosition)
            except:
                print_exc()
        if self.reload_script:
            self.mainwin._close_script()
            sys.modules["__main__"].MAIN()
        sys.modules["__main__"].output.PRINT_DEBUG = (
            XBMC_SETTINGS.getSetting("script_debug") == "true")
Esempio n. 4
0
def main():
    """ Main function for photocopier, this is where it starts. """

    # Toggle: 1 -> Register
    # Toggle: 0 -> Login

    scr = screen.Screen()
    menu1 = menu.menu_screen(
        scr, "Start", ["", "Welcome to the Boring Company photocopier", ""])

    # Login
    menu1.add_menu("Login", account.register_or_login, False, screen=scr,
                   toggle=True)

    # Register
    menu1.add_menu("Register", account.register_or_login, False, screen=scr,
                   toggle=False)

    # Shutdown
    menu1.add_menu("Shutdown", shutdown, False, screen=scr)

    menu1.print_menu()
    ret, info = menu1.select_menu()

    if not ret:
        account.fix_file()
        Home.home(info[0], info[1], info[2], info[3])

    else:
        return
Esempio n. 5
0
 def Reg():
     gender = variable.get()
     valid = validator(gender)
     if valid:
         insert(gender)
         register.withdraw()
         username = eUsername.get()
         Home.launch(username)
Esempio n. 6
0
 def _close_dialog( self ):
     #xbmc.sleep( 100 )
     self.close()
     if self.homeLastPosition is not None:
         try:
             import Home
             Home.show_home( self.homeLastPosition )
         except:
             print_exc()
Esempio n. 7
0
 def populateHood(self, size):
     neigh = []
     for i in range(0, size):
         hood = []
         for j in range(0, size):
             newHome = Home()
             self.count = self.count + newHome.getNumMonsters()
             hood.append(newHome)
             newHome.add_observer(self)
         neigh.append(hood)
     return neigh
Esempio n. 8
0
	def genHouses(self, size):
		neighborhood = []
		for x in range(0, size):
			streetHomes = []
			for y in range(0, size):
				tempHome = Home()
				self.monstersInHouses = self.monstersInHouses + tempHome.numMonster()
				streetHomes.append(tempHome)
				tempHome.add_observer(self)
			neighborhood.append(streetHomes)
		return neighborhood
Esempio n. 9
0
def home_predicting(location, rooms, meterix):

    Home.Home_data_fetching()
    dbconnector_H = mysql.connector.connect(host="127.0.0.1",
                                          user="******" % mysq_useranem,
                                          password="******" % mysql_password,
                                          database="H_C",
                                          table="home_info"
                                          )
    my_cursor_H = dbconnector_H.cursor()

    X2 = [location, rooms, meterix]
    Y2 = []#price of home

    my_cursor_H.execute("SELECT location, rooms, meterix FROM home_info;")
    res3 = my_cursor_H.fetchall()
    for row3 in res3:
        X2.append(row3)
    my_cursor_H.execute("SELECT price FROM home_info;")
    res4 = my_cursor_H.fetchall()
    for row4 in res4:
        Y2.append(row4)
    person2 = [[location, rooms, meterix]]
    hompred = tree.DecisionTreeClassifier()
    hompred = hompred.fit(X2, Y2)
    answer2 = hompred.predict(person2)
    dbconnector_H.commit()
    dbconnector_H.close()
    my_cursor_H.close()
    return answer2
Esempio n. 10
0
	def __init__(self, game):
		self.grid = []
		for row in range(self.GRID_SIZE):
			self.grid.append(list())
			for col in range(self.GRID_SIZE):
				tmp = Home.Home(game)
				self.grid[row].append(tmp)
 def action(self,event):
     fcs=self.tr.focus()
     col=self.tr.identify_column(event.x)
     x=self.tr.item(fcs).get('values')
     text=x[1]
     data=(
         text,
     )
     if col=="#7":
         res=msg.askyesno("Message!","Do you want to delete this product?")
         if res:
             d=Database.delete_details(data)
             if d:
                 msg.showinfo("Deleted","Your product has been deleted successfully!!!")
                 self.window.destroy()
                 x=show()
                 x.add_background()
                 x.add_table()
             else:
                 self.window.destroy()
                 x=show()
                 x.add_table()
     elif col=="#6":
         x=Home.data(self.tr.item(fcs))
         x.add_frame()
     elif col=="#8":
         x = Sales_Products_Records.data(self.tr.item(fcs))
         x.add_frame()
Esempio n. 12
0
 def __init__(self):
     super(Neighborhood, self).__init__()
     self.x = random.randint(2, 5)
     self.y = random.randint(2, 5)
     self.houselist = []
     self.housesdefeated = 0
     self.totalhousecount = self.x * self.y
     for i in xrange(self.y):
         for j in xrange(self.x):
             house = Home.Home()
             self.houselist.append(house)
             house.add_observer(self)
     self.neighborlist = []
     for i in xrange(self.totalhousecount):
         south = i - self.y
         east = i + 1
         north = i + self.y
         west = i - 1
         if south < 0:
             south = None
         if east > self.totalhousecount or east % self.x == 0:
             east = None
         if west < 0 or west % self.x == (self.x - 1):
             west = None
         if north > self.totalhousecount:
             north = None
     neighbor = [north, east, south, west]
     self.neighborlist.append(neighbor)
Esempio n. 13
0
 def _close_credits( self ):
     xbmc.executebuiltin( 'Skin.Reset(IPX_HideVisu)' )
     try:
         if self.player.isPlaying():
             self.player.stop()
     except:
         print_exc()
     try: self.auto_close.cancel()
     except: print_exc()
     self.close()
     if self.homeLastPosition is not None:
         try:
             import Home
             Home.show_home( self.homeLastPosition )
         except:
             print_exc()
Esempio n. 14
0
 def login(self, root):
     id_ip = self.idEntry.get()
     pw_ip = self.pwEntry.get()
     if ES.authenticate(id_ip, pw_ip):
         self.clear()
         Home.Home(root)
     else:
         messagebox.showerror("Failed Login", "Invalid Credentials")
Esempio n. 15
0
 def _close_dialog( self ):
     #xbmc.sleep( 100 )
     for id in range( self.CONTROL_MAIN_LIST_START, self.CONTROL_MAIN_LIST_END + 1 ):
         try:
             if xbmc.getCondVisibility( "Control.IsVisible(%i)" % id ):
                 self.settings[ "manager_view_mode" ] = id
                 Settings().save_settings( self.settings )
                 break
         except:
             pass
     self.close()
     if self.homeLastPosition is not None:
         try:
             import Home
             Home.show_home( self.homeLastPosition )
         except:
             print_exc()
Esempio n. 16
0
 def _close_credits(self):
     xbmc.executebuiltin('Skin.Reset(IPX_HideVisu)')
     try:
         if self.player.isPlaying():
             self.player.stop()
     except:
         print_exc()
     try:
         self.auto_close.cancel()
     except:
         print_exc()
     self.close()
     if self.homeLastPosition is not None:
         try:
             import Home
             Home.show_home(self.homeLastPosition)
         except:
             print_exc()
Esempio n. 17
0
 def _close_dialog(self):
     #xbmc.sleep( 100 )
     for id in range(self.CONTROL_MAIN_LIST_START,
                     self.CONTROL_MAIN_LIST_END + 1):
         try:
             if xbmc.getCondVisibility("Control.IsVisible(%i)" % id):
                 self.settings["manager_view_mode"] = id
                 Settings().save_settings(self.settings)
                 break
         except:
             pass
     self.close()
     if self.homeLastPosition is not None:
         try:
             import Home
             Home.show_home(self.homeLastPosition)
         except:
             print_exc()
Esempio n. 18
0
 def __init__(self, cols, rows, game, player):
     self._grid = [[0 for i in range(cols)] for j in range(rows)]
     for x in range(cols):
         for y in range(rows):
             obj = None
             placement = randint(0, 3)
             if placement is 0:
                 obj = Home(self)
             else:
                 obj = 0
             self._grid[x][y] = obj
     self._grid[0][0] = 0
     self._game = game
     self._player = player
Esempio n. 19
0
    def submitAction(self):
        with open('Account.txt', 'a') as wf:
            wf.write('\n%s;%s' %
                     (self.userField.text(), self.passwordField.text()))

        with open('UserInfo.txt', 'a') as af:
            af.write('\n%s;%s' %
                     (self.userField.text(), self.nameField.text()))

        msg = QMessageBox()
        msg.setWindowTitle("Success")
        msg.setText('Account Added')
        msg.setIcon(QMessageBox.Information)
        x = msg.exec_()

        self.openHome = home.Home()
        self.openHome.show()
        self.close()
def login(event):
    data = (user.get(), passw.get())
    if user.get() == "" and passw.get() == "":
        msg.showwarning("username & password!", "Plz set BOTH!!")
    elif user.get() == "":
        msg.showwarning("username!", "plz set Username First!!")
    elif passw.get() == "":
        msg.showwarning("password!", "plz set password First!!")
    else:
        res = Database.user_login(data)
        if res:
            msg.showinfo('Successfully!', "Login Successfully!!")
            root.destroy()
            x = Home.data()
            x.add_frame()
        else:
            msg.showwarning("Error!", "Username/Password Incorect!")
            user.set("")
            passw.set("")
Esempio n. 21
0
def display_page(pathname):
    if pathname == '/':
        return home.getLayout()
    elif pathname == '/see_the_data':
        return seeTheData.getLayout()
    elif pathname == '/about_us':

        return aboutUs.getLayout()
    elif pathname == '/data_view1':
        return dataView.getLayout1()
    elif pathname == '/data_view2':
        return dataView.getLayout2()
    elif pathname == '/data_view3':
        return dataView.getLayout3()
    elif pathname == '/data_view4':
        return dataView.getLayout4()
    elif pathname == '/data_view5':
        return dataView.getLayout5()
    elif pathname == '/data_view6':
        return aboutCovid.getLayout()
    elif pathname == '/p2p':
        return p2p.getLayout()
Esempio n. 22
0
    def action(self, event):
        fcs = self.tr.focus()
        col = self.tr.identify_column(event.x)
        x = self.tr.item(fcs).get('values')
        text = x[1]
        data = (text, )

        if col == "#6":
            res = msg.askyesno("Message!", "Do you want to delete?")
            if res:
                d = Database_Insert.delete_details(data)
                if d:
                    msg.showinfo("Deleted", "Successfully")
                    self.window.destroy()
                    x = Search()
                    x.add_fram_search()
                else:
                    self.window.destroy()
                    x = Search()
                    x.add_fram_search()
        elif col == "#5":
            # self.window.destroy()
            x = Home.data(self.tr.item(fcs))
            x.add_frame()
Esempio n. 23
0
'''
Created on 2. jan. 2015

@author: Eirik
'''
from Home import *






if __name__ == "__main__":
    home = Home()
    home.defaultSetup()
    home.run()
Esempio n. 24
0
import Home
import AutomationManager

print("Loading Automations")
AutomationManager.loadAutomations()
print("Start Home Assistant Connection")
Home.run()
Esempio n. 25
0
 def add_products(self):
     self.window.destroy()
     home = Home.data()
     home.add_background()
     home.add_frame()
 def turnOff(self):
     Home.sendCommand("light", "turn_off", {"entity_id": self.id})
 def isOn(self):
     return Home.getState()[self.id]["state"] == "on"
Esempio n. 28
0
    import Tkinter as tk
except ImportError:
    import tkinter as tk

try:
    import ttk
    py3 = False
except ImportError:
    import tkinter.ttk as ttk
    py3 = True

def init(top, gui, *args, **kwargs):
    global w, top_level, root
    w = gui
    top_level = top
    root = top

def destroy_window():
    # Function which closes the window.
    global top_level
    top_level.destroy()
    top_level = None

if __name__ == '__main__':
    import Home
    Home.vp_start_gui()




Esempio n. 29
0
import sys
sys.path.insert(1, 'Resource/')
from PyQt5.QtWidgets import QApplication
import Home


if __name__ == '__main__':
    app = QApplication([])
    home = Home.HomePage()
    home.show()
    conn = Home.contrl(home)
    sys.exit(app.exec_())
 def home(self):
     #self.t.cancel()
     self.flag_DesactivaVista = True
     #self.instanciaModbus.closePort()
     self.home = Home.Ui_MainWindow()
     self.home.setupUi(self.MainWindow, self.s)
Esempio n. 31
0
class Control():
    def __init__(self):
        self.IA = Alice()
        self.Home = Home()
        self.create_home()
        self.memory = []
    
    def create_home(self):
        self.Home.KidRoom.new('bombillo')
        self.Home.KidRoom.new('puerta', {'seguro':False, 'abierta':False})
        self.Home.KidRoom.new('ventana')
        self.Home.MainRoom.new('bombillo')
        self.Home.MainRoom.new('puerta', {'seguro':False, 'abierta':False})
        self.Home.MainRoom.new('ventana')
        self.Home.Kitchen.new('bombillo')
        self.Home.Kitchen.new('puerta', {'seguro':False, 'abierta':False})
        self.Home.Kitchen.new('estufa', {'boquilla1':False, 'boquilla2':False, 'boquilla3':False, 'boquilla4':False})
        self.Home.Livingroom.new('bombillo')
        self.Home.Livingroom.new('puerta', {'seguro':False, 'abierta':False})
        self.Home.Garage.new('bombillo')
        self.Home.Garage.new('puerta', {'seguro':False, 'abierta':False})
        self.Home.Hall.new('bombillo')
        self.Home.Hall.new('puerta', {'seguro':False, 'abierta':False})
        
    def interact_console(self):
        while True:
            reply = self.get_response(raw_input(">"))
            if not reply: return 0 #Si se envio salir, terminar.
            if reply[0] == '$': print reply[1:]; continue
            acts = reply[1].split(',')
            print acts
            if not self.memory: #Si no hay una conversacion pendiente
                #Si la respuesta tiene opciones, agreguelas a la memoria:
                if 'OPT' in reply[1]: self.memory.append(acts[1:])
                elif 'QST' in reply[1]: reply[0] = str(self.Home.get(acts[1],acts[2]))
                else:
                    try:
                        self.Home.set(acts[0], acts[1], acts[2], acts[3])
                    except GenericError as e:
                        reply[0] = e.value_
            else: #Si hay memoria
                if acts[0] == 'SLF': 
                    try:
                        self.Home.set(acts[1], self.memory[0][0], self.memory[0][1], self.memory[0][2])
                        self.memory = []
                    except GenericError as e:
                        reply[0] = e.value_
            print reply[0]

    def interact(self, msg):
        reply = self.get_response(msg)
        if not reply: exit() #Si se envio salir, terminar.
        if reply[0] == '$': return reply[1:]
        acts = reply[1].split(',')
        print acts
        if not self.memory: #Si no hay una conversacion pendiente
            #Si la respuesta tiene opciones, agreguelas a la memoria:
            if 'OPT' in reply[1]: self.memory.append(acts[1:])
            elif 'QST' in reply[1]: return str(self.Home.get(acts[1],acts[2]))
            else:
                try:
                    self.Home.set(acts[0], acts[1], acts[2], acts[3])
                except GenericError as e:
                    reply[0] = e.value_
        else: #Si hay memoria
            if acts[0] == 'SLF': 
                try:
                    self.Home.set(acts[1], self.memory[0][0], self.memory[0][1], self.memory[0][2])
                    self.memory = []
                except GenericError as e:
                    reply[0] = e.value_
        return reply[0]
            
    def get_response(self, msg):
        if msg == 'salir':
            return ""
        reply = self.IA.respond(msg)
        if reply == None:
            return random.choice(escapes)
        return reply

# control = Control()
# cont.interact()
Esempio n. 32
0
 def __init__(self):
     self.IA = Alice()
     self.Home = Home()
     self.create_home()
     self.memory = []
Esempio n. 33
0
def MAIN():
    try: output.PRINT_DEBUG = ( XBMC_SETTINGS.getSetting( "script_debug" ) == "true" )
    except: print_exc()

    # print depend of output.PRINT_DEBUG is True or False
    print "bypass_debug: %s" % str( "-" * 100 )
    print "bypass_debug: Starting %s %s, %s, SVN r%s. Built on %s" % ( __script__, __version__, __statut__, __svn_revision__, __date__ )
    print "bypass_debug: The executable script running is: %s" % os.path.join( os.getcwd(), "default.py" )
    print "bypass_debug: %s" % str( "-" * 100 )
    dialog_error = False
    updating = False
    try:
        from utilities import getUserSkin
        current_skin, force_fallback = getUserSkin()
        print "bypass_debug: load default skin:[%s]" % current_skin
        print "bypass_debug: default skin use force fallback: %s" % repr( force_fallback )
        del getUserSkin
    except:
        pass

    #setup skins utilities and reload xbmc skin if necessary
    import skins_utilities
    if skins_utilities.setupUtilities():
        print "Reloaded Skin: %s" % xbmc.getSkinDir()
        xbmc.executebuiltin( "XBMC.Notification(%s,Reloaded Skin...,3000,%s)" % ( xbmc.getSkinDir(), os.path.join( os.getcwd(), "default.tbn" ), ) )
        xbmc.executebuiltin( "XBMC.ReloadSkin()" )
        xbmc.sleep( 2000 )

    # INITIALISATION CHEMINS DE FICHIER LOCAUX
    try:
        import CONF
        setconf = False
        config = CONF.ReadConfig()

        DIALOG_PROGRESS.update( -1, __language__( 101 ), __language__( 110 ) )
        curversion =  config.get('Version','version')
        if "1." in curversion:
            setconf = True
            
        if not config.getboolean( 'InstallPath', 'pathok' ):
            setconf = True

        if setconf:
            # GENERATION DES INFORMATIONS LOCALES
            CONF.SetConfiguration()
    except:
        dialog_error = True
        print "Error while setting the configuration"
        print_exc()

    # CHECK SCRIPT UPDATE AVAILABILITY AND UPDATE CONFIGUARTION FILE
    try:
        import CHECKMAJ
        try:
            CHECKMAJ.UPDATE_STARTUP = ( XBMC_SETTINGS.getSetting( "update_startup" ) == "true" )
        except:
            CHECKMAJ.UPDATE_STARTUP = False
            print_exc()
        print "CHECKMAJ.UPDATE_STARTUP = %s"%str(CHECKMAJ.UPDATE_STARTUP)
        if CHECKMAJ.UPDATE_STARTUP:
            DIALOG_PROGRESS.update( -1, __language__( 102 ), __language__( 110 ) )
            CHECKMAJ.go()
        del CHECKMAJ
    except:
        # In case of an Exception here we still load the script
        print "Error while checking availability of an update for the installer"
        print "We still going to start the script ..."
        print_exc()

    # RETRIEVING CONFIGURATION FROM CONF FILE
    try:
        config = CONF.ReadConfig()
        del CONF
    except:
        print "Error while reading the configuration"
        dialog_error = True
        print_exc()

    try:
        updating = config.getboolean( 'Version', 'UPDATING' )
    except:
        # Issue with conf file, stopping update
        dialog_error = True
        print_exc()
    try:
        if not updating:
            try:
                # LANCEMENT DU SCRIPT
                try:
                    import Home
                    DIALOG_PROGRESS.close()
                    HomeAction = Home.show_home()
                except:
                    print_exc()
                    HomeAction = "error"

                if HomeAction == "error":
                    import MainGui
                    MainGui.show_main()
            except:
                print "bypass_debug: MAIN: Exception while loading the script"
                print_exc()
                dialog_error = True
        else:
            # UPDATING THE SCRIPT
            try:
                scriptmaj = config.get( 'Version', 'SCRIPTMAJ' )
                xbmc.executescript( scriptmaj )
            except:
                print "bypass_debug: MAIN: Exception while updating of the script"
                print_exc()
                dialog_error = True

        if dialog_error: xbmcgui.Dialog().ok( __language__( 111 ), __language__( 112 ) )
    except:
        print_exc()
    DIALOG_PROGRESS.close()
Esempio n. 34
0
def intialize():
    print("App is initializing")
    Home.registerStateInitializedCallback(stateInitializedCallback)
    Home.registerStateChangedCallback(stateChangedCallback)
Esempio n. 35
0
def stateChangedCallback(entity, newState, oldState):
    allStates = Home.getState()
    print("Current state of entities: %r" % allStates)

    # service of Home Assistant can be invoked
    Home.sendCommand("light", "turn_off", "all")
Esempio n. 36
0
 def home(self):
     self.home = Home.Ui_MainWindow()
     self.home.setupUi(self.MainWindow, self.s)