def __init__(self, parent): self.top = Toplevel(parent, takefocus=True) self.top.wm_attributes("-topmost", True) self.top.title('Bezig met verwerken') Label(self.top, text="Even geduld, de gegevens worden verwerkt.").pack(padx=10, pady=10, fill=X, expand=1) # Focus and center utils.centerWindow(self.top) self.top.focus_set() self.top.grab_set() self.top.update()
def __init__(self, parent, e, stacktrace): self.stacktrace = stacktrace self.e = e self.top = Toplevel(parent, takefocus=True) self.top.wm_attributes("-topmost", True) self.top.title('Fout') # User understandable message errorTXT = "Er heeft zich een fout voorgedaan.\nHieronder vindt u een gedetailleerde beschrijving van de fout.\nGelieve deze te rapporteren door ze te kopiëren en in een email bericht te plakken." if (isinstance(e, utils.UserError)): errorTXT = e.msg self.stacktrace = "%s\n\n\nROOT CAUSE:\n %s" % (e.msg, e.stacktrace) + "\n\n" + self.stacktrace userMsg = Label(self.top, text=errorTXT, anchor=W) userMsg.config(justify=LEFT) userMsg.pack(padx=10, pady=10, fill=X, expand=1) # Stacktrace frame self.stacktraceFrame = Frame(self.top) self.stacktraceFrame.pack(padx=10, pady=10, fill=BOTH, expand=1) self.stacktraceBox = Text(self.stacktraceFrame) self.stacktraceBox.pack(fill=BOTH, expand=1, side=LEFT) self.stacktraceBox.insert(END, self.stacktrace) self.stacktraceBox.config(state=DISABLED) # Prohibit any further changes to the textbox try: scroll = Scrollbar(self.stacktraceFrame) scroll.pack(side=RIGHT, fill=Y, expand=1) scroll.config(command=self.stacktraceBox.yview) self.stacktraceBox.config(yscrollcommand=scroll.set) except: ''' doesnt work on macosx''' pass # Copy to clipboard button self.clipbCopyButton = Button(self.top, text=u"Kopiëer naar klembord", command=self.copyStacktraceToClipboard) self.clipbCopyButton.pack(pady=10) # Ok button self.buttonsFrame = Frame(self.top) self.buttonsFrame.pack(fill=X, expand=1, padx=10, pady=10) self.okButton = Button(self.buttonsFrame, text="Ok", command=self.close) self.okButton.pack(side=RIGHT) # Focus and center utils.centerWindow(self.top) self.top.focus_set() self.top.grab_set() self.top.update() # Let the rest of the GUI wait until this dialog is closed parent.wait_window(self.top)
def __init__(self, mainWindow): Toplevel.__init__(self, mainWindow.parent, takefocus=True) self.transient(mainWindow.parent) self.mainWindow = mainWindow self.protocol("WM_DELETE_WINDOW", self.cancelPressed) #self.window.wm_attributes("-topmost", True) # This option does not play well with ttk comboboxes self.title('Instellingen') self.grab_set() self.frame = Frame(self) self.frame.pack(fill=BOTH, expand=1, padx=10, pady=10) font = tkFont.Font(weight="bold") label = Label(self.frame, text='Standaard (referentie) thesauri: ', anchor=W, font=font) label.pack(pady=5, fill=X, expand=1) # Create an input file table for specifying the thesauri and add configured thesauri to it self.thesauriTable = InputFileTable(self.frame,settings=mainWindow.settings) self.thesauriTable.setAvailableTypes(thesaurus_types) settings = mainWindow.settings settings.validate() self.thesauriTable.addRows(settings.thesauri) if settings.thesauri.size() == 0: # Add an empty row to GUI if no thesauri are configured, as a visual cue of what the purpose of this menu is self.thesauriTable.addRow() # Input file toevoegen knop self.addimg = PhotoImage(data=resources.ButtonIcons_base64.add, format="gif89") self.addRowButton = Button(self.frame, text="Thesaurus toevoegen", image=self.addimg, compound=LEFT, command=self.thesauriTable.addRow) self.addRowButton.pack(pady=5) # Description label descrLabel = Label(self.frame, text="De volgorde van de thesauri in deze tabel bepaalt hun belangrijkheid.\nDe bovenste thesaurus is het meest belangrijk.", anchor=W) descrLabel.config(justify=LEFT) descrLabel.pack(pady=5, fill=X, expand=1) # Detail self.detailFrame = Frame(self.frame) self.detailFrame.pack(pady=5, fill=X, expand=1) font = tkFont.Font(weight="bold") detailLabel = Label(self.detailFrame, text="Maximum aantal unieke waardes voor detail: ", anchor=W, font=font) detailLabel.pack(side=LEFT) self.detailField = Entry(self.detailFrame) self.detailField.pack(side=LEFT, fill=X, expand=1) try: self.detailField.insert(0, str(settings.maxUniqueValues)) except: self.detailField.insert(0, str(DEFAULT_MAX_DETAIL)) detaildescrLabel = Label(self.frame, text="Indien er meer unieke waardes voor een bepaald veld zijn dan het getal hierboven, wordt geen detail meer getoond.\nEen hoger maximum geeft een gedetailleerder (maar groter) rapport.\nVoor het genereren/bekijken van een groot rapport is een krachtige computer nodig.", anchor=W) detaildescrLabel.config(justify=LEFT) detaildescrLabel.pack(pady=5, fill=X, expand=1) # Add Ok and Cancel buttons buttonsFrame = Frame(self.frame) buttonsFrame.pack() buttonsFrame.pack(fill=X, expand=1) okButton = Button(buttonsFrame, text="Ok", command=self.okPressed) okButton.pack(side=RIGHT) cancelButton = Button(buttonsFrame, text="Annuleren", command=self.cancelPressed) cancelButton.pack(side=RIGHT, padx=5) self.bind("<Escape>", self.cancelPressed) # Focus and center utils.centerWindow(self) self.focus_set()
def __init__(self, mainWindow): style = Style() style.configure("BW.TLabel", foreground="black", background="white") Toplevel.__init__(self, mainWindow.parent, takefocus=True, bg="white") self.transient(mainWindow.parent) self.mainWindow = mainWindow self.protocol("WM_DELETE_WINDOW", self.cancelPressed) #self.window.wm_attributes("-topmost", True) # This option does not play well with ttk comboboxes self.title('Over erfgoedstats') self.grab_set() self.frame = Frame(self, style="BW.TLabel") self.frame.pack(fill=BOTH, expand=1, padx=10, pady=10) font = tkFont.Font(weight="bold") label = Label(self.frame, text="Erfgoedstats versie %s (%s)" % (release.version, release.date), anchor=W, font=font, style="BW.TLabel") label.pack(pady=5, fill=X, expand=1) font = tkFont.Font(size=10) txt = Text(self.frame, bg="white", borderwidth=0 ) txt.pack(pady=5, fill=X, expand=1) hyperlink = HyperlinkManager(txt) txt.insert(INSERT,"Website: ") txt.insert(INSERT, "http://www.projectcest.be/index.php/Erfgoedstats", hyperlink.add(self.openPackedSite)) txt.config(state=DISABLED) txt.config(height=3) txt.config(font=font) label = Label(self.frame, text="Ontwikkeling:" , anchor=W, style="BW.TLabel",font=font) label.pack(pady=5, fill=X, expand=1) self.logoFrame = Frame(self.frame, style="BW.TLabel") self.logoFrame.pack(fill=BOTH, expand=0) label = Label(self.frame, text="Sonsors:" , anchor=W, style="BW.TLabel", font=font) label.pack(pady=5, fill=X, expand=1) self.logo2Frame = Frame(self.frame, style="BW.TLabel") self.logo2Frame.pack(fill=BOTH, expand=0) ## LOGOs (supplied as base64 encoded strings) ## self.provincies = PhotoImage(master=self.mainWindow.parent,data=resources.logos_provincies.logo__provincie_,format="gif89") pvLogo = Label(self.logo2Frame, image=self.provincies, style="BW.TLabel") pvLogo.pack(side=LEFT, padx=10, pady=10) self.kapernikov = PhotoImage(master=self.mainWindow.parent, data=resources.logo_kapernikov.kapernikov,format="gif89") self.packed = PhotoImage(master=self.mainWindow.parent, data=resources.logo_packed.packed,format="gif89") dLogo = Label(self.logoFrame, image=self.kapernikov, style="BW.TLabel") dLogo.grid(column=0, row=0, padx=10, sticky=W) aLogo = Label(self.logoFrame, image=self.packed, style="BW.TLabel") aLogo.grid(column=1, row=0, padx=10, sticky=E) # Add Ok and Cancel buttons buttonsFrame = Frame(self.frame, style="BW.TLabel") buttonsFrame.pack() buttonsFrame.pack(fill=X, expand=1) okButton = Button(buttonsFrame, text="Ok", command=self.okPressed) okButton.pack(side=RIGHT) self.bind("<Escape>", self.cancelPressed) # Focus and center utils.centerWindow(self) self.focus_set()
def __init__(self, parent): import resources.logo_packed self.parent = parent self.settings = self.loadConfiguration() self.frame = Frame(parent) self.frame.pack(padx=10, pady=10, fill=X, expand=1) # Menu self.menu = Menu(parent) mainmenu = Menu(self.menu, tearoff=False) mainmenu.add_command(label='Opties / Standaardthesauri', command=self.showOptions) mainmenu.add_command(label='Over erfgoedstats', command=self.showAbout) mainmenu.add_separator() mainmenu.add_command(label='Afsluiten', command=self.quit) self.menu.add_cascade(label='Bestand', menu=mainmenu) parent.config(menu=self.menu) self.parent.protocol("WM_DELETE_WINDOW", self.quit) # Kies museum naam self.museumnaamFrame = Frame(self.frame) self.museumnaamFrame.pack(pady=5, fill=X, expand=1) font = tkFont.Font(weight="bold") museumnaamLabel = Label(self.museumnaamFrame, text="Naam collectie: ", font=font, anchor=W) museumnaamLabel.pack(side=LEFT, pady=15) self.museumnaamField = Entry(self.museumnaamFrame) self.museumnaamField.pack(side=LEFT, fill=X, expand=1) ## Input files ## font = tkFont.Font(weight="bold") inputsLabel = Label(self.frame, text="Input bestanden: ", anchor=W, font=font) inputsLabel.pack(pady=5, fill=X, expand=1) self.inputFilesTable = InputFileTable(self.frame, nameColumn=False,settings=self.settings, tabletype="objects") self.inputFilesTable.setAvailableTypes( settings.inputfile_types ) # Set default input rows self.inputFilesTable.addRow(name="Objecten", filetype='Adlib XML Objecten') self.inputFilesTable.addRow(name="Thesaurus", filetype='Adlib XML Thesaurus') self.inputFilesTable.addRow(name="Personen", filetype='Adlib XML Personen') # Input file toevoegen knop img = PhotoImage(master=parent, data=resources.ButtonIcons_base64.add,format="gif89") self.addimg = img self.addRowButton = Button(self.frame, image=img, text="Bestand toevoegen", compound=LEFT, command=self.addInputRow) self.addRowButton.pack(pady=5) # Kies output file self.outputFrame = Frame(self.frame) self.outputFrame.pack(pady=5, fill=X, expand=1) font = tkFont.Font(weight="bold") outputLabel = Label(self.outputFrame, text="Output: ", anchor=W, font=font) outputLabel.pack(side=LEFT) self.outputField = Entry(self.outputFrame) self.outputButton = Button(self.outputFrame, text="Bladeren", command=self.browseOutputFile) self.outputField.pack(side=LEFT, fill=X, expand=1) self.outputButton.pack(side=RIGHT, padx=5) # Vergelijk met thesauri optie self.frame4 = Frame(self.frame) self.frame4.pack(pady=10, fill=X, expand=1) self.checkThesaurus = IntVar() self.checkb = Checkbutton(self.frame4, variable=self.checkThesaurus) self.updateThesauriCheckbox() self.checkb.pack(side=LEFT, padx=5) ## Start button ## self.startButton = Button(self.frame, text="Start", command=self.start) self.startButton.pack(side=BOTTOM) utils.centerWindow(self.parent)