Restructure project
83
mtg-collector/collection.py
Normal file
@@ -0,0 +1,83 @@
|
||||
import os
|
||||
|
||||
import gi
|
||||
from psutil._compat import xrange
|
||||
|
||||
gi.require_version('Gtk', '3.0')
|
||||
from gi.repository import Gtk, GdkPixbuf
|
||||
|
||||
|
||||
class CollectionView(Gtk.Grid):
|
||||
def __init__(self):
|
||||
Gtk.Grid.__init__(self)
|
||||
|
||||
# Search Box
|
||||
self.searchbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=2)
|
||||
self.searchEntry = Gtk.Entry()
|
||||
self.searchEntryLabel = Gtk.Label("Search in Collection:", xalign=0)
|
||||
self.searchbox.add(self.searchEntryLabel)
|
||||
self.searchbox.add(self.searchEntry)
|
||||
|
||||
# Filters
|
||||
self.filterBox = Gtk.ListBox()
|
||||
self.filterBox.set_selection_mode(Gtk.SelectionMode.NONE)
|
||||
|
||||
self.testRow = Gtk.ListBoxRow()
|
||||
hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=50)
|
||||
hbox.add(Gtk.Label("Filters will go here", xalign=0))
|
||||
self.testRow.add(hbox)
|
||||
|
||||
self.filterBox.add(self.testRow)
|
||||
|
||||
# The Small Card Flow
|
||||
self.cardScroller = Gtk.ScrolledWindow(hexpand=True, vexpand=True)
|
||||
self.cardScroller.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
|
||||
|
||||
self.cardFlow = Gtk.FlowBox()
|
||||
self.cardFlow.set_valign(Gtk.Align.START)
|
||||
self.cardFlow.set_max_children_per_line(50)
|
||||
self.cardFlow.set_selection_mode(Gtk.SelectionMode.NONE)
|
||||
self.create_flowbox(self.cardFlow)
|
||||
self.cardScroller.add(self.cardFlow)
|
||||
|
||||
# Detailed Card View
|
||||
self.detailBox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=2)
|
||||
|
||||
# Big Picture of the selected Card
|
||||
self.image_area = Gtk.Box()
|
||||
self.bigCard = Gtk.Image()
|
||||
self.pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(os.path.dirname(__file__) + '/resources/images/demo.jpg', 63 * 4, 88 * 4)
|
||||
self.bigCard.set_from_pixbuf(self.pixbuf)
|
||||
self.image_area.add(self.bigCard)
|
||||
self.detailBox.add(self.image_area)
|
||||
|
||||
# Sta-ts and Details about the selected Card
|
||||
self.stat_listbox = Gtk.ListBox()
|
||||
self.stat_listbox.set_selection_mode(Gtk.SelectionMode.NONE)
|
||||
self.test_statrow = Gtk.ListBoxRow()
|
||||
hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=50)
|
||||
hbox.add(Gtk.Label("Detail about the selected Card goes here", xalign=0))
|
||||
self.test_statrow.add(hbox)
|
||||
self.stat_listbox.add(self.test_statrow)
|
||||
|
||||
self.detailBox.add(self.stat_listbox)
|
||||
|
||||
|
||||
# Bring it all together
|
||||
self.attach(self.searchbox, 0, 0, 1, 1)
|
||||
self.attach(self.filterBox, 0, 1, 1, 1)
|
||||
self.attach(self.cardScroller, 1, 0, 1, 2)
|
||||
self.attach(self.detailBox, 2, 0, 1, 2)
|
||||
|
||||
def add_test_image(self):
|
||||
image = Gtk.Image()
|
||||
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(os.path.dirname(__file__) + '/resources/images/demo.jpg', 63*2, 88*2)
|
||||
image.set_from_pixbuf(pixbuf)
|
||||
|
||||
return image
|
||||
|
||||
def create_flowbox(self, flowbox):
|
||||
|
||||
for nr in xrange(0, 50):
|
||||
image = self.add_test_image()
|
||||
flowbox.add(image)
|
||||
7
mtg-collector/config.py
Normal file
@@ -0,0 +1,7 @@
|
||||
# Title of the Program Window
|
||||
import os
|
||||
|
||||
applicationtitle="MTG Collector (working title) v0.1"
|
||||
|
||||
# Path of image cache
|
||||
cachepath= os.path.dirname(__file__) + "/.cache/"
|
||||
26
mtg-collector/details.py
Normal file
@@ -0,0 +1,26 @@
|
||||
import gi
|
||||
gi.require_version('Gtk', '3.0')
|
||||
from gi.repository import Gtk, GdkPixbuf
|
||||
import util
|
||||
|
||||
|
||||
class DetailBar(Gtk.Grid):
|
||||
def __init__(self):
|
||||
Gtk.Grid.__init__(self)
|
||||
|
||||
self.image_area = Gtk.Box()
|
||||
image = Gtk.Image()
|
||||
pixbuf = util.add_test_image(63 * 5, 88 * 5)
|
||||
image.set_from_pixbuf(pixbuf)
|
||||
self.image_area.add(image)
|
||||
|
||||
self.carddetails = Gtk.ListBox()
|
||||
self.carddetails.set_selection_mode(Gtk.SelectionMode.NONE)
|
||||
|
||||
self.rulings = Gtk.ListBoxRow()
|
||||
self.rulings.add(Gtk.Label("Test"))
|
||||
|
||||
self.carddetails.add(self.rulings)
|
||||
|
||||
self.attach(self.image_area, 0, 0, 1, 1)
|
||||
self.attach(self.carddetails, 0, 1, 1, 1)
|
||||
39
mtg-collector/gui.py
Normal file
@@ -0,0 +1,39 @@
|
||||
import gi
|
||||
import collection
|
||||
import search
|
||||
import config
|
||||
import util
|
||||
gi.require_version('Gtk', '3.0')
|
||||
from gi.repository import Gtk
|
||||
|
||||
|
||||
class MainWindow(Gtk.Window):
|
||||
def __init__(self):
|
||||
Gtk.Window.__init__(self, title=config.applicationtitle)
|
||||
self.set_border_width(2)
|
||||
self.set_size_request(1000, 700)
|
||||
|
||||
# Load local image Data
|
||||
util.reload_image_cache()
|
||||
util.load_mana_icons()
|
||||
|
||||
self.notebook = Gtk.Notebook()
|
||||
self.add(self.notebook)
|
||||
|
||||
self.collectionView = Gtk.Box()
|
||||
self.collectionView.add(collection.CollectionView())
|
||||
|
||||
self.searchView = Gtk.Box()
|
||||
self.searchView.add(search.SearchView())
|
||||
|
||||
self.deckView = Gtk.Box()
|
||||
self.deckView.add(Gtk.Label("View and organize your Decklists!"))
|
||||
|
||||
self.notebook.append_page(self.searchView, Gtk.Label("Search"))
|
||||
self.notebook.append_page(self.collectionView, Gtk.Label("Collection"))
|
||||
self.notebook.append_page(self.deckView, Gtk.Label("Decks"))
|
||||
|
||||
win = MainWindow()
|
||||
win.connect('delete-event', Gtk.main_quit)
|
||||
win.show_all()
|
||||
Gtk.main()
|
||||
3
mtg-collector/mtg-collector
Normal file
@@ -0,0 +1,3 @@
|
||||
#! /usr/bin/env python
|
||||
import os
|
||||
os.s.path.dirname(__file__) + "/mtg-collector/gui.py"
|
||||
BIN
mtg-collector/resources/images/demo.jpg
Normal file
|
After Width: | Height: | Size: 35 KiB |
BIN
mtg-collector/resources/mana_icons/0.png
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
BIN
mtg-collector/resources/mana_icons/1.png
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
mtg-collector/resources/mana_icons/10.png
Normal file
|
After Width: | Height: | Size: 4.4 KiB |
BIN
mtg-collector/resources/mana_icons/11.png
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
mtg-collector/resources/mana_icons/12.png
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
BIN
mtg-collector/resources/mana_icons/13.png
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
mtg-collector/resources/mana_icons/14.png
Normal file
|
After Width: | Height: | Size: 3.6 KiB |
BIN
mtg-collector/resources/mana_icons/15.png
Normal file
|
After Width: | Height: | Size: 4.0 KiB |
BIN
mtg-collector/resources/mana_icons/16.png
Normal file
|
After Width: | Height: | Size: 4.4 KiB |
BIN
mtg-collector/resources/mana_icons/17.png
Normal file
|
After Width: | Height: | Size: 3.6 KiB |
BIN
mtg-collector/resources/mana_icons/18.png
Normal file
|
After Width: | Height: | Size: 4.8 KiB |
BIN
mtg-collector/resources/mana_icons/19.png
Normal file
|
After Width: | Height: | Size: 4.4 KiB |
BIN
mtg-collector/resources/mana_icons/2.png
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
BIN
mtg-collector/resources/mana_icons/20.png
Normal file
|
After Width: | Height: | Size: 5.3 KiB |
BIN
mtg-collector/resources/mana_icons/2b.png
Normal file
|
After Width: | Height: | Size: 5.1 KiB |
BIN
mtg-collector/resources/mana_icons/2g.png
Normal file
|
After Width: | Height: | Size: 4.8 KiB |
BIN
mtg-collector/resources/mana_icons/2r.png
Normal file
|
After Width: | Height: | Size: 5.2 KiB |
BIN
mtg-collector/resources/mana_icons/2u.png
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
BIN
mtg-collector/resources/mana_icons/2w.png
Normal file
|
After Width: | Height: | Size: 5.4 KiB |
BIN
mtg-collector/resources/mana_icons/3.png
Normal file
|
After Width: | Height: | Size: 4.4 KiB |
BIN
mtg-collector/resources/mana_icons/4.png
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
BIN
mtg-collector/resources/mana_icons/5.png
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
mtg-collector/resources/mana_icons/6.png
Normal file
|
After Width: | Height: | Size: 4.5 KiB |
BIN
mtg-collector/resources/mana_icons/7.png
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
BIN
mtg-collector/resources/mana_icons/8.png
Normal file
|
After Width: | Height: | Size: 4.9 KiB |
BIN
mtg-collector/resources/mana_icons/9.png
Normal file
|
After Width: | Height: | Size: 4.4 KiB |
BIN
mtg-collector/resources/mana_icons/B.png
Normal file
|
After Width: | Height: | Size: 5.7 KiB |
BIN
mtg-collector/resources/mana_icons/G.png
Normal file
|
After Width: | Height: | Size: 5.3 KiB |
BIN
mtg-collector/resources/mana_icons/R.png
Normal file
|
After Width: | Height: | Size: 6.1 KiB |
BIN
mtg-collector/resources/mana_icons/U.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
mtg-collector/resources/mana_icons/X.png
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
mtg-collector/resources/mana_icons/Y.png
Normal file
|
After Width: | Height: | Size: 3.6 KiB |
BIN
mtg-collector/resources/mana_icons/Z.png
Normal file
|
After Width: | Height: | Size: 3.5 KiB |
BIN
mtg-collector/resources/mana_icons/bg.png
Normal file
|
After Width: | Height: | Size: 5.5 KiB |
BIN
mtg-collector/resources/mana_icons/bp.png
Normal file
|
After Width: | Height: | Size: 4.9 KiB |
BIN
mtg-collector/resources/mana_icons/br.png
Normal file
|
After Width: | Height: | Size: 5.9 KiB |
BIN
mtg-collector/resources/mana_icons/flip.png
Normal file
|
After Width: | Height: | Size: 4.6 KiB |
BIN
mtg-collector/resources/mana_icons/gp.png
Normal file
|
After Width: | Height: | Size: 4.8 KiB |
BIN
mtg-collector/resources/mana_icons/gu.png
Normal file
|
After Width: | Height: | Size: 4.6 KiB |
BIN
mtg-collector/resources/mana_icons/gw.png
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
BIN
mtg-collector/resources/mana_icons/half.png
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
BIN
mtg-collector/resources/mana_icons/infinite.png
Normal file
|
After Width: | Height: | Size: 4.9 KiB |
BIN
mtg-collector/resources/mana_icons/rg.png
Normal file
|
After Width: | Height: | Size: 5.5 KiB |
BIN
mtg-collector/resources/mana_icons/rp.png
Normal file
|
After Width: | Height: | Size: 4.8 KiB |
BIN
mtg-collector/resources/mana_icons/rw.png
Normal file
|
After Width: | Height: | Size: 6.1 KiB |
BIN
mtg-collector/resources/mana_icons/s.png
Normal file
|
After Width: | Height: | Size: 8.3 KiB |
BIN
mtg-collector/resources/mana_icons/tap.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
mtg-collector/resources/mana_icons/tap_old.png
Normal file
|
After Width: | Height: | Size: 3.6 KiB |
BIN
mtg-collector/resources/mana_icons/ub.png
Normal file
|
After Width: | Height: | Size: 5.0 KiB |
BIN
mtg-collector/resources/mana_icons/untap.png
Normal file
|
After Width: | Height: | Size: 3.6 KiB |
BIN
mtg-collector/resources/mana_icons/up.png
Normal file
|
After Width: | Height: | Size: 4.8 KiB |
BIN
mtg-collector/resources/mana_icons/ur.png
Normal file
|
After Width: | Height: | Size: 5.0 KiB |
BIN
mtg-collector/resources/mana_icons/w.png
Normal file
|
After Width: | Height: | Size: 7.5 KiB |
BIN
mtg-collector/resources/mana_icons/wb.png
Normal file
|
After Width: | Height: | Size: 6.0 KiB |
BIN
mtg-collector/resources/mana_icons/wp.png
Normal file
|
After Width: | Height: | Size: 4.8 KiB |
BIN
mtg-collector/resources/mana_icons/wu.png
Normal file
|
After Width: | Height: | Size: 5.2 KiB |
123
mtg-collector/search.py
Normal file
@@ -0,0 +1,123 @@
|
||||
import gi
|
||||
from gi.repository import Pango
|
||||
import util
|
||||
import details
|
||||
gi.require_version('Gtk', '3.0')
|
||||
from gi.repository import Gtk, GdkPixbuf
|
||||
from mtgsdk import Card
|
||||
|
||||
|
||||
class SearchView(Gtk.Grid):
|
||||
def __init__(self):
|
||||
Gtk.Grid.__init__(self)
|
||||
|
||||
# Search Box
|
||||
self.searchbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=2)
|
||||
self.searchEntry = Gtk.Entry()
|
||||
self.searchEntry.connect("activate", self.online_search_clicked)
|
||||
self.searchbutton = Gtk.Button("Search Online")
|
||||
self.searchbutton.connect("clicked", self.online_search_clicked)
|
||||
self.searchEntryLabel = Gtk.Label("Search for Cards:", xalign=0)
|
||||
self.searchbox.add(self.searchEntryLabel)
|
||||
self.searchbox.add(self.searchEntry)
|
||||
self.searchbox.add(self.searchbutton)
|
||||
|
||||
# Filters
|
||||
self.filterBox = Gtk.ListBox()
|
||||
self.filterBox.set_selection_mode(Gtk.SelectionMode.NONE)
|
||||
|
||||
self.testRow = Gtk.ListBoxRow()
|
||||
hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=50)
|
||||
hbox.add(Gtk.Label("Filters will go here", xalign=0))
|
||||
self.testRow.add(hbox)
|
||||
|
||||
self.filterBox.add(self.testRow)
|
||||
|
||||
|
||||
#Card List
|
||||
self.searchresults = Gtk.ScrolledWindow(hexpand=True, vexpand=True)
|
||||
self.searchresults.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
|
||||
|
||||
self.store = Gtk.ListStore(int, GdkPixbuf.Pixbuf, str, str, GdkPixbuf.Pixbuf)
|
||||
self.list = Gtk.TreeView(self.store)
|
||||
self.list.set_rules_hint(True)
|
||||
self.searchresults.add(self.list)
|
||||
|
||||
image = Gtk.CellRendererPixbuf()
|
||||
|
||||
title = Gtk.CellRendererText(xalign=0.5)
|
||||
title.set_padding = 2
|
||||
|
||||
info = Gtk.CellRendererText()
|
||||
info.set_property("wrap-mode", Pango.WrapMode.WORD)
|
||||
info.set_property("wrap-width", 100)
|
||||
info.set_padding = 2
|
||||
|
||||
index = Gtk.CellRendererText()
|
||||
self.indexcolumn = Gtk.TreeViewColumn(title=index, cell_renderer=index, text=0)
|
||||
self.indexcolumn.set_visible(False)
|
||||
self.column1 = Gtk.TreeViewColumn(title="Image", cell_renderer=image, pixbuf=1)
|
||||
self.column1.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
|
||||
self.column2 = Gtk.TreeViewColumn(title="Name", cell_renderer=title, text=2)
|
||||
self.column2.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
|
||||
self.column3 = Gtk.TreeViewColumn(title="Card Text", cell_renderer=info, text=3)
|
||||
self.column3.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
|
||||
self.column3.set_resizable(True)
|
||||
self.column3.set_expand(True)
|
||||
self.column4 = Gtk.TreeViewColumn(title="Mana Cost", cell_renderer=image, pixbuf=4)
|
||||
self.column4.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
|
||||
|
||||
self.list.append_column(self.column1)
|
||||
self.list.append_column(self.column2)
|
||||
self.list.append_column(self.column3)
|
||||
self.list.append_column(self.column4)
|
||||
|
||||
# Detail View for selected Card
|
||||
self.details = Gtk.Box()
|
||||
self.details.add(details.DetailBar())
|
||||
|
||||
# Bring it all together
|
||||
self.attach(self.searchbox, 0, 0, 1, 1)
|
||||
self.attach(self.filterBox, 0, 1, 1, 1)
|
||||
self.attach(self.searchresults, 1, 0, 1, 2)
|
||||
self.attach(self.details, 2, 0, 1, 2)
|
||||
|
||||
self.selection = self.list.get_selection()
|
||||
self.selection.connect("changed", self.on_card_selected)
|
||||
|
||||
def online_search_clicked(self, button):
|
||||
term = self.searchEntry.get_text()
|
||||
if not term == "":
|
||||
print("Search for \"" + term + "\" online. \n")
|
||||
|
||||
self.cards = Card.where(name=term).where(pageSize=50).where(page=1).all()
|
||||
self.store.clear()
|
||||
for card in self.cards:
|
||||
if card.multiverse_id is not None:
|
||||
print("Found: " + card.name
|
||||
+ " (" + card.multiverse_id.__str__() + ")")
|
||||
|
||||
self.store.append([card.multiverse_id,
|
||||
util.load_card_image(card, 63 * 2, 88 * 2),
|
||||
card.name,
|
||||
card.original_text,
|
||||
util.create_mana_icons(card.mana_cost)])
|
||||
print("\n")
|
||||
util.reload_image_cache()
|
||||
|
||||
def on_card_selected(self, selection):
|
||||
(model, pathlist) = selection.get_selected_rows()
|
||||
for path in pathlist:
|
||||
iter = model.get_iter(path)
|
||||
card_id = model.get_value(iter, 0)
|
||||
|
||||
selected_card = None
|
||||
for card in self.cards:
|
||||
if card.multiverse_id == card_id:
|
||||
selected_card = card
|
||||
|
||||
print(selected_card.name + " selected \n")
|
||||
|
||||
|
||||
|
||||
|
||||
91
mtg-collector/util.py
Normal file
@@ -0,0 +1,91 @@
|
||||
import os
|
||||
import gi
|
||||
import re
|
||||
import config
|
||||
gi.require_version('Gtk', '3.0')
|
||||
from gi.repository import GdkPixbuf
|
||||
from PIL import Image as PImage
|
||||
from urllib import request
|
||||
|
||||
# Loacally stored images for faster loading times
|
||||
imagecache = []
|
||||
manaicons ={}
|
||||
|
||||
|
||||
def load_mana_icons():
|
||||
path = os.path.dirname(__file__) + "/resources/mana_icons/"
|
||||
if not os.path.exists(path):
|
||||
print("ERROR: Directory for mana icons not found")
|
||||
return
|
||||
# return array of icons
|
||||
imagelist = os.listdir(path)
|
||||
manaicons.clear()
|
||||
for image in imagelist:
|
||||
img = PImage.open(path + image)
|
||||
manaicons[os.path.splitext(image)[0]] = img
|
||||
|
||||
def reload_image_cache():
|
||||
if not os.path.exists(config.cachepath):
|
||||
os.makedirs(config.cachepath)
|
||||
|
||||
# return array of images
|
||||
imageslist = os.listdir(config.cachepath)
|
||||
imagecache.clear()
|
||||
for image in imageslist:
|
||||
img = PImage.open(config.cachepath + image)
|
||||
imagecache.append(img)
|
||||
|
||||
|
||||
def add_test_image(sizex, sizey):
|
||||
return GdkPixbuf.Pixbuf.new_from_file_at_size(os.path.dirname(__file__) +
|
||||
'/resources/images/demo.jpg', sizex, sizey)
|
||||
|
||||
|
||||
def load_card_image_online(card):
|
||||
url = card.image_url
|
||||
if url is None:
|
||||
print("No Image URL provided")
|
||||
return add_test_image()
|
||||
filename = config.cachepath + card.multiverse_id.__str__() + ".PNG"
|
||||
print("Loading image from: " + url)
|
||||
response = request.urlretrieve(url, filename)
|
||||
return GdkPixbuf.Pixbuf.new_from_file_at_size(filename, 63 * 2, 88 * 2)
|
||||
|
||||
|
||||
def load_card_image(card, sizex, sizey):
|
||||
# Try loading from disk, if file exists
|
||||
for image in imagecache:
|
||||
filename = os.path.basename(image.filename)
|
||||
if filename == card.multiverse_id.__str__() + ".PNG":
|
||||
print("Using local file for image: " + filename)
|
||||
return GdkPixbuf.Pixbuf.new_from_file_at_size(image.filename, sizex, sizey)
|
||||
|
||||
# No file in local cache found
|
||||
return load_card_image_online(card)
|
||||
|
||||
|
||||
def create_mana_icons(mana_string):
|
||||
# Convert the string to a List
|
||||
list = re.findall("\{(.*?)\}", str(mana_string))
|
||||
if len(list) == 0:
|
||||
return
|
||||
# Compute horizontal size for the final image
|
||||
imagesize = len(list) * 105
|
||||
image = PImage.new("RGBA", (imagesize, 105))
|
||||
# incerment for each position of an icon (Workaround: 2 or more of the same icon will be rendered in the same poisition)
|
||||
poscounter = 0
|
||||
# Go through all entries an add the correspondent icon to the final image
|
||||
for icon in list:
|
||||
xpos = poscounter * 105
|
||||
loaded = manaicons.get(icon)
|
||||
if loaded is None:
|
||||
print("ERROR: No icon file named \"" + icon + "\" found.")
|
||||
else:
|
||||
image.paste(loaded, (xpos, 0))
|
||||
poscounter += 1
|
||||
|
||||
image.save(config.cachepath + "manaicon.png", "PNG")
|
||||
pixbuf = GdkPixbuf.Pixbuf.new_from_file(config.cachepath + "manaicon.png")
|
||||
pixbuf = pixbuf.scale_simple(image.width / 5, image.height / 5, GdkPixbuf.InterpType.HYPER)
|
||||
os.remove(config.cachepath + "manaicon.png")
|
||||
return pixbuf
|
||||