Example #1
0
 def __init__(self, parent, delete_event_cb):
     """Prepare the Debug dialog"""
     self.on_window_debug_delete_event = delete_event_cb
     # Load the user interface
     self.ui = GtkBuilderLoader(get_ui_file('debug.glade'))
     # Initialize preferences
     self.actions_preferences = {
         DEBUG_ENABLED: self.ui.action_enable,
         DEBUG_ENABLED_HIDDEN: self.ui.action_enable_hidden,
         DEBUG_SHOW_INFO: self.ui.action_show_info,
         DEBUG_SHOW_WARNING: self.ui.action_show_warning,
         DEBUG_SHOW_ERROR: self.ui.action_show_error,
         DEBUG_TIMESTAMP: self.ui.action_show_timestamp,
         DEBUG_FOLLOW_TEXT: self.ui.action_follow_text,
     }
     for key in self.actions_preferences:
         self.actions_preferences[key].set_active(preferences.get(key))
     # Initialize actions
     for widget in self.ui.get_objects_by_type(Gtk.Action):
         # Connect the actions accelerators
         widget.connect_accelerator()
         # Set labels
         widget.set_label(text(widget.get_label()))
     # Initialize tooltips
     for widget in self.ui.get_objects_by_type(Gtk.ToolButton):
         action = widget.get_related_action()
         if action:
             widget.set_tooltip_text(action.get_label().replace('_', ''))
     # Connect signals from the glade file to the module functions
     self.ui.connect_signals(self)
Example #2
0
 def __init__(self, parent, services):
     """Prepare the services detail dialog"""
     # Load the user interface
     self.ui = GtkBuilderLoader(get_ui_file('service_detail.glade'))
     if not preferences.get(preferences.DETACHED_WINDOWS):
         self.ui.dialog_edit_service.set_transient_for(parent)
     # Initialize actions
     for widget in self.ui.get_objects_by_type(Gtk.Action):
         # Connect the actions accelerators
         widget.connect_accelerator()
         # Set labels
         widget.set_label(text(widget.get_label()))
     # Initialize labels
     for widget in self.ui.get_objects_by_type(Gtk.Label):
         widget.set_label(text(widget.get_label()))
         widget.set_tooltip_text(widget.get_label().replace('_', ''))
     # Initialize tooltips
     for widget in self.ui.get_objects_by_type(Gtk.Button):
         action = widget.get_related_action()
         if action:
             widget.set_tooltip_text(action.get_label().replace('_', ''))
     self.model = services
     self.selected_iter = None
     self.name = ''
     self.description = ''
     self.command = '[]'
     self.terminal = False
     self.icon = ''
     # Connect signals from the glade file to the module functions
     self.ui.connect_signals(self)
