def addChild(self,ch,withRename = False): # be sure that that it's valid child import traceback if isinstance(ch,Tdata): if ch in self.getChildren(): return chname = self.findUniqueChildName(ch.getName()) if withRename == True: # be sure that the child name is unique ch.setName(chname) self.__Children.append(ch) else: if chname != ch.getName(): # an object of the same name # exist an need to be replace childN = self.childNames() try: index = childN.index(ch.getName()) self.__Children.pop(index) self.__Children.insert(index,ch) except: traceback.print_exc() self.error("addChild","big Trouble in addChild") sys.exit(1) else: self.__Children.append(ch) ch.setParent(self) else: MsgUtils.warning("addChild","Can't add %s to my children List" % ch)
def _init_root_path(self): if self._userInfo == None: return False toCheck = [self._userInfo.local_area, self._userInfo.log_dir] checkLayout = False for d in toCheck: if not DiskUtils.is_dir_exist(d): checkLayout = True MsgUtils.warning("%r is needed, create..." % d) if DiskUtils.create_path_rec(d) == False: MsgUtils.error("can't create %r" % d) else: MsgUtils.info("%r created" % d) #only on creation,copy if exist the defaultLayoutFile from # from the module if checkLayout: import shutil fromlayout = os.path.join(self._resource.resource_path, initDefault.DEFAULT_LAYOUT_ROOT) tolayout = os.path.join(self._userInfo.local_area, initDefault.DEFAULT_LAYOUT_ROOT) fromlayout += ".lyt" tolayout += ".lyt" if os.path.exists(fromlayout) and not os.path.exists(tolayout): shutil.copyfile(fromlayout, tolayout) MsgUtils.info("found a defaut layout file %s" % fromlayout) self.valid_to_save = self.is_persistant()
def write(self, afile="", pretty=False): if afile != "": if self._doc == None: MsgUtils.warning("has no document") return False try: #if pretty: # print(self.getEncoding()) # pstr = self._doc.toprettyxml("\t", "\n", self.getEncoding()) # afile.write(pstr) #else: self._doc.writexml(afile, "\t", "\t", "\n", self.getEncoding()) except Exception as e: MsgUtils.error(str(e)) MsgUtils.error("can't write the current document") return False return True else: if self._doc != None: if pretty: print( str( self._doc.toprettyxml("\t", "\n", self.getEncoding()))) else: print(self._doc.toxml(self.getEncoding())) return True return False
def _push_new_version(self, gitrepo): """ Query, increment tag and push to remote repo """ x = GitUtils(gitrepo) ver = x.get_git_version() if ver in ["", "NONE"]: ver = "v0.0.0" else: verob = DirVersioned(ver) if verob.is_valid(): verob.inc_patch() # need an argument for minor ver = verob.format() glog = x.get_git_log(20) # we only push if head is not tagged do_tag = True for l in glog: log.info("log check for HEAD %s" % l) if l[-1] == True: log.warning("HEAD is already tag, will not create new tag") do_tag = False break if do_tag: x.create_tag(ver) x.push_tag(ver) log.info("new tag will be created: %r" % x.get_git_version())
def checkAdminPath(): for path in DefaultPath.__ADMIN_CREATED__: if not DiskUtils.is_dir_exist(path): MsgUtils.warning("%r needed, creating" % path) if DiskUtils.create_path(path) == False: MsgUtils.error("can't create %r" % path) sys.exit(1) return True
def update_with(self, atask, lockup=None, attribList=None): super(GenPyTask, self).update_with(atask, GenPyTask._LockupPyAttr, GenPyTask._attr_PyTask) if hasattr(atask, 'resolveArgValues'): self.resolveArgValues = atask.resolveArgValues if hasattr(atask, 'resolveKwArgValues'): self.resolveKwArgValues = atask.resolveKwArgValues if atask.resolveArgValues == False or atask.resolveKwArgValues == False: log.warning( "resolve argument set to false is not supported for now" )
def instanciate(self, d): if (JsonHelper._CLASSKEY not in d or JsonHelper._MODULEKEY not in d): # this is a basic dict return d # create an instance aclass = d[JsonHelper._CLASSKEY] amodule = d[JsonHelper._MODULEKEY] if (amodule != '__builtin__'): cmd = "import %s" % amodule try: exec(cmd) except: traceback.print_exc() MsgUtils.warning("cannot import %r" % amodule) MsgUtils.msg("Creating a generic class container") amodule = "tdata" aclass = "container" cmd = "%s.%s()" % (amodule, aclass) newInstance = None try: newInstance = eval(cmd) except: traceback.print_exc() MsgUtils.error("COMMAND %r" % cmd) MsgUtils.msg("class definition %r not found in %r" % (aclass, amodule)) assert newInstance != None # name value and typevalue if JsonHelper._NAMEKEY in d: newInstance.setName(d[JsonHelper._NAMEKEY]) if JsonHelper._VALTYPEKEY in d: newInstance.setTypeValue(d[JsonHelper._VALTYPEKEY]) if JsonHelper._VALKEY in d: newInstance.setValue(d[JsonHelper._VALKEY]) if JsonHelper._PROPKEY in d: newInstance.setVariableMember(d[JsonHelper._PROPKEY]) if JsonHelper._CHKEY in d: assert type(d[JsonHelper._CHKEY]) == dict for k, vn in list(d[JsonHelper._CHKEY].items()): chInstance = self.instanciate(vn) if JsonHelper.isContainerClass(chInstance): chInstance.setName(str(k)) newInstance.addChild(chInstance, False) else: MsgUtils.error("trouble reading %r" % type(chInstance)) return newInstance
def loadRaw(self, elmt, pTask, maxLevel): # foreign xml creationList = [] nb = "n%d:" index = 0 while elmt != None: if elmt.nodeType == elmt.ELEMENT_NODE: if maxLevel == 0: return [] if maxLevel != -1: maxLevel -= 1 if elmt.nodeName != "#text": atask = tdata.container() atask.setName(nb % index + elmt.nodeName) pTask.addChild(atask) index += 1 adict = {} if self.getXmlAttr(elmt, adict): atask.__dict__.update(adict) result = self.getKidsRaw(elmt, atask, maxLevel) for r in result: if r[0] == "TexType": atask.setValue(r[1]) else: MsgUtils.error("not done %r %r t=%s v=%s n=%s" % (pTask.getName(), atask.getName(), r[0], r[1], r[2])) elif elmt.nodeType == elmt.TEXT_NODE: edata = self.getTextValue(elmt).strip() if edata != "": creationList.append(["TextType", edata, elmt.nodeName]) elif elmt.nodeType == elmt.COMMENT_NODE: edata = self.getTextValue(elmt).strip() if edata != "": creationList.append(["CommentType", edata, elmt.nodeName]) elif elmt.nodeType == elmt.CDATA_SECTION_NODE: data = self.getcData(elmt) if data != "" and len(data.strip()) > 0: creationList.append(["CdType", data, elmt.nodeName]) else: MsgUtils.warning("NOT YETXX %r %r" % (elmt.nodeName, elmt.nodeType)) elmt = elmt.nextSibling return creationList
def _do_users(self): """ query and cache step info """ SW.start() conn = self.get_conn() if self.verbose: log.warning("login to shotgun, to get user") step = SQ.user_info_with_id(conn=conn) parent = self['Users'] for s in step: parent.addChild(s, withRename=False) SW.stop() if self.verbose: log.info("user_query in {}".format(SW.elapsed()))
def checkBasicPath(): # required will exist if not found for path in DefaultPath.__REQUIRED__: if not DiskUtils.is_dir_exist(path): MsgUtils.error("%r (REQUIRED)" % path) sys.exit(1) for path in DefaultPath.__SELF_CREATED__: if not DiskUtils.is_dir_exist(path): MsgUtils.warning("%r needed, creating..." % path) if DiskUtils.create_path_rec(path) == False: MsgUtils.error("can't create %r" % path) sys.exit(1) return True
def _do_steps(self): """Query and cache step info """ conn = self.get_conn() if conn == None: return SW.start() if self.verbose: log.warning("login to shotgun, to get default step settings") steps = SQ.step_list_with_id(conn) parent = self['Steps'] steps_name = dict() for s in steps: if not s.getName() in steps_name: steps_name[s.getName()] = s for s in steps_name: parent.addChild(steps_name[s], withRename=False) SW.stop() if self.verbose: log.info("step_query in {}".format(SW.elapsed()))
def load_tp_file(cls, tpZipFile, searchPath=None, group=True): # init tp fileToLoad = tpZipFile doSearch = False # if there is a searchPath and the file doesn't have a path if searchPath != None and fileToLoad.find(os.sep) == -1: doSearch = True if isinstance(searchPath, basestring): searchPath = [searchPath] for i in searchPath: p = os.path.join(i, tpZipFile) if os.path.isfile(p) == True: fileToLoad = p break if doSearch and fileToLoad == tpZipFile: log.warning( "couln't find the package %r at this location, maybe a new package" % tpZipFile) log.info("loading %r" % fileToLoad) return cls.open_tp(fileToLoad)
def get_departments(self): """ query and cache department info """ if len(self._dept_shot) + len(self._dept_asset) > 0: return self._dept_shot + self._dept_asset #if not self._use_coffer: conn = self.get_conn() log.warning("login to shotgun, to get default department settings") dept = SQ.dept_list_with_id(conn) for i in dept: #print i.getName(),i.__dict__ if i.is_shot(): self._dept_shot.append(i) elif i.is_asset(): self._dept_asset.append(i) else: pass # we ignore production (prod) for now #log.warning('unknown department type %r' % i.dept_type) self._dept_shot = sorted(self._dept_shot, DeptInfoDb.compare) self._dept_asset = sorted(self._dept_asset, DeptInfoDb.compare) return self._dept_shot + self._dept_asset
def LoadRecurElement(self, elmt, parentTask, maxLevel): creationList = [] while elmt != None: if elmt.nodeType == elmt.ELEMENT_NODE: # get Attr in a dict adict = {} self.getXmlAttr(elmt, adict) assert not (elmt.nodeName in type_helper.LIST_TYPE_NAME) assert not (elmt.nodeName == 'dict') if elmt.nodeName in type_helper.SIMPLE_TYPE_NAME: result = self.getKids(elmt, parentTask, maxLevel) #assert len(result) == 1 if len(result) == 1: res = result[0] assert len(res) == 3 if elmt.nodeName in type_helper.STRING_TYPE_NAME: if res[1] == '""' or res[1] == '""': v = "" # TESTING else: v = "%r" % res[1] creationList.append( [elmt.nodeName, v, self.NoName]) else: val = res[1].strip() creationList.append( [elmt.nodeName, val, self.NoName]) # property elif elmt.nodeName == self.PROPID or elmt.nodeName == self.PROPID_OLD: # must have type, name optional assert 'type' in adict # property belong to a # 'valid parent' list, dict.. name = self.NoName if 'name' in adict: name = adict['name'] if adict['type'] in type_helper.SIMPLE_TYPE_NAME: #those are suppose to have 1 # child only holding the value result = self.getKids(elmt, parentTask, maxLevel) if len(result) == 0: break assert len(result) == 1 #if len(result) == 1 res = result[0] assert len(res) == 3 if adict['type'] in type_helper.STRING_TYPE_NAME: if res == '""' or res[1] == '""': v = "" # TESTING else: v = "%s" % res[1] creationList.append([adict['type'], v, name]) else: val = res[1].strip() creationList.append([adict['type'], val, name]) elif adict['type'] in type_helper.LIST_TYPE_NAME: result = self.getKids(elmt, parentTask, maxLevel) if adict['type'] == type_helper.LIST_TYPE_NAME[0]: newone = [] elif adict['type'] == type_helper.LIST_TYPE_NAME[1]: newone = () else: MsgUtils.warning("trouble with the list type") for res in result: assert len(res) == 3 if res[0] in type_helper.SIMPLE_TYPE_NAME: val = None val = eval('%s(%s)' % (res[0], res[1])) if adict['type'] == type_helper.LIST_TYPE_NAME[ 0]: newone.append(val) elif adict[ 'type'] == type_helper.LIST_TYPE_NAME[ 1]: newone += (val, ) else: if res[0] == self.REFID: nref = self.refRead(res[1], parentTask) if nref != None: res[1] = nref else: MsgUtils.warning( "can't resolve dependance yet") if adict['type'] == type_helper.LIST_TYPE_NAME[ 0]: newone.append(res[1]) elif adict[ 'type'] == type_helper.LIST_TYPE_NAME[ 1]: newone += (res[1], ) creationList.append( ["%s" % adict['type'], newone, name]) elif adict['type'] == 'dict': newone = {} result = self.getKids(elmt, parentTask, maxLevel) # the result must be key value,... an even number assert not len(result) % 2 for index in range(0, len(result), 2): key = result[index] val = result[index + 1] assert len(key) == 3 assert len(val) == 3 kk = None vv = None if key[0] in type_helper.SIMPLE_TYPE_NAME: kk = eval('%s(%s)' % (key[0], key[1])) else: if key[0] == self.REFID: nref = self.refRead(key[1], parentTask) if nref != None: key[1] = nref else: MsgUtils.warning( "can't resolve dependance yet") kk = key[1] if val[0] in type_helper.SIMPLE_TYPE_NAME: #if len(val[1]) > 2 and val[1][0] = "'" #if val[0] in type_helper.STRING_TYPE_NAME: # vv = val[1] #else: vv = eval('%s(%s)' % (val[0], val[1])) else: vv = val[1] if val[0] == self.REFID: nref = self.refRead(vv, parentTask) if nref != None: vv = nref else: MsgUtils.warning( "can't resolve dependance yet") newone[kk] = vv creationList.append(["dict", newone, name]) elif adict['type'] == types.NoneType.__name__: creationList.append([adict['type'], None, name]) else: #if nothing else it must be an object result = self.getKids(elmt, parentTask, maxLevel) assert len(result) == 1 res = result[0] assert len(res) == 3 if res[0] == self.REFID: nref = self.refRead(res[1], parentTask) if nref != None: res[1] = nref else: MsgUtils.warning( "can't resolve dependance yet") creationList.append(["unknownType", res[1], name]) elif elmt.nodeName == self.CHILDID: assert parentTask != None if maxLevel == 0: break if maxLevel != -1: maxLevel -= 1 result = self.getKids(elmt, parentTask, maxLevel) for res in result: assert len(res) == 3 assert res[0] != self.REFID parentTask.addChild(res[1]) elif elmt.nodeName == self.FILEID: assert 'path' in adict path = adict['path'] insts = tdata.Tdata.ReadAsXml(path) for ist in insts: creationList.append(["unknowType", ist, self.NoName]) elif elmt.nodeName == self.REFID: assert 'path' in adict instance = tdata.defaultContainer() instance.pathname = adict['path'] nref = self.refRead(instance, parentTask) if nref != None: creationList.append(["unknownType", nref, self.NoName]) else: creationList.append( [self.REFID, instance, self.NoName]) elif elmt.nodeName == 'NoneType': creationList.append([noneTypeCast, None, self.NoName]) else: # It's an object that need to be instanciate assert 'class' in adict amodule = elmt.nodeName aclass = adict['class'] if (amodule != 'Tdata' and amodule != '__builtin__'): cmd = "import %s" % amodule try: exec(cmd) except: traceback.print_exc() MsgUtils.warning("cannot import %s" % elmt.nodeName) MsgUtils.msg("Creating a generic class container") amodule = "Tdata" aclass = "container" if 'construct' in adict: #cmd = "newInstance = %s" % adict['construct'] cmd = "%s" % adict['construct'] else: #cmd = "newInstance = %s.%s()" % (amodule,aclass) cmd = "%s.%s()" % (amodule, aclass) newInstance = None try: #exec(cmd,globals(), locals()) newInstance = eval(cmd) except: traceback.print_exc() MsgUtils.error("COMMAND %s" % cmd) MsgUtils.msg("class definition %s not found in %s" % (aclass, amodule)) assert newInstance != None if self.isContainerClass(newInstance): newInstance.updateStringAttribute(adict) self.addRead(newInstance) result = self.getKids(elmt, newInstance, maxLevel) if not aclass in type_helper.SOMEOTHERTYPE: for res in result: assert len(res) == 3 assert not res[2] == self.NoName if res[0] == self.REFID: nref = self.refRead(res[1], parentTask) if nref != None: res[1] = nref else: MsgUtils.warning( "can't resolve dependance yet") if res[0] == "bool": if res[1] == "False": cmd = "newInstance.%s = False" % res[2] else: cmd = "newInstance.%s = True" % res[2] elif res[0] in type_helper.SIMPLE_TYPE_NAME: cmd = "newInstance.%s = %s(res[1])" % (res[2], res[0]) else: cmd = "newInstance.%s = res[1]" % res[2] exec(cmd) else: if aclass == "Set": for res in result: assert len(res) == 3 val = eval('%s(%s)' % (res[0], res[1])) newInstance.add(val) creationList.append(['object', newInstance, self.NoName]) elif elmt.nodeType == elmt.TEXT_NODE: data = self.getTextValue(elmt) if data != "": sdata = data.strip() if len(sdata) > 0: creationList.append(["dType", sdata, self.NoName]) else: raise elif elmt.nodeType == elmt.CDATA_SECTION_NODE: data = self.getcData(elmt) if data != "": sdata = data.strip() if len(sdata) > 0: creationList.append(["CdType", data, self.NoName]) else: pass elmt = elmt.nextSibling return creationList
def to_python(self, stream, acontext): # there is 2 case here, one (when module is present, it only about importing the # module and excuting the function. The other one is to define a local function # and execute it, return value are optional super(GenPyTask, self).to_python(stream, acontext) tab = acontext['tab'] #tabInc = acontext['tabInc'] # command command = GenPyTask._LockupPyAttr['command'].get(self, 'command') if command == None or command.strip() == "": log.error("'command' is required for a py task %r" % self.getName()) return False # output output = GenPyTask._LockupPyAttr['output'].get(self, 'output') if output == "": output = None handler = GenPyTask._LockupPyAttr['handler'].get(self, 'handler') if handler == "": handler = None argumentList = self._build_clean_argument_list() if handler == None or handler == 'eval': # something the argument string is already in the command # module module = GenPyTask._LockupPyAttr['module'].get(self, 'module') doModule = (module != None and module != "") if doModule: # module GenTask.do_python_module(stream, acontext, tab, module) m = GenTask._argumentFunction.search(command) # having argument syntax in the function take precedence startLine = tab if output != None: startLine += "%s = " % output if m: if doModule == True: stream.write("%s%s.%s\n" % (startLine, module, clean_quote(command))) else: stream.write("%s%s\n" % (startLine, clean_quote(command))) else: import traceback nbOfArgument = len(argumentList) if nbOfArgument == 0 and doModule: # some argument like RTD,CFD can be added let check if it's need # inspect import inspect funcstring = "%s.%s" % (module, command) inspectSuccess = True readArg = None try: exec("import %s" % module) except: #traceback.print_exc() inspectSuccess = False log.warning("couldn't import the module('%s')" % module) try: readArg = inspect.getargspec(eval(funcstring)) except: inspectSuccess = False #log.warning("couldn't get the function('%s') argument in %s" % (funcstring,self.label)) if inspectSuccess == False: if doModule: stream.write("%s%s.%s()\n" % (startLine, module, command)) else: stream.write("%s%s()\n" % (startLine, command)) else: # very simple for now #defa = readArg.defaults argu = "" for i in readArg.args: m = GenTask._checkStringEval.match(i) if m: if argu == "": argu = i else: argu = argu + "," + i if argu == "": if doModule: stream.write("%s%s.%s()\n" % (startLine, module, command)) else: stream.write("%s%s()\n" % (startLine, command)) else: if doModule: stream.write( "%s%s.%s(%s)\n" % (startLine, module, command, argu)) else: stream.write("%s%s.%s(%s)\n" % (startLine, command, argu)) else: maxLen = 0 for ea in argumentList: maxLen += len(ea) endValue = ")" if nbOfArgument > 1: endValue = "," startCmd = "" alen = 0 if doModule: startCmd = "%s%s.%s(" % (startLine, module, command) else: startCmd = "%s%s(" % (startLine, command) alen = len(startCmd) if maxLen > 80 and nbOfArgument > 1: # maximum line length to display stream.write("%s%s%s\n" % (startCmd, argumentList[0], endValue)) for ar in argumentList[1:-1]: stream.write("%s%s,\n" % (' ' * alen, ar)) # we need the ) with the last element stream.write("%s%s)\n" % (' ' * alen, argumentList[-1])) else: stream.write("%s%s)\n" % (startCmd, ", ".join(argumentList))) else: sc = command.split("\n") for i in sc: stream.write("%s%s\n" % (tab, i)) return True
def deserialize(self, astr): if self._doc != None: MsgUtils.warning("Be Carrefull the older document will be erase") self.reset() self._doc = parseString(astr)
def doIt(self,subAction,arg): log.warning("in doit %s %s" % (subAction,arg)) log.warning("doIt has to be overloaded for context %s" % self.getName()) return None
def constructDomTree(self, myTask, elmt, rec=True): if myTask == None: return self._doc if elmt == None: if len(self._top) > 0: elmt = self._top[-1] if elmt == None: return self._doc if self.isContainerClass(myTask): if self.addRef(myTask, elmt): pass else: d = {"class": myTask.getClassName()} myTask.loadStringAttribute(d) # query header to be the task to be store # has key/value attribute chdom = self.elementUnder(elmt, myTask.getModuleName(), list(d.items())) if rec: chN = None for ch in myTask.getChildrenForXml(): if chN == None: chN = self.elementUnder(chdom, self.CHILDID) self.constructDomTree(ch, chN, rec) else: # when recursion is 0 we only save # ref to the children pass # query the dictionary of the task dd = {} myTask.getVariableMember(dd) # start the recursion self.recursionDict(dd, chdom) elif hasattr(myTask, "__dict__"): # for simple dict class chdom = self.elementUnder( elmt, myTask.__class__.__module__, list({"class": myTask.__class__.__name__}.items())) dd = {} dd.update(myTask.__dict__) # start the recursion self.recursionDict(dd, chdom) else: # let try sets aclass = None amodule = None try: aclass = myTask.__class__.__name__ amodule = myTask.__class__.__module__ except: traceback.print_exc() MsgUtils.warning('OTHER OBJECT NOT SUPPORTED YET') if (amodule != None and aclass in type_helper.SOMEOTHERTYPE): if aclass == "Set": chdom = self.elementUnder(elmt, amodule, list({"class": aclass}.items())) for e in myTask: attr = self.elementUnder(chdom, type(e).__name__) self.textNodeUnder(attr, str(e)) elif aclass == "xrange": chdom = self.elementUnder( elmt, amodule, list({ "class": aclass, "construct": str(myTask) }.items())) elif aclass == "complex": chdom = self.elementUnder( elmt, amodule, list({ "class": aclass, "construct": 'complex%s' % myTask }.items())) else: MsgUtils.warning("not supported yet module %r class %r" % (amodule, aclass)) else: MsgUtils.warning('not supported xx %s' % aclass) return self._doc
def setModuleName(self,modu): MsgUtils.warning("forcing module name %r to %r" % (self.__ModuleName,modu)) self.__ModuleName = modu
def H_toolInstanciate(widgetApp, editor, widgetNameAction, aname=""): widgetName = "" isNew = False if not isinstance(widgetNameAction, str): widgetN = str(widgetNameAction.text()) isNew = True for i in widgetApp._toolList: if widgetN == widgetApp._toolList[i].name: widgetName = i break else: widgetName = str(widgetNameAction) if not widgetName in list(widgetApp._toolList.keys()): return # reject if unique and already in there if widgetApp._toolList[widgetName].unique == True: if widgetApp._toolList[widgetName].name in widgetApp._docksWidget: log.warning("this widget can only be instantiate once") # let be sure that it's visible then widgetApp._docksWidget[widgetApp._toolList[widgetName].name].show() return widgetApp.setCursor(QtT.QtCore.Qt.WaitCursor) uniqueName = "" # find a unique name if aname == "": uniqueName = get_unique_widget_name( widgetApp._docksWidget, widgetApp._toolList[widgetName].name) else: #uniqueName = widgetApp.getWidgetName(aname) uniqueName = get_unique_widget_name(widgetApp._docksWidget, aname) wclass = widgetApp._toolList[widgetName].get_factory() wclassn = widgetApp._toolList[widgetName].wid_class if wclass == None: log.error("can't load %r" % (widgetName)) traceback.print_exc() widgetApp.setCursor(QtT.QtCore.Qt.ArrowCursor) return cmd = "from dsk.base.widgets.app_dock_widget import DockWidget\n" cmd += widgetApp._toolList[widgetName].str_import() + "\n" cmd += "widgetApp._docksWidget[%r] = DockWidget(widgetApp,%r,%s,False)" % ( uniqueName, uniqueName, wclassn) try: exec(cmd) except: log.error("can't create %r in dock" % (widgetName)) traceback.print_exc() widgetApp.setCursor(QtT.QtCore.Qt.ArrowCursor) return log.info("Creating dockTools %r(%r)" % (uniqueName, widgetName)) widgetApp._docksWidget[uniqueName].setObjectName("D" + uniqueName) widgetApp._docksWidget[uniqueName].setFeatures( QtT.QtWidgets.QDockWidget.DockWidgetMovable | QtT.QtWidgets.QDockWidget.DockWidgetFloatable | QtT.QtWidgets.QDockWidget.DockWidgetClosable) prefArea = QtT.QtCore.Qt.RightDockWidgetArea if isNew == True: upref = widgetApp._toolList[widgetName].pref_place if upref == "L": prefArea = QtT.QtCore.Qt.LeftDockWidgetArea elif upref == 'T': prefArea = QtT.QtCore.Qt.TopDockWidgetArea elif upref == "B": prefArea = QtT.QtCore.Qt.BottomDockWidgetArea widgetApp.addDockWidget(prefArea, widgetApp._docksWidget[uniqueName]) # time for each widget to register there signal widgetApp._docksWidget[uniqueName].registerWidget(editor) msg = MsgFirstTime(widgetApp._docksWidget[uniqueName].getCustomWidget()) widgetApp.sig[confsig.INIT_FIRST_TIME.name].emit(msg) # submenu registration om = widgetApp._toolList[widgetName].optmenu if om != None: widgetApp.addSubOptionMenu(uniqueName, om) widgetApp.setCursor(QtT.QtCore.Qt.ArrowCursor)