Beispiel #1
0
    def get_project(previous=None):
        """get the project number through user input"""
        if previous is not None:
            print("(Leave blank to keep previous)")

        project_string = input("please enter your five digit project number: ")

        if project_string.isdigit():
            if len(project_string) != 5:
                clear_screen()
                print("Project identifier must be a 5 digit number!")
                print(
                    "If you do not currently have a project number consult Doc Control Guidelines section 3(c)"
                )
                return None
            else:
                return int(project_string)
        else:
            if project_string == "" and previous is not None:
                return previous
            clear_screen()
            print("Project identifier must be a 5 digit number!")
            print(
                "If you do not currently have a project number consult Doc Control Guidelines section 3(c)"
            )
            return None
Beispiel #2
0
    def menu_main(self):
        """displays picture for current user if there is one opens a menu with main menu options"""
        clear_screen()
        dilbert_charaters = {
            'dilbert':
            os.path.join(BASE_DIR, 'ascii_art', 'dilbert.txt'),
            'alice':
            os.path.join(BASE_DIR, 'ascii_art', 'alice.txt'),
            'wally':
            os.path.join(BASE_DIR, 'ascii_art', 'wally.txt'),
            'asok':
            os.path.join(BASE_DIR, 'ascii_art', 'asok.txt'),
            'pointyhairedboss':
            os.path.join(BASE_DIR, 'ascii_art', 'pointyhairedboss.txt'),
            'catbert':
            os.path.join(BASE_DIR, 'ascii_art', 'catbert.txt'),
            'dogbert':
            os.path.join(BASE_DIR, 'ascii_art', 'dogbert.txt')
        }
        try:
            file = dilbert_charaters[self.current_user]
        except KeyError:
            pass
        else:
            draw_file(file)

        self.menu(self.MAIN_MENU)
Beispiel #3
0
    def menu(self):
        """
        Main Menu allows user to navigate worklog program
        :return: None
        """
        while True:
            clear_screen()
            print(""" Main Menu
(1) Create a new entry.
(2) Search for an existing entry
(3) Change date format
(exit) type end to program at any time
(menu) to return to this menu
""")
            option = input("please select an option: ")
            self.keywords(option)
            if option == "1" or option == "(1)":
                clear_screen()
                self.new_entry()
            elif option == "2" or option == "(2)":
                clear_screen()
                self.search()
            elif option == "3" or option == "(3)":
                clear_screen()
                self.date_format()
            else:
                clear_screen()
                print("you need to select an option from the main menu list")
                self.menu()
Beispiel #4
0
    def search(self):
        """
        Menu that displays options for searching the worklog and calls their respective functions
        :return: None
        """
        print(""" Search Menu
(1) Search by date.
(2) Search by task
(3) Search by duration
(4) Search by comment
(exit) type end to program at any time
(menu) to return to main menu
""")
        option = input("please select an option 1, 2 or exit: ")
        self.keywords(option)
        if option == "1" or option == "(1)":
            clear_screen()
            self.search_date()

        elif option == "2" or option == "(2)":
            clear_screen()
            self.search_string('task')
        elif option == "3" or option == "(3)":
            clear_screen()
            self.search_duration()
        elif option == "4" or option == "(4)":
            clear_screen()
            self.search_string('comments')
        else:
            clear_screen()
            "please enter one of the options in brakets"
            self.keywords(option)
