Esempio n. 1
0
 def _show_main( self ):
     self.last_pos_container_9000 = xbmc.getInfoLabel( "Container(9000).Position" )
     try:
         import MainGui
         self._close_script()
         MainGui.show_main( self.action, self.last_pos_container_9000 )
         del MainGui
     except:
         print_exc()
     self.action = None
Esempio n. 2
0
 def _show_main(self):
     self.last_pos_container_9000 = xbmc.getInfoLabel(
         "Container(9000).Position")
     try:
         import MainGui
         self._close_script()
         MainGui.show_main(self.action, self.last_pos_container_9000)
         del MainGui
     except:
         print_exc()
     self.action = None
Esempio n. 3
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. 4
0
        :return: Returns the data received from the serial port
        """
        # TODO: Trouver une facon de mettre un vrai timeout sur readline
        print('Reading port...')
        self.ser.flush()
        while True:
            message = ''
            message = self.ser.readline()[:-2]
            message = str(message)
            print(message)
            return message

    def readNow(self):
        message = ''
        message = self.ser.readline()[:-2]
        message = str(message)
        print(message)
        self.ser.flush()
        return message

        
    def writePort(self, packet):
        """ This function writes the input packet to the serial port
        :param packet: Information packet to send to serial port
        :return: None
        """
        self.ser.write(packet)

if __name__ == '__main__':
    MainGui.main()