# Path: commotion_client/utils/logger.py
# class LogHandler(object):
#     def __init__(self, name, verbosity=None, logfile=None):
#     def set_logfile(self, logfile=None):
#     def set_verbosity(self, verbosity=None, log_type=None):
#     def get_logger(self):
# 
# Path: commotion_client/utils/thread.py
# class GenericThread(QtCore.QThread):
#     def __init__(self):
#         def __del__(self):
#         def run(self):
# 
# Path: commotion_client/utils/single_application.py
# class SingleApplication(QtGui.QApplication):
# class SingleApplicationWithMessaging(SingleApplication):
#     def __init__(self, key, argv):
#     def is_running(self):
#     def __init__(self, key, argv):
#     def handle_message(self):
#     def send_message(self, message):
#     def process_message(self, message):
# 
# Path: commotion_client/utils/extension_manager.py
# class ExtensionManager(object):
# class ConfigManager(object):
#     def __init__(self):
#     def get_user_settings(self):
#     def reset_settings_group(self):
#     def init_extension_libraries(self):
#     def set_library_defaults(self):
#     def init_libraries(self):
#     def init_extension_config(self, ext_type=None):
#     def check_installed(self, name=None):
#     def get_installed(self):
#     def load_core(self):
#     def install_loaded(self, ext_type=None):
#     def get_extension_from_property(self, key, val):
#     def get_property(self, name, key):
#     def load_user_interface(self, extension_name, gui):
#     def get_config(self, name):
#     def remove_extension_settings(self, name):
#     def save_settings(self, extension_config, extension_type="global"):
#     def __init__(self, path=None):
#     def has_configs(self):
#     def find(self, name=None):
#     def get_paths(self, directory):
#     def get(self, paths=None):
#     def load(self, path):
# 
# Path: commotion_client/GUI/main_window.py
# class MainWindow(QtGui.QMainWindow):
#     def __init__(self, parent=None):
#     def toggle_menu_bar(self):
#     def setup_menu_bar(self):
#     def init_crash_reporter(self):
#     def set_viewport(self):
#     def apply_viewport(self, viewport, toolbar=None):
#     def init_viewport_signals(self):
#     def change_viewport(self, viewport):
#     def init_toolbar(self, ext_toolbar):
#     def purge(self):
#     def closeEvent(self, event):
#     def exitEvent(self):
#     def cleanup(self):
#     def bring_front(self):
#     def load_settings(self):
#     def save_settings(self):
#     def crash(self, crash_type):
#     def is_dirty(self):
# 
# Path: commotion_client/GUI/system_tray.py
# class TrayIcon(QtGui.QWidget):
#     def __init__(self, parent=None):
#     def tray_iconActivated(self, reason):


import sys
import argparse
import logging
import time
from PyQt4 import QtGui
from PyQt4 import QtCore
from commotion_client.utils import logger
from commotion_client.utils import thread
from commotion_client.utils import single_application
from commotion_client.utils import extension_manager
from commotion_client.GUI import main_window
from commotion_client.GUI import system_tray
        @param force bool Force window reset if hiding is unsuccessful.
        @param errors If set to "strict" errors found will be raised before returning the boolean result.
        @return bool Return True if successful and false is unsuccessful.
        """
        try:
            self.main.exit()
        except Exception as _excp:
            self.log.error(self.translate("logs", "Could not hide main window. Attempting to close all and only open taskbar."))
            self.log.exception(_excp)
            if force:
                try:
                    self.main.purge()
                    self.main = None
                    self.main = self.create_main_window()
                except Exception as _excp:
                    self.log.error(self.translate("logs", "Could not force main window restart."))
                    self.log.exception(_excp)
                    raise
            elif errors == "strict":
                raise
            else:
                return False
        else:
            return True
        #force hide settings
        try:
            #if already open, then close first
            if self.main:
                self.close_main_window()
            #re-open

# Path: commotion_client/utils/logger.py
# class LogHandler(object):
#     def __init__(self, name, verbosity=None, logfile=None):
#     def set_logfile(self, logfile=None):
#     def set_verbosity(self, verbosity=None, log_type=None):
#     def get_logger(self):
# 
# Path: commotion_client/utils/thread.py
# class GenericThread(QtCore.QThread):
#     def __init__(self):
#         def __del__(self):
#         def run(self):
# 
# Path: commotion_client/utils/single_application.py
# class SingleApplication(QtGui.QApplication):
# class SingleApplicationWithMessaging(SingleApplication):
#     def __init__(self, key, argv):
#     def is_running(self):
#     def __init__(self, key, argv):
#     def handle_message(self):
#     def send_message(self, message):
#     def process_message(self, message):
# 
# Path: commotion_client/utils/extension_manager.py
# class ExtensionManager(object):
# class ConfigManager(object):
#     def __init__(self):
#     def get_user_settings(self):
#     def reset_settings_group(self):
#     def init_extension_libraries(self):
#     def set_library_defaults(self):
#     def init_libraries(self):
#     def init_extension_config(self, ext_type=None):
#     def check_installed(self, name=None):
#     def get_installed(self):
#     def load_core(self):
#     def install_loaded(self, ext_type=None):
#     def get_extension_from_property(self, key, val):
#     def get_property(self, name, key):
#     def load_user_interface(self, extension_name, gui):
#     def get_config(self, name):
#     def remove_extension_settings(self, name):
#     def save_settings(self, extension_config, extension_type="global"):
#     def __init__(self, path=None):
#     def has_configs(self):
#     def find(self, name=None):
#     def get_paths(self, directory):
#     def get(self, paths=None):
#     def load(self, path):
# 
# Path: commotion_client/GUI/main_window.py
# class MainWindow(QtGui.QMainWindow):
#     def __init__(self, parent=None):
#     def toggle_menu_bar(self):
#     def setup_menu_bar(self):
#     def init_crash_reporter(self):
#     def set_viewport(self):
#     def apply_viewport(self, viewport, toolbar=None):
#     def init_viewport_signals(self):
#     def change_viewport(self, viewport):
#     def init_toolbar(self, ext_toolbar):
#     def purge(self):
#     def closeEvent(self, event):
#     def exitEvent(self):
#     def cleanup(self):
#     def bring_front(self):
#     def load_settings(self):
#     def save_settings(self):
#     def crash(self, crash_type):
#     def is_dirty(self):
# 
# Path: commotion_client/GUI/system_tray.py
# class TrayIcon(QtGui.QWidget):
#     def __init__(self, parent=None):
#     def tray_iconActivated(self, reason):


# Path: commotion_client/commotion_client.py
import sys
import argparse
import logging
import time
from PyQt4 import QtGui
from PyQt4 import QtCore
from commotion_client.utils import logger
from commotion_client.utils import thread
from commotion_client.utils import single_application
from commotion_client.utils import extension_manager
from commotion_client.GUI import main_window
from commotion_client.GUI import system_tray

        @param force bool Force window reset if hiding is unsuccessful.
        @param errors If set to "strict" errors found will be raised before returning the boolean result.
        @return bool Return True if successful and false is unsuccessful.
        """
        try:
            self.main.exit()
        except Exception as _excp:
            self.log.error(self.translate("logs", "Could not hide main window. Attempting to close all and only open taskbar."))
            self.log.exception(_excp)
            if force:
                try:
                    self.main.purge()
                    self.main = None
                    self.main = self.create_main_window()
                except Exception as _excp:
                    self.log.error(self.translate("logs", "Could not force main window restart."))
                    self.log.exception(_excp)
                    raise
            elif errors == "strict":
                raise
            else:
                return False
        else:
            return True
        #force hide settings
        try:
            #if already open, then close first
            if self.main:
                self.close_main_window()
            #re-open

            self.main = main_window.MainWindow()