comparison Gtk/gui.py @ 3:a221c14c3c31

translate and clean gui
author Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
date Sun, 31 Oct 2010 21:01:48 +0100
parents 2ac1551ad2ab
children 4e976a99efb9
comparison
equal deleted inserted replaced
2:c9bd25abda5d 3:a221c14c3c31
117 <menu action="File"> 117 <menu action="File">
118 <menuitem action="ImportFiebdc"/> 118 <menuitem action="ImportFiebdc"/>
119 <menuitem action="Close"/> 119 <menuitem action="Close"/>
120 </menu> 120 </menu>
121 <menu action="View"> 121 <menu action="View">
122 <menuitem action="Text"/>
123 </menu> 122 </menu>
124 <menu action="Test"> 123 <menu action="Test">
125 <menuitem action="ImportFiebdcPriceDatabase"/> 124 <menuitem action="ImportFiebdcPriceDatabase"/>
126 <menuitem action="OpenPriceDatabase"/> 125 <menuitem action="OpenPriceDatabase"/>
127 </menu> 126 </menu>
160 self.window.add_accel_group(_accelgroup) 159 self.window.add_accel_group(_accelgroup)
161 _general_action_group = gtk.ActionGroup("General") 160 _general_action_group = gtk.ActionGroup("General")
162 self.__general_action_group = _general_action_group 161 self.__general_action_group = _general_action_group
163 _general_action_group.add_actions( 162 _general_action_group.add_actions(
164 [("File", None, _("_File"), None), 163 [("File", None, _("_File"), None),
165 ("ImportFiebdc", gtk.STOCK_OPEN, _('_Import Fiebdc'), "", 'NPI', 164 ("ImportFiebdc", gtk.STOCK_OPEN, _('_Import Fiebdc'), "",
166 self._menuitemImportFiebdc), 165 _('Import FIEBDC'), self._menuitemImportFiebdc),
167 ("Close", gtk.STOCK_CLOSE, _("_Close"), None, 'NPI', 166 ("Close", gtk.STOCK_CLOSE, _("_Close"), None, _('Close'),
168 self._menuitemClose), 167 self._menuitemClose),
169 ("View", None, _("_View")), 168 ("View", None, _("_View")),
170 ("Text", None, _("_Text"), None, 'NPI',
171 self._menuitemText),
172 ("Test", None, _("_Test")), 169 ("Test", None, _("_Test")),
173 ('ImportFiebdcPriceDatabase', gtk.STOCK_OPEN, 170 ('ImportFiebdcPriceDatabase', gtk.STOCK_OPEN,
174 _("Import Fiebdc _price database"), "", "NPI", 171 _("Import Fiebdc _price database"), "", _("Import database"),
175 self._menuitemImportPriceDatabase ), 172 self._menuitemImportPriceDatabase ),
176 ("OpenPriceDatabase", gtk.STOCK_OPEN, _('_Open price database'), 173 ("OpenPriceDatabase", gtk.STOCK_OPEN, _('_Open price database'),
177 "", 'NPI', self._menuitemOpenPriceDatabase), 174 "", _('Open Database'), self._menuitemOpenPriceDatabase),
178 ]) 175 ])
179 _uimanager.insert_action_group(_general_action_group, 0) 176 _uimanager.insert_action_group(_general_action_group, 0)
180 _uimanager.add_ui_from_string(self.__ui) 177 _uimanager.add_ui_from_string(self.__ui)
181 _menu_bar = _uimanager.get_widget("/MenuBar") 178 _menu_bar = _uimanager.get_widget("/MenuBar")
182 _vbox1.pack_start(_menu_bar, False, False, 0) 179 _vbox1.pack_start(_menu_bar, False, False, 0)
344 if isinstance(_page, Page): 341 if isinstance(_page, Page):
345 #not loading budget 342 #not loading budget
346 self.__budget_list.pop(_page_num) 343 self.__budget_list.pop(_page_num)
347 _page.clear() 344 _page.clear()
348 self.__notebook.remove_page(_page_num) 345 self.__notebook.remove_page(_page_num)
349
350 def _menuitemText(self, widget):
351 """_menuitemText(self, widget)
352
353 widget: the widget where the event is emitted from
354
355 Creates and shows a window showing text description
356 using a instance of TextWindow class.
357 """
358 _page_num = self.__notebook.get_current_page()
359 if _page_num == -1:
360 return
361 _budget = self.__budget_list[_page_num]
362 _page = self.__page_list[_page_num]
363 _code = _page.getActiveCode()
364 _concepto = _budget.getRecord(_code)
365 _text = _concepto.text
366 _window = TextWindow(_code, _text)
367 _window.main()
368 346
369 def _delete_event(self, widget, event): 347 def _delete_event(self, widget, event):
370 """_delete_event(self, widget, event) 348 """_delete_event(self, widget, event)
371 349
372 widget: the widget where the event is emitted from 350 widget: the widget where the event is emitted from
1173 1151
1174 Method connected to the "clicked" signal of the __connected_button 1152 Method connected to the "clicked" signal of the __connected_button
1175 It shows a popup menu with some options 1153 It shows a popup menu with some options
1176 """ 1154 """
1177 _menu_view = gtk.Menu() 1155 _menu_view = gtk.Menu()
1178 _item_leftright = gtk.MenuItem("Split View Left/Right") 1156 _item_leftright = gtk.MenuItem(_("Split View Left/Right"))
1179 _menu_view.append(_item_leftright) 1157 _menu_view.append(_item_leftright)
1180 _item_leftright.connect_object("activate", self._split_view, "h") 1158 _item_leftright.connect_object("activate", self._split_view, "h")
1181 _item_leftright.show() 1159 _item_leftright.show()
1182 _item_topbottom = gtk.MenuItem("Split View Top/Bottom") 1160 _item_topbottom = gtk.MenuItem(_("Split View Top/Bottom"))
1183 _menu_view.append(_item_topbottom) 1161 _menu_view.append(_item_topbottom)
1184 _item_topbottom.connect_object("activate", self._split_view, "v") 1162 _item_topbottom.connect_object("activate", self._split_view, "v")
1185 _item_topbottom.show() 1163 _item_topbottom.show()
1186 _item_close = gtk.MenuItem("close view") 1164 _item_close = gtk.MenuItem(_("Close view"))
1187 _menu_view.append(_item_close) 1165 _menu_view.append(_item_close)
1188 _item_close.connect_object("activate", self._closeItem, None) 1166 _item_close.connect_object("activate", self._closeItem, None)
1189 _item_close.show() 1167 _item_close.show()
1190 _menu_view.popup(None, None, None, 0, 0) 1168 _menu_view.popup(None, None, None, 0, 0)
1191 1169