예제 #1
0
    def add_drop_down(self, value):
        """this function adds a drop down menu to a given window
        :param value: a dictionary reference to a value that needs to be written in the form a label to the screen
        :type value: str
        """
        drop_down_lbl = value[0]
        list_call = value[1]
        lbl = Label(self.window, text=ld.get_text_from_dict(self.language, drop_down_lbl) + ': ', font=self.medium_font)
        lbl.grid(row=self.task_row, column=0, ipady=self.row_padding, sticky='W')
        choices = ild.choices.get(list_call)
        choices_formatted = []
        choice_dict = {}
        has_long = False
        for choice in choices:  # short list
            if choice[1]:
                choices_formatted.append(ld.get_text_from_dict(self.language, choice[0]))
                choice_dict[ld.get_text_from_dict(self.language, choice[0])] = choice[0]
            else:
                has_long = True
        if has_long:
            choices_formatted.append('_____________')
            for choice in choices:  # long list
                choices_formatted.append(ld.get_text_from_dict(self.language, choice[0]))
                choice_dict[ld.get_text_from_dict(self.language, choice[0])] = choice[0]
        option = StringVar(self.window)
        drop_down = OptionMenu(self.window, option, *choices_formatted)
        drop_down.grid(row=self.task_row, column=1, sticky=W, columnspan = 2)

        self.widgets.append((drop_down_lbl, option, choice_dict))
        self.task_row += 1
예제 #2
0
 def add_check_boxes(self, value):
     """This method adds a check box to the given window.  As it stands it only places the header for the check
     box but check box functionality will be added in the next update
     :param value: a dictionary reference to a value that needs to be written in the form a label to the screen
     and a str that references the list to be called from data.py
     :type value: list
     """
     cb_label = value[0]
     list_call = value[1]
     lbl = Label(self.window,
                 text=ld.get_text_from_dict(self.language, cb_label) + ': ',
                 font=data.medium_font)
     lbl.grid(row=self.task_row,
              column=0,
              ipady=self.row_padding,
              sticky='W')
     cb_values = data.get_data('choices').get(list_call)
     for val in cb_values:
         test = ld.get_text_from_dict(self.language, val[0])
         checked = IntVar()
         box = Checkbutton(self.window,
                           text=test,
                           variable=checked,
                           onvalue=1,
                           offvalue=0)
         self.widgets.append((value, [checked, val[0]]))
         box.grid(row=self.task_row, column=1, sticky='W')
         self.task_row += 1
     self.task_row += 1
예제 #3
0
    def add_drop_down(self, value):
        """this method adds a drop down menu to a given window
        :param value: a dictionary reference to a value that needs to be written in the form a label to the screen
        :type value: str
        """
        drop_down_lbl = value[0]
        list_call = value[1]
        lbl = Label(self.window,
                    text=ld.get_text_from_dict(self.language, drop_down_lbl) +
                    ': ',
                    font=data.medium_font)
        lbl.grid(row=self.task_row,
                 column=0,
                 ipady=self.row_padding,
                 sticky='W')
        choices = data.get_data('choices').get(list_call)
        choices_formatted = []
        choice_dict = {}
        for choice in choices:
            choices_formatted.append(
                ld.get_text_from_dict(self.language, choice[0]))
            choice_dict[ld.get_text_from_dict(self.language,
                                              choice[0])] = choice[0]

        option = StringVar(self.window)
        drop_down = OptionMenu(self.window, option, *choices_formatted)
        drop_down.grid(row=self.task_row, column=1, sticky='W')

        self.widgets.append((drop_down_lbl, option, choice_dict))
        self.task_row += 1
예제 #4
0
    def add_label(self, value, person_id):
        """this function adds a label to a given window
        :param person_id:  identification number of person (11, or 12) for (tina, tony)
        :type person_id: int
        :param value: a dictionary reference to a value that needs to be written in the form a label to the screen
        :type value: str
        """
        lbl = Label(self.window,
                    text=ld.get_text_from_dict(self.language, value) + ': ',
                    font=data.medium_font)
        lbl.grid(row=self.task_row,
                 column=0,
                 ipady=self.row_padding,
                 sticky='W')
        dict_token = data.get_data('pdata', 2, int(person_id), 9,
                                   value)[0].__getitem__(11)

        lbl_info = Label(self.window,
                         text=ld.get_text_from_dict(self.language, dict_token))

        lbl_info.grid(row=self.task_row,
                      column=1,
                      ipady=self.row_padding,
                      sticky='W')
        self.task_row += 1
