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 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)