Exemplo n.º 1
0
 def __sync_prefs(self, *args):
     prefs = Preferences.getInstance()
     fg = prefs.get_pref('term.foreground', default='#000')
     bg = prefs.get_pref('term.background', default='#FFF')
     _logger.debug("got fg=%s, bg=%s", fg, bg)
     self.set_color(True, gtk.gdk.color_parse(fg))
     self.set_color(False, gtk.gdk.color_parse(bg))
Exemplo n.º 2
0
 def __sync_pref(self):
     prefs = Preferences.getInstance()
     if self.__custom_editor_set:
         self.__pref_editor_uuid = self.__custom_editor_uuid
     else:
         self.__pref_editor_uuid = prefs.get_pref(
             'system.editor', default=self.__default_editor_uuid)
Exemplo n.º 3
0
 def __sync_emacs_sensitive(self):
     prefs = Preferences.getInstance()
     accels = prefs.get_pref('ui.menuaccels', default=True)
     if accels and prefs.get_pref('ui.emacs', default=False): 
         prefs.set_pref('ui.emacs', False)  
         self.__readline.set_property('active', False)
     self.__readline.set_sensitive(not accels)                  
Exemplo n.º 4
0
 def __sync_emacs_sensitive(self):
     prefs = Preferences.getInstance()
     accels = prefs.get_pref('ui.menuaccels', default=True)
     if accels and prefs.get_pref('ui.emacs', default=False):
         prefs.set_pref('ui.emacs', False)
         self.__readline.set_property('active', False)
     self.__readline.set_sensitive(not accels)
Exemplo n.º 5
0
 def __sync_prefs(self, *args):
     prefs = Preferences.getInstance()
     fg = prefs.get_pref('term.foreground', default='#000')
     bg = prefs.get_pref('term.background', default='#FFF')
     _logger.debug("got fg=%s, bg=%s", fg, bg)
     self.set_color(True, gtk.gdk.color_parse(fg))
     self.set_color(False, gtk.gdk.color_parse(bg))
Exemplo n.º 6
0
Arquivo: file.py Projeto: zsx/hotwire
    def _setup_view_columns(self):
        prefs = Preferences.getInstance()
        prefs.monitor_prefs('hotwire.ui.render.File.general.foldersbeforefiles', self.__on_folders_before_files_changed)
        prefs.monitor_prefs('hotwire.ui.render.File.columns.', self.__on_visible_columns_changed)
        self.__folders_before_files = prefs.get_pref('hotwire.ui.render.File.general.foldersbeforefiles', default=True)
        
        self._table.set_search_column(0)
        self._table.set_search_equal_func(self.__path_search_equal)

        self._insert_column('icon', title='', renderfunc=self._render_icon, renderer=gtk.CellRendererPixbuf(), valuefunc=lambda x: x.mimetype)
        self._insert_column('path', title=_('Path'), renderfunc=self._render_path,
                                    sortfunc=self.__compare_paths, 
                                    family='Monospace')
        self._insert_column('size', title=_('Size'), renderfunc=self._render_size, family='Monospace')
        self._insert_column('last_modified', title=_('Last Modified'), renderfunc=self._render_last_modified, family='Monospace',
                            valuefunc=lambda x: x.mtime)
        if self.__fs.supports_owner():
            self._insert_column('owner', title=_('Owner'), renderfunc=self._render_owner, valuefunc=lambda x: x.get_owner(),
                                family='Monospace')
        if self.__fs.supports_group():
            self._insert_column('group', title=_('Group'), renderfunc=self._render_group, valuefunc=lambda x: x.get_group(), family='Monospace')
        self._insert_column('permissions', title=_('Permissions'), renderfunc=self._render_permissions,
                            valuefunc=lambda x: x.permissions_string, 
                            family='Monospace')
        self._insert_column('mime', title=_('Mime Type'), renderfunc=self._render_mime, valuefunc=lambda x: x.mimetype, 
                            family='Monospace')
        
        # Sort on path by default
        self._model.set_sort_column_id(1, gtk.SORT_ASCENDING)        
        
        self.__sync_visible_columns()
