Example #1
0
def delete_region(parent=None, region=None):

    msg = _('Are you sure you want to delete this region ?\n'
            '\n'
            'Deletion will only work if this region is not\n'
            'yet in use in any patient addresses.')

    tt = _('Also delete any towns/cities/villages known\n'
           'to be situated in this state as long as\n'
           'no patients are recorded to live there.')

    dlg = gmGuiHelpers.c2ButtonQuestionDlg(
        parent,
        -1,
        caption=_('Deleting region'),
        question=msg,
        show_checkbox=True,
        checkbox_msg=_('delete related townships'),
        checkbox_tooltip=tt,
        button_defs=[{
            'label':
            _('Yes, delete'),
            'tooltip':
            _('Delete region and possibly related townships.'),
            'default':
            False
        }, {
            'label': _('No'),
            'tooltip': _('No, do NOT delete anything.'),
            'default': True
        }])

    decision = dlg.ShowModal()
    if decision != wx.ID_YES:
        dlg.Destroy()
        return False

    include_urbs = dlg.checkbox_is_checked()
    dlg.Destroy()

    return gmDemographicRecord.delete_region(region=region,
                                             delete_urbs=include_urbs)
Example #2
0
def delete_region(parent=None, region=None):

	msg = _(
		'Are you sure you want to delete this region ?\n'
		'\n'
		'Deletion will only work if this region is not\n'
		'yet in use in any patient addresses.'
	)

	tt = _(
		'Also delete any towns/cities/villages known\n'
		'to be situated in this state as long as\n'
		'no patients are recorded to live there.'
	)

	dlg = gmGuiHelpers.c2ButtonQuestionDlg (
		parent,
		-1,
		caption = _('Deleting region'),
		question = msg,
		show_checkbox = True,
		checkbox_msg = _('delete related townships'),
		checkbox_tooltip = tt,
		button_defs = [
			{'label': _('Yes, delete'), 'tooltip': _('Delete region and possibly related townships.'), 'default': False},
			{'label': _('No'), 'tooltip': _('No, do NOT delete anything.'), 'default': True}
		]
	)

	decision = dlg.ShowModal()
	if decision != wx.ID_YES:
		dlg.DestroyLater()
		return False

	include_urbs = dlg.checkbox_is_checked()
	dlg.DestroyLater()

	return gmDemographicRecord.delete_region(region = region, delete_urbs = include_urbs)