Skip to content

Commit e15eba2

Browse files
committed
Remove code to generate custom icons
Now that custom icons are bundled in the build, this code is no longer used.
1 parent 4926ca9 commit e15eba2

File tree

1 file changed

+1
-65
lines changed

1 file changed

+1
-65
lines changed

src/diffuse/window.py

Lines changed: 1 addition & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,10 @@
3939
import gi # type: ignore
4040
gi.require_version('Gdk', '3.0')
4141
gi.require_version('GObject', '2.0')
42-
gi.require_version('GdkPixbuf', '2.0')
4342
gi.require_version('Gtk', '3.0')
4443
gi.require_version('Pango', '1.0')
4544
gi.require_version('PangoCairo', '1.0')
46-
from gi.repository import Gdk, GdkPixbuf, Gio, GLib, GObject, Gtk, Pango # type: ignore # noqa: E402, E501
45+
from gi.repository import Gdk, Gio, GLib, GObject, Gtk, Pango # type: ignore # noqa: E402
4746

4847

4948
theVCSs = VcsRegistry()
@@ -713,69 +712,6 @@ def __init__(self, rc_dir, **kwargs):
713712
# create a Box for our contents
714713
vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
715714

716-
# create some custom icons for merging
717-
DIFFUSE_STOCK_NEW_2WAY_MERGE = 'diffuse-new-2way-merge'
718-
DIFFUSE_STOCK_NEW_3WAY_MERGE = 'diffuse-new-3way-merge'
719-
DIFFUSE_STOCK_LEFT_RIGHT = 'diffuse-left-right'
720-
DIFFUSE_STOCK_RIGHT_LEFT = 'diffuse-right-left'
721-
722-
# get default theme and window scale factor
723-
default_theme = Gtk.IconTheme.get_default()
724-
scale_factor = self.get_scale_factor()
725-
726-
icon_size = Gtk.IconSize.lookup(Gtk.IconSize.LARGE_TOOLBAR).height
727-
factory = Gtk.IconFactory()
728-
729-
# render the base item used to indicate a new document
730-
p0 = default_theme.load_icon_for_scale('document-new', icon_size, scale_factor, 0)
731-
w, h = p0.get_width(), p0.get_height()
732-
733-
# render new 2-way merge icon
734-
s = 0.8
735-
sw, sh = int(s * w), int(s * h)
736-
w1, h1 = w - sw, h - sh
737-
p = GdkPixbuf.Pixbuf.new(GdkPixbuf.Colorspace.RGB, True, 8, w, h)
738-
p.fill(0)
739-
p0.composite(p, 0, 0, sw, sh, 0, 0, s, s, GdkPixbuf.InterpType.BILINEAR, 255)
740-
p0.composite(p, w1, h1, sw, sh, w1, h1, s, s, GdkPixbuf.InterpType.BILINEAR, 255)
741-
factory.add(DIFFUSE_STOCK_NEW_2WAY_MERGE, Gtk.IconSet.new_from_pixbuf(p))
742-
743-
# render new 3-way merge icon
744-
s = 0.7
745-
sw, sh = int(s * w), int(s * h)
746-
w1, h1 = (w - sw) / 2, (h - sh) / 2
747-
w2, h2 = w - sw, h - sh
748-
p = GdkPixbuf.Pixbuf.new(GdkPixbuf.Colorspace.RGB, True, 8, w, h)
749-
p.fill(0)
750-
p0.composite(p, 0, 0, sw, sh, 0, 0, s, s, GdkPixbuf.InterpType.BILINEAR, 255)
751-
p0.composite(p, w1, h1, sw, sh, w1, h1, s, s, GdkPixbuf.InterpType.BILINEAR, 255)
752-
p0.composite(p, w2, h2, sw, sh, w2, h2, s, s, GdkPixbuf.InterpType.BILINEAR, 255)
753-
factory.add(DIFFUSE_STOCK_NEW_3WAY_MERGE, Gtk.IconSet.new_from_pixbuf(p))
754-
755-
# render the left and right arrow we will use in our custom icons
756-
p0 = default_theme.load_icon_for_scale('go-next', icon_size, scale_factor, 0)
757-
p1 = default_theme.load_icon_for_scale('go-previous', icon_size, scale_factor, 0)
758-
w, h, s = p0.get_width(), p0.get_height(), 0.65
759-
sw, sh = int(s * w), int(s * h)
760-
w1, h1 = w - sw, h - sh
761-
762-
# create merge from left then right icon
763-
p = GdkPixbuf.Pixbuf.new(GdkPixbuf.Colorspace.RGB, True, 8, w, h)
764-
p.fill(0)
765-
p1.composite(p, w1, h1, sw, sh, w1, h1, s, s, GdkPixbuf.InterpType.BILINEAR, 255)
766-
p0.composite(p, 0, 0, sw, sh, 0, 0, s, s, GdkPixbuf.InterpType.BILINEAR, 255)
767-
factory.add(DIFFUSE_STOCK_LEFT_RIGHT, Gtk.IconSet.new_from_pixbuf(p))
768-
769-
# create merge from right then left icon
770-
p = GdkPixbuf.Pixbuf.new(GdkPixbuf.Colorspace.RGB, True, 8, w, h)
771-
p.fill(0)
772-
p0.composite(p, 0, h1, sw, sh, 0, h1, s, s, GdkPixbuf.InterpType.BILINEAR, 255)
773-
p1.composite(p, w1, 0, sw, sh, w1, 0, s, s, GdkPixbuf.InterpType.BILINEAR, 255)
774-
factory.add(DIFFUSE_STOCK_RIGHT_LEFT, Gtk.IconSet.new_from_pixbuf(p))
775-
776-
# make the icons available for use
777-
factory.add_default()
778-
779715
menu_specs = []
780716
menu_specs.append([_('_File'), [
781717
[

0 commit comments

Comments
 (0)