Exemplo n.º 7
0
    def _setup_view_columns(self):
        prefs = Preferences.getInstance()
        prefs.monitor_prefs(
            'hotwire.ui.render.File.general.foldersbeforefiles',
            self.__on_folders_before_files_changed)
        prefs.monitor_prefs('hotwire.ui.render.File.columns.',
                            self.__on_visible_columns_changed)
        self.__folders_before_files = prefs.get_pref(
            'hotwire.ui.render.File.general.foldersbeforefiles', default=True)

        self._table.set_search_column(0)
        self._table.set_search_equal_func(self.__path_search_equal)

        self._insert_column('icon',
                            title='',
                            renderfunc=self._render_icon,
                            renderer=gtk.CellRendererPixbuf(),
                            valuefunc=lambda x: x.mimetype)
        self._insert_column('path',
                            title=_('Path'),
                            renderfunc=self._render_path,
                            sortfunc=self.__compare_paths,
                            family='Monospace')
        self._insert_column('size',
                            title=_('Size'),
                            renderfunc=self._render_size,
                            family='Monospace')
        self._insert_column('last_modified',
                            title=_('Last Modified'),
                            renderfunc=self._render_last_modified,
                            family='Monospace',
                            valuefunc=lambda x: x.mtime)
        if self.__fs.supports_owner():
            self._insert_column('owner',
                                title=_('Owner'),
                                renderfunc=self._render_owner,
                                valuefunc=lambda x: x.get_owner(),
                                family='Monospace')
        if self.__fs.supports_group():
            self._insert_column('group',
                                title=_('Group'),
                                renderfunc=self._render_group,
                                valuefunc=lambda x: x.get_group(),
                                family='Monospace')
        self._insert_column('permissions',
                            title=_('Permissions'),
                            renderfunc=self._render_permissions,
                            valuefunc=lambda x: x.permissions_string,
                            family='Monospace')
        self._insert_column('mime',
                            title=_('Mime Type'),
                            renderfunc=self._render_mime,
                            valuefunc=lambda x: x.mimetype,
                            family='Monospace')

        # Sort on path by default
        self._model.set_sort_column_id(1, gtk.SORT_ASCENDING)

        self.__sync_visible_columns()
Exemplo n.º 8
0
 def __add_checkbutton(self, name, prefname, function, vbox):
     prefs = Preferences.getInstance()
     checkbutton = gtk.CheckButton(name)
     checkbutton.set_property('active',
                              prefs.get_pref(prefname, default=True))
     checkbutton.connect('toggled', function)
     vbox.pack_start(hotwidgets.Align(checkbutton, padding_left=12),
                     expand=False)
Exemplo n.º 9
0
 def __init__(self):
     self.__editors = {} # uuid->editor
     prefs = Preferences.getInstance()
     self.__default_editor_uuid = 'c5851b9c-2618-4078-8905-13bf76f0a94f'
     self.__custom_editor_uuid = '5f8d7da1-fa4f-4753-8541-be58485af722'
     self.__custom_editor_set = 'EDITOR' in os.environ        
     self.__sync_pref()
     prefs.monitor_prefs('system.editor', self.__on_editor_changed)
Exemplo n.º 10
0
 def __init__(self):
     self.__editors = {}  # uuid->editor
     prefs = Preferences.getInstance()
     self.__default_editor_uuid = 'c5851b9c-2618-4078-8905-13bf76f0a94f'
     self.__custom_editor_uuid = '5f8d7da1-fa4f-4753-8541-be58485af722'
     self.__custom_editor_set = 'EDITOR' in os.environ
     self.__sync_pref()
     prefs.monitor_prefs('system.editor', self.__on_editor_changed)
Exemplo n.º 11
0
 def __on_fg_bg_changed(self, cb):
     prefs = Preferences.getInstance()        
     def sync_color_pref(button, prefname):
         color = button.get_color()
         color_str = '#%04X%04X%04X' % (color.red, color.green, color.blue)
         prefs.set_pref(prefname, color_str)
     sync_color_pref(self.__fg_color, 'term.foreground')
     sync_color_pref(self.__bg_color, 'term.background')
