Esempio n. 1
0
def __runCommand(d):

    POVRayApp = os.path.join(config.POVRayPath,
                             'pvengine.exe').replace("\\", "/")
    if not os.path.isfile(POVRayApp):
        error_message = "Error: Could not find Pov-Ray in %s - aborting image generation" % os.path.dirname(
            POVRayApp)
        LicHelpers.writeLogEntry(error_message)
        print error_message
        return

    args = ['"' + POVRayApp + '"']
    for key, value in d.items():
        command = povCommands[key]
        if command:
            args.append(command[0] + command[1](value))
        else:
            if key == 'inFile':
                args.insert(
                    1, value
                )  # Ensure input file is first command (after pvengine.exe itself)
            else:
                args.append(value)

    if config.writePOVRayActivity:
        LicHelpers.writeLogAccess(" ".join(args))

    os.spawnv(os.P_WAIT, POVRayApp, args)
Esempio n. 2
0
def __runCommand(d):
    LogFile= open(os.path.join(config.appDataPath(),"activity.log"),"a")
    l3pApp = os.path.join(config.L3PPath , 'l3p.exe').replace("\\", "/")
    LibDir = '-ldd%s' % config.LDrawPath
    if not os.path.isfile(l3pApp):
        error_message = "Error: Could not find L3P.exe in %s - aborting image generation" % os.path.dirname(l3pApp)
        LicHelpers.writeLogEntry(error_message)
        print error_message
        return
    
    args = [l3pApp,LibDir]
    for key, value in d.items():
        command = l3pCommands[key]
        if command:
            args.append(command[0] + command[1](value))
        else:
            if key == 'inFile':
                args.insert(1, value)  # Ensure input file is first command (after l3p.exe itself)
            else:
                args.append(value)
                            
    if config.writeL3PActivity:                
        LogFile.write(" ".join(args)+"\n")
    LogFile.close()
        
    os.spawnv(os.P_WAIT, l3pApp, args)
Esempio n. 3
0
def __runCommand(d):
    LogFile= open(os.path.join(config.appDataPath(),"activity.log"),"a")
    POVRayApp = os.path.join(config.POVRayPath, 'pvengine.exe').replace("\\", "/")
    if not os.path.isfile(POVRayApp):
        error_message = "Error: Could not find Pov-Ray in %s - aborting image generation" % os.path.dirname(POVRayApp)
        LicHelpers.writeLogEntry(error_message)
        print error_message
        return

    args = ['"' + POVRayApp + '"']
    for key, value in d.items():
        command = povCommands[key]
        if command:
            args.append(command[0] + command[1](value))
        else:
            if key == 'inFile':
                args.insert(1, value)  # Ensure input file is first command (after pvengine.exe itself)
            else:
                args.append(value)
                
    if config.writePOVRayActivity:                
        LogFile.write(" ".join(args)+"\n")
    LogFile.close()
                
    os.spawnv(os.P_WAIT, POVRayApp, args)
Esempio n. 4
0
def __runCommand(d):

    l3pApp = os.path.join(config.L3PPath, 'l3p.exe').replace("\\", "/")
    if not os.path.isfile(l3pApp):
        error_message = "Error: Could not find L3P.exe in %s - aborting image generation" % os.path.dirname(
            l3pApp)
        LicHelpers.writeLogEntry(error_message)
        print error_message
        return

    args = [l3pApp]
    mode = os.P_WAIT
    for key, value in d.items():
        command = l3pCommands[key]
        if command:
            args.append(command[0] + command[1](value))
        else:
            if key == 'inFile':
                args.insert(
                    1, value
                )  # Ensure input file is first command (after l3p.exe itself)
            else:
                args.append(value)

    if config.writeL3PActivity:
        LicHelpers.writeLogAccess(" ".join(args))
    if sys.platform == 'win32':
        mode = os.P_DETACH

    os.spawnv(mode, l3pApp, args)
