Mercurial > libervia-backend
comparison frontends/wix/main_window.py @ 101:783e9d6980ec
Couchsurfing plugin: first draft
SàT core: adding additionnal menu method
bridge: new methods getMenus, getMenuHelp and callMenu
wix: new menu are added on startup
CS plugin: login on CS
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 19 Jun 2010 17:15:30 +0800 |
parents | 39c672544593 |
children | 94011f553cd0 |
comparison
equal
deleted
inserted
replaced
100:50f1591c8fc6 | 101:783e9d6980ec |
---|---|
74 self.contactList.Hide() | 74 self.contactList.Hide() |
75 self.sizer.Add(self.contactList, 1, flag=wx.EXPAND) | 75 self.sizer.Add(self.contactList, 1, flag=wx.EXPAND) |
76 | 76 |
77 self.chat_wins=ChatList(self) | 77 self.chat_wins=ChatList(self) |
78 self.CreateStatusBar() | 78 self.CreateStatusBar() |
79 self.createMenus() | |
80 for i in range(self.menuBar.GetMenuCount()): | |
81 self.menuBar.EnableTop(i, False) | |
82 | 79 |
83 #ToolBar | 80 #ToolBar |
84 self.tools=self.CreateToolBar() | 81 self.tools=self.CreateToolBar() |
85 self.statusBox = wx.ComboBox(self.tools, -1, "Online", choices=[status[1] for status in const_STATUS], | 82 self.statusBox = wx.ComboBox(self.tools, -1, "Online", choices=[status[1] for status in const_STATUS], |
86 style=wx.CB_DROPDOWN | wx.CB_READONLY) | 83 style=wx.CB_DROPDOWN | wx.CB_READONLY) |
102 #events | 99 #events |
103 self.Bind(wx.EVT_CLOSE, self.onClose, self) | 100 self.Bind(wx.EVT_CLOSE, self.onClose, self) |
104 | 101 |
105 QuickApp.__init__(self) | 102 QuickApp.__init__(self) |
106 #self.plug_profile() #gof: | 103 #self.plug_profile() #gof: |
104 | |
105 #menus | |
106 self.createMenus() | |
107 for i in range(self.menuBar.GetMenuCount()): | |
108 self.menuBar.EnableTop(i, False) | |
107 | 109 |
108 #profile panel | 110 #profile panel |
109 self.profile_pan = ProfileManager(self) | 111 self.profile_pan = ProfileManager(self) |
110 #self.profile_pan.Hide() #gof: | 112 #self.profile_pan.Hide() #gof: |
111 self.sizer.Add(self.profile_pan, 1, flag=wx.EXPAND) | 113 self.sizer.Add(self.profile_pan, 1, flag=wx.EXPAND) |
146 self.menuBar = wx.MenuBar() | 148 self.menuBar = wx.MenuBar() |
147 self.menuBar.Append(connectMenu,_("&General")) | 149 self.menuBar.Append(connectMenu,_("&General")) |
148 self.menuBar.Append(contactMenu,_("&Contacts")) | 150 self.menuBar.Append(contactMenu,_("&Contacts")) |
149 self.menuBar.Append(communicationMenu,_("&Communication")) | 151 self.menuBar.Append(communicationMenu,_("&Communication")) |
150 self.SetMenuBar(self.menuBar) | 152 self.SetMenuBar(self.menuBar) |
153 | |
154 #additionals menus | |
155 #FIXME: do this in a more generic way (in quickapp) | |
156 add_menus = self.bridge.getMenus() | |
157 for menu in add_menus: | |
158 category,item,type = menu | |
159 assert(type=="NORMAL") #TODO: manage other types | |
160 menu_idx = self.menuBar.FindMenu(category) | |
161 current_menu = None | |
162 if menu_idx == wx.NOT_FOUND: | |
163 #the menu is new, we create it | |
164 current_menu = wx.Menu() | |
165 self.menuBar.Append(current_menu, category) | |
166 else: | |
167 current_menu = self.menuBar.GetMenu(menu_idx) | |
168 assert(current_menu != None) | |
169 item_id = wx.NewId() | |
170 help_string = self.bridge.getMenuHelp(category, item, type) | |
171 current_menu.Append(item_id, item, help = help_string) | |
172 #now we register the event | |
173 def event_answer(e): | |
174 id = self.bridge.callMenu(category, item, type) | |
175 self.current_action_ids.add(id) | |
176 wx.EVT_MENU(self, item_id, event_answer) | |
177 | |
151 | 178 |
152 #events | 179 #events |
153 wx.EVT_MENU(self, idCONNECT, self.onConnectRequest) | 180 wx.EVT_MENU(self, idCONNECT, self.onConnectRequest) |
154 wx.EVT_MENU(self, idDISCONNECT, self.onDisconnectRequest) | 181 wx.EVT_MENU(self, idDISCONNECT, self.onDisconnectRequest) |
155 wx.EVT_MENU(self, idPARAM, self.onParam) | 182 wx.EVT_MENU(self, idPARAM, self.onParam) |