Mercurial > libervia-backend
comparison frontends/src/jp/base.py @ 898:9720d3d0a764
jp: updated main loop to gobject 3
author | Matteo Cypriani <mcy@lm7.fr> |
---|---|
date | Wed, 05 Mar 2014 16:03:04 +0100 |
parents | 241f6baa6687 |
children | e09f624d3aa9 |
comparison
equal
deleted
inserted
replaced
897:dc0db078ed19 | 898:9720d3d0a764 |
---|---|
31 | 31 |
32 import sys | 32 import sys |
33 import locale | 33 import locale |
34 import os.path | 34 import os.path |
35 import argparse | 35 import argparse |
36 import gobject | 36 from gi.repository import GLib |
37 from glob import iglob | 37 from glob import iglob |
38 from importlib import import_module | 38 from importlib import import_module |
39 from sat.tools.jid import JID | 39 from sat.tools.jid import JID |
40 from sat_frontends.bridge.DBus import DBusBridgeFrontend | 40 from sat_frontends.bridge.DBus import DBusBridgeFrontend |
41 from sat.core import exceptions | 41 from sat.core import exceptions |
152 self.args.func() | 152 self.args.func() |
153 if self.need_loop or self._auto_loop: | 153 if self.need_loop or self._auto_loop: |
154 self._start_loop() | 154 self._start_loop() |
155 | 155 |
156 def _start_loop(self): | 156 def _start_loop(self): |
157 self.loop = gobject.MainLoop() | 157 self.loop = GLib.MainLoop() |
158 try: | 158 try: |
159 self.loop.run() | 159 self.loop.run() |
160 except KeyboardInterrupt: | 160 except KeyboardInterrupt: |
161 info(_("User interruption: good bye")) | 161 info(_("User interruption: good bye")) |
162 | 162 |
253 return "%s/%s" % (_jid.bare, last_resource) | 253 return "%s/%s" % (_jid.bare, last_resource) |
254 return param_jid | 254 return param_jid |
255 | 255 |
256 def watch_progress(self): | 256 def watch_progress(self): |
257 self.pbar = None | 257 self.pbar = None |
258 gobject.timeout_add(10, self._progress_cb) | 258 GObject.timeout_add(10, self._progress_cb) |
259 | 259 |
260 def _progress_cb(self): | 260 def _progress_cb(self): |
261 if self.progress_id: | 261 if self.progress_id: |
262 data = self.bridge.getProgress(self.progress_id, self.profile) | 262 data = self.bridge.getProgress(self.progress_id, self.profile) |
263 if data: | 263 if data: |