Exemplo n.º 1
0
    def createLeftFrame(self):
        left_frame = ttk.Frame(self)
        util.SetGrid(left_frame, 0, 0)
        util.SetGridWeights(left_frame,
                            row_weights=(1, 1, 1, 1, 1, 2, 1, 2, 1))

        # Button to open partially filled barebone filed
        open_file_button = ttk.Button(left_frame,
                                      text=_('Load barebone Excel file'),
                                      command=self.openBareboneExcel)
        util.SetGrid(open_file_button, 0, 0)
        # Opened file name. Empty label if no file is loaded
        open_file_label = ttk.Label(left_frame,
                                    textvariable=self.open_filename_strv)
        util.SetGrid(open_file_label, 1, 0)

        # Start date, end date of new schedule
        start_date_label = ttk.Label(left_frame,
                                     textvariable=self.start_date_strv)
        util.SetGrid(start_date_label, 2, 0)
        end_date_label = ttk.Label(left_frame, textvariable=self.end_date_strv)
        util.SetGrid(end_date_label, 3, 0)

        # How long should the solver run?
        max_time_frame = ttk.Frame(left_frame)
        util.SetGridWeights(max_time_frame, column_weights=(4, 1, 1))
        util.SetGrid(max_time_frame, 6, 0)

        max_time_label1 = ttk.Label(max_time_frame,
                                    text=_('Maximum search time'))
        util.SetGrid(max_time_label1, 0, 0)

        self.max_time_var.set(1)
        spinbox = ttk.Spinbox(max_time_frame,
                              from_=1,
                              to=30,
                              textvariable=self.max_time_var)
        util.SetGrid(spinbox, 0, 1)

        max_time_label2 = ttk.Label(max_time_frame, text=_('minutes'))
        util.SetGrid(max_time_label2, 0, 2)

        # Notice that the solver will stop after the specific time
        max_time_info_label = ttk.Label(
            left_frame, text=_('Search will stop after this time'))
        util.SetGrid(max_time_info_label, 7, 0)

        # Start button. Click will validate the input Excel and run the solver
        submit_button = ttk.Button(left_frame, text=_('Start Search'))
        util.SetGrid(submit_button, 8, 0)
Exemplo n.º 2
0
    def createLeftFrame(self):
        left_frame = ttk.Frame(self)
        util.SetGrid(left_frame, 0, 0)
        util.SetGridWeights(left_frame,
                            row_weights=(1, 1, 1, 1, 1, 2, 1, 2, 1))

        # Button to open updated Excel file
        open_file_button = ttk.Button(left_frame,
                                      text=_('Load schedule'),
                                      command=self.openUpdatedExcel)
        util.SetGrid(open_file_button, 0, 0)
        # Opened file name. Empty label if no file is loaded
        open_file_label = ttk.Label(left_frame,
                                    textvariable=self.open_filename_strv)
        util.SetGrid(open_file_label, 1, 0)

        # Start date, end date of new schedule
        start_date_label = ttk.Label(left_frame,
                                     textvariable=self.start_date_strv)
        util.SetGrid(start_date_label, 2, 0)
        end_date_label = ttk.Label(left_frame, textvariable=self.end_date_strv)
        util.SetGrid(end_date_label, 3, 0)

        # Re-check for error button
        self.recheck_error_button = ttk.Button(left_frame,
                                               text=_('Re-check'),
                                               command=self.validateExcel)
Exemplo n.º 3
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        util.SetGridWeights(self)  # single row, single column

        self.displayed_frame = None
        self.barebone_frame = barebone.BareboneExcelFrame(self)
        self.new_schedule_frame = new_schedule.NewScheduleFrame(self)
        self.update_schedule_frame = update_schedule.UpdateScheduleFrame(self)
        self.validate_schedule_frame = validate_schedule.ValidateScheduleFrame(self)
Exemplo n.º 4
0
    def createRightFrame(self):
        right_frame = ttk.Frame(self)
        util.SetGrid(right_frame, 0, 1)
        util.SetGridWeights(right_frame, row_weights=(1, 9))

        # Right side of the frame only displays status (of validation and solver run)
        label = ttk.Label(right_frame, text=_('Errors'))
        util.SetGrid(label, 0, 0)
        self.status_text_area = scrolledtext.ScrolledText(right_frame, state=tk.DISABLED)
        util.SetGrid(self.status_text_area, 1, 0)
Exemplo n.º 5
0
    def __init__(self, master, *args, **kwargs):
        super().__init__(master, *args, **kwargs)
        util.SetGridWeights(self, column_weights=(1, 2))

        self.open_filename_strv = tk.StringVar(value='')
        self.start_date_strv = tk.StringVar(value='')
        self.end_date_strv = tk.StringVar(value='')

        self.createLeftFrame()
        self.createRightFrame()