Exemplo n.º 12
0
    def __init__(self,
                 cwd=None,
                 cmd=None,
                 title='',
                 ptyfd=None,
                 initbuf=None,
                 autoclose=False):
        super(VteTerminal, self).__init__()
        self.__ui_string = """
<ui>
  <menubar name='Menubar'>
    <menu action='EditMenu'>
      <placeholder name='EditMenuAdditions'>
        <menuitem action='Copy'/>
        <menuitem action='Paste'/>
      </placeholder>
    </menu>
    <!-- <menu action='ControlMenu'>
      <menuitem action='SplitWindow'/>
    </menu> -->
  </menubar>
</ui>"""

        self.__title = title
        self.__header = gtk.HBox()
        self.__msg = gtk.Label('')
        self.__pid = None
        self.__exited = False
        self.__autoclose = autoclose
        self.__header.pack_start(hotwidgets.Align(self.__msg, xalign=1.0),
                                 expand=False)
        self.__msg.set_property('xalign', 1.0)

        self.pack_start(self.__header, expand=False)

        prefs = Preferences.getInstance()
        prefs.monitor_prefs('term.', self.__on_pref_changed)

        termargs = {}
        if isinstance(cmd, basestring):
            termargs['cmd'] = ['/bin/sh', '-c', cmd]
        else:
            termargs['cmd'] = cmd
        if ptyfd is not None:
            termargs['ptyfd'] = ptyfd
        if initbuf is not None:
            termargs['initbuf'] = initbuf
        _logger.debug("creating term, cmd=%r", termargs['cmd'])
        self.__term = term = VteTerminalWidget(cwd=cwd, **termargs)
        self.__action_group = term.get_action_group()
        self.pack_start(self.__term, expand=True)
        self.__term.connect('child-exited', self.__on_child_exited)
        self.__term.connect('fork-child', self.__on_fork_child)
        self.__term.get_vte().connect('key-press-event', self.__on_keypress)

        self.__sync_prefs()
Exemplo n.º 13
0
    def __on_fg_bg_changed(self, cb):
        prefs = Preferences.getInstance()

        def sync_color_pref(button, prefname):
            color = button.get_color()
            color_str = '#%04X%04X%04X' % (color.red, color.green, color.blue)
            prefs.set_pref(prefname, color_str)

        sync_color_pref(self.__fg_color, 'term.foreground')
        sync_color_pref(self.__bg_color, 'term.background')
Exemplo n.º 14
0
Arquivo: file.py Projeto: zsx/hotwire
 def __sync_visible_columns(self):
     if (self._table == None):
         return
     prefs = Preferences.getInstance()
     for colname in ['size', 'last_modified', 'owner', 'group', 'permissions', 'mime']:
         try:
             col = self._get_propcol_by_name(colname)
         except KeyError, e:
             _logger.debug("failed to find col %r", colname, exc_info=True)
             continue
         pref = prefs.get_pref('hotwire.ui.render.File.columns.' + colname, default=True)
         col.set_visible(pref)
Exemplo n.º 15
0
    def __init__(self, cwd=None, cmd=None, title='', ptyfd=None, initbuf=None, autoclose=False):
        super(VteTerminal, self).__init__()
        self.__ui_string = """
<ui>
  <menubar name='Menubar'>
    <menu action='EditMenu'>
      <placeholder name='EditMenuAdditions'>
        <menuitem action='Copy'/>
        <menuitem action='Paste'/>
      </placeholder>
    </menu>
    <!-- <menu action='ControlMenu'>
      <menuitem action='SplitWindow'/>
    </menu> -->
  </menubar>
</ui>"""         

        self.__title = title
        self.__header = gtk.HBox()
        self.__msg = gtk.Label('')
        self.__pid = None
        self.__exited = False
        self.__autoclose = autoclose
        self.__header.pack_start(hotwidgets.Align(self.__msg, xalign=1.0), expand=False)
        self.__msg.set_property('xalign', 1.0)

        self.pack_start(self.__header, expand=False)

        prefs = Preferences.getInstance()
        prefs.monitor_prefs('term.', self.__on_pref_changed)

        termargs = {}
        if isinstance(cmd, basestring):
            termargs['cmd'] = ['/bin/sh', '-c', cmd]
        else:
            termargs['cmd'] = cmd
        if ptyfd is not None:
            termargs['ptyfd'] = ptyfd
        if initbuf is not None:
            termargs['initbuf'] = initbuf
        _logger.debug("creating term, cmd=%r", termargs['cmd'])
        self.__term = term = VteTerminalWidget(cwd=cwd, **termargs)
        self.__action_group = term.get_action_group()        
        self.pack_start(self.__term, expand=True)
        self.__term.connect('child-exited', self.__on_child_exited)
        self.__term.connect('fork-child', self.__on_fork_child)
        self.__term.get_vte().connect('key-press-event', self.__on_keypress)
         
        self.__sync_prefs()
