Skip to content

Commit

Permalink
Merge remote branch 'arantes555/master'
Browse files Browse the repository at this point in the history
Conflicts:
	amsn2/ui/front_ends/gtk/utility.py
  • Loading branch information
borisfaure committed Sep 11, 2010
2 parents 4268418 + 91defb3 commit 4da2610
Show file tree
Hide file tree
Showing 94 changed files with 638 additions and 171 deletions.
2 changes: 2 additions & 0 deletions amsn2/core/amsn.py
Expand Up @@ -29,6 +29,7 @@
from conversation_manager import *
from oim_manager import *
from theme_manager import *
from smiley_manager import *
from personalinfo_manager import *
from event_manager import *
from userinterface_manager import *
Expand Down Expand Up @@ -77,6 +78,7 @@ def __init__(self, options = None, extra_args = None):
self._backend_manager = aMSNBackendManager(self)
self._account_manager = aMSNAccountManager(self, options)
self._theme_manager = aMSNThemeManager(self)
self._smiley_manager = aMSNSmileyManager(self)
self._contactlist_manager = aMSNContactListManager(self)
self._oim_manager = aMSNOIMManager(self)
self._conversation_manager = aMSNConversationManager(self)
Expand Down
122 changes: 122 additions & 0 deletions amsn2/core/smiley_manager.py
@@ -0,0 +1,122 @@
# -*- coding: utf-8 -*-
#
# amsn - a python client for the WLM Network
#
# Copyright (C) 2010 Mehdi KOUHEN <arantes555@hotmail.fr>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA


class aMSNSmileyManager:
def __init__(self, core): #for now, only a dic of default smileys' shortcuts
self._core = core
self.default_smileys_shortcuts = {
"(ap)": "smiley_airplane",
"(a)": "smiley_angel",
":-@": "smiley_angry",
":@": "smiley_angry",
"(so)": "smiley_ball",
":-[": "smiley_bat",
":[": "smiley_bat",
"(b)": "smiley_beer",
":D": "smiley_big_smile",
":>": "smiley_big_smile",
":->": "smiley_big_smile",
":-D": "smiley_big_smile",
"(||)": "smiley_bowl",
"(z)": "smiley_boy",
"(brb)": "smiley_brb",
"(u)": "smiley_broken_heart",
"(^)": "smiley_cake",
"(p)": "smiley_camera",
"(au)": "smiley_car",
"(@)": "smiley_cat",
"(ci)": "smiley_cigarette",
"(h5)": "smiley_clapping_hands",
"(o)": "smiley_clock",
"(c)": "smiley_coffee",
"(co)": "smiley_computer",
":-s": "smiley_confused",
":s": "smiley_confused",
"(h)": "smiley_cool_glasses",
":'(": "smiley_crying",
"(w)": "smiley_dead_rose",
"(6)": "smiley_devil",
":|": "smiley_disapointed",
":-|": "smiley_disapointed",
"(&)": "smiley_dog",
":^)": "smiley_dont_know",
"(d)": "smiley_drink",
"(e)": "smiley_email",
":$": "smiley_embarrassed",
":-$": "smiley_embarrassed",
"8-)": "smiley_eye_rolling",
"(~)": "smiley_film",
"(yn)": "smiley_finger_cross",
"(g)": "smiley_gift",
"(x)": "smiley_girl",
"(nah)": "smiley_goat",
"(%)": "smiley_handcuffs",
"(l)": "smiley_heart",
"*red+u": "smiley_im",
"(ip)": "smiley_island",
"(k)": "smiley_kiss",
"({)": "smiley_left_hug",
"(i)": "smiley_light",
"(mp)": "smiley_mobile",
"(mo)": "smiley_money",
"(s)": "smiley_moon",
"(m)": "smiley_msn",
"8-|": "smiley_nerd",
"(8)": "smiley_note",
"<:o)": "smiley_party",
"(t)": "smiley_phone",
"(pi)": "smiley_pizza",
"(pl)": "smiley_plate",
":-#": "smiley_quiet",
"('.')": "smiley_rabbit",
"(st)": "smiley_rain",
"(r)": "smiley_rainbow",
"(})": "smiley_right_hug",
"(f)": "smiley_rose",
":(": "smiley_sad",
":-(": "smiley_sad",
":-<": "smiley_sad",
":<": "smiley_sad",
"^o)": "smiley_sarcastic",
":-*": "smiley_secret",
"(nah)": "smiley_sheep",
":-o": "smiley_shock",
":o": "smiley_shock",
"+o(": "smiley_sick",
":)": "smiley_smile",
":-)": "smiley_smile",
"(sn)": "smiley_snail",
"(*)": "smiley_star",
"(li)": "smiley_storm",
"(#)": "smiley_sun",
"8o|": "smiley_teeth",
"*-)": "smiley_think",
"(n)": "smiley_thumb_down",
"(y)": "smiley_thumb_up",
"|-)": "smiley_tired",
":p": "smiley_tongue",
":-p": "smiley_tongue",
"(tu)": "smiley_turtle",
"(um)": "smiley_umbrella",
";)": "smiley_wink",
";-)": "smiley_wink",
"(xx)": "smiley_xbox",
}
93 changes: 93 additions & 0 deletions amsn2/core/theme_manager.py
Expand Up @@ -47,6 +47,7 @@ def load(self):
self._statusicons = aMSNStatusIconLoader().load('default')
self._displaypic = aMSNDisplayPicLoader().load('default')
self._emblems = aMSNEmblemLoader().load('default')
self._smileys = aMSNSmileyLoader().load('default')

