def assetPathDialog(self): asset_path = QtGui.QFileDialog.getExistingDirectory() asset_head, asset_tail = os.path.split(asset_path) asset = Asset() asset.setName(asset_tail) asset.setRootPath(asset_head) # try and set asset try: asset.validate() self.setAsset(asset) self.asset_path_line_widget.setText(self.getAsset().getPath()) except ValueError as message: print message return self
def getNewFile(): test_path = os.path.normpath(config['test_asset_path']) new_user = User(config['user']) new_asset = Asset() new_asset.setName('scifiPinup') new_asset.setRootPath(test_path) new_file = Cinema4DFile() new_file.setName('scifiPinup') new_file.setAsset(new_asset) new_file.setFiletype(config['filetypes'][0]) new_file.setUser(new_user) #new_file.setComment('this is a test comment') try: new_file.validate() print new_file.getPath() except ValueError as message: print message