This commit is contained in:
Florent Le Coz 2011-11-16 20:43:17 +01:00
commit 27e587118b
7 changed files with 21 additions and 4 deletions

View file

@ -17,5 +17,5 @@ class Plugin(BasePlugin):
'/afk [status message]\nAfk: Set your status as afk (away from keyboard).')
self.add_command('away', lambda line: self.core.command_status('away '+line),
'/away [status message]\nAway: Set your status as away.')
self.add_command('away', lambda line: self.core.command_status('away '+line),
self.add_command('available', lambda line: self.core.command_status('available '+line),
'/available [status message]\nAvailable: Set your status as available.')

View file

@ -1340,6 +1340,7 @@ class Core(object):
os.path.join(os.environ.get('XDG_DATA_HOME') or\
os.path.join(os.environ.get('HOME'), '.local', 'share'),
'poezio', 'themes')
themes_dir = os.path.expanduser(themes_dir)
try:
names = os.listdir(themes_dir)
except OSError as e:

View file

@ -16,6 +16,7 @@ import logging
log = logging.getLogger(__name__)
DATA_HOME = config.get('log_dir', '') or os.path.join(environ.get('XDG_DATA_HOME') or os.path.join(environ.get('HOME'), '.local', 'share'), 'poezio')
DATA_HOME = os.path.expanduser(DATA_HOME)
class Logger(object):
"""

View file

@ -27,6 +27,13 @@ class PluginConfig(config.Config):
if not self.has_section(self.module_name):
self.add_section(self.module_name)
def options(self, section=None):
if not section:
section = self.module_name
if not self.has_section(section):
self.add_section(section)
return config.Config.options(self, section)
def write(self):
"""Write the config to the disk"""
try:

View file

@ -10,6 +10,7 @@ plugins_dir = plugins_dir or\
os.path.join(os.environ.get('XDG_DATA_HOME') or\
os.path.join(os.environ.get('HOME'), '.local', 'share'),
'poezio', 'plugins')
plugins_dir = os.path.expanduser(plugins_dir)
config_home = os.environ.get("XDG_CONFIG_HOME")
if not config_home:

View file

@ -94,6 +94,12 @@ class Theme(object):
# in the user list
CHAR_STATUS = '|'
# The characters used for the chatstates in the user list
# in a MUC
CHAR_CHATSTATE_ACTIVE = 'A'
CHAR_CHATSTATE_COMPOSING = 'X'
CHAR_CHATSTATE_PAUSED = 'p'
# Separators
COLOR_VERTICAL_SEPARATOR = (4, -1)
COLOR_NEW_TEXT_SEPARATOR = (2, -1)
@ -246,6 +252,7 @@ def reload_theme():
os.path.join(os.environ.get('XDG_DATA_HOME') or\
os.path.join(os.environ.get('HOME'), '.local', 'share'),
'poezio', 'themes')
themes_dir = os.path.expanduser(themes_dir)
try:
os.makedirs(themes_dir)
except OSError:

View file

@ -233,11 +233,11 @@ class UserList(Win):
else:
show_col = self.color_show[user.show]()
if user.chatstate == 'composing':
char = 'X'
char = get_theme().CHAR_CHATSTATE_COMPOSING
elif user.chatstate == 'active':
char = 'A'
char = get_theme().CHAR_CHATSTATE_ACTIVE
elif user.chatstate == 'paused':
char = 'p'
char = get_theme().CHAR_CHATSTATE_PAUSED
else:
char = get_theme().CHAR_STATUS
self.addstr(y, 0, char, to_curses_attr(show_col))