Exemplo n.º 16
0
 def __sync_visible_columns(self):
     if (self._table == None):
         return
     prefs = Preferences.getInstance()
     for colname in [
             'size', 'last_modified', 'owner', 'group', 'permissions',
             'mime'
     ]:
         try:
             col = self._get_propcol_by_name(colname)
         except KeyError, e:
             _logger.debug("failed to find col %r", colname, exc_info=True)
             continue
         pref = prefs.get_pref('hotwire.ui.render.File.columns.' + colname,
                               default=True)
         col.set_visible(pref)
Exemplo n.º 17
0
 def __on_list_filetype_toggled(self, cb):
     active = cb.get_property('active')
     prefs = Preferences.getInstance()
     prefs.set_pref('hotwire.ui.render.File.columns.mime', active)
Exemplo n.º 18
0
 def __on_list_lastmodified_toggled(self, cb):
     active = cb.get_property('active')
     prefs = Preferences.getInstance()
     prefs.set_pref('hotwire.ui.render.File.columns.last_modified', active)
Exemplo n.º 19
0
 def __on_folders_before_files_toggled(self, cb):
     active = cb.get_property('active')
     prefs = Preferences.getInstance()
     prefs.set_pref('hotwire.ui.render.File.general.foldersbeforefiles', active)
Exemplo n.º 20
0
 def __on_menuaccess_toggled(self, cb):
     active = cb.get_property('active')
     prefs = Preferences.getInstance()
     prefs.set_pref('ui.menuaccels', not active)
     self.__sync_emacs_sensitive()
Exemplo n.º 21
0
 def __on_menuaccess_toggled(self, cb):
     active = cb.get_property('active')
     prefs = Preferences.getInstance()
     prefs.set_pref('ui.menuaccels', not active)
     self.__sync_emacs_sensitive()
Exemplo n.º 22
0
 def __sync_pref(self):
     prefs = Preferences.getInstance()
     if self.__custom_editor_set:
         self.__pref_editor_uuid = self.__custom_editor_uuid
     else:
         self.__pref_editor_uuid = prefs.get_pref('system.editor', default=self.__default_editor_uuid)        
Exemplo n.º 23
0
 def __on_list_filetype_toggled(self, cb):
     active = cb.get_property('active')
     prefs = Preferences.getInstance()
     prefs.set_pref('hotwire.ui.render.File.columns.mime', active)
Exemplo n.º 24
0
 def __on_folders_before_files_changed(self, prefs, key, value):
     prefs = Preferences.getInstance()
     self.__folders_before_files = prefs.get_pref(
         'hotwire.ui.render.File.general.foldersbeforefiles', default=True)
     # Redo sort
     self._model.set_sort_column_id(1, gtk.SORT_ASCENDING)
Exemplo n.º 25
0
 def __on_folders_before_files_toggled(self, cb):
     active = cb.get_property('active')
     prefs = Preferences.getInstance()
     prefs.set_pref('hotwire.ui.render.File.general.foldersbeforefiles',
                    active)
