def __test_phase1_cb(parent_status, info): print '[OK] phase1: status-updated, _status_id: %s' % \ parent_status._status_id parent_name = str(info['user']['name']) status = '@%s %s' % (parent_name, random_status()) child_status = TwrStatus() child_status.connect('status-updated', __test_phase2_cb, parent_status) child_status.connect('status-updated-failed', __test_phase2_failed_cb) child_status.update(status, parent_status._status_id)
def _twitter_share_menu_cb(self, menu_item): logging.debug('_twitter_share_menu_cb') self.emit('transfer-state-changed', _('Download started')) tmp_file = tempfile.mktemp() self._image_file_from_metadata(tmp_file) status = TwrStatus() status.connect('status-updated', self._status_updated_cb, tmp_file) status.connect('status-updated-failed', self._status_updated_failed_cb, tmp_file) status.update_with_media(self._comment, tmp_file)
child_status.connect('status-downloaded', __test_phase3_cb, parent_status) child_status.connect('status-downloaded-failed', __test_phase3_failed_cb) child_status.show() def __test_phase1_cb(parent_status, info): print '[OK] phase1: status-updated, _status_id: %s' % \ parent_status._status_id parent_name = str(info['user']['name']) status = '@%s %s' % (parent_name, random_status()) child_status = TwrStatus() child_status.connect('status-updated', __test_phase2_cb, parent_status) child_status.connect('status-updated-failed', __test_phase2_failed_cb) child_status.update(status, parent_status._status_id) loop = GObject.MainLoop() status = random_status() print 'phase0: will update status with %s' % status parent_status = TwrStatus() parent_status.connect('status-updated', __test_phase1_cb) parent_status.connect('status-updated-failed', __test_phase1_failed_cb) parent_status.update_with_media(status, 'image.png') loop.run()