def get_value(self, key):
if (key.startswith('button_')):
Expand All @@ -57,6 +58,8 @@ def get_value(self, key):
return self.get_dp(key)
elif (key.startswith('emblem_')):
return self.get_emblem(key)
elif (key.startswith('smiley_')):
return self.get_smiley(key)
else:
# TODO: This should raise a exception
return (None, None)
Expand All @@ -73,6 +76,9 @@ def get_dp(self, key):
def get_emblem(self, key):
return self.__get(self._emblems, key)

def get_smiley(self, key):
return self.__get(self._smileys, key)

class aMSNGenericLoader:
def __init__(self, basedir):
self._theme = 'default'
Expand Down Expand Up @@ -151,3 +157,90 @@ def __init__(self):
'emblem_hidden': 'offline_emblem.png',
'emblem_blocked': 'blocked_emblem.png',
}

class aMSNSmileyLoader(aMSNGenericLoader):
def __init__(self):
aMSNGenericLoader.__init__(self, "smileys")
self._keys = {
'smiley_airplane': 'airplane.png',
'smiley_angel': 'angel.png',
'smiley_angry': 'angry.png',
'smiley_ball': 'ball.png',
'smiley_bat': 'bat.png',
'smiley_beer': 'beer.png',
'smiley_big_smile': 'big_smile.png',
'smiley_bowl': 'bowl.png',
'smiley_boy': 'boy.png',
'smiley_brb': 'brb.png',
'smiley_broken_heart': 'broken_heart.png',
'smiley_cake': 'cake.png',
'smiley_camera': 'camera.png',
'smiley_car': 'car.png',
'smiley_cat': 'cat.png',
'smiley_cigarette': 'cigarette.png',
'smiley_clapping_hands': 'clapping_hands.png',
'smiley_clock': 'clock.png',
'smiley_coffee': 'coffee.png',
'smiley_computer': 'computer.png',
'smiley_confused': 'confused.png',
'smiley_cool_glasses': 'cool_glasses.png',
'smiley_crying': 'crying.png',
'smiley_dead_rose': 'dead_rose.png',
'smiley_devil': 'devil.png',
'smiley_disapointed': 'disapointed.png',
'smiley_dog': 'dog.png',
'smiley_dont_know': 'dont_know.png',
'smiley_drink': 'drink.png',
'smiley_email': 'email.png',
'smiley_embarrassed': 'embarrassed.png',
'smiley_eye_rolling': 'eye_rolling.png',
'smiley_film': 'film.png',
'smiley_finger_cross': 'finger_cross.png',
'smiley_gift': 'gift.png',
'smiley_girl': 'girl.png',
'smiley_goat': 'goat.png',
'smiley_handcuffs': 'handcuffs.png',
'smiley_heart': 'heart.png',
'smiley_im': 'im.png',
'smiley_island': 'island.png',
'smiley_kiss': 'kiss.png',
'smiley_left_hug': 'left_hug.png',
'smiley_light': 'light.png',
'smiley_mobile': 'mobile.png',
'smiley_money': 'money.png',
'smiley_moon': 'moon.png',
'smiley_msn': 'msn.png',
'smiley_nerd': 'nerd.png',
'smiley_note': 'note.png',
'smiley_party': 'party.png',
'smiley_phone': 'phone.png',
'smiley_pizza': 'pizza.png',
'smiley_plate': 'plate.png',
'smiley_quiet': 'quiet.png',
'smiley_rabbit': 'rabbit.png',
'smiley_rain': 'rain.png',
'smiley_rainbow': 'rainbow.png',
'smiley_right_hug': 'right_hug.png',
'smiley_rose': 'rose.png',
'smiley_sad': 'sad.png',
'smiley_sarcastic': 'sarcastic.png',
'smiley_secret': 'secret.png',
'smiley_sheep': 'sheep.png',
'smiley_shock': 'shock.png',
'smiley_sick': 'sick.png',
'smiley_smile': 'smile.png',
'smiley_snail': 'snail.png',
'smiley_star': 'star.png',
'smiley_storm': 'storm.png',
'smiley_sun': 'sun.png',
'smiley_teeth': 'teeth.png',
'smiley_think': 'think.png',
'smiley_thumb_down': 'thumb_down.png',
'smiley_thumb_up': 'thumb_up.png',
'smiley_tired': 'tired.png',
'smiley_tongue': 'tongue.png',
'smiley_turtle': 'turtle.png',
'smiley_umbrella': 'umbrella.png',
'smiley_wink': 'wink.png',
'smiley_xbox': 'xbox.png',
}
15 changes: 5 additions & 10 deletions amsn2/core/userinterface_manager.py
Expand Up @@ -130,32 +130,27 @@ def load_chat_widget(self, conversation, window, cuids):

