def _check_param_online_services(self): from stoqlib.database.runtime import new_store from stoqlib.lib.parameters import sysparam from gi.repository import Gtk if sysparam.get_bool('ONLINE_SERVICES') is None: from kiwi.ui.dialogs import HIGAlertDialog # FIXME: All of this is to avoid having to set markup as the default # in kiwi/ui/dialogs:HIGAlertDialog.set_details, after 1.0 # this can be simplified when we fix so that all descriptions # sent to these dialogs are properly escaped dialog = HIGAlertDialog(parent=None, flags=Gtk.DialogFlags.MODAL, type=Gtk.MessageType.WARNING) dialog.add_button(_("Not right now"), Gtk.ResponseType.NO) dialog.add_button(_("Enable online services"), Gtk.ResponseType.YES) dialog.set_primary( _('Do you want to enable Stoq online services?')) dialog.set_details(PRIVACY_STRING, use_markup=True) dialog.set_default_response(Gtk.ResponseType.YES) response = dialog.run() dialog.destroy() store = new_store() sysparam.set_bool(store, 'ONLINE_SERVICES', response == Gtk.ResponseType.YES) store.commit() store.close()
def _check_param_online_services(self): from stoqlib.database.runtime import get_default_store, new_store from stoqlib.lib.parameters import sysparam import gtk sparam = sysparam(get_default_store()) if sparam.ONLINE_SERVICES is None: from kiwi.ui.dialogs import HIGAlertDialog # FIXME: All of this is to avoid having to set markup as the default # in kiwi/ui/dialogs:HIGAlertDialog.set_details, after 1.0 # this can be simplified when we fix so that all descriptions # sent to these dialogs are properly escaped dialog = HIGAlertDialog(parent=None, flags=gtk.DIALOG_MODAL, type=gtk.MESSAGE_WARNING) dialog.add_button(_("Not right now"), gtk.RESPONSE_NO) dialog.add_button(_("Enable online services"), gtk.RESPONSE_YES) dialog.set_primary( _('Do you want to enable Stoq online services?')) dialog.set_details(PRIVACY_STRING, use_markup=True) dialog.set_default_response(gtk.RESPONSE_YES) response = dialog.run() dialog.destroy() store = new_store() sysparam(store).ONLINE_SERVICES = int( bool(response == gtk.RESPONSE_YES)) store.commit() store.close()
def _create_dialog(self): app_info = get_utility(IAppInfo, None) self._dialog = HIGAlertDialog(parent=self._parent, flags=Gtk.DialogFlags.MODAL, type=Gtk.MessageType.WARNING) self._dialog.set_details_label(_("Details ...")) self._dialog.set_resizable(True) primary_fmt = _( 'We\'r sorry to inform you that an error occurred while ' 'running %s. Please help us improving Stoq by sending a ' 'automatically generated report about the incident.\n' 'Click on details to see the report text.') self._dialog.set_primary(primary_fmt % (app_info.get('name'), ), bold=False) self._create_details() self._create_comments() self._create_email() self._no_button = self._dialog.add_button(_('No thanks'), Gtk.ResponseType.NO) self._yes_button = self._dialog.add_button(_('Send report'), Gtk.ResponseType.YES) self._insert_tracebacks()