~ubuntu-core-dev/update-manager/main

« back to all changes in this revision

Viewing changes to UpdateManager/GtkProgress.py

  • Committer: Michael Vogt
  • Date: 2011-07-08 07:46:54 UTC
  • mfrom: (2146.2.16 pygi)
  • Revision ID: michael.vogt@ubuntu.com-20110708074654-nbcspqmsrlbxc6p0
merged from the pygi branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20
20
#  USA
21
21
 
22
 
import pygtk
23
 
pygtk.require('2.0')
24
 
import gtk
 
22
from gi.repository import Gtk, Gdk
25
23
import apt
26
24
import apt_pkg
27
25
from gettext import gettext as _
64
62
        if abs(percent-self._progressbar.get_fraction()*100.0) > 0.5:
65
63
            self._progressbar.set_text("%s" % self.op)
66
64
            self._progressbar.set_fraction(progress/100.0)
67
 
        while gtk.events_pending():
68
 
            gtk.main_iteration()
 
65
        while Gtk.events_pending():
 
66
            Gtk.main_iteration()
69
67
    def done(self):
70
68
        """ one sub-step is done """
71
69
        pass
91
89
        # Do not show the close button 
92
90
        self._window.realize()
93
91
        self._window.set_title("")
94
 
        host_window.window.set_functions(gtk.gdk.FUNC_MOVE)
 
92
        host_window.get_window().set_functions(Gdk.WMFunction.MOVE)
95
93
        self._window.set_transient_for(parent)
96
94
 
97
95
    def update(self, percent):
100
98
        #print self.SubOp
101
99
        # only show progress bar if the parent is not iconified (#353195)
102
100
        state = self._parent.window.get_state()
103
 
        if not (state  & gtk.gdk.WINDOW_STATE_ICONIFIED):
 
101
        if not (state  & Gdk.WINDOW_STATE_ICONIFIED):
104
102
            self._window.show()
105
103
        self._parent.set_sensitive(False)
106
104
        # if the old percent was higher, a new progress was started
116
114
        if abs(percent-self._progressbar.get_fraction()*100.0) > 0.1:
117
115
            self._status.set_markup("<i>%s</i>" % self.op)
118
116
            self._progressbar.set_fraction(progress/100.0)
119
 
        while gtk.events_pending():
120
 
            gtk.main_iteration()
 
117
        while Gtk.events_pending():
 
118
            Gtk.main_iteration()
121
119
 
122
120
    def done(self):
123
121
        self._parent.set_sensitive(True)
140
138
        self.window_fetch = parent.window_fetch
141
139
        self.window_fetch.set_transient_for(parent.window_main)
142
140
        self.window_fetch.realize()
143
 
        self.window_fetch.window.set_functions(gtk.gdk.FUNC_MOVE)
 
141
        self.window_fetch.get_window().set_functions(Gdk.WMFunction.MOVE)
144
142
        # set summary
145
143
        if summary != "":
146
144
            self.summary.set_markup("<big><b>%s</b></big> \n\n%s" %
173
171
        # FIXME: show remaining time
174
172
        self.progress.set_text("")
175
173
 
176
 
        while gtk.events_pending():
177
 
            gtk.main_iteration()
 
174
        while Gtk.events_pending():
 
175
            Gtk.main_iteration()
178
176
        return self._continue
179
177
 
180
178
if __name__ == "__main__":