comparison Gtk/gui.py @ 16:60bc5117926c

no durus
author Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
date Fri, 19 Apr 2013 00:04:20 +0200
parents fe9c55f86698
children f7e0cc58737f
comparison
equal deleted inserted replaced
15:2a13413dcc13 16:60bc5117926c
53 53
54 # pyArq-Presupuestos Modules 54 # pyArq-Presupuestos Modules
55 from Gtk import importFiebdc 55 from Gtk import importFiebdc
56 from Generic import base 56 from Generic import base
57 from Generic import fiebdc 57 from Generic import fiebdc
58 from Generic import durusdatabase 58 #from Generic import durusdatabase
59 from Generic import utils 59 from Generic import utils
60 from Generic import globalVars 60 from Generic import globalVars
61 from Generic import openwith 61 from Generic import openwith
62 62
63 # Load default icon 63 # Load default icon
116 <menuitem action="GoPrevious"/> 116 <menuitem action="GoPrevious"/>
117 <menuitem action="GoPosterior"/> 117 <menuitem action="GoPosterior"/>
118 <menuitem action="GoUp"/> 118 <menuitem action="GoUp"/>
119 <menuitem action="GoToRoot"/> 119 <menuitem action="GoToRoot"/>
120 </menu> 120 </menu>
121 <menu action="Test">
122 <menuitem action="ImportFiebdcPriceDatabase"/>
123 <menuitem action="OpenPriceDatabase"/>
124 </menu>
125 </menubar> 121 </menubar>
126 <toolbar name="ToolBar"> 122 <toolbar name="ToolBar">
127 <toolitem action="ImportFiebdc"/> 123 <toolitem action="ImportFiebdc"/>
128 <toolitem action="Close"/> 124 <toolitem action="Close"/>
129 <separator name="sep1"/> 125 <separator name="sep1"/>
131 <toolitem action="GoPostMenu"/> 127 <toolitem action="GoPostMenu"/>
132 <toolitem action="GoUp"/> 128 <toolitem action="GoUp"/>
133 <toolitem action="GoToRoot"/> 129 <toolitem action="GoToRoot"/>
134 </toolbar> 130 </toolbar>
135 </ui>''' 131 </ui>'''
132
133 #<menu action="Test">
134 # <menuitem action="ImportFiebdcPriceDatabase"/>
135 # <menuitem action="OpenPriceDatabase"/>
136 #</menu>
136 137
137 def __init__(self): 138 def __init__(self):
138 """__init__() 139 """__init__()
139 140
140 Initialize the atributes self.__page_list without data. 141 Initialize the atributes self.__page_list without data.
171 ("Close", gtk.STOCK_CLOSE, _("_Close"), None, _('Close'), 172 ("Close", gtk.STOCK_CLOSE, _("_Close"), None, _('Close'),
172 self._menuitemClose), 173 self._menuitemClose),
173 ("View", None, _("_View")), 174 ("View", None, _("_View")),
174 ("Go", None, _("_Go")), 175 ("Go", None, _("_Go")),
175 ("Test", None, _("_Test")), 176 ("Test", None, _("_Test")),
176 ('ImportFiebdcPriceDatabase', gtk.STOCK_OPEN, 177 #('ImportFiebdcPriceDatabase', gtk.STOCK_OPEN,
177 _("Import Fiebdc _price database"), "", _("Import database"), 178 # _("Import Fiebdc _price database"), "", _("Import database"),
178 self._menuitemImportPriceDatabase ), 179 # self._menuitemImportPriceDatabase ),
179 ("OpenPriceDatabase", gtk.STOCK_OPEN, _('_Open price database'), 180 #("OpenPriceDatabase", gtk.STOCK_OPEN, _('_Open price database'),
180 "", _('Open Database'), self._menuitemOpenPriceDatabase), 181 # "", _('Open Database'), self._menuitemOpenPriceDatabase),
181 ]) 182 ])
182 self.__navigation_action_group = gtk.ActionGroup("Navigation") 183 self.__navigation_action_group = gtk.ActionGroup("Navigation")
183 self.__navigation_action_group.add_actions( 184 self.__navigation_action_group.add_actions(
184 [("Go", None, _("_Go")), 185 [("Go", None, _("_Go")),
185 ("GoPrevious", gtk.STOCK_GO_BACK, _("_Back"),"", 186 ("GoPrevious", gtk.STOCK_GO_BACK, _("_Back"),"",
371 _filetype = "budget" 372 _filetype = "budget"
372 _exit_method = _budget_file.cancel 373 _exit_method = _budget_file.cancel
373 _file_window = importFiebdc.FileSelectionWindow(self, 374 _file_window = importFiebdc.FileSelectionWindow(self,
374 _read_method, _budget, _filename, _exit_method, _filetype) 375 _read_method, _budget, _filename, _exit_method, _filetype)
375 376
376 def _menuitemImportPriceDatabase(self, widget): 377 #def _menuitemImportPriceDatabase(self, widget):
377 """_menuitemImportPriceDatabase(widget) 378 # """_menuitemImportPriceDatabase(widget)
378 379 #
379 widget: the widget where the event is emitted from 380 # widget: the widget where the event is emitted from
380 Callback to open a price database file. 381 # Callback to open a price database file.
381 382 #
382 Creates and shows a file selection window to open a price database 383 # Creates and shows a file selection window to open a price database
383 file. 384 # file.
384 """ 385 # """
385 _budget = base.Budget() 386 # _budget = base.Budget()
386 _budget_file = fiebdc.Read() 387 # _budget_file = fiebdc.Read()
387 _read_method = _budget_file.readFile 388 # _read_method = _budget_file.readFile
388 _filename = "file" 389 # _filename = "file"
389 _filetype = "database" 390 # _filetype = "database"
390 _exit_method = _budget_file.cancel 391 # _exit_method = _budget_file.cancel
391 _file_window = importFiebdc.FileSelectionWindow(self, 392 # _file_window = importFiebdc.FileSelectionWindow(self,
392 _read_method, _budget, _filename, _exit_method, _filetype) 393 # _read_method, _budget, _filename, _exit_method, _filetype)
393 394
394 def _menuitemOpenPriceDatabase(self, widget): 395 #def _menuitemOpenPriceDatabase(self, widget):
395 """_menuitemOpenPriceDatabase(widget) 396 # """_menuitemOpenPriceDatabase(widget)
396 397 #
397 widget: the widget where the event is emitted from 398 # widget: the widget where the event is emitted from
398 Callback to open a price database from a durus file. 399 # Callback to open a price database from a durus file.
399 400 #
400 Creates and shows a file selection window to open a durus database 401 # Creates and shows a file selection window to open a durus database
401 """ 402 # """
402 _budget = None 403 # _budget = None
403 _budget_file = durusdatabase.Read() 404 # _budget_file = durusdatabase.Read()
404 _read_method = _budget_file.readFile 405 # _read_method = _budget_file.readFile
405 _filename = "file" 406 # _filename = "file"
406 _filetype = "durus" 407 # _filetype = "durus"
407 _exit_method = _budget_file.cancel 408 # _exit_method = _budget_file.cancel
408 _file_window = importFiebdc.FileSelectionWindow(self, 409 # _file_window = importFiebdc.FileSelectionWindow(self,
409 _read_method, _budget, _filename, _exit_method, _filetype) 410 # _read_method, _budget, _filename, _exit_method, _filetype)
410 411
411 def _menuitemClose(self, widget): 412 def _menuitemClose(self, widget):
412 """_menuitemClose(widget) 413 """_menuitemClose(widget)
413 414
414 widget: the widget where the event is emitted from 415 widget: the widget where the event is emitted from
416 Callback to close a budget file. 417 Callback to close a budget file.
417 """ 418 """
418 _page_num = self.__notebook.get_current_page() 419 _page_num = self.__notebook.get_current_page()
419 if _page_num != -1: 420 if _page_num != -1:
420 _page = self.__page_list[_page_num] 421 _page = self.__page_list[_page_num]
421 if isinstance(_page, EmptyPage) and _page.filetype == "durus": 422 #if isinstance(_page, EmptyPage) and _page.filetype == "durus":
422 print _("Cancel reading Durus database has not been " 423 # print _("Cancel reading Durus database has not been "
423 "implemented.") 424 # "implemented.")
424 else: 425 #else:
425 _page.close() 426 _page.close()
426 427
427 def closePage(self, page): 428 def closePage(self, page):
428 """closePage(page) 429 """closePage(page)
429 430
430 page: EmptyPage or Page object 431 page: EmptyPage or Page object
655 self.__widget.pack_start(_align, True, True, 0) 656 self.__widget.pack_start(_align, True, True, 0)
656 _progressframe = gtk.Frame() 657 _progressframe = gtk.Frame()
657 _progressframe.set_shadow_type(gtk.SHADOW_IN) 658 _progressframe.set_shadow_type(gtk.SHADOW_IN)
658 _progressframe.show() 659 _progressframe.show()
659 self.__progress_bar = gtk.ProgressBar() 660 self.__progress_bar = gtk.ProgressBar()
660 if self.__filetype != "durus": 661 #if self.__filetype != "durus":
661 self.__progress_bar.show() 662 # self.__progress_bar.show()
662 _progressframe.add(self.__progress_bar) 663 _progressframe.add(self.__progress_bar)
663 self.__statusbar.pack_start(_progressframe, False, False, 0) 664 self.__statusbar.pack_start(_progressframe, False, False, 0)
664 self.__widget.pack_end(self.__statusbar, False, True, 0) 665 self.__widget.pack_end(self.__statusbar, False, True, 0)
665 self.__main_item = None 666 self.__main_item = None
666 667
711 1- update progress bar 712 1- update progress bar
712 2- update time label 713 2- update time label
713 3- If the other timetouts are stoped the window is closed 714 3- If the other timetouts are stoped the window is closed
714 """ 715 """
715 gobject.timeout_add(1000, self._updateLabel, time.time()) 716 gobject.timeout_add(1000, self._updateLabel, time.time())
716 if self.__filetype != "durus": 717 #if self.__filetype != "durus":
717 gobject.timeout_add(500, self._updateProgressBar) 718 # gobject.timeout_add(500, self._updateProgressBar)
718 self.__cancel = [False, False] 719 # self.__cancel = [False, False]
719 else: 720 #else:
720 self.__cancel = [True, False] 721 self.__cancel = [True, False]
721 gobject.timeout_add(1000, self._autoClose) 722 gobject.timeout_add(1000, self._autoClose)
722 723
723 def _updateProgressBar(self): 724 def _updateProgressBar(self):
724 """_updateProgressBar() 725 """_updateProgressBar()
725 726