comparison Gtk/gui.py @ 9:229986217a3d

bug fix: view is not displayed when it splits the view Left/Right
author Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
date Wed, 17 Nov 2010 23:59:48 +0100
parents 55df0b15706b
children d2cbc0278b30
comparison
equal deleted inserted replaced
8:55df0b15706b 9:229986217a3d
1211 showed 1211 showed
1212 self.__budget: the budget to show 1212 self.__budget: the budget to show
1213 self.__path: the position or path of the view in the page notebook 1213 self.__path: the position or path of the view in the page notebook
1214 self.__connected: boolean value, True means that the View object sends 1214 self.__connected: boolean value, True means that the View object sends
1215 and receives signals from/to others views 1215 and receives signals from/to others views
1216 self.__widget: main widget. a gtk.Toolbar? 1216 self.__widget: main widget. a gtk.VBox
1217 self.__view: the object to show: 1217 self.__view: the object to show:
1218 * DecompositionList object 1218 * DecompositionList object
1219 * Description object 1219 * Description object
1220 * Measure object 1220 * Measure object
1221 * Sheet object 1221 * Sheet object
1242 _liststore.append([_("Companies")]) #5 1242 _liststore.append([_("Companies")]) #5
1243 _combobox = gtk.ComboBox(_liststore) 1243 _combobox = gtk.ComboBox(_liststore)
1244 _cell = gtk.CellRendererText() 1244 _cell = gtk.CellRendererText()
1245 _combobox.pack_start(_cell, True) 1245 _combobox.pack_start(_cell, True)
1246 _combobox.add_attribute(_cell, 'text', 0) 1246 _combobox.add_attribute(_cell, 'text', 0)
1247 _vbox = gtk.VBox() 1247 self.__widget = gtk.VBox()
1248 _vbox.show()
1249 _toolitem = gtk.ToolItem()
1250 _toolitem.set_expand(True)
1251 _toolitem.add(_vbox)
1252 _toolitem.show()
1253 self.__widget = gtk.Toolbar()
1254 self.__widget.insert(_toolitem, 0)
1255 _hbox = gtk.HBox() 1248 _hbox = gtk.HBox()
1256 if view_type == "DecompositionList": 1249 if view_type == "DecompositionList":
1257 self.__view = DecompositionList(budget, weakref.ref(self), 1250 self.__view = DecompositionList(budget, weakref.ref(self),
1258 path, active_path_record) 1251 path, active_path_record)
1259 _combobox.set_active(0) 1252 _combobox.set_active(0)
1295 raise ValueError, _(utils.mapping("Invalid type of View: $1", 1288 raise ValueError, _(utils.mapping("Invalid type of View: $1",
1296 view_type)) 1289 view_type))
1297 _view_icon.show() 1290 _view_icon.show()
1298 _combobox.connect("changed", self._change_combo) 1291 _combobox.connect("changed", self._change_combo)
1299 _combobox.show() 1292 _combobox.show()
1300 _vbox.pack_start(_hbox,False) 1293 self.__widget.pack_start(_hbox,False)
1301 _vbox.pack_start(self.__view.widget, True, True) 1294 self.__widget.pack_start(self.__view.widget, True, True)
1302 _hbox.pack_start(_view_icon, False, False,0) 1295 _hbox.pack_start(_view_icon, False, False,0)
1303 _hbox.pack_start(_combobox, False, False,0) 1296 _hbox.pack_start(_combobox, False, False,0)
1304 _invisible = gtk.HBox() 1297 _invisible = gtk.HBox()
1305 _invisible.show() 1298 _invisible.show()
1306 _hbox.pack_start(_invisible, True, False,0) 1299 _hbox.pack_start(_invisible, True, False,0)
1355 _index = combobox.get_active() 1348 _index = combobox.get_active()
1356 _budget = self.__view.budget 1349 _budget = self.__view.budget
1357 _wr_page = self.__view.page 1350 _wr_page = self.__view.page
1358 _path = self.__view.path 1351 _path = self.__view.path
1359 _path_record = self.__view.active_path_record 1352 _path_record = self.__view.active_path_record
1360 _toolitem = self.__widget.get_nth_item(0) 1353 _hbox = self.__widget.get_children()[0]
1361 _vbox= _toolitem.get_children()[0]
1362 _hbox = _vbox.get_children()[0]
1363 _combobox = _hbox.get_children()[1] 1354 _combobox = _hbox.get_children()[1]
1364 _hbox.remove(_combobox) 1355 _hbox.remove(_combobox)
1365 _invisible = _hbox.get_children()[1] 1356 _invisible = _hbox.get_children()[1]
1366 _hbox.remove(_invisible) 1357 _hbox.remove(_invisible)
1367 _menu_button = _hbox.get_children()[1] 1358 _menu_button = _hbox.get_children()[1]
1368 _hbox.remove(_menu_button) 1359 _hbox.remove(_menu_button)
1369 _connected_button = _hbox.get_children()[1] 1360 _connected_button = _hbox.get_children()[1]
1370 _hbox.remove(_connected_button) 1361 _hbox.remove(_connected_button)
1371 _close_button = _hbox.get_children()[1] 1362 _close_button = _hbox.get_children()[1]
1372 _hbox.remove(_close_button) 1363 _hbox.remove(_close_button)
1373 _vbox.remove(self.__view.widget) 1364 self.__widget.remove(self.__view.widget)
1374 _vbox.remove(_hbox) 1365 self.__widget.remove(_hbox)
1375 _hbox.destroy() 1366 _hbox.destroy()
1376 _view_icon = gtk.Image() 1367 _view_icon = gtk.Image()
1377 if _index == 0: 1368 if _index == 0:
1378 self.__view = DecompositionList(_budget, _wr_page, _path, 1369 self.__view = DecompositionList(_budget, _wr_page, _path,
1379 _path_record) 1370 _path_record)
1413 _hbox.pack_start(_invisible, True, False,0) 1404 _hbox.pack_start(_invisible, True, False,0)
1414 _hbox.pack_start(_menu_button, False, False, 0) 1405 _hbox.pack_start(_menu_button, False, False, 0)
1415 _hbox.pack_start(_connected_button, False, False, 0) 1406 _hbox.pack_start(_connected_button, False, False, 0)
1416 _hbox.pack_start(_close_button, False, False, 0) 1407 _hbox.pack_start(_close_button, False, False, 0)
1417 _hbox.show() 1408 _hbox.show()
1418 _vbox.pack_start(_hbox, False, False, 0) 1409 self.__widget.pack_start(_hbox, False, False, 0)
1419 _vbox.pack_start(self.__view.widget, True, True, 0) 1410 self.__widget.pack_start(self.__view.widget, True, True, 0)
1420 1411
1421 def _menu_view(self, widget): 1412 def _menu_view(self, widget):
1422 """_menu_view(widget) 1413 """_menu_view(widget)
1423 1414
1424 Method connected to the "clicked" signal of the __connected_button 1415 Method connected to the "clicked" signal of the __connected_button
1575 getItem 1566 getItem
1576 setItem 1567 setItem
1577 runMessage 1568 runMessage
1578 clear(self) 1569 clear(self)
1579 """ 1570 """
1580 # TODO: *control the position paned separator. Now is always 200 pixels 1571 # TODO: *control the position paned separator. Now is always in the middle
1581 # TODO: can be with a float(0.0-1.0) aspect ratio 1572 # TODO: can be with a float(0.0-1.0) aspect ratio
1582 # TODO: 0.0 no space for widget1 1573 # TODO: 0.0 no space for widget1
1583 # TODO: 1.0 all the space for widget1 1574 # TODO: 1.0 all the space for widget1
1584 # TODO: *control the position pane separator when the size of the window
1585 # TODO: change with the same ascpect ratio
1586 1575
1587 def __init__(self, orientation, path, item1, item2): 1576 def __init__(self, orientation, path, item1, item2):
1588 """__init__(oritentation, path, item1, item2) 1577 """__init__(oritentation, path, item1, item2)
1589 1578
1590 orientation: The orientation of de gtk.Paned, can be "v" or "h" 1579 orientation: The orientation of de gtk.Paned, can be "v" or "h"
1610 self.__widget = gtk.HPaned() 1599 self.__widget = gtk.HPaned()
1611 else: 1600 else:
1612 raise ValueError, _("Invalid orientation.") 1601 raise ValueError, _("Invalid orientation.")
1613 self.__widget.pack1(item1.widget,True,False) 1602 self.__widget.pack1(item1.widget,True,False)
1614 self.__widget.pack2(item2.widget,True,False) 1603 self.__widget.pack2(item2.widget,True,False)
1615 self.__widget.set_position(200)
1616 self.__widget.show() 1604 self.__widget.show()
1617 self.__items = [item1, item2] 1605 self.__items = [item1, item2]
1618 self.__path = path 1606 self.__path = path
1619 1607
1620 def __getitem__(self, item): 1608 def __getitem__(self, item):