Ejemplo n.º 1
0
    def listbox_disc_fill():
        """Заполняет лист скидок"""

        for q in range(len(discounts)):       # Очищаем список
            del(discounts[0])
        listbox_disc.delete(0, END)

        for disc in queries.discount_list():
            discounts.append(disc)
            string = u' %-' + unicode(CONTROL_4_WIDTH - 6) + u's %2d'
            string = string % (disc.sinopsys, disc.discount) + u'% '
            listbox_disc.insert(END, string)
Ejemplo n.º 2
0
        def __init__(self, master):

            self.frame = Frame(master)
            self.frame.pack(side = LEFT)
            self.frame_lower_button = Frame(self.frame)
            self.frame_lower_button.pack(side=BOTTOM, fill=Y)
            #------------------------ Кнопки слева от счета ---------#
            self.frame_left_button = Frame(self.frame)
            self.frame_left_button.pack(side=LEFT, fill=Y)
            self.button_up = Button(self.frame_left_button,
                               image=data.IMG_INTERFACE[2], command=self.b_up)
            self.button_up.pack(side=TOP, padx=5, pady=10)
            self.button_down = Button(self.frame_left_button,
                               image=data.IMG_INTERFACE[1], command=self.b_down)
            self.button_down.pack(side=TOP, padx=5, pady=0)
            #------------------------ Собственно счет ---------------#
            self.scrollbar = Scrollbar(self.frame)
            self.listbox = Listbox(self.frame,
                                   yscrollcommand=self.scrollbar.set,
                                   width = BILL_WIDTH, height=BILL_HEIGHT,
                                   activestyle='dotbox',
                                   font=('Lucida Console', BILL_FONT_SIZE))
            self.listbox.pack(side=LEFT, fill=BOTH)
            self.scrollbar.config(command=self.listbox.yview)
            self.scrollbar.pack(side=LEFT, fill=Y)
            #------------------------ Кнопки справа от счета --------#
            self.frame_right_button = Frame(self.frame)
            self.frame_right_button.pack(side=LEFT, fill=Y)
            self.button_plus = Button(self.frame_right_button,
                              image=data.IMG_INTERFACE[6],command=self.b_plus)
            self.button_plus.pack(side=TOP, padx=5, pady=2)
            self.button_minus = Button(self.frame_right_button,
                              image=data.IMG_INTERFACE[7],command=self.b_minus)
            self.button_minus.pack(side=TOP, padx=5, pady=2)
            self.button_del = Button(self.frame_right_button,
                              image=data.IMG_INTERFACE[5],command=self.b_del,
                              state=DISABLED)
            self.button_del.pack(side=TOP, padx=5, pady=25)
            #-------------------------- Кнопки снизу от счета ------------№
            self.button_print = Button(self.frame_lower_button,
                                text=u'Распечатать\nчек',
                                style='Little.TButton',command=self.b_print)
            self.button_print.pack(side=LEFT, padx=10, pady=10, fill=X)
            self.button_save = Button(self.frame_lower_button,
                                text=u'Сохранить\nчек', style='Little.TButton',
                                command=self.b_save, state=DISABLED)
            self.button_save.pack(side=LEFT, padx=10, pady=10, fill=X)
            self.button_accept = Button(self.frame_lower_button,
                                text=u'Провести\nоперацию',
                                style='Little.TButton', command=self.b_accept)
            self.button_accept.pack(side=LEFT, padx=10, pady=10, fill=X)
            #------------------------- Метка с "итого" под счетом --------#
            self.label1 = Label(self.frame_lower_button,
                                       text=u'Итого:    0.00 грн.',
                                       font=('Lucida Console', FONT_SIZE_BIG),
                                       bg='white')
            self.label1.pack(side=LEFT, padx=10, pady=10, fill=X)
            #------------------------- скидка под счетом -----------------#
            self.discountMenu = Menubutton(self.frame_lower_button,
                      text=u'Скидка  0%', direction='below',style='TMenubutton')
            self.discountMenu.pack(side=LEFT, fill=X)
            self.discountMenu.menu  =  Menu(self.discountMenu, tearoff=0)
            self.discountMenu['menu'] = self.discountMenu.menu

            for item in queries.discount_list():
                self.discountMenu.menu.add_command(label=item.sinopsys,
                    font=('Verdana', FONT_SIZE_MENU),
                    command=lambda key=item.id: self.discount_change(key))

            self.discount = 0     # Текущая скидка.
            self.bill = []        # Содержание текущего счета (товар)
            self.quantity = []    # Содержание  счета (количество товара)