Esempio n. 5
0
def __runCommand(d):
    LogFile = open(os.path.join(config.appDataPath(), "activity.log"), "a")
    l3pApp = config.L3PPath
    LibDir = '-ldd%s' % config.LDrawPath
    if not os.path.isfile(l3pApp):
        error_message = "Error: Could not find L3P in %s - aborting image generation" % os.path.dirname(
            l3pApp)
        LicHelpers.writeLogEntry(error_message)
        print error_message
        return

    args = [l3pApp, LibDir]
    for key, value in d.items():
        command = l3pCommands[key]
        if command:
            args.append(command[0] + command[1](value))
        else:
            if key == 'inFile':
                args.insert(
                    1, value
                )  # Ensure input file is first command (after l3p.exe itself)
            else:
                args.append(value)

    if config.writeL3PActivity:
        LogFile.write(" ".join(args) + "\n")
    LogFile.close()

    os.spawnv(os.P_WAIT, l3pApp, args)
Esempio n. 6
0
def __runCommand(d):
    
    l3pApp = os.path.join(config.L3PPath ,'l3p.exe').replace("\\", "/")
    if not os.path.isfile(l3pApp):
        error_message = "Error: Could not find L3P.exe in %s - aborting image generation" % os.path.dirname(l3pApp)
        LicHelpers.writeLogEntry(error_message)
        print error_message
        return
    
    args = [l3pApp]
    mode = os.P_WAIT
    for key, value in d.items():
        command = l3pCommands[key]
        if command:
            args.append(command[0] + command[1](value))
        else:
            if key == 'inFile':
                args.insert(1, value)  # Ensure input file is first command (after l3p.exe itself)
            else:
                args.append(value)
                
    if config.writeL3PActivity:                
        LicHelpers.writeLogAccess(" ".join(args))
    if sys.platform == 'win32':
        mode = os.P_DETACH
        
    os.spawnv(mode, l3pApp, args)
Esempio n. 7
0
 def data(self, index):
     if index in [Qt.WhatsThisRole, Qt.AccessibleTextRole]:
         return self.__class__.__name__
     elif index == Qt.AccessibleDescriptionRole:
         designation = self.abstractPart.name.strip()
         if designation.startswith("~Move"):
             # after split, the result is in example: ['~Moved', 'to', '30027a']
             # get absolute path to part plain text file
             partname = designation.split(" ")[2]
             filepath = LDrawFile.getPartFilePath(partname + ".dat")
             designation = ""
             if filepath:
                 # read and parse first line in file or pass silently
                 f = open(filepath,"r")
                 try:
                     designation = f.readline().strip().replace('0 ','').replace('  ',' ')
                 except (IOError, OSError):
                     pass    
                 f.close()
             else:
                 LicHelpers.writeLogEntry("Can not find %s in LDraw library" % partname)
         return designation
     else:        
         if self._dataString:
             return self._dataString
 
         colorName = self.color.name if self.color else "Unnamed"
         if CSITreeManager.showPartGroupings:
             x, y, z = LicHelpers.GLMatrixToXYZ(self.matrix)
             self._dataString = "%s - (%.1f, %.1f, %.1f)" % (colorName, x, y, z)
         else:
             self._dataString = "%s - %s" % (self.abstractPart.name, colorName)
 
         return self._dataString
Esempio n. 8
0
 def data(self, index):
     if index in [Qt.WhatsThisRole, Qt.AccessibleTextRole]:
         return self.__class__.__name__
     elif index == Qt.AccessibleDescriptionRole:
         designation = self.abstractPart.name.strip()
         if designation.startswith("~Move"):
             # after split, the result is in example: ['~Moved', 'to', '30027a']
             # get absolute path to part plain text file
             partname = designation.split(" ")[2]
             filepath = LDrawFile.getPartFilePath(partname + ".dat")
             designation = ""
             if filepath:
                 # read and parse first line in file or pass silently
                 f = open(filepath,"r")
                 try:
                     designation = f.readline().strip().replace('0 ','').replace('  ',' ')
                 except (IOError, OSError):
                     pass    
                 f.close()
             else:
                 LicHelpers.writeLogEntry("Can not find %s in LDraw library" % partname)
         return designation
     else:        
         if self._dataString:
             return self._dataString
 
         colorName = self.color.name if self.color else "Unnamed"
         if CSITreeManager.showPartGroupings:
             x, y, z = LicHelpers.GLMatrixToXYZ(self.matrix)
             self._dataString = "%s - (%.1f, %.1f, %.1f)" % (colorName, x, y, z)
         else:
             self._dataString = "%s - %s" % (self.abstractPart.name, colorName)
 
         return self._dataString
