class Zenity(CUI) :
+ def __init__(self) :
+
+ self.item_list = None
+
def yesnoback(self, _strs) :
str = ""
str = _strs
- ans = subprocess.call(["zenity", "--question", "--title=Serene Setup Wizard", "--text={}".format(str), "--width=300"])
+ ans = subprocess.call(["zenity", "--question", "--title=Serene Setup Wizard", "--text={}".format(str), "--width=300"], stderr=open("/dev/null", "w"))
if ans == 0 :
return True
else :
return False
+
+ def show(self, _str) :
+
+ if self.item_list is None :
+
+ self.item_list = list()
+
+ self.item_list.append(_str)
+
+
+ def choose(self, _) :
+
+ str = ["zenity", "--list", "--title=Serene Setup Wizard", "--text", "Choose the item you want to change.", "--height=400", "--width=400", "--column", "No.", "--column", "Item", "--column", "Status", "--print-column=all"]
+
+
+ for i, item in enumerate(self.item_list) :
+
+ str.append("{}".format(i+1))
+ str.append("{}".format(item[0]))
+ str.append("{}".format(item[1]))
+
+ self.item_list = None
+
+ while True :
+
+ tmp = open("/tmp/serene-setup-wizard.tmp", "w")
+ ret = subprocess.call(str, stdout=tmp, stderr=open("/dev/null", "w"))
+ tmp.close()
+
+ if ret :
+ print("")
+ return False
+
+ tmp = open("/tmp/serene-setup-wizard.tmp", "r")
+ ans = tmp.readline().split("|")[0]
+ tmp.close()
+
+ if ans != "" :
+ break
+
+ print("")
+ return int(ans)
+