comparison frontends/src/primitivus/primitivus @ 495:a726b234d3bf

primitivus: moved constants in a separate file
author Goffi <goffi@goffi.org>
date Mon, 03 Sep 2012 23:43:15 +0200
parents 2a072735e459
children e9634d2e7b38
comparison
equal deleted inserted replaced
494:385cd2169eb5 495:a726b234d3bf
31 from sat_frontends.primitivus.chat import Chat 31 from sat_frontends.primitivus.chat import Chat
32 from sat_frontends.primitivus.gateways import GatewaysManager 32 from sat_frontends.primitivus.gateways import GatewaysManager
33 from sat_frontends.primitivus.xmlui import XMLUI 33 from sat_frontends.primitivus.xmlui import XMLUI
34 from sat_frontends.primitivus.progress import Progress 34 from sat_frontends.primitivus.progress import Progress
35 from sat_frontends.primitivus.notify import Notify 35 from sat_frontends.primitivus.notify import Notify
36 import sat_frontends.primitivus.constants
36 import logging 37 import logging
37 from logging import debug, info, error 38 from logging import debug, info, error
38 import sys, os
39 from sat.tools.jid import JID 39 from sat.tools.jid import JID
40 40
41 41
42 ### logging configuration FIXME: put this elsewhere ### 42 ### logging configuration FIXME: put this elsewhere ###
43 logging.basicConfig(level=logging.CRITICAL, #TODO: configure it to put messages in a log file 43 logging.basicConfig(level=logging.CRITICAL, #TODO: configure it to put messages in a log file
44 format='%(message)s') 44 format='%(message)s')
45 ### 45 ###
46
47 const_APP_NAME = "Primitivus"
48 const_PALETTE = [('title', 'black', 'light gray', 'standout,underline'),
49 ('title_focus', 'white,bold', 'light gray', 'standout,underline'),
50 ('selected', 'default', 'dark red'),
51 ('selected_focus', 'default,bold', 'dark red'),
52 ('default', 'default', 'default'),
53 ('default_focus', 'default,bold', 'default'),
54 ('alert', 'default,underline', 'default'),
55 ('alert_focus', 'default,bold,underline', 'default'),
56 ('date', 'light gray', 'default'),
57 ('my_nick', 'dark red,bold', 'default'),
58 ('other_nick', 'dark cyan,bold', 'default'),
59 ('menubar', 'light gray,bold', 'dark red'),
60 ('menubar_focus', 'light gray,bold', 'dark green'),
61 ('selected_menu', 'light gray,bold', 'dark green'),
62 ('menuitem', 'light gray,bold', 'dark red'),
63 ('menuitem_focus', 'light gray,bold', 'dark green'),
64 ('notifs', 'black,bold', 'yellow'),
65 ('notifs_focus', 'dark red', 'yellow'),
66 ('card_neutral', 'dark gray', 'white', 'standout,underline'),
67 ('card_neutral_selected', 'dark gray', 'dark green', 'standout,underline'),
68 ('card_special', 'brown', 'white', 'standout,underline'),
69 ('card_special_selected', 'brown', 'dark green', 'standout,underline'),
70 ('card_red', 'dark red', 'white', 'standout,underline'),
71 ('card_red_selected', 'dark red', 'dark green', 'standout,underline'),
72 ('card_black', 'black', 'white', 'standout,underline'),
73 ('card_black_selected', 'black', 'dark green', 'standout,underline'),
74 ('directory', 'dark cyan, bold', 'default'),
75 ('directory_focus', 'dark cyan, bold', 'dark green'),
76 ('separator', 'brown', 'default'),
77 ('warning', 'light red', 'default'),
78 ('progress_normal', 'default', 'black'),
79 ('progress_complete', 'default', 'light red'),
80 ]
81 46
82 class ChatList(QuickChatList): 47 class ChatList(QuickChatList):
83 """This class manage the list of chat windows""" 48 """This class manage the list of chat windows"""
84 49
85 def __init__(self, host): 50 def __init__(self, host):
242 return self.main_widget 207 return self.main_widget
243 208
244 def _nick_completion(self, text, completion_data): 209 def _nick_completion(self, text, completion_data):
245 """Completion method which complete pseudo in group chat 210 """Completion method which complete pseudo in group chat
246 for params, see AdvancedEdit""" 211 for params, see AdvancedEdit"""
247 contact = self.contactList.get_contact() ###Based on the fact that there is currently only one contact selectableat once 212 contact = self.contactList.get_contact() ###Based on the fact that there is currently only one contact selectable at once
248 if contact: 213 if contact:
249 chat = self.chat_wins[contact] 214 chat = self.chat_wins[contact]
250 if chat.type != "group": 215 if chat.type != "group":
251 return text 216 return text
252 space = text.rfind(" ") 217 space = text.rfind(" ")