Example #3
0
 def __init__(self, parent, destinations):
     """Prepare the service association dialog"""
     # Load the user interface
     self.ui = GtkBuilderLoader(get_ui_file('service_association.glade'))
     if not preferences.get(preferences.DETACHED_WINDOWS):
         self.ui.dialog_association.set_transient_for(parent)
     # Restore the saved size and position
     settings.positions.restore_window_position(self.ui.dialog_association,
                                                SECTION_WINDOW_NAME)
     # Initialize actions
     for widget in self.ui.get_objects_by_type(Gtk.Action):
         # Connect the actions accelerators
         widget.connect_accelerator()
         # Set labels
         widget.set_label(text(widget.get_label()))
     # Initialize labels
     for widget in self.ui.get_objects_by_type(Gtk.Label):
         widget.set_label(text(widget.get_label()))
         widget.set_tooltip_text(widget.get_label().replace('_', ''))
     # Initialize tooltips
     for widget in self.ui.get_objects_by_type(Gtk.Button):
         action = widget.get_related_action()
         if action:
             widget.set_tooltip_text(action.get_label().replace('_', ''))
     # Load destinations
     self.destinations = destinations
     self.ui.cbo_destinations.set_model(self.destinations.model)
     # Load services
     self.services = ModelServices(self.ui.store_services)
     self.services.load(model_services.services)
     # Connect signals from the glade file to the module functions
     self.ui.connect_signals(self)
     self.service_arguments_widgets = {}
 def __init__(self, parent):
     """Prepare the command arguments dialog"""
     # Load the user interface
     self.ui = GtkBuilderLoader(get_ui_file("command_arguments.glade"))
     if not preferences.get(preferences.DETACHED_WINDOWS):
         self.ui.dialog_arguments.set_transient_for(parent)
     # Restore the saved size and position
     settings.positions.restore_window_position(self.ui.dialog_arguments, SECTION_WINDOW_NAME)
     # Initialize actions
     for widget in self.ui.get_objects_by_type(Gtk.Action):
         # Connect the actions accelerators
         widget.connect_accelerator()
         # Set labels
         widget.set_label(text(widget.get_label()))
     # Initialize tooltips
     for widget in self.ui.get_objects_by_type(Gtk.Button):
         action = widget.get_related_action()
         if action:
             widget.set_tooltip_text(action.get_label().replace("_", ""))
     # Initialize column headers
     for widget in self.ui.get_objects_by_type(Gtk.TreeViewColumn):
         widget.set_title(text(widget.get_title()))
     # Load the arguments
     self.model_arguments = self.ui.store_arguments
     self.arguments = "[]"
     # Connect signals from the glade file to the module functions
     self.ui.connect_signals(self)
Example #5
0
 def __init__(self, parent):
     """Prepare the groups dialog"""
     # Load the user interface
     self.ui = GtkBuilderLoader(get_ui_file('groups.glade'))
     if not preferences.get(preferences.DETACHED_WINDOWS):
         self.ui.dialog_groups.set_transient_for(parent)
     # Restore the saved size and position
     settings.positions.restore_window_position(self.ui.dialog_groups,
                                                SECTION_WINDOW_NAME)
     # Initialize actions
     for widget in self.ui.get_objects_by_type(Gtk.Action):
         # Connect the actions accelerators
         widget.connect_accelerator()
         # Set labels
         widget.set_label(text(widget.get_label()))
     # Initialize tooltips
     for widget in self.ui.get_objects_by_type(Gtk.Button):
         action = widget.get_related_action()
         if action:
             widget.set_tooltip_text(action.get_label().replace('_', ''))
     # Initialize column headers
     for widget in self.ui.get_objects_by_type(Gtk.TreeViewColumn):
         widget.set_title(text(widget.get_title()))
     # Load the groups
     self.model = ModelGroups(self.ui.store_groups)
     self.selected_iter = None
     # Sort the data in the models
     self.model.model.set_sort_column_id(
         self.ui.column_name.get_sort_column_id(), Gtk.SortType.ASCENDING)
     # Connect signals from the glade file to the module functions
     self.ui.connect_signals(self)
Example #6
0
 def __init__(self, parent):
     """Prepare the services dialog"""
     # Load the user interface
     self.ui = GtkBuilderLoader(get_ui_file('services.glade'))
     if not preferences.get(preferences.DETACHED_WINDOWS):
         self.ui.dialog_services.set_transient_for(parent)
     # Restore the saved size and position
     settings.positions.restore_window_position(
         self.ui.dialog_services, SECTION_WINDOW_NAME)
     # Initialize actions
     for widget in self.ui.get_objects_by_type(Gtk.Action):
         # Connect the actions accelerators
         widget.connect_accelerator()
         # Set labels
         widget.set_label(text(widget.get_label()))
     # Initialize tooltips
     for widget in self.ui.get_objects_by_type(Gtk.Button):
         action = widget.get_related_action()
         if action:
             widget.set_tooltip_text(action.get_label().replace('_', ''))
     # Initialize column headers
     for widget in self.ui.get_objects_by_type(Gtk.TreeViewColumn):
         widget.set_title(text(widget.get_title()))
     # Load the services
     self.model = ModelServices(self.ui.store_services)
     self.selected_iter = None
     self.ui.cell_icon.props.height = preferences.get(preferences.ICON_SIZE)
     # Sort the data in the models
     self.model.model.set_sort_column_id(
         self.ui.column_name.get_sort_column_id(),
         Gtk.SortType.ASCENDING)
     # Connect signals from the glade file to the module functions
     self.ui.connect_signals(self)
