コード例 #1
0
    def presetchanged(self, widget, mode=None):
        """some presets have changed, apply those"""
        active_theme_id = self.presetscombobox.get_active()
        for key, value in self.stylesvalues.iteritems():
            if value == active_theme_id:
                active_theme = key
        if active_theme_id == 0:
            custom_theme = Theme('custom')
            custom_theme['name'] = 'custom'
            custom_theme.update(self.get_custom_data())
            config.set("visual", "theme", str(active_theme))
            state['gui'].theme = custom_theme
            self.save_custom_button.set_sensitive(True)
        else:
            new_theme = Theme(active_theme)
            state['gui'].theme = new_theme
            parse_color = lambda x: gtk.gdk.color_parse(state['gui'].theme[x])
            self.colorpreference.set_color(parse_color('foreground'))
            self.textboxbgpreference.set_color(parse_color('textboxbg'))
            self.bgpreference.set_color(parse_color('background'))
            self.borderpreference.set_color(parse_color('border'))
            self.paddingpreference.set_value(
                float(state['gui'].theme['padding']))
            self.widthpreference.set_value(
                float(state['gui'].theme['width']) * 100)
            self.heightpreference.set_value(
                float(state['gui'].theme['height']) * 100)
            config.set("visual", "theme", str(active_theme))
            self.presetscombobox.set_active(active_theme_id)
            self.save_custom_button.set_sensitive(False)

        state['gui'].apply_theme()
        state['gui'].status.set_text(_('Style Changed to %s') % (active_theme))
コード例 #2
0
ファイル: preferences.py プロジェクト: spectrumIG/PyRoom
 def toggle_indent(self, widget):
     """toggle textbox indent"""
     if config.get('visual', 'indent') == '1':
         config.set('visual', 'indent', '0')
     else:
         config.set('visual', 'indent', '1')
     state['gui'].apply_theme()
コード例 #3
0
ファイル: preferences.py プロジェクト: spectrumIG/PyRoom
 def togglepath(self, widget):
     """toggle full path display in statusbar"""
     pathstate = config.getint('visual', 'showpath')
     if pathstate:
         opposite = 0
     else:
         opposite = 1
     config.set('visual', 'showpath', str(opposite))
コード例 #4
0
ファイル: preferences.py プロジェクト: spectrumIG/PyRoom
 def toggleborder(self, widget):
     """toggle border display"""
     borderstate = config.getint('visual', 'showborder')
     if borderstate:
         opposite = 0
     else:
         opposite = 1
     config.set('visual', 'showborder', str(opposite))
     state['gui'].apply_theme()
コード例 #5
0
    def set_preferences(self, widget, data=None):
        """save preferences"""
        autosavepref = int(self.autosave.get_active())
        config.set("editor", "autosave", str(autosavepref))
        autosave_time = self.autosave_spinbutton.get_value_as_int()
        config.set("editor", "autosavetime", str(autosave_time))

        if self.presetscombobox.get_active_text().lower() == 'custom':
            custom_theme = open(
                os.path.join(state['themes_dir'], 'custom.theme'), "w")
            self.customfile.write(custom_theme)
        self.dlg.hide()
        try:
            config_file = open(os.path.join(state['conf_dir'], "cdraft.conf"),
                               "w")
            config.write(config_file)
        except IOError:
            raise CDraftError(_("Could not save preferences file."))
コード例 #6
0
ファイル: preferences.py プロジェクト: afm-sayem/PyRoom
    def set_preferences(self, widget, data=None):
        """save preferences"""
        autosavepref = int(self.autosave.get_active())
        config.set("editor", "autosave", str(autosavepref))
        autosave_time = self.autosave_spinbutton.get_value_as_int()
        config.set("editor", "autosavetime", str(autosave_time))

        if self.presetscombobox.get_active_text().lower() == 'custom':
            custom_theme = open(os.path.join(
                state['themes_dir'], 'custom.theme'),
                "w"
            )
            self.customfile.write(custom_theme)
        self.dlg.hide()
        try:
            config_file = open(os.path.join(
                state['conf_dir'], "pyroom.conf"), "w"
            )
            config.write(config_file)
        except IOError:
            raise PyroomError(_("Could not save preferences file."))
コード例 #7
0
ファイル: preferences.py プロジェクト: afm-sayem/PyRoom
    def presetchanged(self, widget, mode=None):
        """some presets have changed, apply those"""
        active_theme_id = self.presetscombobox.get_active()
        for key, value in self.stylesvalues.iteritems():
            if value == active_theme_id:
                active_theme = key
        if active_theme_id == 0:
            custom_theme = Theme('custom')
            custom_theme['name'] = 'custom'
            custom_theme.update(self.get_custom_data())
            config.set("visual", "theme", str(active_theme))
            state['gui'].theme = custom_theme
            self.save_custom_button.set_sensitive(True)
        else:
            new_theme = Theme(active_theme)
            state['gui'].theme = new_theme
            parse_color = lambda x: gtk.gdk.color_parse(
                state['gui'].theme[x]
            )
            self.colorpreference.set_color(parse_color('foreground'))
            self.textboxbgpreference.set_color(parse_color('textboxbg'))
            self.bgpreference.set_color(parse_color('background'))
            self.borderpreference.set_color(parse_color('border'))
            self.paddingpreference.set_value(float(
                state['gui'].theme['padding'])
            )
            self.widthpreference.set_value(
                float(state['gui'].theme['width']) * 100
            )
            self.heightpreference.set_value(
                float(state['gui'].theme['height']) * 100
            )
            config.set("visual", "theme", str(active_theme))
            self.presetscombobox.set_active(active_theme_id)
            self.save_custom_button.set_sensitive(False)

        state['gui'].apply_theme()
        state['gui'].status.set_text(_('Style Changed to %s') %
                                        (active_theme))
コード例 #8
0
ファイル: preferences.py プロジェクト: spectrumIG/PyRoom
 def toggleautosave(self, widget):
     """enable or disable autosave"""
     if self.autosave.get_active():
         self.autosave_spinbutton.set_sensitive(True)
         autosave_time = self.autosave_spinbutton.get_value_as_int()
         config.set('editor', 'autosave', '1')
     else:
         self.autosave_spinbutton.set_sensitive(False)
         autosave_time = 0
         config.set('editor', 'autosave', '0')
     config.set('editor', 'autosavetime', str(autosave_time))
コード例 #9
0
ファイル: preferences.py プロジェクト: spectrumIG/PyRoom
 def change_font(self, widget):
     """apply changed fonts"""
     if widget.get_name() in ('fontbutton1', 'radio_custom_font'):
         self.custom_font_preference.set_sensitive(True)
         new_font = self.custom_font_preference.get_font_name()
         config.set('visual', 'use_font_type', 'custom')
         config.set('visual', 'custom_font', new_font)
     else:
         self.custom_font_preference.set_sensitive(False)
         font_type = widget.get_name().split('_')[1]
         config.set('visual', 'use_font_type', font_type)
     state['gui'].apply_theme()
コード例 #10
0
ファイル: preferences.py プロジェクト: spectrumIG/PyRoom
 def changelinespacing(self, widget):
     """Change line spacing"""
     linespacing = self.linespacing_spinbutton.get_value()
     config.set("visual", "linespacing", str(int(linespacing)))
     state['gui'].apply_theme()
コード例 #11
0
ファイル: preferences.py プロジェクト: spectrumIG/PyRoom
 def change_orientation(self, widget):
     """change orientation of the main textbox"""
     orientation = widget.get_name().split('_')[1]
     config.set('visual', 'alignment', orientation)
     state['gui'].apply_theme()