Exemple #1
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)
 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)
Exemple #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 = {}
Exemple #4
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)
 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)
 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)
 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)
 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)
 def on_action_browse_icon_activate(self, action):
     """Browse for an icon file"""
     def update_preview_cb(widget, image, get_preview_filename, set_active):
         """Update preview by trying to load the image"""
         try:
             # Try to load the image from the previewed file
             image.set_from_pixbuf(GdkPixbuf.Pixbuf.new_from_file_at_size(
                 get_preview_filename(),
                 preferences.get(preferences.PREVIEW_SIZE),
                 preferences.get(preferences.PREVIEW_SIZE)))
             set_active(True)
         except:
             # Hide the preview widget for errors
             image.set_from_pixbuf(None)
             set_active(False)
     # Prepare the browse for icon dialog
     dialog = UIFileChooserOpenFile(self.ui.dialog_edit_service,
                                    text("Select a File"))
     dialog.add_filter(_("All Image Files"), "image/*", None)
     dialog.add_filter(_("All Files"), None, "*")
     dialog.set_filename(self.ui.txt_icon.get_text())
     # Set the image preview widget
     image_preview = Gtk.Image()
     image_preview.set_hexpand(False)
     image_preview.set_size_request(
         preferences.get(preferences.PREVIEW_SIZE), -1)
     dialog.set_preview_widget(image_preview, update_preview_cb)
     # Show the browse for icon dialog
     filename = dialog.show()
     if filename is not None:
         self.ui.txt_icon.set_text(filename)
     dialog.destroy()
Exemple #10
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 on_action_browse_icon_activate(self, action):
        """Browse for an icon file"""
        def update_preview_cb(widget, image, get_preview_filename, set_active):
            """Update preview by trying to load the image"""
            try:
                # Try to load the image from the previewed file
                image.set_from_pixbuf(
                    GdkPixbuf.Pixbuf.new_from_file_at_size(
                        get_preview_filename(),
                        preferences.get(preferences.PREVIEW_SIZE),
                        preferences.get(preferences.PREVIEW_SIZE)))
                set_active(True)
            except:
                # Hide the preview widget for errors
                image.set_from_pixbuf(None)
                set_active(False)

        # Prepare the browse for icon dialog
        dialog = UIFileChooserOpenFile(self.ui.dialog_edit_service,
                                       text("Select a File"))
        dialog.add_filter(_("All Image Files"), "image/*", None)
        dialog.add_filter(_("All Files"), None, "*")
        dialog.set_filename(self.ui.txt_icon.get_text())
        # Set the image preview widget
        image_preview = Gtk.Image()
        image_preview.set_hexpand(False)
        image_preview.set_size_request(
            preferences.get(preferences.PREVIEW_SIZE), -1)
        dialog.set_preview_widget(image_preview, update_preview_cb)
        # Show the browse for icon dialog
        filename = dialog.show()
        if filename is not None:
            self.ui.txt_icon.set_text(filename)
        dialog.destroy()
Exemple #12
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)
Exemple #13
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)
Exemple #14
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)
Exemple #16
0
 def on_action_remove_activate(self, action):
     """Remove the selected group"""
     selected_row = get_treeview_selected_row(self.ui.tvw_groups)
     group_name = self.model.get_key(selected_row) if selected_row else ''
     if selected_row and group_name and show_message_dialog(
             class_=UIMessageDialogNoYes,
             parent=self.ui.dialog_groups,
             message_type=Gtk.MessageType.WARNING,
             title=None,
             msg1=_('Remove the group'),
             msg2=_('Remove the group «%s»?') % group_name,
             is_response_id=Gtk.ResponseType.YES):
         group_path = os.path.join(DIR_HOSTS, group_name)
         # Check for directory not empty
         if len(os.listdir(group_path)) and not show_message_dialog(
                 class_=UIMessageDialogNoYes,
                 parent=self.ui.dialog_groups,
                 message_type=Gtk.MessageType.WARNING,
                 title=None,
                 msg1=_('The group is not empty'),
                 msg2='%s\n%s\n\n%s' % (
                     text('If you delete an item, it will '
                          'be permanently lost.'),
                     _('All the hosts defined for the group will be lost.'),
                     _('Are you sure you want to delete the '
                       'group «%s»?') % group_name,
                                    ),
                 is_response_id=Gtk.ResponseType.YES):
             # Exit immediately without deleting the group
             return
         # Delete all the contained files and the directory for the group
         for filename in os.listdir(group_path):
             os.remove(os.path.join(group_path, filename))
         os.rmdir(group_path)
         debug.add_info(_('Removed the group "%s"') % group_name)
         self.model.remove(selected_row)
 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)
