changeset 29:df3b0b5ac49e

Wix: gateways manager => better presentation
author Goffi <goffi@goffi.org>
date Tue, 08 Dec 2009 02:31:35 +0100
parents c2b131e4e262
children d6b613764dd7
files frontends/wix/gateways.py
diffstat 1 files changed, 46 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/frontends/wix/gateways.py	Sun Dec 06 13:27:54 2009 +0100
+++ b/frontends/wix/gateways.py	Tue Dec 08 02:31:35 2009 +0100
@@ -34,13 +34,19 @@
 
         self.host = host
         #self.gateways = gateways
+            
+        #Fonts
+        self.normal_font = wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL)
+        self.bold_font = wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.BOLD)
+        self.italic_font = wx.Font(8, wx.DEFAULT, wx.FONTSTYLE_ITALIC, wx.NORMAL)
+
 
         self.modified = {}  # dict of modified data (i.e. what we have to save)
         self.ctl_list = {}  # usefull to access ctrl, key = (name, category)
 
         self.sizer = wx.BoxSizer(wx.VERTICAL)
         self.panel = wx.Panel(self)
-        self.panel.sizer = wx.BoxSizer(wx.VERTICAL)
+        self.panel.sizer = wx.FlexGridSizer(cols=4)
         self.panel.SetSizer(self.panel.sizer)
         self.panel.SetAutoLayout(True)
         self.sizer.Add(self.panel, 1, flag=wx.EXPAND)
@@ -51,7 +57,15 @@
         self.Bind(wx.EVT_CLOSE, self.onClose, self)
         
         self.MakeModal()
-
+        self.panel.sizer.Add(wx.Window(self.panel, -1))
+        title_name = wx.StaticText(self.panel, -1, "Name")
+        title_name.SetFont(self.bold_font)
+        title_type = wx.StaticText(self.panel, -1, "Type")
+        title_type.SetFont(self.bold_font)
+        self.panel.sizer.Add(title_name)
+        self.panel.sizer.Add(title_type)
+        self.panel.sizer.Add(wx.Window(self.panel, -1))
+    
         for gateway in gateways:
             self.addGateway(gateway, gateways[gateway])
 
@@ -61,43 +75,55 @@
         self.Show()
 
     def addGateway(self, gateway, param):
-        sizer = wx.BoxSizer(wx.HORIZONTAL)
         
-        bold_font = wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.BOLD)
-        italic_font = wx.Font(8, wx.DEFAULT, wx.FONTSTYLE_ITALIC, wx.NORMAL)
 
 
         #First The icon
         isz = (16,16)
         im_icon = wx.StaticBitmap(self.panel, -1, wx.ArtProvider.GetBitmap(wx.ART_GO_FORWARD, wx.ART_TOOLBAR, isz))
 
+        #Then the name
+
+        label=wx.StaticText(self.panel, -1, param['name'])
+        label.SetFont(self.normal_font)
+       
         #Then the transport type message
         
         type_label_txt = 'Unknown IM'
 
-        if param['type'] == 'msn':
+        if param['type'] == 'irc':
+            type_label_txt = "Internet Relay Chat"
+        elif param['type'] == 'xmpp':
+            type_label_txt = "XMPP"
+        elif param['type'] == 'qq':
+            type_label_txt = "Tencent QQ"
+        elif param['type'] == 'simple':
+            type_label_txt = "SIP/SIMPLE"
+        elif param['type'] == 'icq':
+            type_label_txt = "ICQ"
+        elif param['type'] == 'yahoo':
+            type_label_txt = "Yahoo! Messenger"
+        elif param['type'] == 'gadu-gadu':
+            type_label_txt = "Gadu-Gadu"
+        elif param['type'] == 'aim':
+            type_label_txt = "AOL Instant Messenger"
+        elif param['type'] == 'msn':
             type_label_txt = 'Windows Live Messenger'
 
-        type_label_txt = " " + type_label_txt + " "
+        type_label_txt = type_label_txt
 
         type_label = wx.StaticText(self.panel, -1, type_label_txt)
-        type_label.SetFont(bold_font)
-
-        #Then the name
+        type_label.SetFont(self.italic_font)
 
-        label=wx.StaticText(self.panel, -1, '('+param['name']+')')
-        label.SetFont(italic_font)
-       
         #The buttons
-        bold_font2 = wx.Font(6, wx.DEFAULT, wx.NORMAL, wx.BOLD)
+        button_font = wx.Font(6, wx.DEFAULT, wx.NORMAL, wx.BOLD)
         reg_button = wx.Button(self.panel, -1, "Register", size=wx.Size(-1, 8))
-        reg_button.SetFont(bold_font2)
+        reg_button.SetFont(button_font)
 
-        sizer.Add(im_icon)
-        sizer.Add(type_label)
-        sizer.Add(label, 1, wx.EXPAND)
-        sizer.Add(reg_button, 1, wx.EXPAND)
-        self.panel.sizer.Add(sizer, flag=wx.EXPAND)
+        self.panel.sizer.Add(im_icon)
+        self.panel.sizer.Add(label)
+        self.panel.sizer.Add(type_label)
+        self.panel.sizer.Add(reg_button, 1, wx.EXPAND)
 
 
     def onClose(self, event):