Exemplo n.º 26
0
    def __init__(self):
        super(PrefsWindow,
              self).__init__(title=_('Preferences'),
                             parent=None,
                             flags=gtk.DIALOG_DESTROY_WITH_PARENT,
                             buttons=(gtk.STOCK_CLOSE, gtk.RESPONSE_ACCEPT))

        prefs = Preferences.getInstance()

        self.connect('response', lambda *args: self.hide())
        self.connect('delete-event', self.hide_on_delete)

        self.set_has_separator(False)
        self.set_border_width(5)

        self.__vbox = gtk.VBox()
        self.vbox.add(self.__vbox)
        self.vbox.set_spacing(2)
        self.__notebook = gtk.Notebook()
        self.__vbox.add(self.__notebook)

        self.__general_tab = gtk.VBox()
        self.__notebook.append_page(self.__general_tab)
        self.__notebook.set_tab_label_text(self.__general_tab, _('General'))

        vbox = gtk.VBox()
        vbox.set_border_width(12)
        vbox.set_spacing(6)
        self.__general_tab.pack_start(vbox, expand=False)
        label = gtk.Label()
        label.set_markup('<b>%s</b>' % (_('Interface'), ))
        label.set_alignment(0.0, 0.0)
        vbox.pack_start(hotwidgets.Align(label), expand=False)
        menuaccess = gtk.CheckButton(_('Disable menu access keys'))
        menuaccess.set_property(
            'active', not prefs.get_pref('ui.menuaccels', default=True))
        menuaccess.connect('toggled', self.__on_menuaccess_toggled)
        vbox.pack_start(hotwidgets.Align(menuaccess, padding_left=12),
                        expand=False)
        readline = self.__readline = gtk.CheckButton(
            _('Enable Unix "Readline" keys (Ctrl-A, Alt-F, Ctrl-K, etc.)'))
        readline.set_property('active',
                              prefs.get_pref('ui.emacs', default=False))
        readline.connect('toggled', self.__on_readline_toggled)
        vbox.pack_start(hotwidgets.Align(readline, padding_left=12),
                        expand=False)
        self.__sync_emacs_sensitive()

        label = gtk.Label()
        label.set_markup('<b>%s</b>' % (_('System'), ))
        label.set_alignment(0.0, 0.0)
        vbox.pack_start(hotwidgets.Align(label), expand=False)
        hbox = gtk.HBox()
        vbox.pack_start(hotwidgets.Align(hbox, padding_left=12), expand=False)
        ed_label = gtk.Label(_('Editor: '))
        hbox.pack_start(ed_label, expand=False)
        self.__ed_combo = PrefEditorCombo()
        hbox.pack_start(self.__ed_combo, expand=False)

        self.__term_tab = gtk.VBox()
        self.__notebook.append_page(self.__term_tab)
        self.__notebook.set_tab_label_text(self.__term_tab, _('Terminal'))

        vbox = gtk.VBox()
        vbox.set_border_width(12)
        vbox.set_spacing(6)
        label = gtk.Label()
        label.set_markup('<b>%s</b>' % (_('Interface'), ))
        label.set_alignment(0.0, 0.0)
        vbox.pack_start(label, expand=False)
        self.__term_tab.pack_start(vbox, expand=False)

        hbox = gtk.HBox()
        vbox.pack_start(hotwidgets.Align(hbox, padding_left=12), expand=False)
        sg = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL)
        fg_label = gtk.Label(_('Foreground Color: '))
        sg.add_widget(fg_label)
        hbox.pack_start(fg_label, expand=False)
        fg_color = self.__fg_color = gtk.ColorButton(
            gtk.gdk.color_parse(
                prefs.get_pref('term.foreground', default='#000')))
        hbox.pack_start(fg_color, expand=False)
        fg_color.connect('color-set', self.__on_fg_bg_changed)

        hbox = gtk.HBox()
        vbox.pack_start(hotwidgets.Align(hbox, padding_left=12), expand=False)
        bg_label = gtk.Label(_('Background Color: '))
        sg.add_widget(bg_label)
        hbox.pack_start(bg_label, expand=False)
        bg_color = self.__bg_color = gtk.ColorButton(
            gtk.gdk.color_parse(
                prefs.get_pref('term.background', default='#FFF')))
        hbox.pack_start(bg_color, expand=False)
        bg_color.connect('color-set', self.__on_fg_bg_changed)

        self.__folders_tab = gtk.VBox()
        self.__notebook.append_page(self.__folders_tab)
        self.__notebook.set_tab_label_text(self.__folders_tab, _('Folders'))

        vbox = gtk.VBox()
        vbox.set_border_width(12)
        vbox.set_spacing(6)
        label = gtk.Label()
        label.set_markup('<b>%s</b>' % (_('Default view'), ))
        label.set_alignment(0.0, 0.0)
        vbox.pack_start(label, expand=False)
        self.__folders_tab.pack_start(vbox, expand=False)
        self.__add_checkbutton(
            _('Sort folders before files'),
            'hotwire.ui.render.File.general.foldersbeforefiles',
            self.__on_folders_before_files_toggled, vbox)

        vbox = gtk.VBox()
        vbox.set_border_width(12)
        vbox.set_spacing(6)
        label = gtk.Label()
        label.set_markup('<b>%s</b>' % (_('List columns'), ))
        label.set_alignment(0.0, 0.0)
        vbox.pack_start(label, expand=False)
        self.__folders_tab.pack_start(vbox, expand=False)

        self.__add_checkbutton(_('Size'),
                               'hotwire.ui.render.File.columns.size',
                               self.__on_list_size_toggled, vbox)
        self.__add_checkbutton(_('Last modified'),
                               'hotwire.ui.render.File.columns.last_modified',
                               self.__on_list_lastmodified_toggled, vbox)
        self.__add_checkbutton(_('Owner'),
                               'hotwire.ui.render.File.columns.owner',
                               self.__on_list_owner_toggled, vbox)
        self.__add_checkbutton(_('Group'),
                               'hotwire.ui.render.File.columns.group',
                               self.__on_list_group_toggled, vbox)
        self.__add_checkbutton(_('Permissions'),
                               'hotwire.ui.render.File.columns.permissions',
                               self.__on_list_permissions_toggled, vbox)
        self.__add_checkbutton(_('File type'),
                               'hotwire.ui.render.File.columns.mime',
                               self.__on_list_filetype_toggled, vbox)
