Mercurial > pyarq-presupuestos
comparison Gtk/gui.py @ 21:f7e0cc58737f
Default interface in readFile method
| author | Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es> |
|---|---|
| date | Sun, 14 Sep 2014 17:23:02 +0200 |
| parents | 60bc5117926c |
| children | 7bd4ca56607d |
comparison
equal
deleted
inserted
replaced
| 20:f5ec50b625d1 | 21:f7e0cc58737f |
|---|---|
| 567 widget: Read. Main widget showed in the pane | 567 widget: Read. Main widget showed in the pane |
| 568 title: Read. Page Title | 568 title: Read. Page Title |
| 569 filetype: Read. budget, basedata or durus | 569 filetype: Read. budget, basedata or durus |
| 570 Methods: | 570 Methods: |
| 571 run | 571 run |
| 572 progress | 572 readFile_progress |
| 573 readFile_send_message | |
| 574 readFile_set_statistics | |
| 575 readFile_end | |
| 576 readFile_cancel | |
| 573 stopLoading | 577 stopLoading |
| 574 threadFinishedSignal | 578 threadFinishedSignal |
| 575 threadCanceled | 579 threadCanceled |
| 576 close | 580 close |
| 577 clear | 581 clear |
| 595 self.__filename: "file" | 599 self.__filename: "file" |
| 596 self.__cancelMethod: Method to cancel the read method | 600 self.__cancelMethod: Method to cancel the read method |
| 597 self.__filetype: "budget", "database" or "durus" | 601 self.__filetype: "budget", "database" or "durus" |
| 598 self.__children: the read thread | 602 self.__children: the read thread |
| 599 self.__progress: 0 to 1 progress | 603 self.__progress: 0 to 1 progress |
| 604 self.__statistics: record statistics | |
| 600 self.__widget: main widget, a gtk.VBox object | 605 self.__widget: main widget, a gtk.VBox object |
| 601 self.__main_item: None | 606 self.__main_item: None |
| 602 self.__throbber: a gtk.Image | 607 self.__throbber: a gtk.Image |
| 603 self.__animationThobber: a gtk.gdk.PixbufAnimation | 608 self.__animationThobber: a gtk.gdk.PixbufAnimation |
| 604 self.__quietThobber: a pixbuf | 609 self.__quietThobber: a pixbuf |
| 615 self.__filetype = filetype | 620 self.__filetype = filetype |
| 616 self.__cancelMethod = cancelMethod | 621 self.__cancelMethod = cancelMethod |
| 617 self.__children = None | 622 self.__children = None |
| 618 self.__cancel = [False, False] | 623 self.__cancel = [False, False] |
| 619 self.__progress = 0.0 | 624 self.__progress = 0.0 |
| 625 self.__statistics = None | |
| 620 self.__widget = gtk.VBox() | 626 self.__widget = gtk.VBox() |
| 621 self.__main_item = None | 627 self.__main_item = None |
| 622 self.__widget.show() | 628 self.__widget.show() |
| 623 self.__throbber = gtk.Image() | 629 self.__throbber = gtk.Image() |
| 624 self.__throbber.set_from_file(globalVars.getAppPath("THROBBER-ICON")) | 630 self.__throbber.set_from_file(globalVars.getAppPath("THROBBER-ICON")) |
| 656 self.__widget.pack_start(_align, True, True, 0) | 662 self.__widget.pack_start(_align, True, True, 0) |
| 657 _progressframe = gtk.Frame() | 663 _progressframe = gtk.Frame() |
| 658 _progressframe.set_shadow_type(gtk.SHADOW_IN) | 664 _progressframe.set_shadow_type(gtk.SHADOW_IN) |
| 659 _progressframe.show() | 665 _progressframe.show() |
| 660 self.__progress_bar = gtk.ProgressBar() | 666 self.__progress_bar = gtk.ProgressBar() |
| 661 #if self.__filetype != "durus": | 667 self.__progress_bar.show() |
| 662 # self.__progress_bar.show() | |
| 663 _progressframe.add(self.__progress_bar) | 668 _progressframe.add(self.__progress_bar) |
| 664 self.__statusbar.pack_start(_progressframe, False, False, 0) | 669 self.__statusbar.pack_start(_progressframe, False, False, 0) |
| 665 self.__widget.pack_end(self.__statusbar, False, True, 0) | 670 self.__widget.pack_end(self.__statusbar, False, True, 0) |
| 666 self.__main_item = None | 671 self.__main_item = None |
| 667 | 672 |
| 673 self.__statusbar.push(self.__statuscontext, _("Time: 0s")) | 678 self.__statusbar.push(self.__statuscontext, _("Time: 0s")) |
| 674 self.__throbber.set_from_animation(self.__animationThobber) | 679 self.__throbber.set_from_animation(self.__animationThobber) |
| 675 self._launchChildren() | 680 self._launchChildren() |
| 676 self._launchTimeout() | 681 self._launchTimeout() |
| 677 | 682 |
| 678 def progress(self, percent): | 683 def readFile_progress(self, percent): |
| 679 """progress(percent) | 684 """readFile_progress(percent) |
| 680 | 685 |
| 681 percent: Percentage executed. | 686 percent: Percentage executed. |
| 682 | 687 |
| 683 Sets progress | 688 Sets progress |
| 684 """ | 689 """ |
| 685 _progress = str(int(round(100 * percent,0))) | 690 _progress = str(int(round(100 * percent,0))) |
| 686 self.__progress = percent | 691 self.__progress = percent |
| 692 | |
| 693 def readFile_send_message(self, message): | |
| 694 """readFile_send_message(message) | |
| 695 | |
| 696 message: mesage from readFile method | |
| 697 | |
| 698 print message | |
| 699 """ | |
| 700 print message | |
| 701 | |
| 702 def readFile_set_statistics(self, statistics): | |
| 703 """readFile_set_statistics(statistics) | |
| 704 | |
| 705 statistics: record statistics from readFile method | |
| 706 | |
| 707 sets record statistics | |
| 708 """ | |
| 709 self.__statistics = statistics | |
| 710 | |
| 711 def readFile_end(self): | |
| 712 """readFile_end() | |
| 713 | |
| 714 The readFile method end successfully | |
| 715 """ | |
| 716 print self.__statistics | |
| 717 | |
| 718 def readFile_cancel(self): | |
| 719 """readFile_cancel() | |
| 720 | |
| 721 The readFile method is canceled | |
| 722 """ | |
| 723 print _("Process terminated") | |
| 687 | 724 |
| 688 def stopLoading(self): | 725 def stopLoading(self): |
| 689 """stopLoading() | 726 """stopLoading() |
| 690 | 727 |
| 691 Stop progressbar | 728 Stop progressbar |
| 712 1- update progress bar | 749 1- update progress bar |
| 713 2- update time label | 750 2- update time label |
| 714 3- If the other timetouts are stoped the window is closed | 751 3- If the other timetouts are stoped the window is closed |
| 715 """ | 752 """ |
| 716 gobject.timeout_add(1000, self._updateLabel, time.time()) | 753 gobject.timeout_add(1000, self._updateLabel, time.time()) |
| 717 #if self.__filetype != "durus": | 754 gobject.timeout_add(500, self._updateProgressBar) |
| 718 # gobject.timeout_add(500, self._updateProgressBar) | 755 self.__cancel = [False, False] |
| 719 # self.__cancel = [False, False] | 756 #self.__cancel = [True, False] |
| 720 #else: | |
| 721 self.__cancel = [True, False] | |
| 722 gobject.timeout_add(1000, self._autoClose) | 757 gobject.timeout_add(1000, self._autoClose) |
| 723 | 758 |
| 724 def _updateProgressBar(self): | 759 def _updateProgressBar(self): |
| 725 """_updateProgressBar() | 760 """_updateProgressBar() |
| 726 | 761 |
