Example #1
0
 def __init__(self, application):
     self.application = application
     # Load settings
     settings.settings = settings.Settings(FILE_SETTINGS, False)
     settings.positions = settings.Settings(FILE_WINDOWS_POSITION, False)
     settings.services = settings.Settings(FILE_SERVICES, False)
     preferences.preferences = preferences.Preferences()
     # Load services
     for key in settings.services.get_sections():
         model_services.services[key] = ServiceInfo(
             name=key,
             description=settings.services.get(key,
                                               OPTION_SERVICE_DESCRIPTION),
             command=settings.services.get(key, OPTION_SERVICE_COMMAND),
             terminal=settings.services.get_boolean(
                 key, OPTION_SERVICE_TERMINAL),
             icon=settings.services.get(key, OPTION_SERVICE_ICON))
     self.loadUI()
     self.model_hosts = ModelHosts(self.ui.store_hosts)
     self.model_groups = ModelGroups(self.ui.store_groups)
     # Prepare the debug dialog
     debug.debug = debug.UIDebug(self.ui.win_main,
                                 self.on_window_debug_delete_event)
     # Prepare the processes dialog
     processes.processes = processes.UIProcesses(
         self.ui.win_main, self.on_window_processes_delete_event)
     # Load the groups and hosts list
     self.hosts = {}
     self.reload_groups()
     # Sort the data in the models
     self.model_groups.model.set_sort_column_id(
         self.ui.column_group.get_sort_column_id(), Gtk.SortType.ASCENDING)
     self.model_hosts.model.set_sort_column_id(
         self.ui.column_name.get_sort_column_id(), Gtk.SortType.ASCENDING)
     # Automatically select the first host if any
     self.ui.tvw_groups.set_cursor(0)
     if self.model_hosts.count() > 0:
         self.ui.tvw_connections.set_cursor(0)
     # Restore the saved size and position
     settings.positions.restore_window_position(self.ui.win_main,
                                                SECTION_WINDOW_NAME)