Exemplo n.º 27
0
 def __on_list_lastmodified_toggled(self, cb):
     active = cb.get_property('active')
     prefs = Preferences.getInstance()
     prefs.set_pref('hotwire.ui.render.File.columns.last_modified', active)
Exemplo n.º 28
0
 def __on_readline_toggled(self, cb):
     active = cb.get_property('active')
     prefs = Preferences.getInstance()
     prefs.set_pref('ui.emacs', active)   
Exemplo n.º 29
0
 def set_preferred(self, editor):
     prefs = Preferences.getInstance()
     prefs.set_pref('system.editor', editor.uuid)
Exemplo n.º 30
0
Arquivo: file.py Projeto: zsx/hotwire
 def __on_folders_before_files_changed(self, prefs, key, value):
     prefs = Preferences.getInstance()
     self.__folders_before_files = prefs.get_pref('hotwire.ui.render.File.general.foldersbeforefiles', default=True)
     # Redo sort
     self._model.set_sort_column_id(1, gtk.SORT_ASCENDING)        
Exemplo n.º 31
0
 def __add_checkbutton(self, name, prefname, function, vbox):
     prefs = Preferences.getInstance()
     checkbutton = gtk.CheckButton(name)
     checkbutton.set_property('active', prefs.get_pref(prefname, default=True))
     checkbutton.connect('toggled', function)        
     vbox.pack_start(hotwidgets.Align(checkbutton, padding_left=12), expand=False)