Exemple #18
0
 def on_action_remove_activate(self, action):
     """Remove the selected group"""
     selected_row = get_treeview_selected_row(self.ui.tvw_groups)
     group_name = self.model.get_key(selected_row) if selected_row else ''
     if selected_row and group_name and show_message_dialog(
             class_=UIMessageDialogNoYes,
             parent=self.ui.dialog_groups,
             message_type=Gtk.MessageType.WARNING,
             title=None,
             msg1=_('Remove the group'),
             msg2=_('Remove the group «%s»?') % group_name,
             is_response_id=Gtk.ResponseType.YES):
         group_path = os.path.join(DIR_HOSTS, group_name)
         # Check for directory not empty
         if len(os.listdir(group_path)) and not show_message_dialog(
                 class_=UIMessageDialogNoYes,
                 parent=self.ui.dialog_groups,
                 message_type=Gtk.MessageType.WARNING,
                 title=None,
                 msg1=_('The group is not empty'),
                 msg2='%s\n%s\n\n%s' % (
                     text('If you delete an item, it will '
                          'be permanently lost.'),
                     _('All the hosts defined for the group will be lost.'),
                     _('Are you sure you want to delete the '
                       'group «%s»?') % group_name,
                 ),
                 is_response_id=Gtk.ResponseType.YES):
             # Exit immediately without deleting the group
             return
         # Delete all the contained files and the directory for the group
         for filename in os.listdir(group_path):
             os.remove(os.path.join(group_path, filename))
         os.rmdir(group_path)
         debug.add_info(_('Removed the group "%s"') % group_name)
         self.model.remove(selected_row)
 def __init__(self, parent, title):
     """Prepare the file chooser dialog"""
     UIFileChooser.__init__(self, parent, title,
                            Gtk.FileChooserAction.OPEN, (
                                text('_Cancel'), Gtk.ResponseType.CANCEL,
                                text('_Open'), Gtk.ResponseType.OK))
Exemple #20
0
#  with this program; if not, write to the Free Software Foundation, Inc.,
#  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
##

import gettext
import locale

import gcentralaccess.requires

from gcentralaccess.functions import store_message, text, _
from gcentralaccess.constants import DOMAIN_NAME, DIR_LOCALE

# Load domain for translation
for module in (gettext, locale):
    module.bindtextdomain(DOMAIN_NAME, DIR_LOCALE)
    module.textdomain(DOMAIN_NAME)

# Import some translated messages from GTK+ domain
store_message('_Icon:', '_%s:' % text(message='Icon', gtk30=True))
for message in ('_OK', '_Cancel', '_Close', '_Open', '_Save', '_Connect',
                '_Copy', '_Delete', 'Select a File', 'Services', 'Name',
                'Value', '_Name:', '_Value:',
                'If you delete an item, it will be permanently lost.'):
    text(message=message, gtk30=True)
# With domain context
for message in ('_Add', '_Remove', '_Edit', '_New', '_Quit', '_About'):
    text(message=message, gtk30=True, context='Stock label')
# Remove the underscore
for message in ('_Add', '_Remove', '_Edit', '_New', '_Connect', '_Delete'):
    store_message(message.replace('_', ''), _(message).replace('_', ''))
 def __init__(self, parent, title):
     """Prepare the file chooser dialog"""
     UIFileChooser.__init__(self, parent, title, Gtk.FileChooserAction.OPEN,
                            (text('_Cancel'), Gtk.ResponseType.CANCEL,
                             text('_Open'), Gtk.ResponseType.OK))
Exemple #22
0
#  with this program; if not, write to the Free Software Foundation, Inc.,
#  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
##

import gettext
import locale

import gcentralaccess.requires

from gcentralaccess.functions import store_message, text, _
from gcentralaccess.constants import DOMAIN_NAME, DIR_LOCALE

# Load domain for translation
for module in (gettext, locale):
    module.bindtextdomain(DOMAIN_NAME, DIR_LOCALE)
    module.textdomain(DOMAIN_NAME)

# Import some translated messages from GTK+ domain
store_message('_Icon:', '_%s:' % text(message='Icon', gtk30=True))
for message in ('_OK', '_Cancel', '_Close', '_Open', '_Save', '_Connect',
                '_Copy', '_Delete', 'Select a File', 'Services',
                'Name', 'Value', '_Name:', '_Value:',
                'If you delete an item, it will be permanently lost.'):
    text(message=message, gtk30=True)
# With domain context
for message in ('_Add', '_Remove', '_Edit', '_New', '_Quit', '_About'):
    text(message=message, gtk30=True, context='Stock label')
# Remove the underscore
for message in ('_Add', '_Remove', '_Edit', '_New', '_Connect', '_Delete'):
    store_message(message.replace('_', ''), _(message).replace('_', ''))