예제 #5
0
 def add_column_headers(self):
     """This function adds the headers for the tasks in the home screen"""
     label_priority = Label(self.window,
                            text='',
                            width=self.width,
                            borderwidth=3)
     label_priority.grid(column=0, row=self.row_current, sticky=W)
     label_priority = Label(
         self.window,
         text=ld.get_text_from_dict(self.language, '~49')[0:3] + '  ',
         font=self.widget_creator.medium_font,
         width=self.width - 10,
         borderwidth=3,
         relief=GROOVE)
     label_priority.grid(column=1, row=self.row_current, sticky=W)
     label_status = Label(self.window,
                          text=ld.get_text_from_dict(self.language, '~48') +
                          '  ',
                          font=self.widget_creator.medium_font,
                          width=self.width,
                          borderwidth=3,
                          relief=GROOVE)
     label_status.grid(column=2, row=self.row_current, sticky=W)
     label_time = Label(self.window,
                        text=ld.get_text_from_dict(self.language, '~10') +
                        '  ',
                        font=self.widget_creator.medium_font,
                        width=self.width,
                        borderwidth=3,
                        relief=GROOVE)
     label_time.grid(column=3, row=self.row_current, sticky=W)
     self.row_current += 1
예제 #6
0
 def set_home(self):
     """This function sets up the home screen for the staffer creating the windows title and adding the column
     headers."""
     spacer = ' ' * (
         53 - len(self.staff_name + '' +
                  ld.get_text_from_dict(self.language, self.staff_job)))
     self.window.title(self.staff_name + spacer +
                       ld.get_text_from_dict(self.man_lang, self.staff_job))
     self.add_column_headers()
예제 #7
0
 def log_window_header(self, window):
     """Sets the headers for the log window
     :param window: reference to the log window
     :type window: tk Window"""
     Label(window, text=ld.get_text_from_dict(self.language, '~57'), font=self.medium_font).grid(row=0, column=0,
                                                                                                 ipadx=15, sticky=W)
     Label(window, text=ld.get_text_from_dict(self.language, '~10'), font=self.medium_font).grid(row=0, column=1,
                                                                                                 ipadx=15, sticky=W)
     Label(window, text=ld.get_text_from_dict(self.language, '~58'), font=self.medium_font).grid(row=0, column=2,
                                                                                                 ipadx=15, sticky=W)
     Label(window, text=ld.get_text_from_dict(self.language, '~49'), font=self.medium_font).grid(row=0, column=3,
                                                                                                 ipadx=15, sticky=W)
     Label(window, text=ld.get_text_from_dict(self.language, '~59'), font=self.medium_font).grid(row=0, column=4,
                                                                                                 ipadx=15, sticky=W)
예제 #8
0
    def add_label(self, value, person_id):
        """this function adds a label to a given window
        :param person_id:  identification number of person (11, or 12) for (tina, tony)
        :type person_id: int
        :param value: a dictionary reference to a value that needs to be written in the form a label to the screen
        :type value: str
        """
        lbl = Label(self.window, text=ld.get_text_from_dict(self.language, value) + ': ', font=self.medium_font)
        lbl.grid(row=self.task_row, column=0, ipady=self.row_padding, sticky='W', columnspan = 2)
        lbl_val = query.adat_person_key(person_id, value)[1]
        lbl_info = Label(self.window, text=ld.get_text_from_dict(self.language, lbl_val), font = self.medium_font)

        lbl_info.grid(row=self.task_row, column=1, ipady=self.row_padding, sticky=S)
        self.task_row += 1
예제 #9
0
 def add_column_headers(self):
     """This function adds the headers for the tasks in the home screen (name     task)"""
     label_name = Label(self.window,
                        text=ld.get_text_from_dict(self.language, '~1'),
                        font=data.medium_font)
     label_name.grid(column=1, row=self.row_current, ipady=self.row_padding)
     label_event = Label(self.window,
                         text=ld.get_text_from_dict(self.language, '~33'),
                         font=data.get_medium_font())
     label_event.grid(column=2,
                      row=self.row_current,
                      ipadx=self.column_padding,
                      ipady=self.row_padding)
     self.row_current += 1
