PDF-Embanner/pdfembannersrc/choice.py

92 lines
2.9 KiB
Python

# -*-coding:utf-8 -*
import tkinter as tk
from tkinter import messagebox
import logging
from pdfembannersrc import cat, help, encrypt, full_split, get_text, watermark
logger = logging.getLogger()
class Choice(tk.Frame):
"""
Window to chose what to do...
"""
def __init__(self, fenetre, **kwargs):
self.parent = fenetre
tk.Frame.__init__(self, fenetre, **kwargs)
self.pack(fill=tk.BOTH)
# Création de nos widgets
crocus = tk.PhotoImage(file='pdfembannersrc/crocus.png')
img1 = tk.Label(self, image=crocus)
img1.image=crocus
img1.grid(row=0, column=0, rowspan=10, sticky=tk.W)
pdfem = tk.PhotoImage(file='pdfembannersrc/pdfembanner.png')
img2 = tk.Label(self, image=pdfem)
img2.image=pdfem
img2.grid(row=0, column=1, sticky=tk.W+tk.N)
self.bouton_open = tk.Button(self, text="1. Concatenate", command=self.do1)
self.bouton_open.grid(row=1, column=1, sticky=tk.W+tk.E)
self.bouton_open = tk.Button(self, text="2. Watermark", command=self.do2)
self.bouton_open.grid(row=2, column=1, sticky=tk.W+tk.E)
self.bouton_open = tk.Button(self, text="3. Encryption", command=self.do3)
self.bouton_open.grid(row=3, column=1, sticky=tk.W+tk.E)
self.bouton_open = tk.Button(self, text="4. Extract text", command=self.do4)
self.bouton_open.grid(row=4, column=1, sticky=tk.W+tk.E)
self.bouton_open = tk.Button(self, text="5. Full split", command=self.do5)
self.bouton_open.grid(row=5, column=1, sticky=tk.W+tk.E)
self.bouton_open = tk.Button(self, text="6. Forms", command=self.do6)
self.bouton_open.grid(row=6, column=1, sticky=tk.W+tk.E)
self.bouton_open = tk.Button(self, text="7. Help", command=self.do7)
self.bouton_open.grid(row=7, column=1, sticky=tk.W+tk.E)
self.bouton_open = tk.Button(self, text="Close", command=self.quit)
self.bouton_open.grid(row=8, column=1, sticky=tk.W+tk.E)
def do1(self, *args):
"""
Open concatenation interface
"""
cat.Interface(self.parent)
def do2(self, *args):
"""
Open Watermerk interface
"""
watermark.Interface(self.parent)
def do3(self, *args):
"""
Open encryption interface
"""
encrypt.Interface(self.parent)
def do4(self, *args):
"""
Open Text extraction interface
"""
get_text.Interface(self.parent)
def do5(self, *args):
"""
Open Full split interface
"""
full_split.Interface(self.parent)
def do6(self, *args):
"""
Open Forms interface
"""
messagebox.showwarning(title="Warning", message="Not yet implemented!")
def do7(self, *args):
"""
Open help interface
"""
help.Interface(self.parent)
def close(self, *args):
self.quit()