Single card window
This commit is contained in:
@@ -8,22 +8,11 @@
|
||||
<object class="GtkGrid">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="bigCard">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="pixbuf">../resources/images/dummy_315x450.png</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkGrid">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="column_homogeneous">True</property>
|
||||
<property name="halign">start</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
@@ -183,6 +172,8 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Loading...</property>
|
||||
<property name="wrap">True</property>
|
||||
<property name="max_width_chars">50</property>
|
||||
<property name="xalign">0.10000000149011612</property>
|
||||
</object>
|
||||
<packing>
|
||||
@@ -234,6 +225,19 @@
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkOverlay" id="imageContainer">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
|
||||
@@ -96,6 +96,7 @@ def _get_filters(app):
|
||||
output["type"] = _get_combo_value(combo)
|
||||
# Set
|
||||
name = app.ui.get_object("setEntry").get_text()
|
||||
output["set"] = ""
|
||||
for set in util.set_list:
|
||||
if set.name == name:
|
||||
output["set"] = set.code
|
||||
|
||||
@@ -15,6 +15,7 @@ gi.require_version('Gtk', '3.0')
|
||||
imagecache = {}
|
||||
manaicons = {}
|
||||
set_list = []
|
||||
set_dict = {}
|
||||
|
||||
# Card library object
|
||||
library = {}
|
||||
@@ -139,6 +140,7 @@ def load_sets():
|
||||
# Sort the loaded sets based on the sets name
|
||||
for set in sorted(sets, key=lambda x: x.name):
|
||||
set_list.append(set)
|
||||
set_dict[set.code] = set
|
||||
|
||||
|
||||
def reload_image_cache():
|
||||
|
||||
@@ -14,7 +14,6 @@ class MainWindow:
|
||||
self.ui.add_from_file("gui/mainwindow.glade")
|
||||
self.ui.add_from_file("gui/overlays.glade")
|
||||
self.ui.add_from_file("gui/search.glade")
|
||||
self.ui.add_from_file("gui/detailswindow.glade")
|
||||
window = self.ui.get_object("mainWindow")
|
||||
self.current_page = None
|
||||
util.app = self
|
||||
@@ -53,8 +52,41 @@ class MainWindow:
|
||||
status_bar.push(0, msg)
|
||||
|
||||
def show_card_details(self, card):
|
||||
print("Show", card.name)
|
||||
pass
|
||||
builder = Gtk.Builder()
|
||||
builder.add_from_file("gui/detailswindow.glade")
|
||||
builder.add_from_file("gui/overlays.glade")
|
||||
window = builder.get_object("cardDetails")
|
||||
window.set_title(card.name)
|
||||
# Card Image
|
||||
container = builder.get_object("imageContainer")
|
||||
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
|
||||
supertypes = ""
|
||||
if card.subtypes is not None:
|
||||
supertypes = " - " + " ".join(card.subtypes)
|
||||
types = " ".join(card.types) + supertypes
|
||||
builder.get_object("cardTypes").set_text(types)
|
||||
# Rarity
|
||||
builder.get_object("cardRarity").set_text(card.rarity if card.rarity else "")
|
||||
# Release
|
||||
builder.get_object("cardReleaseDate").set_text(card.release_date if card.release_date else "")
|
||||
# Set
|
||||
builder.get_object("cardSet").set_text(card.set_name)
|
||||
# Printings
|
||||
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))
|
||||
window.show_all()
|
||||
|
||||
|
||||
win = MainWindow()
|
||||
|
||||
Reference in New Issue
Block a user