Skip to content

Commit

Permalink
some changes in _general.py
Browse files Browse the repository at this point in the history
  • Loading branch information
quintijn committed Nov 15, 2022
1 parent abc1b37 commit 8da111e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 22 deletions.
35 changes: 14 additions & 21 deletions src/unimacro/UnimacroGrammars/_general.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class ThisGrammar(ancestor):
<presscode> exported = (press|address) (<dgndictation>|<dgnletters>);
<choose> exported = choose {n1-10};
<reload> exported = reload Natlink;
<info> exported = give (user | window |unimacro| path) (info|information) ;
<info> exported = give (user | prog |window |unimacro| path) (info|information) ;
<undo> exported = Undo [That] [{count} [times]];
<redo> exported = Redo [That] [{count} [times]];
<namephrase> exported = Make That [Name] phrase;
Expand Down Expand Up @@ -761,39 +761,32 @@ def gotResults_info(self,words,fullResults):
"""
T = []
extra = []
if self.hasCommon(words,'window'):
if self.hasCommon(words,'window') or self.hasCommon(words,'prog'):
m = natlink.getCurrentModule()
hwnd = m[2]
hndle = m[2]
p = unimacroutils.getProgInfo(m)
topchild = p[2] == 'top'
assert hndle == p.hndle
T.append('---from unimacroutils.getProgInfo:')
T.append('0 prog: %s'% p[0])
T.append('1 title: %s'% p[1])
T.append('2 topchild: %s'% p[2])
T.append('3 classname: %s'% p[3])
# (progpath, prog, title, toporchild, classname, hndle)
if self.hasCommon(words, 'prog'):
T.append(f'progInfo = {p}')
T.append(f' .progpath: "{p.progpath}"\n')
T.append(f' .prog:\t{p.prog}')
T.append(f' .title: "{p.title}"\n')
T.append(f' .toporchild\t{p.toporchild}')
T.append(f' .classname\t{p.classname}')
T.append(f' .hndle:\t{hndle}')
childClass = "#32770"
overruleIsTop = self.getTopOrChild(m, childClass=childClass)

T.append('4 hndle: %s'% p[4])

if topchild != overruleIsTop:
if p.toporchild != overruleIsTop:
T.append('')
if overruleIsTop:
T.append("**** treat as TOP window although it is a child window")
else:
T.append("**** treat as CHILD window although it is a top window")



T.append('')
T.append('---from getCurrentModule:')
T.append('0 program path: %s'% m[0])
T.append('1 window title: %s'% m[1])
T.append('2 window handle: %s'% m[2])
T.append('')
T.append('---from GetClassName:')
T.append('class name: %s'% win32gui.GetClassName(hwnd))

elif self.hasCommon(words,'user'):
# status (natlinkstatus.NatlinkStatus()) is global variable
T.append('user:\t\t%s'% status.user)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_grammar_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
def mock_unimacro_user_dir(tmp_dir,_self):

mock_folder= tmp_dir / "mock_unimacro_userdir"
print(f"Mock unimacro folder {mock_folder} in {__FILE__}") #just for understanding remove eventually
print(f"Mock unimacro folder {mock_folder} in {__file__}") #just for understanding remove eventually
if not mock_folder.is_dir():
mock_folder.mkdir()
return str(mock_folder)
Expand Down

0 comments on commit 8da111e

Please sign in to comment.