예제 #10
0
def create_staff_popup(staff_data):
    """this method creates a pop up window for the staff member as they arrive"""
    global popup_spacer, log, root
    person_data = data.get_next_person()
    language = staff_data[3]

    def clicked_exit():
        """function to handle the clicking of exit and close a window presented for the staff member and write their
        departure to the log.  Window distruction is done by calling the .destroy() function for the root of that window"""
        write_person_event(staff_data, 'depart')  # write event to the log
        person_popup.destroy()

    def manage_non_laggard():
        """a method for handling staff members marked as laggards.  In the current iteration of this method,
        clicked_exit is called after a wait time of 3 seconds.  As of now, it does not distinguish whether the timer
        is or is not currently running at the time of exiting """
        root.after(3000, clicked_exit)

    # create the popup window for a person
    person_popup = Toplevel(root)
    person_popup.title(staff_data[0])
    person_popup.geometry("200x110+0+" + popup_spacer.__str__())
    greeting = Label(person_popup, text=ld.get_text_from_dict(language, '~4'))
    greeting.pack()
    person_name = Label(person_popup,
                        text=ld.get_text_from_dict(language, '~1') + ': ' +
                        person_data[0])
    person_name.pack()
    person_diagnosis = Label(person_popup,
                             text=ld.get_text_from_dict(language, '~2') +
                             ': ' +
                             ld.get_text_from_dict(language, person_data[1]))
    person_diagnosis.pack()
    popup_spacer += 160

    # create an exit button
    btn_exit = Button(person_popup,
                      text=ld.get_text_from_dict(language, '~3'),
                      fg="black",
                      bg="gray",
                      command=clicked_exit,
                      height=1,
                      width=10)
    btn_exit.pack(side=BOTTOM)
    write_person_event(staff_data, 'arrive')
    # handle laggard status with a new function
    if not staff_data[2]:
        manage_non_laggard()
예제 #11
0
    def view_log_data(self, token):
        """creates the a window where the user is able to view the information in the log
        :param token: the unique token id for the information handled by the staff member
        :type token: int
        """
        def close():
            """destroy the log window after it has close button has been selected"""
            log_screen.destroy()

        # create the log viewer screen directly above the current window
        log_screen = Toplevel(self.root)
        log_screen.geometry(self.window.geometry())
        log_row = 1
        self.widget_creator.log_window_header(log_screen)
        try:  # attempt to display the log data
            for data in working_data.log_dict.get(token):
                self.widget_creator.display_log_info(log_screen, data, log_row)
                log_row += 1
        except:  # if there is no data disply no log data
            for widget in log_screen.winfo_children():
                widget.destroy()
            Label(log_screen,
                  text='NO LOG DATA',
                  font=self.widget_creator.larger_font).grid(row=0, column=0)
        Button(log_screen,
               text=ld.get_text_from_dict(self.language, '~54'),
               command=close,
               fg="black",
               bg="gray",
               height=1,
               width=10).grid(sticky=S)
예제 #12
0
 def add_entry(self, info):
     """This function adds an entry to the given window.  As it stands it only places the header for the entry box
      but entry box functionality will be added in the next update
     :param info: a dictionary reference to a value that needs to be written in the form a label to the screen
     :type info: str
     """
     value = info[0]
     units = info[1].get('units')
     lbl = Label(self.window, text=ld.get_text_from_dict(self.language, value) + ': ', font=self.medium_font)
     lbl.grid(row=self.task_row, column=0, ipady=self.row_padding, sticky='W')
     text_entered = Variable
     entry_box = Entry(self.window, textvariable=text_entered)
     self.widgets.append((value, entry_box, info[1]))
     entry_box.grid(row=self.task_row, column=1, sticky='W')
     Label(self.window, text=ld.get_text_from_dict(self.language, units), font = self.medium_font).grid(row=self.task_row, column=2, sticky='W')
     self.task_row += 1
예제 #13
0
 def set_home(self):
     """This function sets up the home screen for the staffer"""
     self.window.title(ld.get_text_from_dict(self.language, self.staff_id))
     staff_name = Label(self.window,
                        text=self.staff_name,
                        font=data.get_large_font())
     staff_name.grid(column=0, row=0)
     self.add_column_headers()
