Пример #1
0
 def __init__(self, master, label, thead=False, **kw):
     super().__init__(master,
                      style=f"{'H' if thead else ''}Cell.TFrame",
                      **kw)
     lbl = Label(self,
                 text=label,
                 style=f"{'H' if thead else ''}Cell.TLabel",
                 font=TABLE_FONT)
     self.rowconfigure((0, 2), weight=1)
     self.columnconfigure((0, 2), weight=1)
     lbl.grid(row=1, column=1)
Пример #2
0
    def __init__(self, parent, controller):
        super().__init__(parent, controller)

        self.window = None
        self.sheet_name = StringVar(
            value=self.controller.get_sheet("BASE_SHEET"))
        for i, weight in zip(range(3), [0, 1, 0]):
            self.grid_rowconfigure(i, weight=weight)
            self.grid_columnconfigure(i, weight=weight)
        div = Frame(self)
        div.grid(row=1, column=1, padx=0, pady=0)

        frame1 = Frame(div)
        label = Label(frame1, text="Вибрана таблиця і день")

        frame2 = Frame(div)
        self.day_input = Select(frame2,
                                state="readonly",
                                width=3,
                                values=self.worksheet_list)
        self.day_input.set(self.controller.date.day)
        self.day_input.bind('<<ComboboxSelected>>', self.day_change_callback)

        self.month_input = Select(frame2,
                                  state="readonly",
                                  width=10,
                                  values=self.controller.config.MONTH_NAMES)
        self.month_input.set(self.controller.date.strftime("%B"))
        self.month_input.bind('<<ComboboxSelected>>',
                              self.month_change_callback)
        self.sheet_input = Entry(frame2,
                                 width=30,
                                 textvar=self.sheet_name,
                                 state=DISABLED)
        self.update_widget_name()
        self.update_btn = Button(frame2,
                                 text="Змінити",
                                 command=self.select_sheet)

        frame1.pack()
        label.pack()
        frame2.pack()
        self.day_input.pack(side=LEFT)
        self.month_input.pack(side=LEFT, padx=(10, 0))
        self.sheet_input.pack(side=LEFT, padx=10)
        self.update_btn.pack(side=LEFT)

        frame3 = Frame(div)
        frame3.pack()
        load_data = Button(frame3,
                           text="Завантажити дані",
                           command=self.controller.show_data)
        load_data.pack()
Пример #3
0
    def render(self):
        super().render()
        frm1 = Frame(self)
        frm2 = Frame(self)
        frm3 = Frame(self)
        frm1.pack()
        frm2.pack()
        frm3.pack()

        Label(frm1, text="QC Engineers wordcount and project").pack()
        SheetSelect(frm1, self.controller, "INTERNAL_SHEET", True).pack()

        Label(frm2, text="Main report").pack()
        SheetSelect(frm2, self.controller, "FAILURES_SHEET", True).pack()

        Label(frm3, text="HandOff report").pack()
        SheetSelect(frm3, self.controller, "HAND_OFF_SHEET", True).pack()
Пример #4
0
    def initialize(self):
        if not self.data:
            return None
        pd = self.prepare_data()

        frm = Frame(self.frame)
        frm.pack(padx=0, pady=0)
        frm.grid_rowconfigure(0, weight=1)
        frm.grid_columnconfigure(0, weight=1)

        title = None
        if self.label:
            title = Label(self, text=self.label)
            title.pack()
        if not pd:
            if title:
                title['text'] = f"{title['text']} - Немає данних"
            else:
                Label(self, text='Немає данних').pack()
            return None

        if self.prepend_date:
            Cell(frm, "Date", thead=True).grid(row=0, column=0)
            for ridx in range(1, len(pd) + 1):
                if ridx > self.MAX_ROWS:
                    break
                Cell(frm, self.format_date).grid(row=ridx, column=0)

        for idx, name in enumerate(self.labels, int(self.prepend_date)):
            Cell(frm, name, thead=True).grid(row=0, column=idx)
        for ridx, row in enumerate(pd, 1):
            if ridx > self.MAX_ROWS:
                break
            for cidx, col in enumerate(row, int(self.prepend_date)):
                Cell(frm, col).grid(row=ridx, column=cidx)
        if (row_count := len(pd)) > self.MAX_ROWS:
            for cidx in range(len(pd[0]) + int(self.prepend_date)):
                Cell(frm, '...').grid(row=row_count + 1, column=cidx)
Пример #5
0
    def select_sheet(self):
        self.window = Toplevel(self)

        frame1 = Frame(self.window)
        frame1.pack()
        label = Label(frame1, text="Вибери таблицю зі списку:")
        label.pack()

        frame2 = Frame(self.window)
        frame2.pack()
        select = SheetSelect(frame2, self.controller, "BASE_SHEET")
        select.pack()

        frame3 = Frame(self.window)
        frame3.pack()
        btn1 = Button(
            frame3,
            text="Зберегти",
            command=lambda: self.controller.save_sheet(
                "BASE_SHEET", select.get(), self.select_sheet_callback))
        btn1.pack(side=LEFT, padx=10)
        btn2 = Button(frame3, text="Відмінити", command=self.window.destroy)
        btn2.pack(side=LEFT)
Пример #6
0
    def __init__(self, parent, controller):
        super().__init__(parent, controller)
        for i, weight in zip(range(3), [0, 1, 0]):
            self.grid_rowconfigure(i, weight=weight)
            self.grid_columnconfigure(i, weight=weight)
        div = Frame(self)
        div.grid(row=1, column=1, padx=0, pady=0)
        frame1 = Frame(div)
        frame1.pack()
        Label(frame1, text="Привіт Іра").pack()

        frame2 = Frame(div)
        frame2.pack()
        Button(frame2,
               text="Увійти",
               command=lambda: controller.show_page("HomePage")).pack(
                   side=LEFT, padx=10)
        Button(frame2, text="Я не Іра!!!", command=sys.exit).pack(side=LEFT)
Пример #7
0
    def __init__(self, parent, controller):
        super().__init__(parent, controller)
        Label(self, text="Дані по QC").pack(padx=5, pady=5)

        self.notebook = Notebook(self)
        self.notebook.pack(pady=5, padx=5)

        self.tab_general = GeneralTab(self.notebook, self.controller)
        self.notebook.add(self.tab_general, text="General")

        self.failures = FailuresTab(self.notebook, self.controller)
        self.notebook.add(self.failures, text="Failures")

        config = ConfigTab(self.notebook, self.controller)
        self.notebook.add(config, text="Configuration")

        btn_frame = Frame(self)
        btn_frame.pack()
        Button(btn_frame, text="Заповнити все",
               command=self.fill_all).pack(side=LEFT)
        Button(btn_frame,
               text="Назад",
               command=lambda: self.controller.show_page("HomePage")).pack(
                   side=LEFT, padx=10, pady=10)