Skip to content

Commit

Permalink
zti display check
Browse files Browse the repository at this point in the history
Signed-off-by: Neil Johnson <najohnsn@us.ibm.com>
  • Loading branch information
najohnsn committed Nov 4, 2024
1 parent 89c5981 commit b696cd8
Showing 1 changed file with 41 additions and 33 deletions.
74 changes: 41 additions & 33 deletions tnz/ati.py
Original file line number Diff line number Diff line change
Expand Up @@ -1202,19 +1202,10 @@ def send(self, *args):
return 12

tns = self.get_tnz()

zti = self.__zti
zti = self.__zti_display_check()
zti2 = zti
if zti:
display = self.__gv["DISPLAY"]
if display not in ("ALL", "HOST", "HOSTCODE"):
zti = None
zti2 = None
elif not self.connected:
zti = None
zti2 = None
elif not self.__gv["SHOWTYPE"]:
zti = None
if zti and not self.__gv["SHOWTYPE"]:
zti = None

if not value.startswith(reset):
keyunlock = self.__gv["KEYUNLOCK"]
Expand Down Expand Up @@ -1998,7 +1989,7 @@ def wait(self, *args):
self.__logerror(">> WAIT TIMEOUT occurred")

raise_it = True
if self.connected:
if self.connected and ati is self:
if os.isatty(0) and os.isatty(1):
if not self.__zti:
from . import zti
Expand Down Expand Up @@ -2240,7 +2231,8 @@ def __drop_session(self):
tns = self.__session_tnz.pop(session, None)
if not self.__session_tnz:
next_session = "NONE"
self.__shell_mode()
if ati is self:
self.__shell_mode()

self.__gv["SESSION"] = next_session
self.__refresh_vars()
Expand Down Expand Up @@ -2373,15 +2365,9 @@ def __refresh(self, timeout=0, keylock=True):
session = self.session
tns = self.__session_tnz[session]
seslost = tns.seslost

if self.connected and not in_wait:
zti = self.__zti
else:
zti = None

display = self.__gv["DISPLAY"]
if zti and display not in ("ALL", "HOST", "HOSTCODE"):
zti = None
zti = None
if not in_wait:
zti = self.__zti_display_check()

if tns.updated:
timeout = 0
Expand Down Expand Up @@ -2556,15 +2542,7 @@ def __set_session(self, name, verifycert, lognew):

self.__gv["SESLOST"] = ""
self.ses_exc = None

zti = self.__zti
if zti:
display = self.__gv["DISPLAY"]
if display not in ("ALL", "HOST", "HOSTCODE"):
zti = None
elif not self.connected:
zti = None

zti = self.__zti_display_check()
if zti:
zti.rewrite = True

Expand Down Expand Up @@ -2691,6 +2669,30 @@ def __when_priority(self, name):

return whenv.pri[0]

def __zti_display_check(self):
zti = self.__zti
if not zti:
return None

if not self.connected:
return None

display = self.__gv["DISPLAY"]
if display not in ("ALL", "HOST", "HOSTCODE"):
return None

if ati is not self: # another program "stole" zti
if display == "ALL":
self.set("DISPLAY", "RESULTS")
elif display == "HOSTCODE":
self.set("DISPLAY", "CODE")
else:
self.set("DISPLAY", "NONE")

return None

return zti

# static methods

@staticmethod
Expand Down Expand Up @@ -3011,6 +3013,7 @@ def display(self):

@display.setter
def display(self, value):
global ati
valstr = str(value).upper().strip()
if self.connected:
display = self.__gv["DISPLAY"]
Expand All @@ -3027,10 +3030,15 @@ def display(self, value):
from . import zti
self.__zti = zti.create()

if self.__zti and ati is not self:
ati = self
show = True
self.__shell_mode()

if show and self.__zti and self.get_tnz():
self.__zti.show()

elif display in ("ALL", "HOST", "HOSTCODE"):
elif display in ("ALL", "HOST", "HOSTCODE") and ati is self:
self.__shell_mode()

self.__gv["DISPLAY"] = valstr
Expand Down

0 comments on commit b696cd8

Please sign in to comment.