예제 #14
0
 def add_task_header(self, task_id):
     """This function adds the task header of the staffer to the display window. After adding, I'm not sure
     this is something we really need but could be useful in the future
     :param task_id: the ~vocab reference of the task that must be completed by the staffer
     :type task_id: str"""
     task = ld.get_text_from_dict(self.language, task_id)
     task_lbl = Label(self.window, text=task, font=self.medium_font)
     task_lbl.grid(row=self.task_row, column=0, columnspan=2, sticky='W')
     self.task_row += 1
예제 #15
0
 def login_button(self):
     """This function creates a login button that allows the user to submit their login information"""
     btn_submit = Button(self.window,
                         text=ld.get_text_from_dict(self.language, '~20'),
                         command=self.login_button_listener,
                         fg="black",
                         bg="gray",
                         height=1,
                         width=10)
     self.window.bind('<Return>',
                      lambda event: self.login_button_listener())
     btn_submit.grid(row=self.task_row, column=0, sticky='S')
예제 #16
0
 def add_button_submit(self, value, token):
     """this method adds a submit button to a given window
     :param value: a dictionary reference to a value that needs to be written in the form a label to the screen
     :type value: str
     """
     btn_submit = Button(self.window,
                         text=ld.get_text_from_dict(self.language, value),
                         command=lambda: self.submit_btn_listener(token),
                         fg="black",
                         bg="gray",
                         height=1,
                         width=10)
     btn_submit.grid(row=self.task_row + 5, column=0, sticky='S')
     self.task_row += 1
예제 #17
0
    def populate_task(self, task_id, person_id, task_window_info, token,
                      priority, status):
        """This function adds the buttons for the staffer's task to the task window.
        :param task_id: the value that corresponds to the task that the staffer needs to complete
        :type task_id: str
        :param person_id: the unique identification number of the person being processed by the staff member
        :type person_id: str
        :param task_window_info: contains a list of widget elements to be added to the task window for the staff member
        :type task_window_info: list
        :param token: the unique token id for the information handled by the staff member
        :type token: int
        :param priority: the current priority of a task
        :type priority: int
        :param status: the current status of the task being processed
        :type status: str (~vocab)
        """
        name = query.adat_person_key(
            person_id,
            '~1')[1]  # maybe list handling should be done in query.py
        if not self.dat.check_in_display(name):
            label_name = Label(self.window,
                               text=name,
                               font=self.widget_creator.medium_font)
            label_name.grid(column=0,
                            row=self.row_current,
                            columnspan=3,
                            sticky=W)
        self.row_current += 1
        btn_process: Button = Button(
            self.window,
            text='=>',
            command=lambda: self.write_task_screen(task_window_info, person_id,
                                                   token, task_id, priority),
            fg="black",
            bg="gray",
            width=self.width - 10)
        btn_process.grid(column=4, row=self.row_current, sticky=E)

        self.dat.add_token_row_name(self.row_current, name)
        btn_log: Button = Button(self.window,
                                 text=ld.get_text_from_dict(
                                     self.language, '~13'),
                                 width=self.width,
                                 command=lambda: self.view_log_data(token),
                                 fg="black",
                                 bg="gray")
        btn_log.grid(column=0, row=self.row_current)

        self.add_person_to_tasks(priority, token, status)
예제 #18
0
 def add_entry_id(self):
     """This function adds an entry for the users unique id
     """
     lbl = Label(self.window,
                 text=ld.get_text_from_dict(self.language, '~42') + ': ',
                 font=self.medium_font)
     lbl.grid(row=self.task_row,
              column=0,
              ipady=self.row_padding,
              sticky='W')
     text_entered = StringVar()
     entry_box = Entry(self.window, textvariable=text_entered)
     self.login_widgets.append(('~42', entry_box))
     entry_box.grid(row=self.task_row, column=1, sticky='W')
     self.task_row += 1