Exemplo n.º 32
0
    def __init__(self):
        super(PrefsWindow, self).__init__(title=_('Preferences'),
                                          parent=None,
                                          flags=gtk.DIALOG_DESTROY_WITH_PARENT,
                                          buttons=(gtk.STOCK_CLOSE, gtk.RESPONSE_ACCEPT))
        
        prefs = Preferences.getInstance()
        
        self.connect('response', lambda *args: self.hide())
        self.connect('delete-event', self.hide_on_delete)
                
        self.set_has_separator(False)
        self.set_border_width(5)
        
        self.__vbox = gtk.VBox()
        self.vbox.add(self.__vbox)   
        self.vbox.set_spacing(2)
        self.__notebook = gtk.Notebook()
        self.__vbox.add(self.__notebook)

        self.__general_tab = gtk.VBox()
        self.__notebook.append_page(self.__general_tab)
        self.__notebook.set_tab_label_text(self.__general_tab, _('General'))
        
        vbox = gtk.VBox()
        vbox.set_border_width(12)
        vbox.set_spacing(6)
        self.__general_tab.pack_start(vbox, expand=False)                           
        label = gtk.Label()
        label.set_markup('<b>%s</b>' % (_('Interface'),))
        label.set_alignment(0.0, 0.0)
        vbox.pack_start(hotwidgets.Align(label), expand=False)
        menuaccess = gtk.CheckButton(_('Disable menu access keys'))
        menuaccess.set_property('active', not prefs.get_pref('ui.menuaccels', default=True))
        menuaccess.connect('toggled', self.__on_menuaccess_toggled)        
        vbox.pack_start(hotwidgets.Align(menuaccess, padding_left=12), expand=False)
        readline = self.__readline = gtk.CheckButton(_('Enable Unix "Readline" keys (Ctrl-A, Alt-F, Ctrl-K, etc.)'))
        readline.set_property('active', prefs.get_pref('ui.emacs', default=False))
        readline.connect('toggled', self.__on_readline_toggled)        
        vbox.pack_start(hotwidgets.Align(readline, padding_left=12), expand=False)
        self.__sync_emacs_sensitive()
        
        label = gtk.Label()
        label.set_markup('<b>%s</b>' % (_('System'),))
        label.set_alignment(0.0, 0.0)
        vbox.pack_start(hotwidgets.Align(label), expand=False)
        hbox = gtk.HBox()
        vbox.pack_start(hotwidgets.Align(hbox, padding_left=12), expand=False)
        ed_label = gtk.Label(_('Editor: '))
        hbox.pack_start(ed_label, expand=False)
        self.__ed_combo = PrefEditorCombo()
        hbox.pack_start(self.__ed_combo, expand=False)        
        
        self.__term_tab = gtk.VBox()
        self.__notebook.append_page(self.__term_tab)
        self.__notebook.set_tab_label_text(self.__term_tab, _('Terminal'))   
        
        vbox = gtk.VBox()
        vbox.set_border_width(12)
        vbox.set_spacing(6) 
        label = gtk.Label()
        label.set_markup('<b>%s</b>' % (_('Interface'),))
        label.set_alignment(0.0, 0.0)
        vbox.pack_start(label, expand=False)
        self.__term_tab.pack_start(vbox, expand=False)
        
        hbox = gtk.HBox()
        vbox.pack_start(hotwidgets.Align(hbox, padding_left=12), expand=False)
        sg = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL)
        fg_label = gtk.Label(_('Foreground Color: '))
        sg.add_widget(fg_label)
        hbox.pack_start(fg_label, expand=False)
        fg_color = self.__fg_color = gtk.ColorButton(gtk.gdk.color_parse(prefs.get_pref('term.foreground', default='#000')))
        hbox.pack_start(fg_color, expand=False)
        fg_color.connect('color-set', self.__on_fg_bg_changed)
        
        hbox = gtk.HBox()
        vbox.pack_start(hotwidgets.Align(hbox, padding_left=12), expand=False)
        bg_label = gtk.Label(_('Background Color: '))
        sg.add_widget(bg_label)
        hbox.pack_start(bg_label, expand=False)
        bg_color = self.__bg_color = gtk.ColorButton(gtk.gdk.color_parse(prefs.get_pref('term.background', default='#FFF')))
        hbox.pack_start(bg_color, expand=False)
        bg_color.connect('color-set', self.__on_fg_bg_changed)

        self.__folders_tab = gtk.VBox()
        self.__notebook.append_page(self.__folders_tab)
        self.__notebook.set_tab_label_text(self.__folders_tab, _('Folders'))   

        vbox = gtk.VBox()
        vbox.set_border_width(12)
        vbox.set_spacing(6) 
        label = gtk.Label()
        label.set_markup('<b>%s</b>' % (_('Default view'),))
        label.set_alignment(0.0, 0.0)
        vbox.pack_start(label, expand=False)
        self.__folders_tab.pack_start(vbox, expand=False)
        self.__add_checkbutton(_('Sort folders before files'), 'hotwire.ui.render.File.general.foldersbeforefiles', 
                               self.__on_folders_before_files_toggled, vbox)

        vbox = gtk.VBox()
        vbox.set_border_width(12)
        vbox.set_spacing(6) 
        label = gtk.Label()
        label.set_markup('<b>%s</b>' % (_('List columns'),))
        label.set_alignment(0.0, 0.0)
        vbox.pack_start(label, expand=False)
        self.__folders_tab.pack_start(vbox, expand=False)

        self.__add_checkbutton(_('Size'), 'hotwire.ui.render.File.columns.size', self.__on_list_size_toggled, vbox)
        self.__add_checkbutton(_('Last modified'), 'hotwire.ui.render.File.columns.last_modified', self.__on_list_lastmodified_toggled, vbox)
        self.__add_checkbutton(_('Owner'), 'hotwire.ui.render.File.columns.owner', self.__on_list_owner_toggled, vbox)
        self.__add_checkbutton(_('Group'), 'hotwire.ui.render.File.columns.group', self.__on_list_group_toggled, vbox)
        self.__add_checkbutton(_('Permissions'), 'hotwire.ui.render.File.columns.permissions', self.__on_list_permissions_toggled, vbox)
        self.__add_checkbutton(_('File type'), 'hotwire.ui.render.File.columns.mime', self.__on_list_filetype_toggled, vbox)
Exemplo n.º 33
0
 def set_preferred(self, editor):
     prefs = Preferences.getInstance()
     prefs.set_pref('system.editor', editor.uuid)
Exemplo n.º 34
0
 def __on_readline_toggled(self, cb):
     active = cb.get_property('active')
     prefs = Preferences.getInstance()
     prefs.set_pref('ui.emacs', active)