From: <tom...@us...> - 2008-09-24 19:43:04
|
Revision: 10519 http://amsn.svn.sourceforge.net/amsn/?rev=10519&view=rev Author: tomhennigan Date: 2008-09-24 19:42:36 +0000 (Wed, 24 Sep 2008) Log Message: ----------- Update cocoa front end to reflect API changes in core. Modified Paths: -------------- trunk/amsn2/amsn2/gui/front_ends/cocoa/cocoa.py trunk/amsn2/amsn2/gui/front_ends/cocoa/contact_list.py trunk/amsn2/amsn2/gui/front_ends/cocoa/image.py trunk/amsn2/amsn2/gui/front_ends/cocoa/main.py Added Paths: ----------- trunk/amsn2/amsn2/gui/front_ends/cocoa/menu.py Modified: trunk/amsn2/amsn2/gui/front_ends/cocoa/cocoa.py =================================================================== --- trunk/amsn2/amsn2/gui/front_ends/cocoa/cocoa.py 2008-09-24 11:46:04 UTC (rev 10518) +++ trunk/amsn2/amsn2/gui/front_ends/cocoa/cocoa.py 2008-09-24 19:42:36 UTC (rev 10519) @@ -1,7 +1,10 @@ from main_loop import * from image import * +from menu import * + from main import * from contact_list import * from login import * from splash import * +from skins import * \ No newline at end of file Modified: trunk/amsn2/amsn2/gui/front_ends/cocoa/contact_list.py =================================================================== --- trunk/amsn2/amsn2/gui/front_ends/cocoa/contact_list.py 2008-09-24 11:46:04 UTC (rev 10518) +++ trunk/amsn2/amsn2/gui/front_ends/cocoa/contact_list.py 2008-09-24 19:42:36 UTC (rev 10519) @@ -4,51 +4,11 @@ from amsn2.core.views import StringView from amsn2.core.views import GroupView from amsn2.core.views import ContactView - -import pymsn - -class Contact(object): - def __init__(self, name, presence): - self.name = name - self.presence = presence - self.p2s = {pymsn.Presence.ONLINE:"Online", - pymsn.Presence.BUSY:"Busy", - pymsn.Presence.IDLE:"Idle", - pymsn.Presence.AWAY:"Away", - pymsn.Presence.BE_RIGHT_BACK:"BRB", - pymsn.Presence.ON_THE_PHONE:"On The Phone", - pymsn.Presence.OUT_TO_LUNCH:"Out To Lunch", - pymsn.Presence.INVISIBLE:"Hidden", - pymsn.Presence.OFFLINE:"Offline"} - - - def is_online(self): - return bool(self.presence != pymsn.Presence.OFFLINE) - - def status(self): - return self.p2s[self.presence] - -class Group(object): - def __init__(self, name): - self.contacts = {} - self.name = name - - def count(self): - online = 0 - total = 0 - for c in self.contacts: - total += 1 - if self.contacts[c].is_online(): - online +=1 - - return (online, total) -class aMSNContactList(base.aMSNContactList): +class aMSNContactList(base.aMSNContactListWindow): def __init__(self, amsn_core, parent): - self._amsn_core = amsn_core - self.groups = {} - self.contacts = {} + pass def show(self): pass @@ -57,10 +17,7 @@ pass def contactStateChange(self, contact): - for group in contact.groups: - self.groups[group.uid].contacts[contact.id].presence = contact.presence - - self.__update_view() + pass def contactNickChange(self, contact): pass @@ -90,8 +47,7 @@ pass def contactAdded(self, group, contact): - self.groups[group.uid].contacts[contact.id] = Contact(contact.display_name, contact.presence) - self.__update_view() + pass def contactRemoved(self, group, contact): pass @@ -103,8 +59,7 @@ pass def groupAdded(self, group): - self.groups[group.uid] = Group(group.name) - self.__update_view() + pass def groupRemoved(self, group): pass @@ -114,16 +69,3 @@ def cget(self, option, value): pass - - def __cls(self): - print "[H[2J" - - def __update_view(self): - self.__cls() - for g in self.groups: - count = self.groups[g].count() - print "|X| %s (%d/%d)" % (self.groups[g].name, count[0], count[1]) - for c in self.groups[g].contacts: - print " |=> %s (%s)" % (self.groups[g].contacts[c].name, self.groups[g].contacts[c].status()) - print "" - Modified: trunk/amsn2/amsn2/gui/front_ends/cocoa/image.py =================================================================== --- trunk/amsn2/amsn2/gui/front_ends/cocoa/image.py 2008-09-24 11:46:04 UTC (rev 10518) +++ trunk/amsn2/amsn2/gui/front_ends/cocoa/image.py 2008-09-24 19:42:36 UTC (rev 10519) @@ -2,18 +2,32 @@ from AppKit import * from amsn2.gui import base -class Image(base.Image): - def __init__(self, amsn_core, window): - self._amsn_core = amsn_core - self._amsn_gui = self._amsn_core.getMainWindow() - #self._img = NSImage.alloc().init() +class Image(object): + """ This interface will represent an image to be used by the UI""" + def __init__(self, amsn_core, parent): + """Initialize the interface. You should store the reference to the core in here """ + self._img = NSImage.alloc().initWithSize_((1,1)) - def loadFromFile(self, filename): - #self._img.release() - #self._img = NSImage.alloc().initWithContentsOfFile_(filename) - pass + def load(self, resource_name, value): + """ This method is used to load an image using the name of a resource and a value for that resource + resource_name can be : + - 'File', value is the filename + - 'Skin', value is the skin key + - some more :) + """ + self._img.release() + + if (resource_name == 'File'): + self._img = NSImage.alloc().initWithContentsOfFile_(str(value)) - def loadFromResource(self, resource_name): + def append(self, resource_name, value): + """ This method is used to overlap an image on the current image + Have a look at the documentation of the 'load' method for the meanings of 'resource_name' and 'value' + """ raise NotImplementedError - + def prepend(self, resource_name, value): + """ This method is used to underlap an image under the current image + Have a look at the documentation of the 'load' method for the meanings of 'resource_name' and 'value' + """ + raise NotImplementedError Modified: trunk/amsn2/amsn2/gui/front_ends/cocoa/main.py =================================================================== --- trunk/amsn2/amsn2/gui/front_ends/cocoa/main.py 2008-09-24 11:46:04 UTC (rev 10518) +++ trunk/amsn2/amsn2/gui/front_ends/cocoa/main.py 2008-09-24 19:42:36 UTC (rev 10519) @@ -11,6 +11,9 @@ # Load our window. self.cocoaWin = CocoaMainWindow.getMainWindow() + def setMenu(self, menu_view): + pass + def setTitle(self, title): self.cocoaWin.setTitle_(title) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |