# Path: ubuntucleaner/settings/constants.py
# CONFIG_ROOT = os.path.join(GLib.get_user_config_dir(), 'ubuntu-cleaner')
# 
# Path: ubuntucleaner/utils/system.py
# def get_distro():
# def get_codename():
# def get_desktop():
# def get_app():
# DISTRO = get_distro()
# CODENAME = get_codename()
# DESKTOP = get_desktop()
# APP = get_app()


import logging
import os
import traceback
import gi
from io import StringIO
from gi.repository import Gdk, Gtk, Notify
from ubuntucleaner.settings.constants import CONFIG_ROOT
from ubuntucleaner.utils import system
    from ubuntucleaner.gui import GuiBuilder


def on_copy_button_clicked(widget, text):
    notify = Notify.Notification()
    notify.update(summary=_('Error message has been copied'),
                  body=_('Now click "Report" to enter the bug '
                         'report website. Make sure to attach the '
                         'error message in "Further information".'),
                  icon='ubuntu-cleaner')
    notify.show()


def run_traceback(level, textview_only=False, text_only=False):
    '''Two level: fatal and error'''

    output = StringIO.StringIO()
    exc = traceback.print_exc(file=output)

    worker = GuiBuilder('traceback.xml')

    textview = worker.get_object('%s_view' % level)

    buffer = textview.get_buffer()
    iter = buffer.get_start_iter()
    anchor = buffer.create_child_anchor(iter)
    button = Gtk.Button(label=_('Copy Error Message'))
    button.show()

    textview.add_child_at_anchor(button, anchor)


# Path: ubuntucleaner/settings/constants.py
# CONFIG_ROOT = os.path.join(GLib.get_user_config_dir(), 'ubuntu-cleaner')
# 
# Path: ubuntucleaner/utils/system.py
# def get_distro():
# def get_codename():
# def get_desktop():
# def get_app():
# DISTRO = get_distro()
# CODENAME = get_codename()
# DESKTOP = get_desktop()
# APP = get_app()


# Path: ubuntucleaner/settings/debug.py
import logging
import os
import traceback
import gi
from io import StringIO
from gi.repository import Gdk, Gtk, Notify
from ubuntucleaner.settings.constants import CONFIG_ROOT
from ubuntucleaner.utils import system
    from ubuntucleaner.gui import GuiBuilder



def on_copy_button_clicked(widget, text):
    notify = Notify.Notification()
    notify.update(summary=_('Error message has been copied'),
                  body=_('Now click "Report" to enter the bug '
                         'report website. Make sure to attach the '
                         'error message in "Further information".'),
                  icon='ubuntu-cleaner')
    notify.show()


def run_traceback(level, textview_only=False, text_only=False):
    '''Two level: fatal and error'''

    output = StringIO.StringIO()
    exc = traceback.print_exc(file=output)

    worker = GuiBuilder('traceback.xml')

    textview = worker.get_object('%s_view' % level)

    buffer = textview.get_buffer()
    iter = buffer.get_start_iter()
    anchor = buffer.create_child_anchor(iter)
    button = Gtk.Button(label=_('Copy Error Message'))
    button.show()

    textview.add_child_at_anchor(button, anchor)


    error_text = "\nDistribution: %s\nApplication: %s\nDesktop:%s\n\n%s" % (system.DISTRO,