Example #7
0
 def __init__(self, parent, delete_event_cb):
     """Prepare the Debug dialog"""
     self.on_window_debug_delete_event = delete_event_cb
     # Load the user interface
     self.ui = GtkBuilderLoader(get_ui_file('debug.glade'))
     # Initialize preferences
     self.actions_preferences = {
         DEBUG_ENABLED: self.ui.action_enable,
         DEBUG_ENABLED_HIDDEN: self.ui.action_enable_hidden,
         DEBUG_SHOW_INFO: self.ui.action_show_info,
         DEBUG_SHOW_WARNING: self.ui.action_show_warning,
         DEBUG_SHOW_ERROR: self.ui.action_show_error,
         DEBUG_TIMESTAMP: self.ui.action_show_timestamp,
         DEBUG_FOLLOW_TEXT: self.ui.action_follow_text,
     }
     for key in self.actions_preferences:
         self.actions_preferences[key].set_active(preferences.get(key))
     # Initialize actions
     for widget in self.ui.get_objects_by_type(Gtk.Action):
         # Connect the actions accelerators
         widget.connect_accelerator()
         # Set labels
         widget.set_label(text(widget.get_label()))
     # Initialize tooltips
     for widget in self.ui.get_objects_by_type(Gtk.ToolButton):
         action = widget.get_related_action()
         if action:
             widget.set_tooltip_text(action.get_label().replace('_', ''))
     # Connect signals from the glade file to the module functions
     self.ui.connect_signals(self)
 def __init__(self, parent):
     """Prepare the command arguments dialog"""
     # Load the user interface
     self.ui = GtkBuilderLoader(get_ui_file('command_arguments.glade'))
     if not preferences.get(preferences.DETACHED_WINDOWS):
         self.ui.dialog_arguments.set_transient_for(parent)
     # Restore the saved size and position
     settings.positions.restore_window_position(self.ui.dialog_arguments,
                                                SECTION_WINDOW_NAME)
     # Initialize actions
     for widget in self.ui.get_objects_by_type(Gtk.Action):
         # Connect the actions accelerators
         widget.connect_accelerator()
         # Set labels
         widget.set_label(text(widget.get_label()))
     # Initialize tooltips
     for widget in self.ui.get_objects_by_type(Gtk.Button):
         action = widget.get_related_action()
         if action:
             widget.set_tooltip_text(action.get_label().replace('_', ''))
     # Initialize column headers
     for widget in self.ui.get_objects_by_type(Gtk.TreeViewColumn):
         widget.set_title(text(widget.get_title()))
     # Load the arguments
     self.model_arguments = self.ui.store_arguments
     self.arguments = '[]'
     # Connect signals from the glade file to the module functions
     self.ui.connect_signals(self)
Example #9
0
 def __init__(self, parent, destinations):
     """Prepare the destination dialog"""
     # Load the user interface
     self.ui = GtkBuilderLoader(get_ui_file('destination.glade'))
     if not preferences.get(preferences.DETACHED_WINDOWS):
         self.ui.dialog_destination.set_transient_for(parent)
     # Restore the saved size and position
     settings.positions.restore_window_position(
         self.ui.dialog_destination, SECTION_WINDOW_NAME)
     # Initialize actions
     for widget in self.ui.get_objects_by_type(Gtk.Action):
         # Connect the actions accelerators
         widget.connect_accelerator()
         # Set labels
         widget.set_label(text(widget.get_label()))
     # Initialize labels
     for widget in self.ui.get_objects_by_type(Gtk.Label):
         widget.set_label(text(widget.get_label()))
         widget.set_tooltip_text(widget.get_label().replace('_', ''))
     # Initialize tooltips
     for widget in self.ui.get_objects_by_type(Gtk.Button):
         action = widget.get_related_action()
         if action:
             widget.set_tooltip_text(action.get_label().replace('_', ''))
     self.model = destinations
     self.selected_iter = None
     self.name = ''
     self.value = ''
     # Connect signals from the glade file to the module functions
     self.ui.connect_signals(self)
 def __init__(self, parent, services):
     """Prepare the services detail dialog"""
     # Load the user interface
     self.ui = GtkBuilderLoader(get_ui_file('service_detail.glade'))
     if not preferences.get(preferences.DETACHED_WINDOWS):
         self.ui.dialog_edit_service.set_transient_for(parent)
     # Initialize actions
     for widget in self.ui.get_objects_by_type(Gtk.Action):
         # Connect the actions accelerators
         widget.connect_accelerator()
         # Set labels
         widget.set_label(text(widget.get_label()))
     # Initialize labels
     for widget in self.ui.get_objects_by_type(Gtk.Label):
         widget.set_label(text(widget.get_label()))
         widget.set_tooltip_text(widget.get_label().replace('_', ''))
     # Initialize tooltips
     for widget in self.ui.get_objects_by_type(Gtk.Button):
         action = widget.get_related_action()
         if action:
             widget.set_tooltip_text(action.get_label().replace('_', ''))
     self.model = services
     self.selected_iter = None
     self.name = ''
     self.description = ''
     self.command = '[]'
     self.terminal = False
     self.icon = ''
     # Connect signals from the glade file to the module functions
     self.ui.connect_signals(self)
Example #11
0
 def startup(self, application):
     """Configure the application during the startup"""
     self.ui = UIMain(self)
     # Add the about action to the app menu
     action = Gio.SimpleAction(name="settings_folder")
     action.connect("activate", self.on_app_settings_folder_activate)
     self.add_action(action)
     # Add the about action to the app menu
     action = Gio.SimpleAction(name="about")
     action.connect("activate", self.on_app_about_activate)
     self.add_action(action)
     # Add the quit action to the app menu
     action = Gio.SimpleAction(name="quit")
     action.connect("activate", self.on_app_quit_activate)
     self.add_action(action)
     # Add the app menu
     builder_appmenu = GtkBuilderLoader(get_ui_file('appmenu.ui'))
     self.set_app_menu(builder_appmenu.app_menu)
Example #12
0
 def __init__(self, parent):
     """Prepare the about dialog"""
     # Retrieve the translators list
     translators = []
     for line in readlines(FILE_TRANSLATORS, False):
         if ':' in line:
             line = line.split(':', 1)[1]
         line = line.replace('(at)', '@').strip()
         if line not in translators:
             translators.append(line)
     # Load the user interface
     self.ui = GtkBuilderLoader(get_ui_file('about.glade'))
     # Set various properties
     self.ui.dialog_about.set_program_name(APP_NAME)
     self.ui.dialog_about.set_version('Version %s' % APP_VERSION)
     self.ui.dialog_about.set_comments(APP_DESCRIPTION)
     self.ui.dialog_about.set_website(APP_URL)
     self.ui.dialog_about.set_copyright(APP_COPYRIGHT)
     # Prepare lists for authors and contributors
     authors = ['%s <%s>' % (APP_AUTHOR, APP_AUTHOR_EMAIL)]
     contributors = []
     for line in readlines(FILE_CONTRIBUTORS, False):
         contributors.append(line)
     if len(contributors) > 0:
         contributors.insert(0, _('Contributors:'))
         authors.extend(contributors)
     self.ui.dialog_about.set_authors(authors)
     self.ui.dialog_about.set_license('\n'.join(
         readlines(FILE_LICENSE, True)))
     self.ui.dialog_about.set_translator_credits('\n'.join(translators))
     # Retrieve the external resources links
     # only for GTK+ 3.6.0 and higher
     if not Gtk.check_version(3, 6, 0):
         for line in readlines(FILE_RESOURCES, False):
             resource_type, resource_url = line.split(':', 1)
             self.ui.dialog_about.add_credit_section(
                 resource_type, (resource_url, ))
     icon_logo = Pixbuf.new_from_file(FILE_ICON)
     self.ui.dialog_about.set_logo(icon_logo)
     if not preferences.get(preferences.DETACHED_WINDOWS):
         self.ui.dialog_about.set_transient_for(parent)
