Пример #1
0
	def get_preview_pixbuf(self, icon_size):
		"""Create icongroup preview pixbuf"""
		if self.is_double:
			icon1, icon2 = self.preview, self.pair
			if self.pairsw:
				icon1, icon2 = icon2, icon1

			pixbuf = PixbufCreator.new_double_at_size(icon1, icon2, size=icon_size)
		else:
			pixbuf = PixbufCreator.new_single_at_size(self.preview, size=icon_size)

		return pixbuf
Пример #2
0
    def get_preview_pixbuf(self, icon_size):
        """Create icongroup preview pixbuf"""
        if self.is_double:
            icon1, icon2 = self.preview, self.pair
            if self.pairsw:
                icon1, icon2 = icon2, icon1

            pixbuf = PixbufCreator.new_double_at_size(icon1,
                                                      icon2,
                                                      size=icon_size)
        else:
            pixbuf = PixbufCreator.new_single_at_size(self.preview,
                                                      size=icon_size)

        return pixbuf
Пример #3
0
	def update_preview(self):
		"""Update filter preview"""
		try:
			pixbuf = PixbufCreator.new_single_at_size(self.filter_editor.current_preview, self.PREVIEW_ICON_SIZE)
			self.gui['editor_preview_icon'].set_from_pixbuf(pixbuf)
		except Exception:
			self.gui['editor_preview_icon'].set_from_icon_name('image-missing', Gtk.IconSize.DIALOG)
Пример #4
0
 def update_preview(self):
     """Update filter preview"""
     try:
         pixbuf = PixbufCreator.new_single_at_size(
             self.filter_editor.current_preview, self.PREVIEW_ICON_SIZE)
         self.gui['editor_preview_icon'].set_from_pixbuf(pixbuf)
     except Exception:
         self.gui['editor_preview_icon'].set_from_icon_name(
             'image-missing', Gtk.IconSize.DIALOG)
Пример #5
0
	def on_applications_combo_changed(self, combo):
		text = combo.get_active_text()
		if text:
			self.appthemes.set_active_by_name(text)

			icons = self.appthemes.get_icons()
			self.pixbufs = [PixbufCreator.new_single_at_size(icon, self.VIEW_ICON_SIZE) for icon in icons]

			return "icons_loaded"
Пример #6
0
    def __init__(self, filters, config):
        # Color page filters
        self.filters = filters

        # Filter edit helper
        self.filter_editor = RawFilterEditor(config.get("Editor", "preview"))

        # File dialog
        self.filechooser = FileChooser(acyls.dirs['filters'], "filter.xml")

        # Read icon size settins from config
        self.PREVIEW_ICON_SIZE = config.getint("PreviewSize", "single")

        # Load GUI
        self.builder = Gtk.Builder()
        self.builder.add_from_file(
            os.path.join(acyls.dirs['gui'], "editor.glade"))

        gui_elements = (
            'editor_grid',
            'editor_textview',
            'editor_preview_icon',
            'filter_info_label',
        )
        self.gui = {
            element: self.builder.get_object(element)
            for element in gui_elements
        }
        self.gui['editor_textview'].modify_font(
            Pango.FontDescription("Monospace"))

        # Build buffer
        self.buffer = Gtk.TextBuffer(text="Enter filter source here")
        self.gui['editor_textview'].set_buffer(self.buffer)

        # Mainpage buttnons hanlers
        self.mhandlers = dict()
        self.mhandlers['refresh_button'] = self.on_refresh_click

        # Toolbar buttnons hanlers
        self.bhandlers = dict()
        self.bhandlers[
            'edit_filter_toolbutton'] = self.on_edit_filter_button_click
        self.bhandlers[
            'load_filter_toolbutton'] = self.on_load_filter_button_click
        self.bhandlers[
            'revert_filter_toolbutton'] = self.on_revert_filter_button_click
        self.bhandlers[
            'save_filter_toolbutton'] = self.on_save_filter_button_click
        self.bhandlers[
            'save_as_filter_toolbutton'] = self.on_save_as_filter_button_click

        # Fill up GUI
        pixbuf = PixbufCreator.new_single_at_size(self.filter_editor.preview,
                                                  self.PREVIEW_ICON_SIZE)
        self.gui['editor_preview_icon'].set_from_pixbuf(pixbuf)
