Ejemplo n.º 1
0
window.connect('delete-event', gtk.main_quit)
window.set_border_width(6)

vbox = gtk.VBox()
window.add(vbox)

data_types = [
    (True, bool),
    (42, int),
    (22.0/7.0, float),
    (3000L, long),
    ('THX', str),
    (datetime.datetime.now(), datetime.datetime),
    (datetime.date.today(), datetime.date),
    (datetime.time(11, 38, 00), datetime.time),
    (currency('50.1'), currency),
    ]

for data, data_type in data_types:
    hbox = gtk.HBox(True)
    vbox.pack_start(hbox, False, False, 6)

    label = ProxyLabel(data_type.__name__.capitalize())
    label.set_bold(True)
    hbox.pack_start(label)

    label = ProxyLabel(data_type=data_type)
    label.update(data)
    hbox.pack_start(label, False, False, 6)

    entry = ProxyEntry(data_type=data_type)
Ejemplo n.º 2
0
 def __init__(self, cod, title, valor, check=False):
     self.check = check
     self.cod = cod
     self.title = title
     self.valor = currency(valor)
Ejemplo n.º 3
0
 def __init__(self, cod, title, valor):
     self.cod = cod
     self.title = title
     self.valor = currency(valor)
Ejemplo n.º 4
0
    def on_about__validate(self, widget, data):
        if not 'kinda' in data.lower():
            return ValidationError("use a better language")

person = Person()
person.name = u'John Doe'
person.age = 36
person.birthdate = datetime.datetime(year=1969, month=2, day=20)
person.height = 183.0
person.weight = 86.0
person.nationality = 'Yankee'
person.about = 'Kinda fat'
person.status = True
person.gender = 'Female'
person.salary = currency(1234)

form = Form()
proxy = form.add_proxy(person, ['name', 'age', 'birthdate',
                                'height', 'weight', 'about',
                                'nationality', 'status', 'gender', 'salary'])
form.show_all()

def on_ok_btn_clicked(widget):
    print "Name:", person.name
    print "Age:", person.age
    print "Birthday:", person.birthdate
    print "Height:", person.height
    print "Weight:", person.weight
    print "Nationality:", person.nationality
    print "About Your self:", person.about
Ejemplo n.º 5
0
    def __init__(self, controle, window, itens):
        """window é a janela que está chamando o recebimento
            itens a lista de itens adquiridos com descrição e preço"""
        self.w_receber = gtk.Dialog("CEF SHOP - Recebimento", window, gtk.DIALOG_MODAL)
        self.w_receber.set_position(gtk.WIN_POS_CENTER)
        self.w_receber.set_size_request(550,450)
        self.w_receber.connect("destroy", self.close)
        self.controle = controle

#------Divisao v principal
        vbox_main = gtk.VBox(False, 2)
        self.w_receber.vbox.add(vbox_main)   

#------Lista
        self.data = []
        columns = [
            Column('item', data_type = str, title="Item"),
            Column('valor', data_type = currency, title="Valor") 
        ]
        self.lista = ObjectList(columns)
        for iten in itens:
            item = iten[0]
            valor = iten[1]
            self.data.append(Receber.Item(item, valor))
        self.lista.extend(self.data)

#------lista de itens    
        frame_itens = gtk.Frame("Lista de Produtos")
        vbox_main.pack_start(frame_itens, True, True, 2)
        vbox_lista = gtk.VBox(False, 2)

        frame_itens.add(vbox_lista)
        vbox_lista.pack_start(self.lista, True, True, 2)
        
        label = SummaryLabel(klist=self.lista, column='valor', label='<b>Total:</b>',
                     value_format='<b>%s</b>')
        vbox_lista.pack_start(label, False, False, 4)
        
#-----entrada valor
        hbox_valor = gtk.HBox() 

        label_troco = ProxyLabel('Troco ')
        label_troco.set_bold(True)
        label_valor_troco = ProxyLabel(data_type = currency)
        label_valor_troco.set_bold(True)
        label_valor_troco.update(currency('0.00'))
        
        label_dinheiro = ProxyLabel('Dinheiro ')
        label_dinheiro.set_bold(True)
        entry_dinheiro = ProxyEntry(data_type = currency)
        
        hbox_valor.pack_start(label_troco, False, False, 2)
        hbox_valor.pack_start(label_valor_troco, False, False, 2)
        
        hbox_valor.pack_end(entry_dinheiro, False, False, 2)
        hbox_valor.pack_end(label_dinheiro, False, False, 2)
        self.w_receber.vbox.pack_start(hbox_valor,False, True, 4)
        
#-------area de notificacao
        self.notify_box = notify_area(self.controle)
        self.w_receber.vbox.pack_start(self.notify_box,False, True, 4)

#-------Botoes
        button_cancel = gtk.Button(stock=gtk.STOCK_CANCEL)
        button_cancel.connect("clicked", self.close)
        button_ok = gtk.Button(stock=gtk.STOCK_OK)
        button_ok.connect("clicked", self.recebido)

        bbox = gtk.HButtonBox ()
        bbox.set_layout(gtk.BUTTONBOX_END)
        bbox.add(button_cancel)
        button_cancel.set_flags(gtk.CAN_DEFAULT)
        bbox.add(button_ok)
        self.w_receber.action_area.pack_start(bbox, False, True, 0)
    
#------Mostra tudo
        self.w_receber.show_all()
        self.notify_box.hide()
        self.w_receber.show()
Ejemplo n.º 6
0
 def __init__(self,item, valor):
     """item é a descrição do item alugado ou comprado
         valor o preço do item"""
     self.item = item
     self.valor = currency(valor)