Example #13
0
 def __init__(self, parent):
     """Prepare the about dialog"""
     # Retrieve the translators list
     translators = []
     for line in readlines(FILE_TRANSLATORS, False):
         if ':' in line:
             line = line.split(':', 1)[1]
         line = line.replace('(at)', '@').strip()
         if line not in translators:
             translators.append(line)
     # Load the user interface
     self.ui = GtkBuilderLoader(get_ui_file('about.glade'))
     # Set various properties
     self.ui.dialog_about.set_program_name(APP_NAME)
     self.ui.dialog_about.set_version('Version %s' % APP_VERSION)
     self.ui.dialog_about.set_comments(APP_DESCRIPTION)
     self.ui.dialog_about.set_website(APP_URL)
     self.ui.dialog_about.set_copyright(APP_COPYRIGHT)
     # Prepare lists for authors and contributors
     authors = ['%s <%s>' % (APP_AUTHOR, APP_AUTHOR_EMAIL)]
     contributors = []
     for line in readlines(FILE_CONTRIBUTORS, False):
         contributors.append(line)
     if len(contributors) > 0:
         contributors.insert(0, _('Contributors:'))
         authors.extend(contributors)
     self.ui.dialog_about.set_authors(authors)
     self.ui.dialog_about.set_license(
         '\n'.join(readlines(FILE_LICENSE, True)))
     self.ui.dialog_about.set_translator_credits('\n'.join(translators))
     # Retrieve the external resources links
     # only for GTK+ 3.6.0 and higher
     if not Gtk.check_version(3, 6, 0):
         for line in readlines(FILE_RESOURCES, False):
             resource_type, resource_url = line.split(':', 1)
             self.ui.dialog_about.add_credit_section(
                 resource_type, (resource_url,))
     icon_logo = Pixbuf.new_from_file(FILE_ICON)
     self.ui.dialog_about.set_logo(icon_logo)
     if not preferences.get(preferences.DETACHED_WINDOWS):
         self.ui.dialog_about.set_transient_for(parent)
Example #14
0
 def loadUI(self):
     """Load the interface UI"""
     self.ui = GtkBuilderLoader(get_ui_file('main.glade'))
     self.ui.win_main.set_application(self.application)
     self.ui.win_main.set_title(APP_NAME)
     # Initialize actions
     for widget in self.ui.get_objects_by_type(Gtk.Action):
         # Connect the actions accelerators
         widget.connect_accelerator()
         # Set labels
         widget.set_label(text(widget.get_label()))
     # Initialize tooltips
     for widget in self.ui.get_objects_by_type(Gtk.ToolButton):
         action = widget.get_related_action()
         if action:
             widget.set_tooltip_text(action.get_label().replace('_', ''))
     # Initialize column headers
     for widget in self.ui.get_objects_by_type(Gtk.TreeViewColumn):
         widget.set_title(text(widget.get_title()))
     # Set list items row height
     icon_size = preferences.ICON_SIZE
     self.ui.cell_name.props.height = preferences.get(icon_size)
     self.ui.cell_group_name.props.height = preferences.get(icon_size)
     # Set groups visibility
     self.ui.scroll_groups.set_visible(
         preferences.get(preferences.GROUPS_SHOW))
     # Add a Gtk.Headerbar, only for GTK+ 3.10.0 and higher
     if (not Gtk.check_version(3, 10, 0)
             and not preferences.get(preferences.HEADERBARS_DISABLE)):
         self.load_ui_headerbar()
         if preferences.get(preferences.HEADERBARS_REMOVE_TOOLBAR):
             # This is only for development, it should always be True
             # Remove the redundant toolbar
             self.ui.toolbar_main.destroy()
         # Flatten the Gtk.ScrolledWindows
         self.ui.scroll_groups.set_shadow_type(Gtk.ShadowType.NONE)
         self.ui.scroll_connections.set_shadow_type(Gtk.ShadowType.NONE)
     # Connect signals from the glade file to the module functions
     self.ui.connect_signals(self)