예제 #19
0
 def add_entry_password(self):
     """This function adds an entry for the users password this is only diplayed as '*' on the UI side
     """
     lbl = Label(self.window,
                 text=ld.get_text_from_dict(self.language, '~43') + ': ',
                 font=self.medium_font)
     lbl.grid(row=self.task_row,
              column=0,
              ipady=self.row_padding,
              sticky='W')
     text_entered = StringVar()
     entry_box = Entry(self.window, textvariable=text_entered)
     entry_box.config(show="*")
     self.login_widgets.append(('~42', entry_box))
     entry_box.grid(row=self.task_row, column=1, sticky='W')
     self.task_row += 1
예제 #20
0
 def drop_down(self, choices):
     """drop_down displays the available options for staff reassignment to the staffer after selecting
     the forward button
     :param choices: a list of choices of different possible staffers
     :type choices: list"""
     Label(self.window,
           text=ld.get_text_from_dict(self.language, '~56') + ': ').pack(
               side=LEFT, anchor=N)
     option = StringVar(self.window)
     choices_formatted = []
     for choice in choices:
         choices_formatted.append(communicator.name_from_staff_id(choice))
     communicator.staff_id_from_name(choices_formatted[0])
     option.set(choices_formatted[0])
     drop_down = OptionMenu(self.window, option, *choices_formatted)
     self.alternate_staff = option
     drop_down.pack(side=LEFT, anchor=N)
예제 #21
0
 def display_log_info(self, window, data, r):
     """writes a row of data from from the log to be displayed on the window
     :param window: reference to the log window
     :type window: tk Window
     :param data: a dictionary of references to points of data to be displayed by the log
     :type data: dict
     :param r: the row that this data needs to be written to
     :type r: int
     """
     user = ild.staffers[data.get('user')].get('~1')
     time = datetime.fromtimestamp(int(data.get('time'))).strftime('%H:%M')
     status = ld.get_text_from_dict(self.language, data.get('status'))
     Label(window, text=user, font=self.medium_font).grid(row=r, column=0)
     Label(window, text=time, font=self.medium_font).grid(row=r, column=1)
     Label(window, text=status, font=self.medium_font).grid(row=r, column=2)
     Label(window, text=data.get('priority'), font=self.medium_font).grid(row=r, column=3)
     Label(window, text=data.get('comments'), font=self.medium_font, justify = LEFT, height=3, wraplength=190).grid(row=r, column=4)
예제 #22
0
 def add_entry(self, value):
     """This method adds an entry to the given window.  As it stands it only places the header for the entry box
      but entry box functionality will be added in the next update
     :param value: a dictionary reference to a value that needs to be written in the form a label to the screen
     :type value: str
     """
     lbl = Label(self.window,
                 text=ld.get_text_from_dict(self.language, value) + ': ',
                 font=data.medium_font)
     lbl.grid(row=self.task_row,
              column=0,
              ipady=self.row_padding,
              sticky='W')
     text_entered = StringVar()
     entry_box = Entry(self.window, textvariable=text_entered)
     self.widgets.append((value, entry_box))
     entry_box.grid(row=self.task_row, column=1, sticky='W')
     self.task_row += 1
예제 #23
0
 def add_entry_with_text(self, value, person_id):
     """This function adds an entry with text prefilled to the given window.
      As it stands it only places the header for the entry box
      but entry box functionality will be added in the next update
     :param person_id: identification number of the person in question
     :type person_id: int
     :param value: a dictionary reference to a value that needs to be written in the form a label to the screen
     :type value: str
     """
     phone_number = query.adat_person_key(person_id, '~16')[1]
     lbl = Label(self.window, text=ld.get_text_from_dict(self.language, value) + ': ', font=self.medium_font)
     lbl.grid(row=self.task_row, column=0, ipady=self.row_padding, sticky='W')
     text_entered = StringVar()
     entry_box = Entry(self.window, textvariable=text_entered)
     entry_box.insert(0, phone_number)
     self.widgets.append((value, entry_box))
     entry_box.grid(row=self.task_row, column=1, sticky='W')
     self.task_row += 1
