adhering to our new coding style for Classes and fixing glade banners stuff

This commit is contained in:
Nikos Kouremenos 2005-06-10 22:45:50 +00:00
parent 4c1581c072
commit c77387346c
11 changed files with 472 additions and 521 deletions

View file

@ -34,7 +34,7 @@ OPT_VAL = 1
GTKGUI_GLADE = 'gtkgui.glade' GTKGUI_GLADE = 'gtkgui.glade'
class Advanced_configuration_window: class AdvancedConfigurationWindow:
def __init__(self, plugin): def __init__(self, plugin):
self.plugin = plugin self.plugin = plugin

View file

@ -799,15 +799,5 @@ class Chat:
# iterate through tabs/windows and repaint # iterate through tabs/windows and repaint
for jid in self.xmls: for jid in self.xmls:
if self.widget_name == 'tabbed_chat_window': self.xmls[jid].get_widget('banner_eventbox').modify_bg(
self.xmls[jid].get_widget('banner_status_eventbox').modify_bg(
gtk.STATE_NORMAL, gtk.gdk.color_parse(bgcolor))
self.xmls[jid].get_widget('banner_typing_eventbox').modify_bg(
gtk.STATE_NORMAL, gtk.gdk.color_parse(bgcolor))
self.xmls[jid].get_widget('banner_name_eventbox').modify_bg(
gtk.STATE_NORMAL, gtk.gdk.color_parse(bgcolor))
self.xmls[jid].get_widget('banner_avatar_eventbox').modify_bg(
gtk.STATE_NORMAL, gtk.gdk.color_parse(bgcolor))
elif self.widget_name == 'groupchat_window':
self.xmls[jid].get_widget('banner_name_eventbox').modify_bg(
gtk.STATE_NORMAL, gtk.gdk.color_parse(bgcolor)) gtk.STATE_NORMAL, gtk.gdk.color_parse(bgcolor))

View file

@ -952,7 +952,7 @@ class PreferencesWindow:
self.plugin.windows['advanced_config'].window.present() self.plugin.windows['advanced_config'].window.present()
else: else:
self.plugin.windows['advanced_config'] = \ self.plugin.windows['advanced_config'] = \
dialogs.Advanced_configuration_window(self.plugin) dialogs.AdvancedConfigurationWindow(self.plugin)
#---------- AccountModificationWindow class -------------# #---------- AccountModificationWindow class -------------#
class AccountModificationWindow: class AccountModificationWindow:
@ -1261,7 +1261,7 @@ _('To change the account name, it must be disconnected.')).get_response()
return return
if not self.plugin.windows[self.account]['infos'].has_key('vcard'): if not self.plugin.windows[self.account]['infos'].has_key('vcard'):
self.plugin.windows[self.account]['infos'][jid] = \ self.plugin.windows[self.account]['infos'][jid] = \
dialogs.Vcard_window(jid, self.plugin, self.account, True) dialogs.VcardWindow(jid, self.plugin, self.account, True)
gajim.connections[self.account].request_vcard(jid) gajim.connections[self.account].request_vcard(jid)
def on_manage_proxies_button_clicked(self, widget): def on_manage_proxies_button_clicked(self, widget):

View file

@ -22,9 +22,9 @@ import gtk.glade
import gobject import gobject
import os import os
from vcard import Vcard_window from vcard import VcardWindow
from gajim_themes_window import GajimThemesWindow from gajim_themes_window import GajimThemesWindow
from advanced import Advanced_configuration_window from advanced import AdvancedConfigurationWindow
from gajim import User from gajim import User
from common import gajim from common import gajim
from common import helpers from common import helpers
@ -535,7 +535,7 @@ class Subscription_request_window:
self.plugin.windows[self.account]['infos'][self.jid].window.present() self.plugin.windows[self.account]['infos'][self.jid].window.present()
else: else:
self.plugin.windows[self.account]['infos'][self.jid] = \ self.plugin.windows[self.account]['infos'][self.jid] = \
Vcard_window(self.jid, self.plugin, self.account, True) VcardWindow(self.jid, self.plugin, self.account, True)
#remove the publish / retrieve buttons #remove the publish / retrieve buttons
vcard_xml = self.plugin.windows[self.account]['infos'][self.jid].xml vcard_xml = self.plugin.windows[self.account]['infos'][self.jid].xml
hbuttonbox = vcard_xml.get_widget('information_hbuttonbox') hbuttonbox = vcard_xml.get_widget('information_hbuttonbox')

View file

@ -807,7 +807,7 @@ class Interface:
#2:autoaway and use sleeper #2:autoaway and use sleeper
#3:autoxa and use sleeper #3:autoxa and use sleeper
self.roster = roster_window.Roster_window(self) self.roster = roster_window.RosterWindow(self)
path_to_file = os.path.join(gajim.DATA_DIR, 'pixmaps/gajim.png') path_to_file = os.path.join(gajim.DATA_DIR, 'pixmaps/gajim.png')
pix = gtk.gdk.pixbuf_new_from_file(path_to_file) pix = gtk.gdk.pixbuf_new_from_file(path_to_file)
gtk.window_set_default_icon(pix) # set the icon to all newly opened windows gtk.window_set_default_icon(pix) # set the icon to all newly opened windows