Esempio n. 9
0
def __runCommand(d):
    LogFile = open(os.path.join(config.appDataPath(), "activity.log"), "a")
    POVRayApp = config.POVRayPath
    if not os.path.isfile(POVRayApp):
        error_message = "Error: Could not find Pov-Ray in %s - aborting image generation" % os.path.dirname(
            POVRayApp)
        LicHelpers.writeLogEntry(error_message)
        print error_message
        return

    args = ['"' + POVRayApp + '"']
    for key, value in d.items():
        command = povCommands[key]
        if command:
            args.append(command[0] + command[1](value))
        else:
            if key == 'inFile':
                args.insert(
                    1, value
                )  # Ensure input file is first command (after pvengine.exe itself)
            else:
                args.append(value)

    if config.writePOVRayActivity:
        LogFile.write(" ".join(args) + "\n")
    LogFile.close()

    os.spawnv(os.P_WAIT, POVRayApp, args)
Esempio n. 10
0
def getColorName(LDrawColorCode):
    if LDrawColorCode == CurrentColor:
        return None
    if LDrawColorCode == ComplimentColor:
        return None  #TODO: Handle compliment colors
    if LDrawColorCode not in colors:
        color_error = "Could not find LDraw Color: %d - Using Black" % LDrawColorCode
        LicHelpers.writeLogEntry(color_error ,"getColorName")
        print color_error
    return colors[LDrawColorCode][-1]
Esempio n. 11
0
 def job_2(self):
     destfile = ""
     if self.hasConnection:
         for srcfile in self.fileToDownload:
             try:
                 destfile = self.download_file(self.host + srcfile)
             except Exception, ex:
                 LicHelpers.writeLogEntry(ex.message, self.__class__.__name__)
             else:
                 self.setText("Downloaded %s" % os.path.basename(destfile))
Esempio n. 12
0
def getColorName(LDrawColorCode):
    if LDrawColorCode == CurrentColor:
        return None
    if LDrawColorCode == ComplimentColor:
        return None  #TODO: Handle compliment colors
    if LDrawColorCode not in colors:
        color_error = "Could not find LDraw Color: %d - Using Black" % LDrawColorCode
        LicHelpers.writeLogEntry(color_error, "getColorName")
        print color_error
    return colors[LDrawColorCode][-1]
Esempio n. 13
0
def convertToRGBA(LDrawColorCode):
    if LDrawColorCode == CurrentColor:
        return None
    if LDrawColorCode == ComplimentColor:
        return None  #TODO: Handle compliment colors
    if LDrawColorCode not in colors:
        color_error = "Could not find LDraw Color: %d - Using Black" % LDrawColorCode
        LicHelpers.writeLogEntry(color_error , "convertToRGBA")
        print color_error
        return LicHelpers.LicColor(*colors[0])
    return LicHelpers.LicColor(*colors[LDrawColorCode])
Esempio n. 14
0
def convertToRGBA(LDrawColorCode):
    if LDrawColorCode == CurrentColor:
        return None
    if LDrawColorCode == ComplimentColor:
        return None  #TODO: Handle compliment colors
    if LDrawColorCode not in colors:
        color_error = "Could not find LDraw Color: %d - Using Black" % LDrawColorCode
        LicHelpers.writeLogEntry(color_error, "convertToRGBA")
        print color_error
        return LicHelpers.LicColor(*colors[0])
    return LicHelpers.LicColor(*colors[LDrawColorCode])
Esempio n. 15
0
 def job_2(self):
     destfile = ""
     if self.hasConnection:
         for srcfile in self.fileToDownload:
             try:
                 destfile = self.download_file(self.host + srcfile)
             except Exception, ex:
                 LicHelpers.writeLogEntry(ex.message,
                                          self.__class__.__name__)
             else:
                 self.setText("Downloaded %s" % os.path.basename(destfile))
Esempio n. 16
0
 def updatePersistentIndices(self):
     for index in self.persistentIndexList():
         item = index.internalPointer()
         if item is None:
             continue  # Happens whenever we delete a persistent index (below)
         newIndex = QModelIndex()
         try:
             if item.parent():
                 newIndex = self.createIndex(item.row(), 0, item)
         except Exception, ex:
             LicHelpers.writeLogEntry("updatePersistentIndices: %s" % ex.message, item.__class__.__name__) 
             pass
         self.changePersistentIndex(index, newIndex)