예제 #24
0
 def priority_radio_buttons(self, priority):
     """creates radio buttons for changing the priority of a given task
     :param priority: the current priority of a task
     :type priority: int"""
     self.task_row+=1
     pri_lbl = Label(self.window, text=ld.get_text_from_dict(self.language, '~49'), font=self.medium_font)
     pri_radio_1 = tk.Radiobutton(self.window, text='1', fg="red", variable=self.priority, value=1)
     pri_radio_2 = tk.Radiobutton(self.window, text='2', fg="blue", variable=self.priority, value=2)
     pri_radio_3 = tk.Radiobutton(self.window, text='3', fg="black", variable=self.priority, value=3)
     pri_lbl.grid(row=self.task_row , column=0,sticky=W)
     pri_radio_1.grid(row=self.task_row , column=0, sticky=E)
     pri_radio_2.grid(row=self.task_row , column=1, sticky=S)
     pri_radio_3.grid(row=self.task_row , column=2, sticky=W)
     if priority == 1:
         pri_radio_1.invoke()
     elif priority == 2:
         pri_radio_2.invoke()
     else:
         pri_radio_3.invoke()
예제 #25
0
    def add_person_header(self, person_id):
        """This method adds the person header to the given window based on the id number of the person given to the
        method.
        :param person_id: the identification number of the person being processed used to intake their data
        :type person_id: int
        """
        person_data = data.get_data('pdata', 2, person_id)
        name = person_data[0].__getitem__(11)
        sex = ld.get_text_from_dict(self.language,
                                    person_data[1].__getitem__(11))
        age = person_data[2].__getitem__(11).__str__()
        name_lbl = Label(self.window, text=name, font=data.medium_font)
        sex_lbl = Label(self.window, text=sex, font=data.medium_font)
        age_lbl = Label(self.window, text=age, font=data.medium_font)

        name_lbl.grid(row=self.task_row, column=0, sticky='W')
        sex_lbl.grid(row=self.task_row, column=1, sticky='W')
        age_lbl.grid(row=self.task_row, column=2, sticky='W')
        self.task_row += 1
예제 #26
0
    def add_person_header(self, person_id):
        """This function adds the person header to the given window based on the id number of the person given to the
        function.
        :param person_id: the identification number of the person being processed used to intake their data
        :type person_id: int
        """

        name = query.adat_person_key(person_id, '~1')[1]
        sex = query.adat_person_key(person_id, '~14')[1]
        sex = ld.get_text_from_dict(self.language, sex)
        age = query.adat_person_key(person_id, '~15')[1]
        name_lbl = Label(self.window, text=name, font=self.medium_font)
        sex_lbl = Label(self.window, text=sex, font=self.medium_font, width = self.width)
        age_lbl = Label(self.window, text=age, font=self.medium_font, width = self.width)

        name_lbl.grid(row=self.task_row, column=0, sticky='W', columnspan=2)
        sex_lbl.grid(row=self.task_row, column=2, sticky='W')
        age_lbl.grid(row=self.task_row, column=3, sticky='W')
        self.task_row += 1
예제 #27
0
 def populate_task_btn(self, task_id, person_id, task_window_info, token):
     """This function adds the buttons for the staffer's task to the task window.
     :param task_id: the value that corresponds to the task that the staffer needs to complete
     :type task_id: str
     :param person_id: the unique identification number of the person being processed by the staff member
     :type person_id: int
     :param task_window_info: contains a list of widget elements to be added to the task window for the staff member
     :type task_window_info: list
     :param token: the unique token id for the information handled by the staff member
     :type token: int"""
     task_name = ld.get_text_from_dict(self.language, task_id)
     self.add_person_to_tasks(person_id)
     btn_action: Button = Button(
         self.window,
         text=task_name,
         command=lambda: self.write_task_screen(task_window_info, person_id,
                                                token, task_id),
         fg="black",
         bg="gray",
         height=1,
         width=10)
     btn_action.grid(column=2, row=self.row_current, ipadx=self.row_padding)
     self.row_current += 1