Beispiel #5
0
    def linux_commands(self):
        clear_screen()
        try:
            with open("/home/dima/secret/nordVPN.json", 'r') as file:
                data = file.read()
                creed = json.loads(data)
                user_name = creed['user_name']
                password = creed['password']
        except:
            user_name = input("VPN User name: ")
            password = getpass.getpass("VPN Password:"******"Connecting ...."
            sleep 5
            clear
            sudo rm '{NORD_VPN_COUNTRIES}/credentials'
            sudo rm 'vpn_changer.sh'
            echo "-> connected to [ {self.full_path.split('/')[-1]} ]"
            echo "-> test your location: [ https://tools.keycdn.com/geo ]"
        '''
        os.system(remove_files)
Beispiel #6
0
 def auto_login(self):
     def open_QR():
         for get_count in range(10):
             out.print_line('Getting uuid', True)
             while not self.get_QRuuid(): time.sleep(1)
             out.print_line('Getting QR Code', True)
             if self.get_QR(): break
             elif get_count >= 9:
                 out.print_line('Failed to get QR Code, please restart the program')
                 sys.exit()
         out.print_line('Please scan the QR Code', True)
     open_QR()
     while 1:
         status = self.check_login()
         if status == '200':
             break
         elif status == '201':
             out.print_line('Please press confirm', True)
         elif status == '408':
             out.print_line('Reloading QR Code\n', True)
             open_QR()
     self.web_init()
     self.show_mobile_login()
     tools.clear_screen()
     self.get_contract()
     out.print_line('Login successfully as %s\n'%(
         self.storageClass.find_nickname(self.storageClass.userName)), False)
     self.start_receiving()
Beispiel #7
0
 def auto_login(self):
     def open_QR():
         for get_count in range(10):
             out.print_line('Getting uuid', True)
             while not self.get_QRuuid(): time.sleep(1)
             out.print_line('Getting QR Code', True)
             if self.get_QR(): break
             elif get_count >= 9:
                 out.print_line('Failed to get QR Code, please restart the program')
                 sys.exit()
         out.print_line('Please scan the QR Code', True)
     open_QR()
     while 1:
         status = self.check_login()
         if status == '200':
             break
         elif status == '201':
             out.print_line('Please press confirm', True)
         elif status == '408':
             out.print_line('Reloading QR Code\n', True)
             open_QR()
     self.web_init()
     self.show_mobile_login()
     tools.clear_screen()
     self.get_contract()
     out.print_line('Login successfully as %s\n'%(
         self.storageClass.find_nickname(self.storageClass.userName)), False)
     self.start_receiving()
Beispiel #8
0
    def select_vpn(self):
        clear_screen()
        head_foot('Welcome to openvpn')
        all_countries = os.listdir(self.main_path)
        country = display_list(all_countries)
        single_country_servers = f"{self.main_path}/{country}"
        list_of_vpns = os.listdir(single_country_servers)

        tcp_vpn = []
        udp_vpn = []
        vpn_server = None
        x, y = 0, 0
        for vpn in list_of_vpns:
            category = (vpn.split('.'))[-2]
            if category.startswith('tcp'):
                tcp_vpn.append((vpn, x))
                x += 1
            elif category.startswith('udp'):
                udp_vpn.append((vpn, y))
                y += 1

        if self.vpn_type() in ['tcp', 't']:
            vpn_server = self.select_server(tcp_vpn)
        else:
            vpn_server = self.select_server(udp_vpn)

        self.server_path = f"{single_country_servers}/{vpn_server}"
Beispiel #9
0
    def search_date(self):
        """
        Search all worklog entries by date. date is requested from the user with a given format.
        a single entry will look for a specific date two dates will look for a range of dates including given dates
        :return:
        """
        date_range = input(
            "enter two dates a range of dates {} {} or a single date:".format(
                self.date_str, self.date_str))
        self.keywords(date_range)
        dates = re.findall(r'\d{2}-\d{2}-\d{4}', date_range)

        if len(dates) < 1:
            clear_screen()
            print("no date entered or incorrect format")
            self.search_date()
        elif len(dates) == 1:

            datetime_new = datetime.datetime.strptime(dates[0],
                                                      self.time_format)
            date = time.mktime(
                datetime_new.timetuple())  # convert to time stamp

            self.active_log = sorted(self.active_log,
                                     key=lambda date_key: date_key['date'],
                                     reverse=True)
            self.display_list = []

            for entry in self.active_log:
                if entry['date'] == date:
                    self.display_list.append(entry)

            self.display()

        elif len(dates) == 2:

            datetime1 = datetime.datetime.strptime(dates[0], self.time_format)
            datetime2 = datetime.datetime.strptime(dates[1], self.time_format)
            date1 = time.mktime(datetime1.timetuple())  # convert to time stamp
            date2 = time.mktime(datetime2.timetuple())  # convert to time stamp

            self.active_log = sorted(self.active_log,
                                     key=lambda date_key: date_key['date'],
                                     reverse=False)
            self.display_list = []

            for entry in self.active_log:
                if date1 <= entry['date'] <= date2:
                    self.display_list.append(entry)

            self.display()
        else:
            clear_screen()
            print(
                "too many dates given two dates are required for a range, one date for individual dates."
            )
            self.search_date()
Beispiel #10
0
def print_board():
    clear_screen()
    print(
        board_template.format(board_current[0][0], board_current[0][1],
                              board_current[0][2], board_current[1][0],
                              board_current[1][1], board_current[1][2],
                              board_current[2][0], board_current[2][1],
                              board_current[2][2]))
    print('Turn is on: {}. Symbol is: {}'.format(players[turn_player_index],
                                                 symbols[turn_player_index]))
Beispiel #11
0
 def edit(self, entry):
     """calls function for user input to edit the existing TimeSheet model: entry saves changes to db"""
     clear_screen()
     entry_dict = self.task_entry(self.current_user, self.access, entry)
     entry.username = entry_dict['username']
     entry.project = entry_dict['project']
     entry.task = entry_dict['task']
     entry.date = entry_dict['date']
     entry.duration = entry_dict['duration']
     entry.notes = entry_dict['notes']
     entry.save()
Beispiel #12
0
 def vpn_type(self):
     clear_screen()
     vpn_type = None
     condition = ['u', 'udp', 't', 'tcp']
     while True:
         vpn_type = input('Choose udp(u), tcp(t): ')
         if vpn_type.lower() in condition:
             break
         else:
             print("Your selections are: u, udp, t, tcp: ")
     return vpn_type
Beispiel #13
0
    def date_format(self):
        """
        Menu that allows the format of the date to be changed to either MM-DD-YYYY or DD-MM-YYYY
        :return: None
        """
        clear_screen()

        while True:
            print(""" Time format
        (1) DD-MM-YYYY
        (2) MM-DD-YYYY
        """)
            option = input("please select an option: ")
            if option == "1" or option == "(1)":
                self.time_format = "%d-%m-%Y"
                self.date_str = "DD-MM-YYYY"
                clear_screen()
                break

            elif option == "2" or option == "(2)":
                self.time_format = "%m-%d-%Y"
                self.date_str = "MM-DD-YYYY"
                clear_screen()
                break

            else:
                clear_screen()
                print("you need to select an option from the list")
Beispiel #14
0
 def login(self):
     """login screen for entering username and password calls the function that checks database"""
     while True:
         clear_screen()
         draw_file(os.path.join(BASE_DIR, 'ascii_art', 'login.txt'))
         username = input('Username: '******'Password: '******'User name or password fail press enter to try again: ')
             return False
Beispiel #15
0
 def menu(menu_list):
     """re-useable menu takes a menu_list dict to display options and call functions"""
     flag = False
     while True:
         for option in menu_list:
             print(option['text'])
         choice = input("")
         for option in menu_list:
             if option['key'] == choice.lower():
                 option['fn']()
                 flag = True
         clear_screen()
         if flag:
             break
         else:
             print('{} is not an option, please select from ( ) in menu'.
                   format(choice))
Beispiel #16
0
 def delete_user(self):
     """function that allows users to be removed"""
     if self.access == "admin":
         self.list_users()
         user = input("choose a user to fire: ")
         if user != 'dogbert':
             time_sheets.delete_user(user)
         else:
             print("nice try you can't fire me")
         if user == self.current_user:
             clear_screen()
             print("you fired yourself goodbye and good riddance")
             input("press enter to be ejected from the build")
             my_exit()
     else:
         print(
             "Access Denied! See Catbert evil director of HR for your punishment"
         )
Beispiel #17
0
    def run(self):
        while self.allow_rendering:
            if not self.renderer_obj.debug_mode:
                clear_screen()
            # Clear screen objects list
            self.renderer_obj.renderer_objects.clear()
            for screen_object in self.screen_obj.screen_objects:
                screen_object.model.on_render()
                renderer_obj = screen_object.model.get_renderer_object()
                renderer_obj.pos_x = screen_object.pos_x
                renderer_obj.pos_y = self.renderer_obj.screen_y - (renderer_obj.size_y + screen_object.pos_y)
                self.renderer_obj.renderer_objects.append(renderer_obj)
                # print("Obj: x/y: " + str(screen_object.pos_x) + "/" + str(screen_object.pos_y))
                # print(" @ renderer-Obj: x/y: " + str(renderer_obj.pos_x) + "/" + str(renderer_obj.pos_y))
                # print(" @ renderer-Obj: size(x/y): " + str(renderer_obj.size_x) + "/" + str(renderer_obj.size_y))

            self.renderer_obj.clear_screen_buffer()
            self.renderer_obj.print_renderer_objects_to_matrix()
            self.renderer_obj.render()
Beispiel #18
0
    def search_project(self):
        """seach timesheet db for projects matching a given number"""
        while True:
            project = input("please enter a project number: ")
            if len(project) == 5:
                if project.isdigit():
                    project = int(project)
                    break
                else:
                    clear_screen()
                    print("project must be numbers only:")
            else:
                clear_screen()
                print("project must be five digits")

        selected = time_sheets.TimeSheets.select().where(
            time_sheets.TimeSheets.project == project)

        self.display(selected)
Beispiel #19
0
    def search_date(self):
        """
        Search all worklog entries by date. date is requested from the user with a given format.
        a single entry will look for a specific date two dates will look for a range of dates including given dates
        :return: a query list of entries
        """
        while True:
            date_range = input(
                "enter two dates a range of dates {} {} or a single date:".
                format(self.date_str, self.date_str))
            dates = re.findall(r'\d{2}-\d{2}-\d{4}', date_range)

            if len(dates) < 1:
                clear_screen()
                print("no date entered or incorrect format")

            elif len(dates) == 1:
                datetime_new = datetime.datetime.strptime(
                    dates[0], self.time_format)
                selected = (time_sheets.TimeSheets.select().where(
                    time_sheets.TimeSheets.date == datetime_new).order_by(
                        time_sheets.TimeSheets.date))
                self.display(selected)
                break

            elif len(dates) == 2:
                datetime1 = datetime.datetime.strptime(dates[0],
                                                       self.time_format)
                datetime2 = datetime.datetime.strptime(dates[1],
                                                       self.time_format)
                selected = (time_sheets.TimeSheets.select().where(
                    (time_sheets.TimeSheets.date >= datetime1)
                    & (time_sheets.TimeSheets.date <= datetime2)).order_by(
                        time_sheets.TimeSheets.date))
                self.display(selected)
                break

            else:
                clear_screen()
                print(
                    "too many dates given two dates are required for a range, one date for individual dates."
                )
Beispiel #20
0
 def check_login(self):
     url = '%s/cgi-bin/mmwebwx-bin/login'%BASE_URL
     # add tip so that we can get many reply, use string payloads to avoid auto-urlencode
     payloads = 'tip=1&uuid=%s&_=%s'%(self.uuid, int(time.time()))
     r = self.s.get(url, params = payloads)
     regx = r'window.code=(\d+)'
     data = re.search(regx, r.text)
     if data and data.group(1) == '200':
         regx = r'window.redirect_uri="(\S+)";'
         self.loginInfo['url'] = re.search(regx, r.text).group(1)
         r = self.s.get(self.loginInfo['url'], allow_redirects=False)
         self.loginInfo['url'] = self.loginInfo['url'][:self.loginInfo['url'].rfind('/')]
         self.get_login_info(r.text)
         tools.clear_screen()
         return False
     if data and data.group(1) == '201':
         tools.clear_screen()
         out.print_line('Please press confirm', True)
     if data and data.group(1) == '408':
         tools.clear_screen()
         out.print_line('Reloading QR Code\n', True)
         while 1:
             while self.get_QRuuid(): time.sleep(1)
             if self.get_QR(): break
     return True
Beispiel #21
0
    def get_notes(previous):
        """get the notes through user input"""
        if previous is not None:
            print("(Leave blank to keep previous)")
            print("Multi-line comment leave a blank line to end note: ")
        else:
            print("Multi-line comment leave a blank line to end note: ")

        notes = ""
        while True:
            new_comment = input("")

            if new_comment == "":
                if notes == "":
                    if previous is None:
                        clear_screen()
                        print("comments required")
                        return None
                    else:
                        clear_screen()
                        return previous
                else:
                    clear_screen()
                    return notes
            else:
                if notes == "":
                    notes = notes + new_comment
                else:
                    notes = notes + '\n' + new_comment
Beispiel #22
0
    def create_user(self):
        """create new users"""
        if self.access == "admin":
            clear_screen()
            username = input('Username: '******'New Password: '******'confirm Password: '******'enter access level: ')
                    if access_level == '1':
                        access = 'minion'
                        print('access = minion')
                    elif access_level == '2':
                        access = 'manager'
                        print('access = manager')
                    elif access_level == '3':
                        access = 'admin'
                        print('access = admin')
                    else:
                        access = 'minion'
                        print(
                            'you should have typed a number you are now a minion'
                        )

                    time_sheets.create_user(username, password, access)
                    input('press enter to continue: ')
                else:
                    print("passwords don't match")
            else:
                print("user already exists")
        else:
            print(
                "Access Denied! See Catbert evil director of HR for your punishment"
            )
Beispiel #23
0
def game_loop():
    scores_tupple()
    direction = 'down' # snake moves down at game start
    size = rect_size
    global snake
    global food
    while game_border() and snake_overlay():
    	
        direction = control_input(direction)
        move_snake(snake, direction)
        tools.clear_screen()
        draw_frame(size, food, snake)
        maybe_eat_food_and_grow()
        score()
        print score_points
        time.sleep(0.250)
    else:
    	print "GAME OVER"
    	get_player_name()
    	board_max_10()
    	add_result()
    	leaderboard()
    	save_scores()    
Beispiel #24
0
    def get_user(current_user, previous=None):
        """choose a user for this entry from user input"""
        if previous is not None:
            print("(Leave blank to keep previous)")
        else:
            print("(Leave blank for self)")

        choose_user = input("Choose the user for this entry: ")
        if choose_user == "":
            if previous is None:
                return current_user
            else:
                return previous
        else:
            try:
                time_sheets.Users.get(
                    time_sheets.Users.username == choose_user.lower())
            except DoesNotExist:
                clear_screen()
                print("user does not exist try again\n\n")
                return None
            else:
                return choose_user
Beispiel #25
0
    def search_by_user(self):
        """search times sheet entries by user"""
        while True:
            print(self.list_users())

            choose_user = input(
                "(leave blank for self) Choose the user to display records: ")
            if choose_user == "":
                user = self.current_user
                break
            else:
                try:
                    time_sheets.Users.get(
                        time_sheets.Users.username == choose_user.lower())
                except DoesNotExist:
                    clear_screen()
                    print("user does not exist try again\n\n")
                else:
                    user = choose_user
                    break
        selected = time_sheets.TimeSheets.select().where(
            time_sheets.TimeSheets.username == user)
        self.display(selected)
Beispiel #26
0
    def get_date(self, previous=None):
        """get the date through user input"""
        if previous is not None:
            print("(Leave blank to keep previous)")
        else:
            print("(Leave blank for today's date)")

        date_text = input("please enter a date {} for the task: ".format(
            self.date_str))
        if date_text == "":
            if previous is None:
                return datetime.date.today()
            else:
                return previous
        else:
            try:
                date = datetime.datetime.strptime(date_text, self.time_format)
            except ValueError:
                clear_screen()
                print("please follow {} format for date".format(
                    self.time_format))
                return None
            else:
                return date
Beispiel #27
0
    def search_duration(self):
        """
        searches the duration field of all worklog entries to see if they are within a range
        or match a specific duration. Determined by if one or two durations are given (min and max)
        :return: None
        """

        clear_screen()
        is_range = True
        self.display_list = []

        while True:
            min_time = input("please enter a minimum time for the task: ")
            if min_time.isdigit():
                min_time = int(min_time)
                break
            else:
                clear_screen()
                print("time must be numbers only:")

        clear_screen()
        while True:
            max_time = input("please enter a maximum time for the task " +
                             "or leave blank to search for a specific time: ")

            if max_time == "":
                is_range = False
                break
            elif max_time.isdigit():
                max_time = int(max_time)
                break
            else:
                clear_screen()
                print("time must be numbers only:")

        for entry in self.active_log:

            if is_range:
                if min_time <= entry['duration'] <= max_time:
                    self.display_list.append(entry)
            else:
                if min_time == entry['duration']:
                    self.display_list.append(entry)

        self.display()
Beispiel #28
0
    def search_duration(self):
        """
        searches the duration field of all worklog entries to see if they are within a range
        or match a specific duration. Determined by if one or two durations are given (min and max)
        :return: a query list of entries
        """

        clear_screen()
        is_range = True
        while True:
            min_time = input("please enter a minimum time for the task: ")
            if min_time.isdigit():
                min_time = int(min_time)
                break
            else:
                clear_screen()
                print("time must be numbers only:")

        clear_screen()
        while True:
            max_time = input("please enter a maximum time for the task " +
                             "or leave blank to search for a specific time: ")

            if max_time == "":
                is_range = False
                break
            elif max_time.isdigit():
                max_time = int(max_time)
                break
            else:
                clear_screen()
                print("time must be numbers only:")

        if is_range:
            selected = (time_sheets.TimeSheets.select().where(
                (min_time <= time_sheets.TimeSheets.duration)
                & (time_sheets.TimeSheets.duration <= max_time)).order_by(
                    time_sheets.TimeSheets.date))
        else:
            selected = (time_sheets.TimeSheets.select().where(
                (min_time == time_sheets.TimeSheets.duration)).order_by(
                    time_sheets.TimeSheets.date))

        self.display(selected)
Beispiel #29
0
    def get_duration(previous=None):
        """get the duration through user input"""
        if previous is not None:
            print("(Leave blank to keep previous)")

        duration = input("please enter the duration of the task in minutes: ")

        if duration == "":
            clear_screen()
            return previous

        elif duration.isdigit():
            clear_screen()
            return int(duration)

        else:
            clear_screen()
            print("duration must be a number")
            return None
Beispiel #30
0
    def edit(self, previous_entry):
        """
        allows for the editing of existing entries with user input, updates the active_log and saves changes to CSV.
        :param previous_entry: an existing entry dict
        :return: None
        """
        clear_screen()
        while True:
            date_text = input(
                "please enter a date for the task {} leave blank to keep previous: "
                .format(self.date_str))

            if self.keywords(date_text, True):
                pass
            elif date_text == "":
                date = previous_entry['date']
                break
            else:
                try:
                    date_new = datetime.datetime.strptime(
                        date_text, self.time_format)
                except ValueError:
                    print("please follow {} format for date".format(
                        self.date_str))
                else:
                    date = time.mktime(date_new.timetuple(
                    ))  # convert date into timestamp to allow sorting
                    break

        while True:
            duration = input(
                "please enter the duration of the task in minutes leave blank to keep previous: "
            )

            if self.keywords(duration, True):
                pass
            elif duration == "":
                duration = previous_entry['duration']
                break
            elif duration.isdigit():
                duration = int(duration)
                break
            else:
                print("duration must be a number")

        while True:
            task = input(
                "What task have you been performing? leave blank to keep previous: "
            )
            if self.keywords(task, True):
                pass
            elif task == "":
                task = previous_entry['task']
                break
            else:
                break

        comments = ""
        print(
            "please enter a comment leave a blank line to end comment: empty comment will keep previous: "
        )
        while True:
            new_comment = input("")
            self.keywords(new_comment)
            if new_comment == "":
                if comments == "":
                    comments = previous_entry['comments']
                    break
                else:
                    break
            else:
                if comments == "":
                    comments = comments + new_comment
                else:
                    comments = comments + '\n' + new_comment

        entry = {
            "date": date,
            "duration": duration,
            "task": task,
            "comments": comments,
            "ID": previous_entry["ID"]
        }
        self.active_log.append(entry)
        self.display_list.remove(previous_entry)
        self.display_list.append(entry)
        self.save()

        stamp = entry['date']
        entry_date = datetime.datetime.fromtimestamp(stamp)
        entry_date = entry_date.strftime(self.time_format)

        clear_screen()
        input("""Entry added successfully
Date: {}
Duration: {duration}
Task: {task}
Comments: {comments}

Press enter to continue""".format(entry_date, **entry))
        clear_screen()
Beispiel #31
0
 def destroy(self):
     self.screen_renderer_updater.allow_rendering = False
     self.screen_updater.allow_updating = False
     clear_screen()
Beispiel #32
0
    def display(self, selected):
        """
        prints the contents of an individual entry, provides options for the deletion or editing of presented entry
        and allows forward and reverse scrolling through a sorted list of entries (newest first)
        :return: None
        """

        index = 0
        selected = list(selected)

        if len(
                selected
        ) == 0:  # checks to see if the search list is empty (no matches)
            clear_screen()
            input("Nothing to display press enter to return to main menu: ")
            return None

        while True:
            clear_screen()
            entry_date = selected[index].date
            entry_date = entry_date.strftime(self.time_format)
            entry = selected[index]
            print("""entry {} of {}:
User: {}
Project: {}
Task: {}
Date: {}
Duration: {}
Comments: {}""".format((index + 1), len(selected), entry.username,
                       entry.project, entry.task, entry_date, entry.duration,
                       entry.notes))

            options = input(
                "options:(exit) exit program, (menu) main menu,(E) Edit, (D) Delete, (P) Previous, [Enter] Next: "
            )
            if options.lower() == 'd' or options.lower() == 'delete':
                entry.delete_instance()
                del selected[index]

                if len(
                        selected
                ) == 0:  # checks to see if the search list is empty (no matches)
                    clear_screen()
                    input(
                        "Nothing to display press enter to return to main menu: "
                    )
                    return None

            elif options.lower() == 'e' or options.lower() == 'edit':
                self.edit(entry)

            elif options.lower() == "" or options.lower() == "next":
                if index >= (len(selected) - 1):
                    index = 0
                else:
                    index += 1
            elif options.lower() == 'p' or options.lower() == 'previous':
                if index <= 0:
                    index = len(selected) - 1
                else:
                    index -= 1
            elif options.lower() == 'menu':
                break
            elif options.lower() == 'exit':
                my_exit()
Beispiel #33
0
 def menu_options(self):
     """runs a menu with option menu options"""
     clear_screen()
     self.menu(self.OPTIONS_MENU)
Beispiel #34
0
 def menu_search(self):
     """runs a menu with search menu options"""
     clear_screen()
     self.menu(self.SEARCH_MENU)
Beispiel #35
0

if __name__ == "__main__":
    frames_matrix_go_right = read_matrix_from_file("models/example_right.model")
    frames_matrix_go_left = read_matrix_from_file("models/example_left.model")

    renderer = Renderer()

    demo_object = RendererObject(0, 0)
    renderer.renderer_objects.append(demo_object)
    go_right = True
    while True:
        # Walk logic
        if demo_object.pos_x == 0:
            go_right = True
            demo_object.set_model_matrix_frames(frames_matrix_go_right)
        if demo_object.pos_x == renderer.screen_x - 19:
            go_right = False
            demo_object.set_model_matrix_frames(frames_matrix_go_left)

        if go_right:
            demo_object.pos_x += 1
        else:  # go left
            demo_object.pos_x -= 1

        renderer.clear_screen_buffer()
        clear_screen()
        renderer.print_renderer_objects_to_matrix()
        renderer.render()
        # input("Monster at " + str(demo_object.pos_x) + "; Press smt for next frame")