Ejemplo n.º 1
0
    def scan(self):
        print("Welcome. This will help you to scan for alienfx-controllers and their lightning zones.")
        afxcontroldevs=AlienFXProber.find_controllers(self.vendorid)  # Get a list of all usb-devices with the given vendor-id
        for controller in afxcontroldevs:
            # Perform zone scanning for each controller found...
            zone = 1  # initial zone from which we start iterating
            vendorstring = "0x" + format(controller.idVendor, '04x')
            devicestring = "0x" + format(controller.idProduct, '04x')
            print("Found device \""+vendorstring + " / " + devicestring + "\". ")
            if self.askuser("Would you like to test a newer controller? Default=Y\r\n"
                            "Note that choosing a wrong controller will result in packet-errors.\r\n"
                            "In this case you might choose another one instead."):
                crev=2  # newer controller revision
            else:
                crev=1  # old controller revision
            print("- Testing zones...")
            while zone <= self.maxzone:
                # Iterate all possible zone codes (have a look at reverse-engineering-knowledgebase.txt for possible codes...)
                print("Testing zone \"0x"+format(zone, '04x')+"\"")
                if self.scanzone(zone, crev, controller.idVendor, controller.idProduct):
                    # Zone found
                    print("Zone found :)")
                    # Ask user for a name, store name and zonecode
                    zonename = self.askzonename()
                    self.zonesfound[zonename] = zone  # Store name an zone code in Dictionary
                zone = zone*2
            print("")
            print("These are your " + str(len(self.zonesfound.items())) + " zonecodes for the current controller (\"VID: "+vendorstring + " / DEV: " + devicestring + "\"):")
            for z in self.zonesfound.items():
                print(z[0]+": 0x"+format(z[1], '04x'))  # Print out each zone found
            print("")
            print("Current controller finished.")

        print("All controllers done. I hope i was helpful.")
Ejemplo n.º 2
0
    def scan(self):
        print("Welcome. This will help you to scan for alienfx-controllers and their lightning zones.")
        afxcontroldevs=AlienFXProber.find_controllers(self.vendorid)  # Get a list of all usb-devices with the given vendor-id
        for controller in afxcontroldevs:
            # Perform zone scanning for each controller found...
            zone = 1  # initial zone from which we start iterating
            vendorstring = "0x" + format(controller.idVendor, '04x')
            devicestring = "0x" + format(controller.idProduct, '04x')
            print("Found device \""+vendorstring + " / " + devicestring + "\". - Testing zones...")
            while zone <= self.maxzone:
                # Iterate all possible zone codes (have a look at reverse-engineering-knowledgebase.txt for possible codes...)
                print("Testing zone \"0x"+format(zone, '04x')+"\"")
                if self.scanzone(zone, "new", controller.idVendor, controller.idProduct):
                    # Zone found
                    print("Zone found :)")
                    # Ask user for a name, store name and zonecode
                    zonename = self.askzonename()
                    self.zonesfound[zonename] = zone  # Store name an zone code in Dictionary
                zone = zone*2
            print("")
            print("These are your " + str(len(self.zonesfound.items())) + " zonecodes for the current controller (\"VID: "+vendorstring + " / DEV: " + devicestring + "\"):")
            for z in self.zonesfound.items():
                print(z[0]+": 0x"+format(z[1], '04x'))  # Print out each zone found
            print("")
            print("Current controller finished.")

        print("All controllers done. I hope i was helpful.")
Ejemplo n.º 3
0
 def __init__(self):
     Gtk.Application.__init__(self)
     self.connect("activate", self.on_activate)
     self.controller = AlienFXProber.get_controller()
     self.themefile = AlienFXThemeFile(self.controller)
     self.selected_action = None
     self.action_type = self.themefile.KW_ACTION_TYPE_FIXED
     self.theme_edited = False
     self.set_theme_done = True
