pymensago/userprofile.py
def load_profiles(self, profile_path='') -> RetVal:
		'''Loads all profiles under the specified path
		
		Parameters:
		  * profile_path: (optional) the path containing the profile hierarchy
		
		Returns:
		  * no additional fields
		
		Notes:
			If not specified, the profile manager will look in ~/config/mensago on POSIX
			platforms and %LOCALAPPDATA%\mensago on Windows.
		'''

		self.active_index = -1
		
		if profile_path:
			self.profile_folder = profile_path
		else:
			osname = platform.system().casefold()
			if osname == 'windows':
				self.profile_folder = os.path.join(os.getenv('LOCALAPPDATA'), 'mensago')
			else:
				self.profile_folder = os.path.join(os.getenv('HOME'), '.config','mensago')
		
		if not os.path.exists(self.profile_folder):
			os.mkdir(self.profile_folder)
		
		items = os.listdir(self.profile_folder)

		self.profiles = list()
		self.default_profile = ''
		for item in items:
			itempath = os.path.join(self.profile_folder, item)
			if not os.path.isdir(itempath):
				continue
			
			profile = Profile(itempath)
			self.profiles.append(profile)
			if profile.is_default():
				if self.default_profile:
					# If we have more than profile marked as default, the first one encountered
					# retains that status
					profile.set_default(False)
				else:
					self.default_profile = profile.name

		if not self.get_profiles():
			self.error_state = self.create_profile('primary')
			if not self.error_state.error():
				self.set_default_profile('primary')
		
		if not self.error_state.error():
			self.error_state = self.activate_profile(self.get_default_profile())

		return RetVal()
Loads all profiles under the specified path
		
		Parameters:
		  * profile_path: (optional) the path containing the profile hierarchy
		
		Returns:
		  * no additional fields
		
		Notes:
			If not specified, the profile manager will look in ~/config/mensago on POSIX
			platforms and %LOCALAPPDATA%\mensago on Windows.
		
Loads all profiles under the specified path
Loads all profiles under the specified path
def load_profiles(self, profile_path='') -> RetVal:
		self.active_index = -1
		if profile_path:
			self.profile_folder = profile_path
		else:
			osname = platform.system().casefold()
			if osname == 'windows':
				self.profile_folder = os.path.join(os.getenv('LOCALAPPDATA'), 'mensago')
			else:
				self.profile_folder = os.path.join(os.getenv('HOME'), '.config','mensago')
		if not os.path.exists(self.profile_folder):
			os.mkdir(self.profile_folder)
		items = os.listdir(self.profile_folder)
		self.profiles = list()
		self.default_profile = ''
		for item in items:
			itempath = os.path.join(self.profile_folder, item)
			if not os.path.isdir(itempath):
				continue
			profile = Profile(itempath)
			self.profiles.append(profile)
			if profile.is_default():
				if self.default_profile:
					profile.set_default(False)
				else:
					self.default_profile = profile.name
		if not self.get_profiles():
			self.error_state = self.create_profile('primary')
			if not self.error_state.error():
				self.set_default_profile('primary')
		if not self.error_state.error():
			self.error_state = self.activate_profile(self.get_default_profile())
		return RetVal()
def load_profiles ( self , profile_path = '' ) -> RetVal : self . active_index = - 1 if profile_path : self . profile_folder = profile_path else : osname = platform . system ( ) . casefold ( ) if osname == 'windows' : self . profile_folder = os . path . join ( os . getenv ( 'LOCALAPPDATA' ) , 'mensago' ) else : self . profile_folder = os . path . join ( os . getenv ( 'HOME' ) , '.config' , 'mensago' ) if not os . path . exists ( self . profile_folder ) : os . mkdir ( self . profile_folder ) items = os . listdir ( self . profile_folder ) self . profiles = list ( ) self . default_profile = '' for item in items : itempath = os . path . join ( self . profile_folder , item ) if not os . path . isdir ( itempath ) : continue profile = Profile ( itempath ) self . profiles . append ( profile ) if profile . is_default ( ) : if self . default_profile : profile . set_default ( False ) else : self . default_profile = profile . name if not self . get_profiles ( ) : self . error_state = self . create_profile ( 'primary' ) if not self . error_state . error ( ) : self . set_default_profile ( 'primary' ) if not self . error_state . error ( ) : self . error_state = self . activate_profile ( self . get_default_profile ( ) ) return RetVal ( )
Loads all profiles under the specified path
Loads all profiles under the specified path
'''Loads all profiles under the specified path
		
		Parameters:
		  * profile_path: (optional) the path containing the profile hierarchy
		
		Returns:
		  * no additional fields
		
		Notes:
			If not specified, the profile manager will look in ~/config/mensago on POSIX
			platforms and %LOCALAPPDATA%\mensago on Windows.
		''' # If we have more than profile marked as default, the first one encountered # retains that status
no additional fields
no additional fields
self
profile_path
* profile_path
(optional) the path containing the profile hierarchy
( optional ) the path containing the profile hierarchy