Exemplo n.º 6
0
    def __init__(self, master, lower_frame, *args, **kwargs):
        super().__init__(master, *args, **kwargs)
        self._lower_frame = lower_frame

        # Configure layouts
        util.SetGridWeights(self, column_weights=(1, 2, 2, 2, 2, 1))
        self.CreateBareboneExcelButton(1)
        self.CreateNewScheduleButton(2)
        self.CreateUpdateScheduleButton(3)
        self.CreateValidateScheduleButton(4)
Exemplo n.º 7
0
    def __init__(self, master, *args, **kwargs):
        super().__init__(master, *args, **kwargs)
        util.SetGridWeights(self, column_weights=(1, 2))

        self.open_filename_strv = tk.StringVar(value='')
        self.start_date_cal = None  # To be assigned when DateEntry is created
        self.end_date_cal = None  # To be assigned when DateEntry is created
        self.keep_offdate_var = tk.BooleanVar()
        self.max_time_var = tk.IntVar()

        self.createLeftFrame()
        self.createRightFrame()
Exemplo n.º 8
0
def CreateGUI():
    root = tk.Tk()
    root.minsize(900, 600)
    root.maxsize(900, 600)
    root.title(_('Shift Scheduler v0.1'))
    util.SetGridWeights(root, row_weights=(1, 4))

    lower_frame = lower.LowerFrame(root)
    util.SetGrid(lower_frame, 1, 0)
    upper_frame = upper.UpperFrame(root, lower_frame)
    util.SetGrid(upper_frame, 0, 0)

    return root
Exemplo n.º 9
0
    def createLeftFrame(self):
        left_frame = ttk.Frame(self)
        util.SetGrid(left_frame, 0, 0)
        util.SetGridWeights(left_frame,
                            row_weights=(1, 1, 1, 1, 1, 1, 1, 1, 2, 1))

        # Open modified schedule
        open_file_button = ttk.Button(left_frame,
                                      text=_('Load file'),
                                      command=self.openExcelToUpdate)
        util.SetGrid(open_file_button, 0, 0)
        open_file_label = ttk.Label(left_frame,
                                    textvariable=self.open_filename_strv)
        util.SetGrid(open_file_label, 1, 0)

        # Select date range to update
        start_date_label = ttk.Label(left_frame, text=_('Update start date'))
        util.SetGrid(start_date_label, 2, 0)
        self.start_date_cal = tkc.DateEntry(left_frame,
                                            year=2020,
                                            month=5,
                                            day=1,
                                            date_pattern=DATE_PATTERN,
                                            locale=LOCALE_CODE)
        util.SetGrid(self.start_date_cal, 3, 0)
        # End date to update
        end_date_label = ttk.Label(left_frame, text=_('Update end date'))
        util.SetGrid(end_date_label, 4, 0)
        self.end_date_cal = tkc.DateEntry(left_frame,
                                          year=2020,
                                          month=5,
                                          day=31,
                                          date_pattern=DATE_PATTERN,
                                          locale=LOCALE_CODE)
        util.SetGrid(self.end_date_cal, 5, 0)

        # Checkbox to keep the off dates
        keep_offdate_checkbox = ttk.Checkbutton(left_frame,
                                                text=_('Keep the OFF dates'),
                                                variable=self.keep_offdate_var,
                                                onvalue=True,
                                                offvalue=False)
        util.SetGrid(keep_offdate_checkbox, 6, 0)

        # Max search time frame
        max_time_frame = ttk.Frame(left_frame)
        util.SetGrid(max_time_frame, 7, 0)
        util.SetGridWeights(max_time_frame, column_weights=(4, 1, 1))

        max_time_label1 = ttk.Label(max_time_frame,
                                    text=_('Maximum search time'))
        util.SetGrid(max_time_label1, 0, 0)

        self.max_time_var.set(1)
        max_time_spinbox = ttk.Spinbox(max_time_frame,
                                       from_=1,
                                       to=30,
                                       textvariable=self.max_time_var)
        util.SetGrid(max_time_spinbox, 0, 1)

        max_time_label2 = ttk.Label(max_time_frame, text=_('minutes'))
        util.SetGrid(max_time_label2, 0, 2)

        max_time_info_label = ttk.Label(
            left_frame, text=_('Search will stop after this time'))
        util.SetGrid(max_time_info_label, 8, 0)

        # Start button
        submit_button = ttk.Button(left_frame,
                                   text=_('Start'),
                                   command=self.updateSchedule)
        util.SetGrid(submit_button, 9, 0)