Example #1
0
def about(version):
    """Display basic information about cyckei"""
    msg = "Cyckei version {}\n\n" \
          "Cyckei is developed by Gabriel Ewig and Vincent Chevrier " \
          "at Cyclikal, LLC.\n\n Updates and source code can be found " \
          "on GitLab at gitlab.com/cyclikal/cyckei. \n\nFor information" \
          "about Cyclikal, visit cyclikal.com.".format(version)
    func.message(msg)
Example #2
0
 def alert_check(self, result, message):
     if result:
         msg = {
             "text": "Passed!",
             "info": "Script is good to go.",
         }
     else:
         msg = {
             "text": "Failed!",
             "info": "Script did not pass the check.",
             "detail": message,
             "icon": func.Warning
         }
     func.message(**msg)
Example #3
0
    def increment_batch(self):
        """Increments last letter of batch by char number"""
        for channel in self.channels:
            working_list = list(channel.settings[3].text())
            if working_list:
                try:
                    current_letter = ord(working_list[-5])
                    next_letter = chr(current_letter + 1)
                    working_list[-5] = next_letter

                    channel.settings[3].setText("".join(working_list))
                except Exception as exception:
                    msg = {
                        "text": "Could not increment channel {}.\n".format(
                            channel["channel"]
                        ) + str(exception),
                        "icon": func.Warning
                    }
                    func.message(**msg)
Example #4
0
    def stop(self):
        msg = {
            "text": "Are you sure you want to quit Cyckei?",
            "info": "This will stop any current cycles and "
            "release control of all channels.",
            "icon": func.Warning,
            "confirm": True
        }

        if func.message(**msg):
            logging.warning("applet.applet.Icon.stop: Shutting down\n")
            sys.exit()
Example #5
0
def start():
    display.fill(white)

    message('Racecar Dodge', lobsterL, -75)
    message('By Shaunak Warty', lobsterS, 0)
    message('Press any key to start', lobsterS, 50)

    gear = pygame.image.load(r'Images\gear.png')
    gearRect = gear.get_rect(topright=(dispWD - 3, 3))
    display.blit(gear, gearRect)

    pygame.display.update()

    while True:
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                end()
            elif event.type == pygame.KEYUP:
                main()
                start()
            elif event.type == pygame.MOUSEBUTTONUP:
                mouse = pygame.mouse.get_pos()
                if gearRect.collidepoint(mouse):
                    settings()
                    start()

        clock.tick(10)
Example #6
0
 def load_batch(self):
     """Loads id and log information from file"""
     msg = {
         "text": "Load batch?",
         "info": "All current values will be overwritten.",
         "confirm": True,
         "icon": func.Question
     }
     if func.message(**msg):
         with open(self.config["record_dir"] + "/batch.txt", "r") as file:
             for index, line in enumerate(file):
                 channel = self.channels[index]
                 values = line.split(",")
                 if len(values) > 1:
                     channel.settings[2].setText(values[0])
                     channel.settings[3].setText(values[1])
Example #7
0
    def save_batch(self):
        """Saves id and log information to file"""
        msg = {
            "text": "Save batch?",
            "info": "Current saved batch will be deleted.",
            "confirm": True,
            "icon": func.Question
        }
        if func.message(**msg):
            batch = []
            for channel_widget in self.channels:
                channel = [channel_widget.attributes["cellid"],
                           channel_widget.attributes["path"]]
                batch.append(channel)

            with open(self.config["record_dir"] + "/batch.txt", "a") as file:
                file.truncate(0)
                for channel in batch:
                    for value in channel:
                        file.write(str(value) + ",")
                    file.write("\n")
f.clear()

# play the intro text
f.intro()

# prompt the player to start the game
raw_input("\n\nPress ENTER when you are ready!")

# clear the console
f.clear()

# first drawing of the gallows!!
f.draw(guesses)

#print a playful message to the player
f.message(guesses, random.choice(m[guesses]))

# print out the hidden word proxy
# the proxy starts out as a string of underscores
# which are replaced with letters when the player
# guesses correctly
f.printProxy(proxy)

# START THE GAME LOOP
# The game loop continues to run until the
# player has won or until our friend is hanged
while True:
    # deconstructing the tuple into
    # three disict variables
    # 'didfind' is a boolean that tells us whether the
    #          player guesses a correct character or not