Ejemplo n.º 4
0
def start():
    """ Main entry point for the alienfx cli."""
    
    controller = AlienFXProber.get_controller()
    if controller is None:
        logging.error("No supported Alien FX controllers found!")
        quit()
        
    themefile = alienfx_themefile.AlienFXThemeFile(controller)
    try:
        argparser = argparse.ArgumentParser(
            description="""AlienFX is a utility to control the lighting effects 
                of your Alienware computer. 
                Lighting effect configurations are stored in theme files."""
        )
        argparser.add_argument(
            "-l", "--log", help="write detailed logging information to LOG"
        )
        argparser.add_argument(
            "-t", "--theme",
            help="set the lighting theme to THEME."
        )
        argparser.add_argument(
            "-s", "--list", action="store_const", const=1, 
            help="list all available lighting themes"
        )
        argparser.add_argument(
            "-v", "--version", action="version", 
            version="%(prog)s {}".format(alienfx.common.get_version())
        )
        args = argparser.parse_args()
        if args.log is not None:
            alienfx_logger.set_logfile(args.log)
        if args.list is not None:
            print "Available themes:"
            themes = themefile.get_themes()
            for t in themes:
                print "\t{}".format(t)
        elif args.theme is not None:
            themefile.load(args.theme)
            controller.set_theme(themefile)
            themefile.applied()
            
    except Exception as e:
        logging.error(e)
Ejemplo n.º 5
0
def start():
    """ Main entry point for the alienfx cli."""

    controller = AlienFXProber.get_controller()
    if controller is None:
        logging.error("No supported Alien FX controllers found!")
        quit()

    themefile = alienfx_themefile.AlienFXThemeFile(controller)
    try:
        argparser = argparse.ArgumentParser(
            description="""AlienFX is a utility to control the lighting effects 
                of your Alienware computer. 
                Lighting effect configurations are stored in theme files.""")
        argparser.add_argument(
            "-l", "--log", help="write detailed logging information to LOG")
        argparser.add_argument("-t",
                               "--theme",
                               help="set the lighting theme to THEME.")
        argparser.add_argument("-s",
                               "--list",
                               action="store_const",
                               const=1,
                               help="list all available lighting themes")
        argparser.add_argument("-v",
                               "--version",
                               action="version",
                               version="%(prog)s {}".format(
                                   alienfx.common.get_version()))
        args = argparser.parse_args()
        if args.log is not None:
            alienfx_logger.set_logfile(args.log)
        if args.list is not None:
            print "Available themes:"
            themes = themefile.get_themes()
            for t in themes:
                print "\t{}".format(t)
        elif args.theme is not None:
            themefile.load(args.theme)
            controller.set_theme(themefile)
            themefile.applied()

    except Exception as e:
        logging.error(e)
Ejemplo n.º 6
0
    def scan(self):
        print(
            "Welcome. This will help you to scan for alienfx-controllers and their lightning zones."
        )
        afxcontroldevs = AlienFXProber.find_controllers(
            self.vendorid
        )  # Get a list of all usb-devices with the given vendor-id
        for controller in afxcontroldevs:
            # Perform zone scanning for each controller found...
            zone = 1  # initial zone from which we start iterating
            vendorstring = "0x" + format(controller.idVendor, '04x')
            devicestring = "0x" + format(controller.idProduct, '04x')
            print("Found device \"" + vendorstring + " / " + devicestring +
                  "\". - Testing zones...")
            while zone <= self.maxzone:
                # Iterate all possible zone codes (have a look at reverse-engineering-knowledgebase.txt for possible codes...)
                print("Testing zone \"0x" + format(zone, '04x') + "\"")
                if self.scanzone(zone, "new", controller.idVendor,
                                 controller.idProduct):
                    # Zone found
                    print("Zone found :)")
                    # Ask user for a name, store name and zonecode
                    zonename = self.askzonename()
                    self.zonesfound[
                        zonename] = zone  # Store name an zone code in Dictionary
                zone = zone * 2

            print("These are your zonecodes for current controller (\"" +
                  vendorstring + " / " + devicestring + "\"):")
            for z in self.zonesfound.items():
                print(z[0] + ": 0x" +
                      format(z[1], '04x'))  # Print out each zone found
            print("")
            print("Current controller finished.")

        print("All controllers done. I hope i was helpful.")
