Restructure project
92
.gitignore
vendored
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
# Byte-compiled / optimized / DLL files
|
||||||
|
__pycache__/
|
||||||
|
*.py[cod]
|
||||||
|
*$py.class
|
||||||
|
|
||||||
|
# C extensions
|
||||||
|
*.so
|
||||||
|
|
||||||
|
# Distribution / packaging
|
||||||
|
.Python
|
||||||
|
env/
|
||||||
|
build/
|
||||||
|
develop-eggs/
|
||||||
|
dist/
|
||||||
|
downloads/
|
||||||
|
eggs/
|
||||||
|
.eggs/
|
||||||
|
lib/
|
||||||
|
lib64/
|
||||||
|
parts/
|
||||||
|
sdist/
|
||||||
|
var/
|
||||||
|
*.egg-info/
|
||||||
|
.installed.cfg
|
||||||
|
*.egg
|
||||||
|
|
||||||
|
# PyInstaller
|
||||||
|
# Usually these files are written by a python script from a template
|
||||||
|
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||||
|
*.manifest
|
||||||
|
*.spec
|
||||||
|
|
||||||
|
# Installer logs
|
||||||
|
pip-log.txt
|
||||||
|
pip-delete-this-directory.txt
|
||||||
|
|
||||||
|
# Unit test / coverage reports
|
||||||
|
htmlcov/
|
||||||
|
.tox/
|
||||||
|
.coverage
|
||||||
|
.coverage.*
|
||||||
|
.cache
|
||||||
|
nosetests.xml
|
||||||
|
coverage.xml
|
||||||
|
*,cover
|
||||||
|
.hypothesis/
|
||||||
|
|
||||||
|
# Translations
|
||||||
|
*.mo
|
||||||
|
*.pot
|
||||||
|
|
||||||
|
# Django stuff:
|
||||||
|
*.log
|
||||||
|
local_settings.py
|
||||||
|
|
||||||
|
# Flask stuff:
|
||||||
|
instance/
|
||||||
|
.webassets-cache
|
||||||
|
|
||||||
|
# Scrapy stuff:
|
||||||
|
.scrapy
|
||||||
|
|
||||||
|
# Sphinx documentation
|
||||||
|
docs/_build/
|
||||||
|
|
||||||
|
# PyBuilder
|
||||||
|
target/
|
||||||
|
|
||||||
|
# IPython Notebook
|
||||||
|
.ipynb_checkpoints
|
||||||
|
|
||||||
|
# pyenv
|
||||||
|
.python-version
|
||||||
|
|
||||||
|
# celery beat schedule file
|
||||||
|
celerybeat-schedule
|
||||||
|
|
||||||
|
# dotenv
|
||||||
|
.env
|
||||||
|
|
||||||
|
# virtualenv
|
||||||
|
.venv/
|
||||||
|
venv/
|
||||||
|
ENV/
|
||||||
|
|
||||||
|
# Spyder project settings
|
||||||
|
.spyderproject
|
||||||
|
|
||||||
|
# Rope project settings
|
||||||
|
.ropeproject
|
||||||
|
|
||||||
|
.idea
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
import gi
|
import gi
|
||||||
from psutil._compat import xrange
|
from psutil._compat import xrange
|
||||||
|
|
||||||
@@ -44,7 +46,7 @@ class CollectionView(Gtk.Grid):
|
|||||||
# Big Picture of the selected Card
|
# Big Picture of the selected Card
|
||||||
self.image_area = Gtk.Box()
|
self.image_area = Gtk.Box()
|
||||||
self.bigCard = Gtk.Image()
|
self.bigCard = Gtk.Image()
|
||||||
self.pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size('./resources/images/demo.jpg', 63 * 4, 88 * 4)
|
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.bigCard.set_from_pixbuf(self.pixbuf)
|
||||||
self.image_area.add(self.bigCard)
|
self.image_area.add(self.bigCard)
|
||||||
self.detailBox.add(self.image_area)
|
self.detailBox.add(self.image_area)
|
||||||
@@ -69,7 +71,7 @@ class CollectionView(Gtk.Grid):
|
|||||||
|
|
||||||
def add_test_image(self):
|
def add_test_image(self):
|
||||||
image = Gtk.Image()
|
image = Gtk.Image()
|
||||||
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size('./resources/images/demo.jpg', 63*2, 88*2)
|
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)
|
image.set_from_pixbuf(pixbuf)
|
||||||
|
|
||||||
return image
|
return image
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
# Title of the Program Window
|
# Title of the Program Window
|
||||||
|
import os
|
||||||
|
|
||||||
applicationtitle="MTG Collector (working title) v0.1"
|
applicationtitle="MTG Collector (working title) v0.1"
|
||||||
|
|
||||||
# Path of image cache
|
# Path of image cache
|
||||||
cachepath=".cache/"
|
cachepath= os.path.dirname(__file__) + "/.cache/"
|
||||||
@@ -13,6 +13,10 @@ class MainWindow(Gtk.Window):
|
|||||||
self.set_border_width(2)
|
self.set_border_width(2)
|
||||||
self.set_size_request(1000, 700)
|
self.set_size_request(1000, 700)
|
||||||
|
|
||||||
|
# Load local image Data
|
||||||
|
util.reload_image_cache()
|
||||||
|
util.load_mana_icons()
|
||||||
|
|
||||||
self.notebook = Gtk.Notebook()
|
self.notebook = Gtk.Notebook()
|
||||||
self.add(self.notebook)
|
self.add(self.notebook)
|
||||||
|
|
||||||
@@ -29,13 +33,7 @@ class MainWindow(Gtk.Window):
|
|||||||
self.notebook.append_page(self.collectionView, Gtk.Label("Collection"))
|
self.notebook.append_page(self.collectionView, Gtk.Label("Collection"))
|
||||||
self.notebook.append_page(self.deckView, Gtk.Label("Decks"))
|
self.notebook.append_page(self.deckView, Gtk.Label("Decks"))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
win = MainWindow()
|
win = MainWindow()
|
||||||
# Load local image Data
|
|
||||||
util.reload_image_cache()
|
|
||||||
util.load_mana_icons()
|
|
||||||
win.connect('delete-event', Gtk.main_quit)
|
win.connect('delete-event', Gtk.main_quit)
|
||||||
win.show_all()
|
win.show_all()
|
||||||
Gtk.main()
|
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"
|
||||||
|
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 35 KiB |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.4 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.4 KiB |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.4 KiB |
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 5.1 KiB |
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
|
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.4 KiB |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.4 KiB |
|
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 5.7 KiB |
|
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.1 KiB |
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 5.5 KiB |
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
|
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
|
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 5.5 KiB |
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.1 KiB |
|
Before Width: | Height: | Size: 8.3 KiB After Width: | Height: | Size: 8.3 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 5.0 KiB |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 5.0 KiB |
|
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 7.5 KiB |
|
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 6.0 KiB |
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
|
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB |
@@ -13,7 +13,7 @@ manaicons ={}
|
|||||||
|
|
||||||
|
|
||||||
def load_mana_icons():
|
def load_mana_icons():
|
||||||
path = "resources/mana_icons/"
|
path = os.path.dirname(__file__) + "/resources/mana_icons/"
|
||||||
if not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
print("ERROR: Directory for mana icons not found")
|
print("ERROR: Directory for mana icons not found")
|
||||||
return
|
return
|
||||||
@@ -37,7 +37,8 @@ def reload_image_cache():
|
|||||||
|
|
||||||
|
|
||||||
def add_test_image(sizex, sizey):
|
def add_test_image(sizex, sizey):
|
||||||
return GdkPixbuf.Pixbuf.new_from_file_at_size('./resources/images/demo.jpg', 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):
|
def load_card_image_online(card):
|
||||||
@@ -45,7 +46,7 @@ def load_card_image_online(card):
|
|||||||
if url is None:
|
if url is None:
|
||||||
print("No Image URL provided")
|
print("No Image URL provided")
|
||||||
return add_test_image()
|
return add_test_image()
|
||||||
filename = ".cache/" + card.multiverse_id.__str__() + ".PNG"
|
filename = config.cachepath + card.multiverse_id.__str__() + ".PNG"
|
||||||
print("Loading image from: " + url)
|
print("Loading image from: " + url)
|
||||||
response = request.urlretrieve(url, filename)
|
response = request.urlretrieve(url, filename)
|
||||||
return GdkPixbuf.Pixbuf.new_from_file_at_size(filename, 63 * 2, 88 * 2)
|
return GdkPixbuf.Pixbuf.new_from_file_at_size(filename, 63 * 2, 88 * 2)
|
||||||