This is a sweep to remove bad inclusive terms like master. Also testing functionality.
This commit is contained in:
@@ -67,7 +67,10 @@ _DCCSI_DEV_MODE = env_bool.env_bool(constants.ENVAR_DCCSI_DEV_MODE, False)
|
||||
# for py2.7 (Maya) we provide this, so we must assume some bootstrapping
|
||||
# has occured, see DccScriptingInterface\\config.py (_DCCSI_PYTHON_LIB_PATH)
|
||||
|
||||
import pathlib
|
||||
try:
|
||||
import pathlib
|
||||
except:
|
||||
import pathlib2 as pathlib
|
||||
from pathlib import Path
|
||||
if _G_DEBUG:
|
||||
print('DCCsi debug breadcrumb, pathlib is: {}'.format(pathlib))
|
||||
|
||||
+1
-1
@@ -145,7 +145,7 @@ def start_wing_to_maya_menu():
|
||||
port = object() # init a dummy object
|
||||
|
||||
# default name ... name is first arg, or a kwarg
|
||||
portName, kwargs = setSynthArgKwarg(port, argPosIndex=0, argTag='portName',
|
||||
portName, kwargs = setSynthArgKwarg(port, arg_pos_index=0, argTag='portName',
|
||||
inArgs=args, inKwargs=kwargs,
|
||||
defaultValue="127.0.0.1:6000")
|
||||
|
||||
|
||||
+109
-21
@@ -15,30 +15,118 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
"""azpy.shared.ui.__init__"""
|
||||
|
||||
import os
|
||||
import logging
|
||||
import logging.config
|
||||
from pathlib import Path
|
||||
import logging as _logging
|
||||
|
||||
# global space debug flag
|
||||
_G_DEBUG = os.getenv('DCCSI_GDEBUG', False)
|
||||
from azpy.env_bool import env_bool
|
||||
from azpy.constants import ENVAR_DCCSI_GDEBUG
|
||||
from azpy.constants import ENVAR_DCCSI_DEV_MODE
|
||||
|
||||
# global space debug flag
|
||||
_DCCSI_DEV_MODE = os.getenv('DCCSI_DEV_MODE', False)
|
||||
# global space
|
||||
_G_DEBUG = env_bool(ENVAR_DCCSI_GDEBUG, False)
|
||||
_DCCSI_DEV_MODE = env_bool(ENVAR_DCCSI_DEV_MODE, False)
|
||||
|
||||
_PACKAGENAME = __name__
|
||||
if _PACKAGENAME is '__main__':
|
||||
_PACKAGENAME = 'azpy.shared.noodely'
|
||||
|
||||
import azpy
|
||||
_LOGGER = azpy.initialize_logger(_PACKAGENAME)
|
||||
_LOGGER.debug('Invoking __init__.py for {0}.'.format({_PACKAGENAME}))
|
||||
# -------------------------------------------------------------------------
|
||||
#
|
||||
__all__ = ['find_arg',
|
||||
'helpers',
|
||||
'node',
|
||||
'synth',
|
||||
'synth_arg_kwarg',
|
||||
'test_foo']
|
||||
#
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
|
||||
# -- Project Globals ------------------------------------------------------
|
||||
while 1:
|
||||
# But if we want to change the prject root, we can set a new one here.
|
||||
def set_G_DEFAULT_PROJECT_DIR(value):
|
||||
global _G_DEFAULT_PROJECT_DIR
|
||||
"""Sets and returns the _G_DEFAULT_PROJECT_DIR"""
|
||||
_G_DEFAULT_PROJECT_DIR = Path(value).resolve()
|
||||
return Path(_G_DEFAULT_PROJECT_DIR)
|
||||
|
||||
def get_G_DEFAULT_PROJECT_DIR():
|
||||
global _G_DEFAULT_PROJECT_DIR
|
||||
"""Returns the _G_DEFAULT_PROJECT_DIR"""
|
||||
return Path(_G_DEFAULT_PROJECT_DIR)
|
||||
|
||||
# if we are initializing everythin properly, we can assume the project
|
||||
# variables are properly set
|
||||
global _G_DEFAULT_PROJECT_DIR
|
||||
_G_DEFAULT_PROJECT_DIR = Path(os.getcwd()).resolve()
|
||||
|
||||
break
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
while 1:
|
||||
global _G_PRIME_ROOT_NODE
|
||||
_G_PRIME_ROOT_NODE = None # <-- needs to be set up!
|
||||
# But if we want to change the prject root, we can set a new one here.
|
||||
|
||||
def set_G_PRIME_ROOT_NODE(node):
|
||||
"""Sets and returns the _G_PRIME_ROOT_NODE"""
|
||||
global _G_PRIME_ROOT_NODE
|
||||
if not isinstance(node, ProjectRootNode):
|
||||
message = '_G_PRIME_ROOT_NODE: {}\r'.format(type(node))
|
||||
message += 'A project root node needs to be properly set\r'
|
||||
raise TypeError(message)
|
||||
_G_PRIME_ROOT_NODE = node
|
||||
return _G_PRIME_ROOT_NODE
|
||||
|
||||
def get_G_PRIME_ROOT_NODE():
|
||||
"""Returns the _G_PRIME_ROOT_NODE"""
|
||||
global _G_PRIME_ROOT_NODE
|
||||
return _G_PRIME_ROOT_NODE
|
||||
|
||||
break
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
|
||||
###########################################################################
|
||||
# tests(), code block for testing module
|
||||
# -------------------------------------------------------------------------
|
||||
def tests():
|
||||
_G_DEFAULT_PROJECT_DIR = set_G_DEFAULT_PROJECT_DIR(os.getcwd())
|
||||
_LOGGER.info(_G_DEFAULT_PROJECT_DIR)
|
||||
_LOGGER.info(_G_DEFAULT_PROJECT_DIR.parent)
|
||||
_LOGGER.info(_G_DEFAULT_PROJECT_DIR.parts)
|
||||
|
||||
# NOT implemented yet
|
||||
# _G_PRIME_ROOT_NODE
|
||||
|
||||
return
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
if _DCCSI_DEV_MODE:
|
||||
_PACKAGENAME = __name__
|
||||
if _PACKAGENAME is '__main__':
|
||||
_PACKAGENAME = 'noodely'
|
||||
|
||||
_PKG_PARENT_PATH = str('azpy.shared')
|
||||
_PKG_PATH = str('{0}.{1}'.format(_PKG_PARENT_PATH, _PACKAGENAME))
|
||||
_LOGGER = logging.getLogger(_PACKAGENAME)
|
||||
_LOGGER.debug('Invoking __init__.py for {0}.'.format({_PKG_PATH}))
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
#
|
||||
__all__ = ['config', 'find_arg', 'master', 'node', 'synth',
|
||||
'synth_arg_kwarg', 'test_foo']
|
||||
#
|
||||
# If in dev mode this will test imports of __all__
|
||||
from azpy import test_imports
|
||||
_LOGGER.debug('Testing Imports from {0}'.format(_PACKAGENAME))
|
||||
test_imports(__all__,
|
||||
_pkg=_PACKAGENAME,
|
||||
_logger=_LOGGER)
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
del _LOGGER
|
||||
|
||||
###########################################################################
|
||||
# --call block-------------------------------------------------------------
|
||||
if __name__ == "__main__":
|
||||
_LOGGER.info("# {0} #".format('-' * 72))
|
||||
_LOGGER.info('~ noodely.prime ... Running script as __main__')
|
||||
_LOGGER.info("# {0} #".format('-' * 72))
|
||||
|
||||
# run simple tests
|
||||
tests()
|
||||
|
||||
del _LOGGER
|
||||
+7
-7
@@ -23,7 +23,7 @@ __author__ = 'HogJonny'
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
|
||||
def find_arg(argPosIndex=None, argTag=None, removeKwarg=None,
|
||||
def find_arg(arg_pos_index=None, argTag=None, removeKwarg=None,
|
||||
inArgs=None, inKwargs=None, defaultValue=None):
|
||||
"""
|
||||
# finds and returns an arg...
|
||||
@@ -41,15 +41,15 @@ def find_arg(argPosIndex=None, argTag=None, removeKwarg=None,
|
||||
#
|
||||
# foundArg, args, kwargs = find_arg(0, 'name',)
|
||||
"""
|
||||
if argPosIndex != None:
|
||||
if not isinstance(argPosIndex, int):
|
||||
if arg_pos_index != None:
|
||||
if not isinstance(arg_pos_index, int):
|
||||
raise TypeError('argPosIndex: accepts a index integer!\r'
|
||||
'got: {0}'.format(argPosIndex))
|
||||
'got: {0}'.format(arg_pos_index))
|
||||
|
||||
# positional args ... check the position
|
||||
if len(inArgs) > 0:
|
||||
try:
|
||||
foundArg = inArgs[argPosIndex]
|
||||
foundArg = inArgs[arg_pos_index]
|
||||
except:
|
||||
pass
|
||||
|
||||
@@ -88,10 +88,10 @@ if __name__ == "__main__":
|
||||
super().__init__()
|
||||
self._name, kwargs = find_arg(argTag='foo', removeKwarg=True,
|
||||
inArgs=args, inKwargs=kwargs)
|
||||
self._name, kwargs = find_arg(argPosIndex=0, argTag='name',
|
||||
self._name, kwargs = find_arg(arg_pos_index=0, argTag='name',
|
||||
removeKwarg=True,
|
||||
inArgs=args, inKwargs=kwargs) # <-- first positional OR kwarg
|
||||
self._parent, kwargs = find_arg(argPosIndex=1, argTag='parent',
|
||||
self._parent, kwargs = find_arg(arg_pos_index=1, argTag='parent',
|
||||
removeKwarg=True,
|
||||
inArgs=args, inKwargs=kwargs) # <-- second positional OR kwarg
|
||||
|
||||
|
||||
-90
@@ -1,90 +0,0 @@
|
||||
"""
|
||||
All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
its licensors.
|
||||
|
||||
For complete copyright and license terms please see the LICENSE at the root of this
|
||||
distribution (the "License"). All use of this software is governed by the License,
|
||||
or, if provided, by the license below or the license accompanying this file. Do not
|
||||
remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
"""
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# -------------------------------------------------------------------------
|
||||
# master.py
|
||||
# Allows for project based setup to be used with noodly
|
||||
# version: 0.1
|
||||
# author: Gallowj
|
||||
# -------------------------------------------------------------------------
|
||||
# -------------------------------------------------------------------------
|
||||
import os
|
||||
|
||||
from unipath import Path
|
||||
|
||||
_G_DEFAULT_PROJECT_DIR = os.getcwd()
|
||||
_G_MASTER_ROOT_NODE = None
|
||||
|
||||
|
||||
@property
|
||||
def _G_DEFAULT_PROJECT_DIR(value):
|
||||
_G_DEFAULT_PROJECT_DIR = value
|
||||
return _G_DEFAULT_PROJECT_DIR
|
||||
|
||||
|
||||
def set_PROJECT_DIR(value):
|
||||
"""Sets and returns _G_DEFAULT_PROJECT_DIR"""
|
||||
global _G_DEFAULT_PROJECT_DIR
|
||||
_G_DEFAULT_PROJECT_DIR = Path(value).expand()
|
||||
return Path(_G_DEFAULT_PROJECT_DIR)
|
||||
|
||||
|
||||
@property
|
||||
def _G_MASTER_ROOT_NODE(value):
|
||||
_G_MASTER_ROOT_NODE = value
|
||||
return _G_MASTER_ROOT_NODE
|
||||
|
||||
|
||||
def set_MASTER_ROOT_NODE(value):
|
||||
"""Sets and returns _G_MASTER_ROOT_NODE"""
|
||||
global _G_MASTER_ROOT_NODE
|
||||
if not isinstance(inNode, ProjectRootNode):
|
||||
raise TypeError('self._projectRootNode is: {0}\r'
|
||||
'A _projectRootNode, needs to be properly set\r'
|
||||
'So that we can acces:\r'
|
||||
'\tself._projectRootNode._sourceRoot\r'
|
||||
'\tself._projectRootNode._overrideRoot\r'
|
||||
'Use self.assignProjectRootNode(<projectRootNode>)\r'
|
||||
''.format(type(inNode)))
|
||||
|
||||
_G_MASTER_ROOT_NODE = inNode
|
||||
return _G_MASTER_ROOT_NODE
|
||||
|
||||
|
||||
###########################################################################
|
||||
# tests(), code block for testing module
|
||||
# -------------------------------------------------------------------------
|
||||
def tests():
|
||||
set_PROJECT_DIR(os.getcwd())
|
||||
print(_G_DEFAULT_PROJECT_DIR)
|
||||
print(_G_DEFAULT_PROJECT_DIR.parent)
|
||||
print(_G_DEFAULT_PROJECT_DIR.components())
|
||||
|
||||
# NOT implemented yet
|
||||
# set_PROJECT_DIR
|
||||
|
||||
return
|
||||
|
||||
|
||||
###########################################################################
|
||||
# --call block-------------------------------------------------------------
|
||||
if __name__ == "__main__":
|
||||
print ("# ----------------------------------------------------------------------- #")
|
||||
print ('~ noodly.master ... Running script as __main__')
|
||||
print ("# ----------------------------------------------------------------------- #\r")
|
||||
|
||||
# run simple tests
|
||||
tests()
|
||||
|
||||
#_G_DEFAULT_PROJECT_DIR = Path(os.getcwd())
|
||||
print(_G_DEFAULT_PROJECT_DIR.components())
|
||||
+33
-21
@@ -16,7 +16,7 @@ from __future__ import division
|
||||
# -------------------------------------------------------------------------
|
||||
# -------------------------------------------------------------------------
|
||||
# node.py
|
||||
# simple base Node Class, for tool creation.
|
||||
# simple base Node Class, useful in tool creation.
|
||||
# version: 0.1
|
||||
# author: Gallowj
|
||||
# -------------------------------------------------------------------------
|
||||
@@ -25,16 +25,8 @@ from __future__ import division
|
||||
Module docstring:
|
||||
A Simple Node Base Class Module, for creating basic nodes within a hierarchy.
|
||||
"""
|
||||
|
||||
__author__ = 'HogJonny'
|
||||
|
||||
_G_DEBUG = True # global state for debugging
|
||||
_G_SETTINGS = None # global Settings storage
|
||||
_G_LOG = None # global LOGger storage
|
||||
|
||||
_G_MASTER_NODE = None # We intend to init a master node, unless provided
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# built-ins
|
||||
import os
|
||||
import copy
|
||||
@@ -48,11 +40,32 @@ import cachetools
|
||||
from sched import scheduler
|
||||
|
||||
# local imports
|
||||
from LyPy.si_shared.noodly.helpers import display_cached_value
|
||||
from LyPy.si_shared.noodly.find_arg import find_arg
|
||||
from LyPy.si_shared.noodly.synth import synthesize
|
||||
from azpy.shared.noodely.helpers import display_cached_value
|
||||
from azpy.shared.noodely.find_arg import find_arg
|
||||
from azpy.shared.noodely.synth import synthesize
|
||||
|
||||
import azpy
|
||||
from azpy.env_bool import env_bool
|
||||
from azpy.constants import ENVAR_DCCSI_GDEBUG
|
||||
from azpy.constants import ENVAR_DCCSI_DEV_MODE
|
||||
|
||||
# global space
|
||||
# To Do: update to dynaconf dynamic env and settings?
|
||||
_G_DEBUG = env_bool(ENVAR_DCCSI_GDEBUG, False)
|
||||
_DCCSI_DEV_MODE = env_bool(ENVAR_DCCSI_DEV_MODE, False)
|
||||
|
||||
_MODULENAME = 'azpy.shared.noodely.node'
|
||||
|
||||
_log_level = int(20)
|
||||
if _G_DEBUG:
|
||||
_log_level = int(10)
|
||||
_LOGGER = azpy.initialize_logger(_MODULENAME,
|
||||
log_to_file=False,
|
||||
default_log_level=_log_level)
|
||||
_LOGGER.debug('Starting:: {}.'.format({_MODULENAME}))
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# quick test code (remove later)
|
||||
from hashids import Hashids
|
||||
@@ -79,8 +92,6 @@ if os.path.supports_unicode_filenames:
|
||||
###########################################################################
|
||||
# HELPER method functions
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
|
||||
def return_node_from_hashid(hashid):
|
||||
if not isinstance(hashid, str):
|
||||
raise TypeError("{0},{1}: Accepts hashids as str types!\r"
|
||||
@@ -95,6 +106,7 @@ def return_node_from_hashid(hashid):
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
class Node(object):
|
||||
"""Class constructor: makes a node."""
|
||||
|
||||
@@ -131,7 +143,7 @@ class Node(object):
|
||||
|
||||
# -- secret keyword -----------------------------------------------
|
||||
self._temp_node = False
|
||||
temp_node, kwargs = find_arg(argPosIndex=None, argTag='temp_node',
|
||||
temp_node, kwargs = find_arg(arg_pos_index=None, argTag='temp_node',
|
||||
removeKwarg=True, inArgs=args,
|
||||
inKwargs=kwargs) # <-- kwarg only
|
||||
self._temp_node = temp_node
|
||||
@@ -141,7 +153,7 @@ class Node(object):
|
||||
|
||||
# -- store message header -----------------------------------------
|
||||
# setup the .message_header <-- kwarg only
|
||||
message_header, kwargs = find_arg(argPosIndex=None, argTag='message_header',
|
||||
message_header, kwargs = find_arg(arg_pos_index=None, argTag='message_header',
|
||||
removeKwarg=True, inArgs=args, inKwargs=kwargs,
|
||||
defaultValue=('{0}(), Message'
|
||||
.format(self._node_type)))
|
||||
@@ -165,7 +177,7 @@ class Node(object):
|
||||
# -- store the node name ------------------------------------------
|
||||
self._node_name = node_name
|
||||
if (self._node_class_index == 0 and self._node_name == None):
|
||||
self._node_name = 'MASTER'
|
||||
self._node_name = 'PRIME'
|
||||
elif (self._node_class_index > 0 and self._node_name == None):
|
||||
# set a default node_name if none, based on the unihashid
|
||||
if not self._name_is_uni_hashid:
|
||||
@@ -325,7 +337,7 @@ class Node(object):
|
||||
@property
|
||||
def cls_node_dict(self):
|
||||
return Node._cls_node_dict
|
||||
# ----------------------------------------------------------------------
|
||||
# ---------------------------------------------------------------------
|
||||
|
||||
# --method-set---------------------------------------------------------
|
||||
def cls_node_count_up(self):
|
||||
@@ -584,10 +596,10 @@ def tests():
|
||||
print(default_node.hierarchy())
|
||||
|
||||
# retreive a node from it's known hashid
|
||||
master_node = return_node_from_hashid('kxYLm0XQeXJ7jWaP')
|
||||
print(master_node.uni_hashid) # verify hasid
|
||||
prime_node = return_node_from_hashid('kxYLm0XQeXJ7jWaP')
|
||||
print(prime_node.uni_hashid) # verify hasid
|
||||
# should return the same node as default_node
|
||||
print(master_node.node_name) # should be 'MASTER'
|
||||
print(prime_node.node_name) # should be 'PRIME'
|
||||
return
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
|
||||
+30
-23
@@ -27,12 +27,6 @@ A simple path objecy based Node Class, for creating path hierarchies.
|
||||
"""
|
||||
__author__ = 'HogJonny'
|
||||
|
||||
_G_DEBUG = True # global state for debugging
|
||||
_G_SETTINGS = None # global Settings storage
|
||||
_G_LOG = None # global LOGger storage
|
||||
|
||||
_G_MASTER_NODE = None # We intend to init a master node
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# built-ins
|
||||
import os
|
||||
@@ -44,10 +38,31 @@ import logging
|
||||
from unipath import Path, AbstractPath
|
||||
|
||||
# local ly imports
|
||||
from LyPy.si_shared.noodly.helpers import istext
|
||||
from LyPy.si_shared.noodly.find_arg import find_arg
|
||||
from LyPy.si_shared.noodly.synth import synthesize
|
||||
from LyPy.si_shared.noodly.node import Node
|
||||
from azpy.shared.noodely.helpers import istext
|
||||
from azpy.shared.noodely.find_arg import find_arg
|
||||
from azpy.shared.noodely.synth import synthesize
|
||||
from azpy.shared.noodely.node import Node
|
||||
|
||||
import azpy
|
||||
from azpy.env_bool import env_bool
|
||||
from azpy.constants import ENVAR_DCCSI_GDEBUG
|
||||
from azpy.constants import ENVAR_DCCSI_DEV_MODE
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# global space
|
||||
# To Do: update to dynaconf dynamic env and settings?
|
||||
_G_DEBUG = env_bool(ENVAR_DCCSI_GDEBUG, False)
|
||||
_DCCSI_DEV_MODE = env_bool(ENVAR_DCCSI_DEV_MODE, False)
|
||||
|
||||
_MODULENAME = 'azpy.shared.noodely.pathnode'
|
||||
|
||||
_log_level = int(20)
|
||||
if _G_DEBUG:
|
||||
_log_level = int(10)
|
||||
_LOGGER = azpy.initialize_logger(_MODULENAME,
|
||||
log_to_file=False,
|
||||
default_log_level=_log_level)
|
||||
_LOGGER.debug('Starting:: {}.'.format({_MODULENAME}))
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -63,20 +78,12 @@ if os.path.supports_unicode_filenames:
|
||||
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# set up logger
|
||||
_G_LOGGER = logging.getLogger(__name__)
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
|
||||
class PathNode(Node):
|
||||
"""doc string"""
|
||||
|
||||
# share the debug state
|
||||
_DEBUG = _G_DEBUG
|
||||
|
||||
# logger
|
||||
_LOGGER = _G_LOGGER
|
||||
|
||||
# class header
|
||||
_message_header = 'noodly, PathNode(): Message'
|
||||
|
||||
@@ -117,7 +124,7 @@ class PathNode(Node):
|
||||
|
||||
# -- secret keyword -----------------------------------------------
|
||||
self._temp_node = False
|
||||
temp_node, kwargs = find_arg(argPosIndex=None, argTag='temp_node',
|
||||
temp_node, kwargs = find_arg(arg_pos_index=None, argTag='temp_node',
|
||||
removeKwarg=True, inArgs=args,
|
||||
inKwargs=kwargs) # <-- kwarg only
|
||||
|
||||
@@ -126,11 +133,11 @@ class PathNode(Node):
|
||||
self.k_wargs_dict['temp_node'] = self._temp_node
|
||||
|
||||
# -- Node class args/kwargs ---------------------------------------
|
||||
node_name, kwargs = find_arg(argPosIndex=2, argTag='node_name',
|
||||
node_name, kwargs = find_arg(arg_pos_index=2, argTag='node_name',
|
||||
removeKwarg=True, inArgs=args,
|
||||
inKwargs=kwargs) # <-- third arg, kwarg
|
||||
|
||||
parent_node, kwargs = find_arg(argPosIndex=3, argTag='parent_node',
|
||||
parent_node, kwargs = find_arg(arg_pos_index=3, argTag='parent_node',
|
||||
removeKwarg=True, inArgs=args,
|
||||
inKwargs=kwargs) # <-- fourth arg, kwarg
|
||||
|
||||
@@ -344,12 +351,12 @@ class PathNode(Node):
|
||||
# -------------------------------------------------------------------------
|
||||
def tests():
|
||||
from node import Node
|
||||
default_node = Node() # result: Node(node_name='MASTER')
|
||||
default_node = Node() # result: Node(node_name='PRIME')
|
||||
print(default_node)
|
||||
|
||||
first_child = PathNode(path=None, node_name='first_child', parent_node=default_node)
|
||||
print(first_child)
|
||||
# result: PathNode(temp_node=True, parent_node=Node(node_name='MASTER')).siblingNodeFromHashid('WNPZoKBVpXV16QLz')
|
||||
# result: PathNode(temp_node=True, parent_node=Node(node_name='PRIME')).siblingNodeFromHashid('WNPZoKBVpXV16QLz')
|
||||
# first_child.nodeType
|
||||
# first_child.parent_node
|
||||
# first_child.node_name
|
||||
|
||||
+23
-20
@@ -20,7 +20,10 @@ import os
|
||||
# from io import StringIO # for handling unicode strings
|
||||
|
||||
# azpy
|
||||
from azpy import initialize_logger
|
||||
import azpy
|
||||
from azpy.env_bool import env_bool
|
||||
from azpy.constants import ENVAR_DCCSI_GDEBUG
|
||||
from azpy.constants import ENVAR_DCCSI_DEV_MODE
|
||||
|
||||
# 3rd Party
|
||||
from unipath import Path
|
||||
@@ -28,22 +31,22 @@ import PySide2.QtCore as QtCore
|
||||
import PySide2.QtWidgets as QtWidgets
|
||||
import PySide2.QtGui as QtGui
|
||||
# -------------------------------------------------------------------------
|
||||
# global space debug flag
|
||||
_G_DEBUG = os.getenv('DCCSI_GDEBUG', False)
|
||||
|
||||
# global space debug flag
|
||||
_DCCSI_DEV_MODE = os.getenv('DCCSI_DEV_MODE', False)
|
||||
# global space
|
||||
# To Do: update to dynaconf dynamic env and settings?
|
||||
_G_DEBUG = env_bool(ENVAR_DCCSI_GDEBUG, False)
|
||||
_DCCSI_DEV_MODE = env_bool(ENVAR_DCCSI_DEV_MODE, False)
|
||||
|
||||
_MODULE_PATH = Path(__file__)
|
||||
|
||||
_ORG_TAG = 'Amazon_Lumberyard'
|
||||
_APP_TAG = 'DCCsi'
|
||||
_TOOL_TAG = 'azpy.shared.ui.custom_treemodel'
|
||||
_TYPE_TAG = 'test'
|
||||
_MODULENAME = 'azpy.shared.ui.custom_treemodel'
|
||||
|
||||
_MODULENAME = __name__
|
||||
if _MODULENAME is '__main__':
|
||||
_MODULENAME = _TOOL_TAG
|
||||
_log_level = int(20)
|
||||
if _G_DEBUG:
|
||||
_log_level = int(10)
|
||||
_LOGGER = azpy.initialize_logger(_MODULENAME,
|
||||
log_to_file=False,
|
||||
default_log_level=_log_level)
|
||||
_LOGGER.debug('Starting:: {}.'.format({_MODULENAME}))
|
||||
|
||||
_UI_FILE = Path(_MODULE_PATH.parent, 'resources', 'example.ui')
|
||||
# -------------------------------------------------------------------------
|
||||
@@ -75,15 +78,15 @@ class CustomFileTreeModel(QtCore.QAbstractItemModel):
|
||||
# TODO: need to make sure we are getting path objects
|
||||
|
||||
# build the root node
|
||||
self._root_node = self.buildRootNode('root', None, self._rootFilePath)
|
||||
self._root_node = self.build_rootnode('root', None, self._root_filepath)
|
||||
|
||||
# master selection
|
||||
self._masterSelection = masterSelection
|
||||
# prime selection
|
||||
self._prime_selection = prime_selection
|
||||
|
||||
# build the master selection node
|
||||
self._masterNode = self.buildMasterNode('master', None, self._masterSelection, self._rootNode.path())
|
||||
# build the prime selection node
|
||||
self._primenode = self.build_primenode('prime', None, self._prime_selection, self._rootnode.path())
|
||||
|
||||
# want to store off a couple lists in the model, for retreival later
|
||||
self._nodeList = None
|
||||
self._depNodesList = None
|
||||
self._nodelist = None
|
||||
self._dep_nodelist = None
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ from pathlib import Path
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
_BOOT_CHECK = False # set true to test breakpoint in this module directly
|
||||
|
||||
import azpy
|
||||
from azpy.env_bool import env_bool
|
||||
from azpy.constants import ENVAR_DCCSI_GDEBUG
|
||||
|
||||
Reference in New Issue
Block a user