Ejemplo n.º 7
0
def start():
    """ Main entry point for the alienfx cli."""
    print("You are running alienfx under Python-Version: " + sys.version)

    # You may switch the commenting of the following 2 lines to force zonescan-execution
    controller = AlienFXProber.get_controller(
    )  # DEBUG: you may comment this out for development of zonescanner
    # controller = None  # DEBUG: you may uncomment this out for development of zonescanner

    if controller is None:
        logging.error(
            "No Alien FX controller, defined by a supported model, found!")
        logging.info("Asking user for zone probing...")
        # print("No Alien FX controller, defined by a supported model, found.")
        if askuser("Would you like to perform a zonescan?"):
            # User answered yes: Zonescan should be performed
            doZonescan()
            print("Zonescan finished")
            logging.info("Zonescan finished")
            return True
        else:
            # No Zonescan should be performed
            print("OK. Bye.")
            logging.info("Zonescanning not performed")
        quit()  # Finish

    themefile = alienfx_themefile.AlienFXThemeFile(controller)
    try:
        argparser = argparse.ArgumentParser(
            description="""AlienFX is a utility to control the lighting effects 
                of your Alienware computer. 
                Lighting effect configurations are stored in theme files.""")
        argparser.add_argument(
            "-l", "--log", help="write detailed logging information to LOG")
        argparser.add_argument("-t",
                               "--theme",
                               help="set the lighting theme to THEME.")
        argparser.add_argument("-s",
                               "--list",
                               action="store_const",
                               const=1,
                               help="list all available lighting themes")
        argparser.add_argument("-v",
                               "--version",
                               action="version",
                               version="%(prog)s {}".format(
                                   alienfx.common.get_version()))
        argparser.add_argument("-z",
                               "--zonescan",
                               action="store_true",
                               help="starts a zonescan")
        args = argparser.parse_args()
        if args.zonescan is not None:
            if args.zonescan:
                doZonescan()
                return True

        if args.log is not None:
            alienfx_logger.set_logfile(args.log)
        if args.list is not None:
            print("Available themes:")
            themes = themefile.get_themes()
            for t in themes:
                print(("\t{}").format(t))
        elif args.theme is not None:
            themefile.load(args.theme)
            controller.set_theme(themefile)
            themefile.applied()

    except Exception as e:
        logging.error(e)
Ejemplo n.º 8
0
def start():
    """ Main entry point for the alienfx cli."""
    print("You are running alienfx under Python-Version: "+sys.version)

    # You may switch the commenting of the following 2 lines to force zonescan-execution
    controller = AlienFXProber.get_controller()  # DEBUG: you may comment this out for development of zonescanner
    # controller = None  # DEBUG: you may uncomment this out for development of zonescanner

    if controller is None:
        logging.error("No Alien FX controller, defined by a supported model, found!")
        logging.info("Asking user for zone probing...")
        # print("No Alien FX controller, defined by a supported model, found.")
        if askuser("Would you like to perform a zonescan?"):
            # User answered yes: Zonescan should be performed
            doZonescan()
            print("Zonescan finished")
            logging.info("Zonescan finished")
            return True
        else:
            # No Zonescan should be performed
            print("OK. Bye.")
            logging.info("Zonescanning not performed")
        quit()  # Finish
        
    themefile = alienfx_themefile.AlienFXThemeFile(controller)
    try:
        argparser = argparse.ArgumentParser(
            description="""AlienFX is a utility to control the lighting effects 
                of your Alienware computer. 
                Lighting effect configurations are stored in theme files."""
        )
        argparser.add_argument(
            "-l", "--log", help="write detailed logging information to LOG"
        )
        argparser.add_argument(
            "-t", "--theme",
            help="set the lighting theme to THEME."
        )
        argparser.add_argument(
            "-s", "--list", action="store_const", const=1, 
            help="list all available lighting themes"
        )
        argparser.add_argument(
            "-v", "--version", action="version", 
            version="%(prog)s {}".format(alienfx.common.get_version())
        )
        argparser.add_argument(
            "-z", "--zonescan", action="store_true", help="starts a zonescan"
        )
        args = argparser.parse_args()
        if args.zonescan is not None:
            if args.zonescan:
                doZonescan()
                return True

        if args.log is not None:
            alienfx_logger.set_logfile(args.log)
        if args.list is not None:
            print("Available themes:")
            themes = themefile.get_themes()
            for t in themes:
                print(("\t{}").format(t))
        elif args.theme is not None:
            themefile.load(args.theme)
            controller.set_theme(themefile)
            themefile.applied()
            
    except Exception as e:
        logging.error(e)