Example #9
0
def main(record_dir="Cyckei"):
    """
    Begins execution of Cyckei.

    Args:
        record_dir: Optional path to recording directory.
    Returns:
        Result of app.exec_(), Qt's main event loop.

    """
    try:
        # Ensure Recording Directory is Setup
        record_dir = os.path.join(os.path.expanduser("~"), record_dir)
        file_structure(record_dir)

        # Setup Configuration
        with open(record_dir + "/config.json") as file:
            config = json.load(file)
        with open(func.find_path("assets/variables.json")) as file:
            var = json.load(file)
        config["version"] = var["version"]
        config["record_dir"] = record_dir

        # Setup Logging
        logging.basicConfig(filename="{}/cyckei.log".format(record_dir),
                            level=config["verbosity"],
                            format="%(asctime)s \t %(message)s")
        sys.excepthook = handler
    except Exception as e:
        print("An error occured before logging began.")
        print(e)

    logging.info("cyckei.main: Initializing Cyckei version {}".format(
        config["version"]))
    logging.debug("cyckei.main: Logging at debug level")

    # Create QApplication
    logging.debug("cyckei.main: Creating QApplication")
    app = QApplication(sys.argv)
    app.setStyle("fusion")
    app.setQuitOnLastWindowClosed(False)
    app.setWindowIcon(QIcon(func.find_path("assets/cyckei.png")))

    # Create Server's ZMQ Socket
    logging.debug("cyckei.server.server.main: Binding socket")
    try:
        context = zmq.Context(1)
        socket = context.socket(zmq.REP)
        socket.bind("{}:{}".format(config["zmq"]["server-address"],
                                   config["zmq"]["port"]))
    except zmq.error.ZMQError as error:
        logging.critical(
            "It appears the server is already running: ".format(error))
        msg = [
            "Cyckei Instance Already Running!",
            "To show client, open taskbar widget and click \"Launch Client\"",
            func.Critical, "Failed to initialize socket. "
            "This indicates an existing server insance. "
            "Error: {}".format(error)
        ]
        func.message(*msg)
        return
    logging.debug("cyckei.server.server.main: Socket bound successfully")

    # Start Server
    logging.debug("cyckei.main: Starting Server")
    server_thread = threading.Thread(target=server.main,
                                     args=(
                                         config,
                                         socket,
                                     ),
                                     daemon=True)
    server_thread.start()

    # Create Applet
    logging.debug("cyckei.main: Creating Applet")
    applet_object = applet.Icon(config)
    applet_object.show()

    # Create Client
    logging.debug("cyckei.main: Creating Initial Client")
    main_window = client.MainWindow(config)
    main_window.show()

    return app.exec_()
Example #10
0
while(validator):
  while escolhamenu not in {'1','2','3'}:
    print("welcome to "+sett.systenName);
    func.creatinMenu();
    escolhamenu=input("key ur option.. ");
    system("clear");




  if escolhamenu == "1":
    while(resp=="s"):
      i=0;
      system("clear");
      #client
      print(func.message(c1));
      c1.attrName.sort();
      for i in range(len(c1.attrName)):
        while(func.isEmpty(c1.attributes[i])==True or func.isSpecialChar(c1.attributes[i])==True):
          c1.attributes[i]=input(c1.attrName[i]+": ");
      system("clear")
    
    
    
      #service
      print(func.message(s1));
      s1.attrName.sort();
      for i in range(len(s1.attrName)):
        if i==0 or i==1:
          s1.attributes[i]="date";
          while(func.isdate(s1.attributes[i])==False):

# prompt the player to start the game
raw_input("\n\nPress ENTER when you are ready!")


# clear the console
f.clear()


# first drawing of the gallows!!
f.draw(guesses)


#print a playful message to the player
f.message(guesses, random.choice(m[guesses]))


# print out the hidden word proxy
# the proxy starts out as a string of underscores
# which are replaced with letters when the player
# guesses correctly
f.printProxy(proxy)


# START THE GAME LOOP
# The game loop continues to run until the
# player has won or until our friend is hanged
while True:
    # deconstructing the tuple into
    # three disict variables
Example #12
0
def help():
    """Direct to help"""
    msg = "For help refer to the HELP.md and README.md files located in" \
          "the cyckei install location, or online on our GitLab page." \
          "\n\ngitlab.com/cyclikal/cyckei"
    func.message(msg)
Example #13
0
defaults = dict(
    path='C:\\0Utvikling\\Installasjon\\bmc-tools-master\\output\\',
    extension='bmp')

if __name__ == '__main__':
    f.welcome_screen()
    main_menu = f.menu()
    keep_running = True
    while keep_running:
        command = input("> ").split(' ', maxsplit=2)
        if command[0] in main_menu:
            if main_menu[command[0]] == 1:  # help menu
                f.help_screen()
            elif main_menu[command[0]] == 2:  # load menu
                if len(command) > 1:
                    print('Loading ' + command[1])
                    f.find_images(path=command[1], file_extension=command[2])
                else:
                    print(f.message('invalid_path'))

            elif main_menu[command[0]] == 3:  # quick load
                list_images = f.find_images(defaults['path'],
                                            defaults['extension'])
                print(list_images)
                f.create_new_image(list_images)

            elif main_menu[command[0]] == 99:  # quit the program
                print(f.message('quit'))
                keep_running = False
        else:
            print("cannot find item")