def load_contact_input_window(self, callback, groupviews):
win = self._ui.aMSNContactInputWindow(('Contact to add: ', 'Invite message: '),
callback, groupviews)
win.set_title("aMSN 2 - Add a Contact")
callback, groupviews, "aMSN 2 - Add a Contact")
win.show()
return win

def load_contact_delete_window(self, callback, contactviews):
win = self._ui.aMSNContactDeleteWindow(('Contact to remove: ',), callback, contactviews)
win.set_title("aMSN 2 - Delete a Contact")
win = self._ui.aMSNContactDeleteWindow(('Contact to remove: ',), callback, contactviews, "aMSN 2 - Delete a Contact")
win.show()
return win

def load_group_input_window(self, callback, contactviews):
win = self._ui.aMSNGroupInputWindow(('Group to add: ',), callback, contactviews)
win.set_title("aMSN 2 - Add a Group")
win = self._ui.aMSNGroupInputWindow(('Group to add: ',), callback, contactviews, "aMSN 2 - Add a Group")
win.show()
return win

def load_group_delete_window(self, callback, groupviews):
win = self._ui.aMSNGroupDeleteWindow(('Group to remove: ',), callback, groupviews)
win.set_title("aMSN 2 - Delete a Group")
win = self._ui.aMSNGroupDeleteWindow(('Group to remove: ',), callback, groupviews, "aMSN 2 - Delete a Group")
win.show()
return win

def load_DP_chooser_window(self):
win = self._ui.aMSNDPChooserWindow(self._core._account.set_dp ,self._core._backend_manager)
win.set_title("aMSN 2 - Choose a Display Picture")
win = self._ui.aMSNDPChooserWindow(self._core._account.set_dp ,self._core._backend_manager, "aMSN 2 - Choose a Display Picture")
win.show()

# Common methods for all UI
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
2 changes: 1 addition & 1 deletion amsn2/ui/base/choosers.py
Expand Up @@ -4,7 +4,7 @@ class aMSNFileChooserWindow(object):
This Interface represent a window used to choose a file,
which could be an image for the dp, a file to send, a theme file, etc.
"""
def __init__(self, filters, directory, callback):
def __init__(self, filters, directory, callback, title = "aMSN Display Picture Chooser"):
"""
@type filter: dict of tuple
@param filter: A dict whose keys are the names of the filters,
Expand Down

0 comments on commit 4da2610

Please sign in to comment.