def shutdown_core(signal=None, frame=None, delay=2): from vmc.common.config import config config.close() # free VMCConfig singleton from vmc.common.phonebook import get_phonebook phonebook = get_phonebook(None) try: phonebook.close() # free Phonebook singleton except AttributeError: pass from vmc.common.messages import get_messages_obj messages = get_messages_obj(None) try: messages.close() # free Messages singleton except AttributeError: pass from vmc.common.persistent import net_manager try: net_manager.close() except AttributeError: pass log.msg(_('Shutting down...')) reactor.callLater(delay, reactor.stop)
def delete_messages_from_db_and_tv(self, smslist): messages = get_messages_obj(self.parent_ctrl.model.get_sconn()) messages.delete_messages(smslist) model = self.parent_ctrl.view['drafts_treeview'].get_model() iter = model.get_iter_first() while iter: if model.get_value(iter, 4) in smslist: model.remove(iter) iter = model.iter_next(iter)
def post_configure_device(ignored): d = self.device.initialize() d.addCallback(lambda _: self.sconn.delete_all_sms()) d.addCallback(lambda _: self.sconn.delete_all_contacts()) self.messages = get_messages_obj(self.sconn) return d
def save_messages_to_db(self, smslist, where): messages = get_messages_obj(self.parent_ctrl.model.get_sconn()) smslistback = messages.add_messages(smslist, where) tv_name = TV_DICT[where] model = self.parent_ctrl.view[tv_name].get_model() model.add_messages(smslistback)
def post_configure_device(ignored): d = self.device.postinit() d.addCallback(lambda _: self.sconn.delete_all_sms()) d.addCallback(lambda _: self.sconn.delete_all_contacts()) self.messages = get_messages_obj(self.sconn) return d