Skip to content

Commit

Permalink
Merge pull request #102 from davidlatwe/profile_paths
Browse files Browse the repository at this point in the history
Minor fix and improve
  • Loading branch information
davidlatwe authored Aug 18, 2020
2 parents 62ed58d + 9ff1ea7 commit 2eacba8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
17 changes: 11 additions & 6 deletions allzpark/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def __init__(self, ctrl, storage):
"profileName": storage.value("startupProfile"),
"appRequest": storage.value("startupApplication"),

# String or callable, returning list of profile names
# list or callable, returning list of profile names
"root": None,

# Current error, if any
Expand Down Expand Up @@ -385,7 +385,7 @@ def on_unhandled_exception(self, type, value, tb):
# package family not found: occoc (searched: C:\)
_, package, paths = value.value.split(": ", 2)
package = package.split(" (", 1)[0]
paths = paths.rstrip(")").split(os.pathsep)
paths = paths.rstrip(")").split("; ") # Hard-coded pathsep in Rez

message = """
<h2><font color=\"red\">:(</font></h2>
Expand Down Expand Up @@ -444,7 +444,7 @@ def find(self, family, range_=None):
Arguments:
family (str): Name of package
range (str): Range, e.g. "1" or "==0.3.13"
range_ (str): Range, e.g. "1" or "==0.3.13"
"""

Expand Down Expand Up @@ -552,8 +552,9 @@ def reset(self, root=None, on_success=lambda: None):
with its corresponding Rez package.
Arguments:
root (str): Absolute path to profiles on disk, or callable
returning names of profiles
root (list, callable): A list of profile names, or a callable
returning names of profiles.
on_success (callable): Callback on reset completed.
"""

Expand Down Expand Up @@ -811,6 +812,10 @@ def list_profiles(self, root=None):
self.error("Could not find profiles in %s" % root)
profiles = []

else:
raise TypeError("Argument 'root' should be either list type or "
"callable.")

# Facilitate accidental empty family names, e.g. None or ''
profiles = list(filter(None, profiles))

Expand Down Expand Up @@ -941,7 +946,7 @@ def select_tool(self, tool_name):
def _package_paths(self):
"""Return all package paths, relative the current state of the world"""

paths = util.normpaths(*rez.config.packages_path)
paths = rez.config.packages_path[:]

# Optional development packages
if not self._state.retrieve("useDevelopmentPackages"):
Expand Down
2 changes: 2 additions & 0 deletions allzpark/dock.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,8 @@ def append(self, line, level=logging.INFO):
logging.CRITICAL: "<font color=\"red\">",
}.get(level, "<font color=\"#222\">")

line = line.replace(" ", "&nbsp;")
line = line.replace("\n", "<br>")
line = "%s%s</font><br>" % (color, line)

cursor = self._widgets["text"].textCursor()
Expand Down

0 comments on commit 2eacba8

Please sign in to comment.