# Path: ubuntucleaner/gui/gtk.py
# @log_func(log)
# def post_ui(func):
#     def func_wrapper(*args, **kwargs):
#         Gdk.threads_enter()
#         func(*args, **kwargs)
#         Gdk.threads_leave()
# 
#     return func_wrapper
# 
# Path: ubuntucleaner/settings/debug.py
# def log_func(log):
#     def wrap(func):
#         def func_wrapper(*args, **kwargs):
#             log.debug("%s:" % func)
#             for i, arg in enumerate(args):
#                 log.debug("\targs-%d: %s" % (i + 1, arg))
#             for k, v in enumerate(kwargs):
#                 log.debug("\tdict args-%d: %s: %s" % (k, v, kwargs[v]))
#             return func(*args, **kwargs)
#         return func_wrapper
#     return wrap


import logging
import apt
import apt_pkg
import aptdaemon.client
import aptdaemon.errors
from aptdaemon.enums import *
from aptdaemon.gtk3widgets import AptErrorDialog, AptProgressDialog, AptConfirmDialog
from gi.repository import Gtk, Gdk
from defer import inline_callbacks
from ubuntucleaner.gui.gtk import post_ui
from ubuntucleaner.settings.debug import log_func
            if status == EXIT_FAILED and show_error:
                Gdk.threads_enter()
                err_dia = AptErrorDialog(self._transaction.error, self)
                err_dia.run()
                err_dia.hide()
                Gdk.threads_leave()
        self.emit("finished")


class AptWorker(object):
    cache = None

    @log_func(log)
    def __init__(self, parent,
                 finish_handler=None, error_handler=None,data=None):
        '''
        finish_handler: must take three parameter
        '''
        self.parent = parent
        self.data = data
        self.finish_handler = finish_handler
        if error_handler:
            self._on_error = error_handler
        self.ac = aptdaemon.client.AptClient()

    @log_func(log)
    def _simulate_trans(self, trans):
        trans.simulate(reply_handler=lambda: self._confirm_deps(trans),
                       error_handler=self._on_error)


# Path: ubuntucleaner/gui/gtk.py
# @log_func(log)
# def post_ui(func):
#     def func_wrapper(*args, **kwargs):
#         Gdk.threads_enter()
#         func(*args, **kwargs)
#         Gdk.threads_leave()
# 
#     return func_wrapper
# 
# Path: ubuntucleaner/settings/debug.py
# def log_func(log):
#     def wrap(func):
#         def func_wrapper(*args, **kwargs):
#             log.debug("%s:" % func)
#             for i, arg in enumerate(args):
#                 log.debug("\targs-%d: %s" % (i + 1, arg))
#             for k, v in enumerate(kwargs):
#                 log.debug("\tdict args-%d: %s: %s" % (k, v, kwargs[v]))
#             return func(*args, **kwargs)
#         return func_wrapper
#     return wrap


# Path: ubuntucleaner/utils/package.py
import logging
import apt
import apt_pkg
import aptdaemon.client
import aptdaemon.errors
from aptdaemon.enums import *
from aptdaemon.gtk3widgets import AptErrorDialog, AptProgressDialog, AptConfirmDialog
from gi.repository import Gtk, Gdk
from defer import inline_callbacks
from ubuntucleaner.gui.gtk import post_ui
from ubuntucleaner.settings.debug import log_func

            if status == EXIT_FAILED and show_error:
                Gdk.threads_enter()
                err_dia = AptErrorDialog(self._transaction.error, self)
                err_dia.run()
                err_dia.hide()
                Gdk.threads_leave()
        self.emit("finished")


class AptWorker(object):
    cache = None

    @log_func(log)
    def __init__(self, parent,
                 finish_handler=None, error_handler=None,data=None):
        '''
        finish_handler: must take three parameter
        '''
        self.parent = parent
        self.data = data
        self.finish_handler = finish_handler
        if error_handler:
            self._on_error = error_handler
        self.ac = aptdaemon.client.AptClient()

    @log_func(log)
    def _simulate_trans(self, trans):
        trans.simulate(reply_handler=lambda: self._confirm_deps(trans),
                       error_handler=self._on_error)


    @post_ui