Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check unimacro feb24, go to version 4.1.5 #50

Merged
merged 33 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
3387fd3
a new test, and a few fixes, so making a brand new inifile passes wit…
quintijn Jan 31, 2024
2549515
checking getTopOrChild function...
quintijn Feb 1, 2024
11b8499
fixing, at lasts, switch on a unimacro grammar, doing a reload (by th…
quintijn Feb 7, 2024
49ed8d0
several details in boilerplate code. added rememberDialog to .gitignore
quintijn Feb 7, 2024
32ddae1
_general.py fixed several dgndictation things (also in nsformat.py of…
quintijn Feb 8, 2024
2a3a992
fixed a few flaws in _brackets, started test_grammar_brackets.py
quintijn Feb 8, 2024
99b33ce
brought win32clipboard under try finally
quintijn Feb 8, 2024
353ccb8
tidy up _general
quintijn Feb 8, 2024
b33efe3
few small things _clickbyvoice.py, mostly tyding up things
quintijn Feb 8, 2024
2ac87ed
work in progress _folders, getting natlinktimer again at work...
quintijn Feb 12, 2024
bea933b
logging _folders settings
quintijn Feb 16, 2024
24ce0c8
working on the _folders grammar option and checking automatic trackin…
quintijn Feb 16, 2024
743f6bb
work in progress _folders.py
quintijn Feb 16, 2024
233b6ff
isolate fillinstancevariables (old) of _folders.py (txt)
quintijn Feb 16, 2024
2d33ed4
tidy up detail
quintijn Feb 16, 2024
1244d68
starting option checking for _folders
quintijn Feb 16, 2024
1efb267
Merge branch 'check_unimacro_feb24' of github.com:dougransom/unimacro…
quintijn Feb 16, 2024
c6f8e7d
refinement with switching on a unimacro grammar
quintijn Feb 19, 2024
29fcc5e
effort to diminish the errors when an ini file is invalid...
quintijn Feb 19, 2024
3ffd9e7
_folders automatic catching files and folders made working again, inc…
quintijn Feb 19, 2024
6b8867f
add number simple.ini to sample ini files...
quintijn Feb 20, 2024
bd8e1b4
minor, commenting out print statements
quintijn Feb 23, 2024
c8219f6
merging logging.
dougransom Mar 2, 2024
6993843
fixed some errors switching to logging.
dougransom Mar 3, 2024
1577ce3
natlinkutilsbj now has a mechansim for logging and for subclasses to …
dougransom Mar 3, 2024
4a446e0
working on debug messages and understanding Dougs logging mechanism. …
quintijn Mar 6, 2024
45f03cb
trying logging for folders, control
quintijn Mar 7, 2024
ae24c8d
clickbyvoice attempt print lines at spot where it fails with Dragon 16
quintijn Mar 12, 2024
ef36bf1
working on getActiveFolder
quintijn Mar 13, 2024
0a6a25b
changed extenvvars in dtactions, with changes here too
quintijn Mar 27, 2024
e202484
small fix in _folders, "recent show"
quintijn Apr 19, 2024
cf27f19
go to version 4.1.5
quintijn May 1, 2024
4accabb
Merge branch 'master' into check_unimacro_feb24
quintijn May 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 18 additions & 15 deletions src/unimacro/UnimacroGrammars/_folders.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@
# from unimacro.unimacro_wxpythondialogs import InputBox
# import natlinkcore.natlinkutils as natut

# manipulating file names with env variables etc...
envvars = extenvvars.ExtEnvVars()

thisDir = str(Path(__file__).parent)
status = natlinkstatus.NatlinkStatus()
# for getting unicode explorer window titles:
Expand Down Expand Up @@ -160,7 +163,6 @@ class ThisGrammar(ancestor):
<namepathcopy> = (copy (name|path)) | ((name|path) copy);

"""

def initialize(self):
# self.envDict = natlinkcorefunctions.getAllFolderEnvironmentVariables() # for (generalised) environment variables
self.subfiles = self.subfiles = self.activeFolder = self.activeTimerFolder = None # for catching on the fly in explorer windows (CabinetClassW)
Expand All @@ -169,11 +171,12 @@ def initialize(self):
self.dialogNumberRange = [] # ditto
self.catchRemember = ""
self.inTimerRecentFolders = False
self.prevDisplayRecentFolders = None # displaying recent folders list
self.prevActiveFolder = None
self.subfoldersDict = {}
self.subfilesDict = {}
self.foldersSet = set()


if not self.language:
self.error("no valid language in grammar "+__name__+" grammar not initialized")
return
Expand Down Expand Up @@ -547,7 +550,7 @@ def getFolderFromVirtualDrive(self, vd):
also make alternative paths possible like (C|D):/Documents
"""
# natlinkcorefunctions.printAllEnvVariables()
vd = extenvvars.expandEnvVariables(vd)
vd = envvars.expandEnvVariables(vd)
for possiblePath in loop_through_alternative_paths(vd):
folder = self.substituteFolder(possiblePath)
if os.path.isdir(folder):
Expand Down Expand Up @@ -624,8 +627,8 @@ def getActiveFolder(self, hndle=None, className=None):
self.debug("getActiveFolder, got: %s",nf)
self.prevActiveFolder = nf
return nf
result = extenvvars.getFolderFromLibraryName(f)
if result and os.path.isdir(f):
result = envvars.getFolderFromLibraryName(f)
if result and os.path.isdir(result):
self.debug("getActiveFolder, via getFolderFromLibraryName %s: %s", f, result)
return os.path.normpath(result)
self.warning('getActiveFolder, strange invalid path for folder: %s', f)
Expand Down Expand Up @@ -874,18 +877,13 @@ def displayRecentFolders(self):
mess_list = ["--- recent folders:"]
if not self.recentfoldersDict:
message = 'recent folders list is empty at the moment'
self.prevDisplayRecentFolders = message
self.info(message)
return
for name, value in reversed(self.recentfoldersDict.items()):
mess_list.append('- %s: %s'% (name, value))
mess_list.append('-'*20)
message = '\n'.join(mess_list)
if message == self.prevDisplayRecentFolders:
self.info("recent folders, no change")
else:
self.prevDisplayRecentFolders = message
Message(message)
Message(message)


# def gotoRecentFolder(self, chooseNum):
Expand Down Expand Up @@ -1260,9 +1258,9 @@ def gotResults_remember(self, words, fullResults):
# reset variables, no action in gotResults:
self.wantedFile = self.wantedFolder = self.wantedWebsite = ""
self.info(f'thisDir: {thisDir}')
UnimacroDirectory = extenvvars.expandEnvVariableAtStart('%Unimacro%')
UnimacroDirectory = envvars.expandEnvVariableAtStart('%Unimacro%')
self.info(f'UnimacroDirectory: {UnimacroDirectory}')
UnimacroGrammarsDirectory = extenvvars.expandEnvVariableAtStart('%UnimacroGrammars%')
UnimacroGrammarsDirectory = envvars.expandEnvVariableAtStart('%UnimacroGrammars%')
self.info(f'UnimacroGrammarsDirectory: {UnimacroGrammarsDirectory}')
makeFromTemplateAndExecute(UnimacroDirectory, "unimacrofoldersremembertemplate.py", UnimacroGrammarsDirectory, "rememberdialog.py",
prompt, text, default, inifile, section, value, pausetime=pausetime)
Expand Down Expand Up @@ -1629,7 +1627,7 @@ def substituteEnvVariable(self,folder):
With expandEnvVars, also NATLINK and related variables can be handled.
NATLINKDIRECTORY, COREDIRECTORY etc.
"""
substitute = extenvvars.expandEnvVariables(folder)
substitute = envvars.expandEnvVariables(folder)
return substitute

def substituteFilename(self, filename):
Expand Down Expand Up @@ -2447,10 +2445,15 @@ def unload():
thisGrammar = ThisGrammar(inifile_stem="_folders")
# thisGrammar.startInifile()
thisGrammar.initialize()
# print(thisGrammar.envvars)
# get hndle of a explore window (via _general "give window info") and try interactive
# thisGrammar.catchTimerRecentFolders(132524, "CabinetWClass")
active_folder = thisGrammar.getActiveFolder(198434)
print(f'active_folder: {active_folder}')

# get hndle of a explore window (via _general "give window info") and try interactive
# thisGrammar.catchTimerRecentFolders(132524, "CabinetWClass")
thisGrammar.getActiveFolder(67062)
thisGrammar.getActiveFol>>> master
thisGrammar.displayRecentFolders()

# # Words = ['folder', 'dtactions']
Expand Down
2 changes: 1 addition & 1 deletion src/unimacro/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ def control_logger_name() -> str :
def logname() -> str:
""" Returns the name of the unimacro logger."""
return "natlink.unimacro"
__version__ = '4.1.4.5'
__version__ = '4.1.5'

1 change: 1 addition & 0 deletions tests/test_grammar_folders.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

thisDir = Path(__file__).parent


def test_fill_folders_list(unimacro_setup):
"""see if (with debugging) the list folders (foldersDict) is filled
"""
Expand Down
Loading