diff --git a/cardvault/gui/detailswindow.glade b/cardvault/gui/detailswindow.glade
index 865b0be..4f864d3 100644
--- a/cardvault/gui/detailswindow.glade
+++ b/cardvault/gui/detailswindow.glade
@@ -4,20 +4,28 @@
-
+
diff --git a/cardvault/gui/overlays.glade b/cardvault/gui/overlays.glade
index ddb7a29..7f1afd7 100644
--- a/cardvault/gui/overlays.glade
+++ b/cardvault/gui/overlays.glade
@@ -73,6 +73,7 @@
True
False
+ True
center
center
10
@@ -81,6 +82,7 @@
True
False
+ True
end
100
edit-find-symbolic
@@ -94,6 +96,7 @@
True
False
+ True
center
Search
@@ -110,6 +113,7 @@
True
False
+ True
start
Use the entry on the left to search for cards
diff --git a/cardvault/handlers.py b/cardvault/handlers.py
index a6f5bdd..d73aa79 100644
--- a/cardvault/handlers.py
+++ b/cardvault/handlers.py
@@ -26,7 +26,7 @@ class Handlers:
container = self.app.ui.get_object("contentPage")
new_page = self.app.pages[item.get_name()]
if self.app.current_page:
- container.remove(self.app.current_page)
+ container.remove(self.app.current_page)
self.app.current_page = new_page
container.pack_start(self.app.current_page, True, True, 0)
container.show_all()
diff --git a/cardvault/util.py b/cardvault/util.py
index 76e1f6a..9027069 100644
--- a/cardvault/util.py
+++ b/cardvault/util.py
@@ -26,6 +26,12 @@ status_bar = None
app = None
unsaved_changes = False
+legality_colors ={
+ "Banned": "#C65642",
+ "Restricted": "#D39F30",
+ "Legal": "#62B62F"
+}
+
rarity_dict = {
"special": 0,
"common": 1,
diff --git a/cardvault/window.py b/cardvault/window.py
index 114eea4..3d8d6f2 100644
--- a/cardvault/window.py
+++ b/cardvault/window.py
@@ -2,8 +2,9 @@ import config
import handlers
import util
import search_funct
+import re
import gi
-from gi.repository import Gtk
+from gi.repository import Gtk, Pango
gi.require_version('Gtk', '3.0')
@@ -62,8 +63,6 @@ class MainWindow:
pixbuf = util.load_card_image(card, 63 * 5, 88 * 5)
image = Gtk.Image().new_from_pixbuf(pixbuf)
container.add(image)
-
-
# Name
builder.get_object("cardName").set_text(card.name)
# Types
@@ -82,12 +81,58 @@ class MainWindow:
prints = []
for set in card.printings:
prints.append(util.set_dict[set].name)
-
builder.get_object("cardPrintings").set_text(", ".join(prints))
# Legalities
- #builder.get_object("cardLegalities").set_text(", ".join(card.legalities))
+ grid = builder.get_object("legalitiesGrid")
+ rows = 1
+ for legality in card.legalities:
+ date_label = Gtk.Label()
+ date_label.set_halign(Gtk.Align.END)
+ text_label = Gtk.Label()
+ text_label.set_line_wrap_mode(Pango.WrapMode.WORD)
+ text_label.set_line_wrap(True)
+ text_label.set_halign(Gtk.Align.END)
+ color = util.legality_colors[legality["legality"]]
+ date_label.set_markup("" + legality["format"] + ":" + "")
+ text_label.set_markup("" + legality["legality"] + "")
+ grid.attach(date_label, 0, rows + 2, 1, 1)
+ grid.attach(text_label, 1, rows + 2, 1, 1)
+
+ rows += 1
+ grid.show_all()
+
+ # Rulings
+ if card.rulings:
+ grid = builder.get_object("rulesGrid")
+ rows = 1
+ for rule in card.rulings:
+ date_label = Gtk.Label(rule["date"])
+ text_label = Gtk.Label(rule["text"])
+ text_label.set_line_wrap_mode(Pango.WrapMode.WORD)
+ text_label.set_line_wrap(True)
+ text_label.set_justify(Gtk.Justification.LEFT)
+ text_label.set_halign(Gtk.Align.START)
+
+ grid.attach(date_label, 0, rows+2, 1, 1)
+ grid.attach(text_label, 1, rows+2, 1, 1)
+
+ rows += 1
+ grid.show_all()
+ else:
+ builder.get_object("ruleBox").set_visible(False)
+
window.show_all()
+ def eval_key_pressed(widget,event):
+ key, modifier = Gtk.accelerator_parse('Escape')
+ keyval = event.keyval
+ if keyval == key:
+ window.destroy()
+
+ window.connect("key-press-event", eval_key_pressed)
+
+
+
win = MainWindow()
Gtk.main()