class Onglet(Vue): """ Vue principal """ def __init__(self, fenetre): """ Constructeur de la fenetre """ self.frame = Frame(fenetre, borderwidth=1, relief='groove') self.frame.pack_configure(side='top', fill='both', expand='yes') self.frame.pack() self.titre = Label(self.frame, text=GT_('Onglet'), font=(20)) self.titre.pack() self.scrollbar = Scrollbar() self.result = Text(self.frame, yscrollcommand=self.scrollbar) self.result.tag_configure( 'error', background='red', foreground='white', font='helvetica 15 bold', relief='raised', ) self.result.tag_configure( 'result', background='green', font='helvetica 15 bold', relief='raised', ) self.result.pack(side='top', fill='both', expand='yes') def set_result(self, liste): """ Update parameters list """ self.result.delete(0.0, 'end') for key, value in liste.items(): self.result.insert( 'end', "%s\n\n" % key, ('result', ) ) # Formate in list properly display all list # don't display root python list format inline if type(value) == type(list()): tmp_value = None for dictionnaire in value: tmp_value = '%s%s\n' % (tmp_value, list_display_to_textarea(dictionnaire)) value = tmp_value value = "%s\n\n\n" % value self.result.insert('end', value) def set_error(self, liste): """ Update parameters list """ self.result.delete(0.0, 'end') for key, value in liste.items(): self.result.insert('end', "%s\n\n" % key, ('error', )) self.result.insert('end', value)
class Result(Vue): """ Vue principal """ def __init__(self, fenetre): """ Constructeur de la fenetre """ self.frame = Frame(fenetre, borderwidth=1, relief='groove') self.frame.pack_configure(side='left', expand='yes', fill='both') self.frame.pack() self.titre = Label(self.frame, text=GT_('Resultats'), font=(20)) self.titre.pack()
class Status(Vue): """ Vue principal """ def __init__(self, fenetre): """ Constructeur de la fenetre """ self.frame = Frame(fenetre, borderwidth=1, relief='groove') self.frame.pack_configure(side='bottom', fill='both') self.frame.pack() self.titre = Label(self.frame, text=GT_('Status'), font=(20)) self.titre.pack() self.progressbar = TkProgessBar(self.frame) self.progressbar.pack()
class Recherche(Vue): """ Vue principal """ def __init__(self, fenetre): """ Constructeur de la fenetre """ self.parent = fenetre self.frame = Frame(self.parent, borderwidth=1, relief='groove', width=100) self.frame.pack_configure(side='top', fill='both') self.frame.pack() self.titre = Label(self.frame, text=GT_('Url'), font=(20)) self.titre.pack() self.img = PhotoImage(file="%slogo.gif" % RESSOURCES_PATH) self.logo = Label(self.frame, image=self.img) self.logo.pack(pady=(0, 20), side="left") self.brand = Label(self.frame, text=GT_('WebForge %s' % VERSION), font=(20)) self.brand.pack(pady=(10, 20), padx=(0, 20), side="left") self.txt_recherche = Entry(self.frame, font=(22)) self.txt_recherche.pack(pady=(0, 20), expand='yes', fill='both', side='left') self.btn_go = Button(self.frame, text="GO") self.btn_go.pack(pady=(0, 20), side='right') self.btn_erase = Button(self.frame, text="X") self.btn_erase.pack(pady=(0, 20), side='right') def set_url(self, url): """ Set a new url value to the field """ self.txt_recherche.insert(0, url)