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'
class Advanced_configuration_window:
class AdvancedConfigurationWindow:
def __init__(self, plugin):
self.plugin = plugin

View File

@ -799,15 +799,5 @@ class Chat:
# iterate through tabs/windows and repaint
for jid in self.xmls:
if self.widget_name == 'tabbed_chat_window':
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(
self.xmls[jid].get_widget('banner_eventbox').modify_bg(
gtk.STATE_NORMAL, gtk.gdk.color_parse(bgcolor))

View File

@ -952,7 +952,7 @@ class PreferencesWindow:
self.plugin.windows['advanced_config'].window.present()
else:
self.plugin.windows['advanced_config'] = \
dialogs.Advanced_configuration_window(self.plugin)
dialogs.AdvancedConfigurationWindow(self.plugin)
#---------- AccountModificationWindow class -------------#
class AccountModificationWindow:
@ -1261,7 +1261,7 @@ _('To change the account name, it must be disconnected.')).get_response()
return
if not self.plugin.windows[self.account]['infos'].has_key('vcard'):
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)
def on_manage_proxies_button_clicked(self, widget):

View File

@ -22,9 +22,9 @@ import gtk.glade
import gobject
import os
from vcard import Vcard_window
from vcard import VcardWindow
from gajim_themes_window import GajimThemesWindow
from advanced import Advanced_configuration_window
from advanced import AdvancedConfigurationWindow
from gajim import User
from common import gajim
from common import helpers
@ -535,7 +535,7 @@ class Subscription_request_window:
self.plugin.windows[self.account]['infos'][self.jid].window.present()
else:
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
vcard_xml = self.plugin.windows[self.account]['infos'][self.jid].xml
hbuttonbox = vcard_xml.get_widget('information_hbuttonbox')

View File

@ -807,7 +807,7 @@ class Interface:
#2:autoaway 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')
pix = gtk.gdk.pixbuf_new_from_file(path_to_file)
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'
class Groupchat_window(chat.Chat):
class GroupchatWindow(chat.Chat):
"""Class for Groupchat window"""
def __init__(self, room_jid, nick, plugin, account):
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()
else:
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
# cause we'll user real information window
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'
class History_window:
class HistoryWindow:
"""Class for bowser agent window:
to know the agents on the selected server"""
def on_history_window_destroy(self, widget):

View File

@ -44,7 +44,7 @@ gtk.glade.textdomain(APP)
GTKGUI_GLADE = 'gtkgui.glade'
class Roster_window:
class RosterWindow:
'''Class for main window of gtkgui plugin'''
def get_account_iter(self, name):
@ -450,7 +450,7 @@ class Roster_window:
if info.has_key(user.jid):
info[user.jid].window.present()
else:
info[user.jid] = dialogs.Vcard_window(user, self.plugin,
info[user.jid] = dialogs.VcardWindow(user, self.plugin,
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()
else:
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):
'''Make user's popup menu'''
@ -974,7 +974,7 @@ class Roster_window:
if gajim.config.get('usetabbedchat'):
if not self.plugin.windows[account]['chats'].has_key('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:
self.plugin.windows[account]['chats']['tabbed'].new_user(user)
@ -982,13 +982,13 @@ class Roster_window:
self.plugin.windows[account]['chats']['tabbed']
else:
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):
if gajim.config.get('usetabbedchat'):
if not self.plugin.windows[account]['gc'].has_key('tabbed'):
self.plugin.windows[account]['gc']['tabbed'] = \
groupchat_window.Groupchat_window(jid, nick, self.plugin,
groupchat_window.GroupchatWindow(jid, nick, self.plugin,
account)
else:
self.plugin.windows[account]['gc']['tabbed'].new_room(jid, nick)
@ -996,7 +996,7 @@ class Roster_window:
self.plugin.windows[account]['gc']['tabbed']
else:
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):
'''when we receive a message'''

View File

@ -40,7 +40,7 @@ gtk.glade.textdomain(APP)
GTKGUI_GLADE = 'gtkgui.glade'
class Tabbed_chat_window(chat.Chat):
class TabbedChatWindow(chat.Chat):
"""Class for tabbed chat window"""
def __init__(self, user, plugin, account):
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
# separate event box for each component (name label and
# 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
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)
# 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):
if not vcard.has_key('PHOTO'):
@ -208,7 +198,7 @@ class Tabbed_chat_window(chat.Chat):
self.plugin.windows['logs'][jid].window.present()
else:
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):
"""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:
## - Yann Le Boulanger <asterix@lagaule.org>
@ -33,7 +33,7 @@ gtk.glade.textdomain (APP)
GTKGUI_GLADE = 'gtkgui.glade'
class Vcard_window:
class VcardWindow:
'''Class for contact's information window'''
def on_user_information_window_destroy(self, widget = None):
del self.plugin.windows[self.account]['infos'][self.jid]