Пример #7
0
	def on_alt_theme_combo_changed(self, combo):
		DIG_LEVEL = 2
		text = combo.get_active_text()
		if text:
			self.alternatives.dig(text.lower(), DIG_LEVEL)
			with self.iconview_lock:
				self.store.clear()
				for icon in self.alternatives.get_icons(DIG_LEVEL):
					pixbuf = PixbufCreator.new_single_at_size(icon, self.VIEW_ICON_SIZE)
					self.store.append([pixbuf])
Пример #8
0
 def on_alt_theme_combo_changed(self, combo):
     DIG_LEVEL = 2
     text = combo.get_active_text()
     if text:
         self.alternatives.dig(text.lower(), DIG_LEVEL)
         with self.iconview_lock:
             self.store.clear()
             for icon in self.alternatives.get_icons(DIG_LEVEL):
                 pixbuf = PixbufCreator.new_single_at_size(
                     icon, self.VIEW_ICON_SIZE)
                 self.store.append([pixbuf])
Пример #9
0
    def on_iconview_combo_changed(self, combo):
        DIG_LEVEL = 1
        text = combo.get_active_text()
        if text:
            self.iconview.dig(text.lower(), DIG_LEVEL)

            icons = self.iconview.get_icons(DIG_LEVEL)
            self.pixbufs = [
                PixbufCreator.new_single_at_size(icon, self.VIEW_ICON_SIZE)
                for icon in icons
            ]

            return "icons_loaded"
Пример #10
0
	def on_iconview_combo_changed(self, combo):
		DIG_LEVEL = 1
		text = combo.get_active_text()
		if text:
			self.iconview.dig(text.lower(), DIG_LEVEL)

			icons = self.iconview.get_icons(DIG_LEVEL)
			pixbufs = [PixbufCreator.new_single_at_size(icon, self.VIEW_ICON_SIZE) for icon in icons]

			# GUI action catched in seperate function and moved to main thread
			def update_gui_with_new_icons():
				with self.iconview_lock:
					self.store.clear()
					for pix in pixbufs:
						self.store.append([pix])

			return update_gui_with_new_icons
Пример #11
0
	def __init__(self, filters, config):
		# Color page filters
		self.filters = filters

		# Filter edit helper
		self.filter_editor = RawFilterEditor(config.get("Editor", "preview"))

		# File dialog
		self.filechooser = FileChooser(acyls.dirs['filters'], "filter.xml")

		# Read icon size settins from config
		self.PREVIEW_ICON_SIZE = int(config.get("PreviewSize", "single"))

		# Load GUI
		self.builder = Gtk.Builder()
		self.builder.add_from_file(os.path.join(acyls.dirs['gui'], "editor.glade"))

		gui_elements = (
			'editor_grid', 'editor_textview', 'editor_preview_icon', 'filter_info_label',
		)
		self.gui = {element: self.builder.get_object(element) for element in gui_elements}
		self.gui['editor_textview'].modify_font(Pango.FontDescription("Monospace"))

		# Build buffer
		self.buffer = Gtk.TextBuffer(text="Enter filter source here")
		self.gui['editor_textview'].set_buffer(self.buffer)

		# Mainpage buttnons hanlers
		self.mhandlers = dict()
		self.mhandlers['refresh_button'] = self.on_refresh_click

		# Toolbar buttnons hanlers
		self.bhandlers = dict()
		self.bhandlers['edit_filter_toolbutton'] = self.on_edit_filter_button_click
		self.bhandlers['load_filter_toolbutton'] = self.on_load_filter_button_click
		self.bhandlers['revert_filter_toolbutton'] = self.on_revert_filter_button_click
		self.bhandlers['save_filter_toolbutton'] = self.on_save_filter_button_click
		self.bhandlers['save_as_filter_toolbutton'] = self.on_save_as_filter_button_click

		# Fill up GUI
		pixbuf = PixbufCreator.new_single_at_size(self.filter_editor.preview, self.PREVIEW_ICON_SIZE)
		self.gui['editor_preview_icon'].set_from_pixbuf(pixbuf)