View file

@ -37,7 +37,7 @@ gtk.glade.textdomain(APP)
GTKGUI_GLADE = 'gtkgui.glade' GTKGUI_GLADE = 'gtkgui.glade'
class Groupchat_window(chat.Chat): class GroupchatWindow(chat.Chat):
"""Class for Groupchat window""" """Class for Groupchat window"""
def __init__(self, room_jid, nick, plugin, account): def __init__(self, room_jid, nick, plugin, account):
chat.Chat.__init__(self, plugin, account, 'groupchat_window') chat.Chat.__init__(self, plugin, account, 'groupchat_window')
@ -513,7 +513,7 @@ class Groupchat_window(chat.Chat):
self.plugin.windows[self.account]['infos'][jid].window.present() self.plugin.windows[self.account]['infos'][jid].window.present()
else: else:
self.plugin.windows[self.account]['infos'][jid] = \ self.plugin.windows[self.account]['infos'][jid] = \
dialogs.Vcard_window(jid, self.plugin, self.account, True) dialogs.VcardWindow(jid, self.plugin, self.account, True)
# FIXME: when we'll have a user for each contact, this won't be needed # FIXME: when we'll have a user for each contact, this won't be needed
# cause we'll user real information window # cause we'll user real information window
vcard_xml = self.plugin.windows[self.account]['infos'][jid].xml vcard_xml = self.plugin.windows[self.account]['infos'][jid].xml

File diff suppressed because it is too large Load diff

View file

@ -31,7 +31,7 @@ gtk.glade.textdomain(APP)
GTKGUI_GLADE = 'gtkgui.glade' GTKGUI_GLADE = 'gtkgui.glade'
class History_window: class HistoryWindow:
"""Class for bowser agent window: """Class for bowser agent window:
to know the agents on the selected server""" to know the agents on the selected server"""
def on_history_window_destroy(self, widget): def on_history_window_destroy(self, widget):

View file

@ -44,7 +44,7 @@ gtk.glade.textdomain(APP)
GTKGUI_GLADE = 'gtkgui.glade' GTKGUI_GLADE = 'gtkgui.glade'
class Roster_window: class RosterWindow:
'''Class for main window of gtkgui plugin''' '''Class for main window of gtkgui plugin'''
def get_account_iter(self, name): def get_account_iter(self, name):
@ -450,7 +450,7 @@ class Roster_window:
if info.has_key(user.jid): if info.has_key(user.jid):
info[user.jid].window.present() info[user.jid].window.present()
else: else:
info[user.jid] = dialogs.Vcard_window(user, self.plugin, info[user.jid] = dialogs.VcardWindow(user, self.plugin,
account) account)
def on_agent_logging(self, widget, jid, state, account): def on_agent_logging(self, widget, jid, state, account):
@ -521,7 +521,7 @@ class Roster_window:
self.plugin.windows['logs'][user.jid].window.present() self.plugin.windows['logs'][user.jid].window.present()
else: else:
self.plugin.windows['logs'][user.jid] = history_window.\ self.plugin.windows['logs'][user.jid] = history_window.\
History_window(self.plugin, user.jid) HistoryWindow(self.plugin, user.jid)
def mk_menu_user(self, event, iter): def mk_menu_user(self, event, iter):
'''Make user's popup menu''' '''Make user's popup menu'''
@ -974,7 +974,7 @@ class Roster_window:
if gajim.config.get('usetabbedchat'): if gajim.config.get('usetabbedchat'):
if not self.plugin.windows[account]['chats'].has_key('tabbed'): if not self.plugin.windows[account]['chats'].has_key('tabbed'):
self.plugin.windows[account]['chats']['tabbed'] = \ self.plugin.windows[account]['chats']['tabbed'] = \
tabbed_chat_window.Tabbed_chat_window(user, self.plugin, account) tabbed_chat_window.TabbedChatWindow(user, self.plugin, account)
else: else:
self.plugin.windows[account]['chats']['tabbed'].new_user(user) self.plugin.windows[account]['chats']['tabbed'].new_user(user)
@ -982,13 +982,13 @@ class Roster_window:
self.plugin.windows[account]['chats']['tabbed'] self.plugin.windows[account]['chats']['tabbed']
else: else:
self.plugin.windows[account]['chats'][user.jid] = \ self.plugin.windows[account]['chats'][user.jid] = \
tabbed_chat_window.Tabbed_chat_window(user, self.plugin, account) tabbed_chat_window.TabbedChatWindow(user, self.plugin, account)
def new_room(self, jid, nick, account): def new_room(self, jid, nick, account):
if gajim.config.get('usetabbedchat'): if gajim.config.get('usetabbedchat'):
if not self.plugin.windows[account]['gc'].has_key('tabbed'): if not self.plugin.windows[account]['gc'].has_key('tabbed'):
self.plugin.windows[account]['gc']['tabbed'] = \ self.plugin.windows[account]['gc']['tabbed'] = \
groupchat_window.Groupchat_window(jid, nick, self.plugin, groupchat_window.GroupchatWindow(jid, nick, self.plugin,
account) account)
else: else:
self.plugin.windows[account]['gc']['tabbed'].new_room(jid, nick) self.plugin.windows[account]['gc']['tabbed'].new_room(jid, nick)
@ -996,7 +996,7 @@ class Roster_window:
self.plugin.windows[account]['gc']['tabbed'] self.plugin.windows[account]['gc']['tabbed']
else: else:
self.plugin.windows[account]['gc'][jid] = \ self.plugin.windows[account]['gc'][jid] = \
groupchat_window.Groupchat_window(jid, nick, self.plugin, account) groupchat_window.GroupchatWindow(jid, nick, self.plugin, account)
def on_message(self, jid, msg, tim, account, encrypted = False): def on_message(self, jid, msg, tim, account, encrypted = False):
'''when we receive a message''' '''when we receive a message'''