Example #15
0
 def __init__(self, parent, delete_event_cb):
     """Prepare the processes dialog"""
     self.on_window_processes_delete_event = delete_event_cb
     self.processes = {}
     self.poller_id = None
     # Load the user interface
     self.ui = GtkBuilderLoader(get_ui_file('processes.glade'))
     # Restore the saved size and position
     settings.positions.restore_window_position(
         self.ui.window_processes, SECTION_WINDOW_NAME)
     # Initialize actions
     for widget in self.ui.get_objects_by_type(Gtk.Action):
         # Connect the actions accelerators
         widget.connect_accelerator()
         # Set labels
         widget.set_label(text(widget.get_label()))
     # Initialize tooltips
     for widget in self.ui.get_objects_by_type(Gtk.ToolButton):
         action = widget.get_related_action()
         if action:
             widget.set_tooltip_text(action.get_label().replace('_', ''))
     self.model = ModelProcesses(self.ui.store_processes)
     # Connect signals from the glade file to the module functions
     self.ui.connect_signals(self)
Example #16
0
 def __init__(self, parent):
     """Prepare the argument dialog"""
     # Load the user interface
     self.ui = GtkBuilderLoader(get_ui_file('command_argument.glade'))
     if not preferences.get(preferences.DETACHED_WINDOWS):
         self.ui.dialog_argument.set_transient_for(parent)
     # Initialize actions
     for widget in self.ui.get_objects_by_type(Gtk.Action):
         # Connect the actions accelerators
         widget.connect_accelerator()
         # Set labels
         widget.set_label(text(widget.get_label()))
     # Initialize labels
     for widget in self.ui.get_objects_by_type(Gtk.Label):
         widget.set_label(text(widget.get_label()))
         widget.set_tooltip_text(widget.get_label().replace('_', ''))
     # Initialize tooltips
     for widget in self.ui.get_objects_by_type(Gtk.Button):
         action = widget.get_related_action()
         if action:
             widget.set_tooltip_text(action.get_label().replace('_', ''))
     self.argument = ''
     # Connect signals from the glade file to the module functions
     self.ui.connect_signals(self)
 def __init__(self, parent):
     """Prepare the argument dialog"""
     # Load the user interface
     self.ui = GtkBuilderLoader(get_ui_file('command_argument.glade'))
     if not preferences.get(preferences.DETACHED_WINDOWS):
         self.ui.dialog_argument.set_transient_for(parent)
     # Initialize actions
     for widget in self.ui.get_objects_by_type(Gtk.Action):
         # Connect the actions accelerators
         widget.connect_accelerator()
         # Set labels
         widget.set_label(text(widget.get_label()))
     # Initialize labels
     for widget in self.ui.get_objects_by_type(Gtk.Label):
         widget.set_label(text(widget.get_label()))
         widget.set_tooltip_text(widget.get_label().replace('_', ''))
     # Initialize tooltips
     for widget in self.ui.get_objects_by_type(Gtk.Button):
         action = widget.get_related_action()
         if action:
             widget.set_tooltip_text(action.get_label().replace('_', ''))
     self.argument = ''
     # Connect signals from the glade file to the module functions
     self.ui.connect_signals(self)