Ahenk/usr/share/ahenk/base/agreement/ahenkmessage.py

92 lines
3 KiB
Python
Raw Normal View History

# #!/usr/bin/python3
# -*- coding: utf-8 -*-
import tkinter as tk
from tkinter import *
import os
2020-04-06 18:10:41 +03:00
import sys
class AskRegister():
2020-04-06 18:10:41 +03:00
message = None
title = None
host = ""
2020-04-06 18:10:41 +03:00
def __init__(self, message, title, host):
2020-04-06 18:10:41 +03:00
self.message = message
self.title = title
self.host = host
self.master = tk.Tk()
self.text= tk.StringVar()
self.master.title(self.title)
2020-04-06 18:10:41 +03:00
tk.Label(self.master, text="* Etki Alanı: ").grid(row=0)
self.e1 = tk.Entry(self.master)
self.e1.grid(row=0, column=1)
# if self.host != "":
# pass
# else:
2020-04-06 18:10:41 +03:00
tk.Label(self.master, text="* Yetkili Kullanıcı : ").grid(row=1)
tk.Label(self.master, text="* Parola : ").grid(row=2)
2020-04-06 18:10:41 +03:00
self.e2 = tk.Entry(self.master)
self.e3 = tk.Entry(show="*")
2020-04-06 18:10:41 +03:00
tk.Label(self.master, textvariable=self.text, fg="red").grid(row=3, columnspan=2)
# self.var1 = IntVar()
# Checkbutton(self.master, text="Active Directory", variable=self.var1, command=self.check1).grid(row=3, column=0, stick=tk.W,
# pady=4)
# self.var2 = IntVar()
# self.var2.set(1)
# Checkbutton(self.master, text="OpenLDAP", variable=self.var2, command=self.check2).grid(row=3, column=1, stick=tk.W, pady=4)
2020-04-06 18:10:41 +03:00
self.e2.grid(row=1, column=1)
self.e3.grid(row=2, column=1)
tk.Button(self.master, text='Çıkış', command=self.master.quit).grid(row=4, column=0, sticky=tk.W, pady=4)
tk.Button(self.master, text='Tamam', command=self.show).grid(row=4, column=1, sticky=tk.W, pady=4)
tk.mainloop()
def show(self):
if(self.e1.get() =='' or self.e2.get()=='' or self.e3.get()==''):
self.text.set("Lütfen zorunlu alanları doldurunuz!")
else:
print(self.e1.get()+" "+self.e2.get()+" "+self.e3.get())
self.master.quit()
# if self.var2.get() == 1:
# if self.host != "":
# print(self.e2.get()+" "+self.e3.get()+" "+"LDAP")
# else:
# print(self.e1.get()+" "+self.e2.get()+" "+self.e3.get()+" "+"LDAP")
#
# if self.var1.get() == 1:
# if self.host != "":
# print(self.e2.get()+" "+self.e3.get()+" "+"AD")
# else:
# print(self.e1.get()+" "+self.e2.get()+" "+self.e3.get()+" "+"AD")
def check1(self):
self.var2.set(0)
def check2(self):
self.var1.set(0)
2020-04-06 18:10:41 +03:00
if __name__ == '__main__':
if len(sys.argv) > 1:
try:
m_message = sys.argv[1]
t_title = sys.argv[2]
h_host = sys.argv[3]
display = sys.argv[4]
os.environ["DISPLAY"] = display
app = AskRegister(m_message, t_title, h_host)
2020-04-06 18:10:41 +03:00
except Exception as e:
print(str(e))
else:
print("Argument fault. Check your parameters or content of parameters. Parameters:" + str(sys.argv))