예제 #28
0
    def add_person_to_tasks(self, priority, token, status):
        """This function adds the name of a person who needs to be processed by the staffer
        :param priority: the priority level of a task
        :type priority: int
        :param token: the token value of the task in question
        :type token: int
        :param status: the current status of the task being processed
        :type status: str (~vocab)"""

        priority_color = {1: "red", 2: "blue", 3: "black"}

        label_priority = Label(self.window,
                               text=priority,
                               font=self.widget_creator.medium_font,
                               width=self.width - 10,
                               fg=priority_color.get(priority),
                               borderwidth=3,
                               relief=GROOVE)
        label_priority.grid(column=1, row=self.row_current)
        label_status = Label(self.window,
                             text=ld.get_text_from_dict(self.language, status),
                             width=self.width,
                             font=self.widget_creator.medium_font,
                             borderwidth=3,
                             relief=GROOVE)
        label_status.grid(column=2, row=self.row_current)
        label_time = Label(self.window,
                           text=self.dat.time_diff_start_time(token),
                           width=self.width,
                           font=self.widget_creator.medium_font,
                           borderwidth=3,
                           relief=GROOVE)
        label_time.grid(column=3, row=self.row_current)

        self.dat.add_start_time_label(token, label_time)
        self.dat.update_repost_time(token)
예제 #29
0
파일: main.py 프로젝트: davidaries/Job4
import internal_timer as in_time
import tkinter.font as tkFont
import language_dictionary as ld
import data
import controller
from home_screen import home_screen

base_language = data.get_data('language_preference')

root = Tk()

data.create_fonts(
    root
)  # data.create_fonts(root) creates the fonts to be used in the program

root.title(ld.get_text_from_dict(base_language, '~11'))  # title for window
root.geometry('302x100+0+0')  # main window geometry
time_lbl = Label(root, text="test", font='Helvetica 18 bold')
time_lbl.pack()
""""""
# pd = [[111, 2, 3], [111, 4, 5], [222, 6, 7], [222, 8, 9]] # the first field (offset 0) is the person id.
# persons = [111, 222]
# person_dict = {}
#
# for p in persons:
#     person_dict[p] = [[pd[1], pd[2]] for pd in pd if pd[0] == p]
#
# print(person_dict.get(111))
# print(person_dict.get(222))
# TIME WINDOW NOT NEEDED FOR JOB 3
# time_window = Toplevel(root)
예제 #30
0
    def create_buttons(self, row, token, priority):
        """create_buttons is in charge of setting up the buttons found at the bottom of the task screen.  It also
        creates links to the various button listeners used to execute the tasks described by the buttons
        :param row: the starting row for the button placement in the windows grid
        :type row: int
        :param token: the unique token id of the task
        :type token: int
        :param priority: the priority level of the incoming task
        :type priority: int
        """
        self.priority = priority
        for _ in range(
                2):  # space buttons need to figure out a better way to do this
            row += 1
            Label(self.window, text=' ').grid(row=row, column=0)
        btn_pause = Button(self.window,
                           text=ld.get_text_from_dict(self.language, '~6'),
                           command=lambda: self.pause_btn_listener(token),
                           fg="green",
                           bg="light gray",
                           height=1,
                           width=self.width)
        btn_pause.grid(row=row, column=0, sticky=E)
        btn_forward = Button(self.window,
                             text=ld.get_text_from_dict(self.language, '~50'),
                             command=lambda: self.forward_btn_listener(token),
                             fg="blue",
                             bg="light gray",
                             height=1,
                             width=self.width)
        btn_forward.grid(row=row, column=1, sticky=S)
        btn_skip = Button(self.window,
                          text=ld.get_text_from_dict(self.language, '~52'),
                          command=lambda: self.skip_btn_listener(token),
                          fg="red",
                          bg="light gray",
                          height=1,
                          width=self.width)
        btn_skip.grid(row=row, column=2, ipadx=self.xpad, sticky=W)

        row += 1
        btn_return = Button(self.window,
                            text=ld.get_text_from_dict(self.language, '~8'),
                            command=lambda: self.return_btn_listener(token),
                            fg="green",
                            bg="light gray",
                            height=1,
                            width=self.width)
        btn_return.grid(row=row, column=0, sticky=E)
        btn_reassign = Button(
            self.window,
            text=ld.get_text_from_dict(self.language, '~51'),
            command=lambda: self.reassign_btn_listener(token),
            fg="blue",
            bg="light gray",
            height=1,
            width=self.width)
        btn_reassign.grid(row=row, column=1, sticky=S)
        btn_drop = Button(self.window,
                          text=ld.get_text_from_dict(self.language, '~53'),
                          command=lambda: self.drop_btn_listener(token),
                          fg="red",
                          bg="light gray",
                          height=1,
                          width=self.width)
        btn_drop.grid(row=row, column=2, ipadx=self.xpad, sticky=W)