View file

@ -40,7 +40,7 @@ gtk.glade.textdomain(APP)
GTKGUI_GLADE = 'gtkgui.glade' GTKGUI_GLADE = 'gtkgui.glade'
class Tabbed_chat_window(chat.Chat): class TabbedChatWindow(chat.Chat):
"""Class for tabbed chat window""" """Class for tabbed chat window"""
def __init__(self, user, plugin, account): def __init__(self, user, plugin, account):
chat.Chat.__init__(self, plugin, account, 'tabbed_chat_window') chat.Chat.__init__(self, plugin, account, 'tabbed_chat_window')
@ -102,22 +102,12 @@ class Tabbed_chat_window(chat.Chat):
# setting the bg color of the eventboxes. There is a # setting the bg color of the eventboxes. There is a
# separate event box for each component (name label and # separate event box for each component (name label and
# status icon). The avatar has one too in the glade file. # status icon). The avatar has one too in the glade file.
self.xmls[jid].get_widget('banner_eventbox').modify_bg(
gtk.STATE_NORMAL, gtk.gdk.color_parse(bgcolor))
# setup the label that holds name and jid # setup the label that holds name and jid
banner_name_label = self.xmls[jid].get_widget('banner_name_label') banner_name_label = self.xmls[jid].get_widget('banner_name_label')
banner_name_label.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse("white")) banner_name_label.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse('white'))
banner_name_label.set_markup(label_text) banner_name_label.set_markup(label_text)
# setup the eventbox that holds the above label, and colour it
banner_name_eventbox = self.xmls[jid].get_widget('banner_name_eventbox')
banner_name_eventbox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(bgcolor))
# setup the eventbox that holds the status icon and colour it
banner_status_eventbox = self.xmls[jid].get_widget('banner_status_eventbox')
banner_status_eventbox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(bgcolor))
# setup the eventbox that holds the avatar and colour it
banner_avatar_eventbox = self.xmls[jid].get_widget('banner_avatar_eventbox')
banner_avatar_eventbox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(bgcolor))
def set_avatar(self, vcard): def set_avatar(self, vcard):
if not vcard.has_key('PHOTO'): if not vcard.has_key('PHOTO'):
@ -208,7 +198,7 @@ class Tabbed_chat_window(chat.Chat):
self.plugin.windows['logs'][jid].window.present() self.plugin.windows['logs'][jid].window.present()
else: else:
self.plugin.windows['logs'][jid] = history_window.\ self.plugin.windows['logs'][jid] = history_window.\
History_window(self.plugin, jid, self.account) HistoryWindow(self.plugin, jid, self.account)
def on_send_button_clicked(self, widget): def on_send_button_clicked(self, widget):
"""When send button is pressed: send the current message""" """When send button is pressed: send the current message"""

View file

@ -1,4 +1,4 @@
## vcard.py (has Vcard_window class) ## vcard.py (has VcardWindow class)
## ##
## Gajim Team: ## Gajim Team:
## - Yann Le Boulanger <asterix@lagaule.org> ## - Yann Le Boulanger <asterix@lagaule.org>
@ -33,7 +33,7 @@ gtk.glade.textdomain (APP)
GTKGUI_GLADE = 'gtkgui.glade' GTKGUI_GLADE = 'gtkgui.glade'
class Vcard_window: class VcardWindow:
'''Class for contact's information window''' '''Class for contact's information window'''
def on_user_information_window_destroy(self, widget = None): def on_user_information_window_destroy(self, widget = None):
del self.plugin.windows[self.account]['infos'][self.jid] del self.plugin.windows[self.account]['infos'][self.jid]